-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathProjection.cpp
115 lines (89 loc) · 3.29 KB
/
Projection.cpp
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/** Projection from Spherical Earth to Euclidean Plane
*
* Authors: George Hagen NASA Langley Research Center
* Ricky Butler NASA Langley Research Center
* Jeff Maddalon NASA Langley Research Center
* Anthony Narkawicz NASA Langley Research Center
*
* Holding area for universal projection information. All projection objects should be retrieved using these functions.
*
* Copyright (c) 2011-2021 United States Government as represented by
* the National Aeronautics and Space Administration. No copyright
* is claimed in the United States under Title 17, U.S.Code. All Other
* Rights Reserved.
*/
#include "Projection.h"
#include "SimpleProjection.h"
#include "SimpleNoPolarProjection.h"
#include "ENUProjection.h"
#include "AziEquiProjection.h"
#include "OrthographicProjection.h"
#include "LatLonAlt.h"
#include "string_util.h"
#include <string>
namespace larcfm {
// the default!!!
EuclideanProjection Projection::projection = EuclideanProjection();
ProjectionType Projection::ptype = projection_type_value__;
EuclideanProjection Projection::createProjection(double lat, double lon, double alt) {
return projection.makeNew(lat, lon, alt);
}
EuclideanProjection Projection::createProjection(const LatLonAlt& lla) {
return projection.makeNew(lla);
}
EuclideanProjection Projection::createProjection(const Position& pos) {
LatLonAlt lla = pos.lla().zeroAlt();
if (!pos.isLatLon()) lla = LatLonAlt::ZERO();
return projection.makeNew(lla);
}
double Projection::projectionConflictRange(double lat, double accuracy) {
return projection.conflictRange(lat,accuracy);
}
double Projection::projectionMaxRange() {
return projection.maxRange();
}
// void in C++
void Projection::setProjectionType(ProjectionType t) { }
ProjectionType Projection::getProjectionTypeFromString(const std::string& s) {
ProjectionType p = UNKNOWN_PROJECTION;
if (toLowerCase(s).compare("simple") == 0) {
p = SIMPLE;
} else if (toLowerCase(s).compare("simple_no_polar") == 0) {
p = SIMPLE_NO_POLAR;
} else if (toLowerCase(s).compare("enu") == 0) {
p = ENU;
} else if (toLowerCase(s).compare("aziequi") == 0) {
p = AZIEQUI;
} else if (toLowerCase(s).compare("ortho") == 0) {
p = ORTHO;
}
return p;
}
ProjectionType Projection::getProjectionType() {
return ptype;
}
//***********************************
// deprecated functions:
// EuclideanProjection projection = EuclideanProjection();
// ProjectionType ptype = projection_type_value__;
EuclideanProjection getProjection(double lat, double lon, double alt) {
return Projection::createProjection(lat, lon, alt);
}
EuclideanProjection getProjection(const LatLonAlt& lla) {
return Projection::createProjection(lla);
}
double projectionConflictRange(double lat, double accuracy) {
return Projection::projectionConflictRange(lat,accuracy);
}
double projectionMaxRange() {
return Projection::projectionMaxRange();
}
// void in C++
void setProjectionType(ProjectionType t) { }
ProjectionType getProjectionTypeFromString(std::string s) {
return Projection::getProjectionTypeFromString(s);
}
ProjectionType getProjectionType() {
return Projection::getProjectionType();
}
}