-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathSerializedGeodetic2d.cs
More file actions
74 lines (60 loc) · 1.79 KB
/
SerializedGeodetic2d.cs
File metadata and controls
74 lines (60 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//Copyright SimBlocks LLC 2016-2022
//https://www.simblocks.io/
//The source code in this file is licensed under the MIT License. See the LICENSE text file for full terms.
using System;
using sbio.Core.Math;
using sbio.owsdk.Geodetic;
using UnityEngine;
namespace sbio.owsdk.Unity
{
[Serializable]
public struct SerializedGeodetic2d
{
public Geodetic2d Value
{
get { return this; }
}
public double LatitudeRadians
{
get { return NumUtil.DegreesToRadians(m_Latitude); }
}
public double LatitudeDegrees
{
get { return m_Latitude; }
}
public double LongitudeRadians
{
get { return NumUtil.DegreesToRadians(m_Longitude); }
}
public double LongitudeDegrees
{
get { return m_Longitude; }
}
public SerializedGeodetic2d(Geodetic2d value)
{
m_Latitude = value.LatitudeDegrees;
m_Longitude = value.LongitudeDegrees;
}
public static explicit operator Geodetic3d(SerializedGeodetic2d obj)
{
return Geodetic3d.FromDegrees(obj.m_Latitude, obj.m_Longitude, 0);
}
public static implicit operator SerializedGeodetic2d(Geodetic3d obj)
{
return new SerializedGeodetic2d((Geodetic2d)obj);
}
public static implicit operator Geodetic2d(SerializedGeodetic2d obj)
{
return Geodetic2d.FromDegrees(obj.m_Latitude, obj.m_Longitude);
}
public static implicit operator SerializedGeodetic2d(Geodetic2d obj)
{
return new SerializedGeodetic2d(obj);
}
[Range(-90, 90)] [SerializeField] private double m_Latitude;
[Range(-180, 180)] [SerializeField] private double m_Longitude;
}
}
//Copyright SimBlocks LLC 2016-2022
//https://www.simblocks.io/
//The source code in this file is licensed under the MIT License. See the LICENSE text file for full terms.