-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathSerializedGeodetic3d.cs
More file actions
88 lines (72 loc) · 2.13 KB
/
SerializedGeodetic3d.cs
File metadata and controls
88 lines (72 loc) · 2.13 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
//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 SerializedGeodetic3d
{
public Geodetic3d 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 double HeightMeters
{
get { return m_Height; }
}
public SerializedGeodetic3d(Geodetic3d value)
{
m_Latitude = value.LatitudeDegrees;
m_Longitude = value.LongitudeDegrees;
m_Height = value.HeightMeters;
}
public SerializedGeodetic3d(double latitude, double longitude, double heightMeters)
{
m_Latitude = latitude;
m_Longitude = longitude;
m_Height = heightMeters;
}
public static implicit operator Geodetic3d(SerializedGeodetic3d obj)
{
return Geodetic3d.FromDegrees(obj.m_Latitude, obj.m_Longitude, obj.m_Height);
}
public static implicit operator SerializedGeodetic3d(Geodetic3d obj)
{
return new SerializedGeodetic3d(obj);
}
public static explicit operator Geodetic2d(SerializedGeodetic3d obj)
{
return Geodetic2d.FromDegrees(obj.m_Latitude, obj.m_Longitude);
}
public static implicit operator SerializedGeodetic3d(Geodetic2d obj)
{
return new SerializedGeodetic3d(obj);
}
[Range(-85, 85)] [SerializeField] private double m_Latitude;
[Range(-180, 180)] [SerializeField] private double m_Longitude;
[SerializeField] private double m_Height;
}
}
//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.