106 using namespace MSP::CCS;
114 const double PI = 3.14159265358979323e0;
125 Orthographic::Orthographic(
double ellipsoidSemiMajorAxis,
double ellipsoidFlattening,
double centralMeridian,
double originLatitude,
double falseEasting,
double falseNorthing ) :
127 es2( 0.0066943799901413800 ),
128 es4( 4.4814723452405e-005 ),
129 es6( 3.0000678794350e-007 ),
130 Ra( 6371007.1810824 ),
131 Orth_Origin_Long( 0.0 ),
132 Orth_Origin_Lat( 0.0 ),
133 Orth_False_Easting( 0.0 ),
134 Orth_False_Northing( 0.0 ),
135 Sin_Orth_Origin_Lat( 0.0 ),
136 Cos_Orth_Origin_Lat( 1.0 )
156 double inv_f = 1 / ellipsoidFlattening;
158 if (ellipsoidSemiMajorAxis <= 0.0)
162 if ((inv_f < 250) || (inv_f > 350))
170 if ((centralMeridian < -
PI) || (centralMeridian >
TWO_PI))
181 Ra =
semiMajorAxis * (1.0 - es2 / 6.0 - 17.0 * es4 / 360.0 - 67.0 * es6 /3024.0);
182 Orth_Origin_Lat = originLatitude;
183 Sin_Orth_Origin_Lat = sin(Orth_Origin_Lat);
184 Cos_Orth_Origin_Lat = cos(Orth_Origin_Lat);
185 if (centralMeridian >
PI)
186 centralMeridian -=
TWO_PI;
187 Orth_Origin_Long = centralMeridian;
188 Orth_False_Easting = falseEasting;
189 Orth_False_Northing = falseNorthing;
201 Orth_Origin_Long = o.Orth_Origin_Long;
202 Orth_Origin_Lat = o.Orth_Origin_Lat;
203 Orth_False_Easting = o.Orth_False_Easting;
204 Orth_False_Northing = o.Orth_False_Northing;
205 Sin_Orth_Origin_Lat = o.Sin_Orth_Origin_Lat;
206 Cos_Orth_Origin_Lat = o.Cos_Orth_Origin_Lat;
225 Orth_Origin_Long = o.Orth_Origin_Long;
226 Orth_Origin_Lat = o.Orth_Origin_Lat;
227 Orth_False_Easting = o.Orth_False_Easting;
228 Orth_False_Northing = o.Orth_False_Northing;
229 Sin_Orth_Origin_Lat = o.Sin_Orth_Origin_Lat;
230 Cos_Orth_Origin_Lat = o.Cos_Orth_Origin_Lat;
279 double longitude = geodeticCoordinates->
longitude();
280 double latitude = geodeticCoordinates->
latitude();
281 double slat = sin(latitude);
282 double clat = cos(latitude);
288 if ((longitude < -
PI) || (longitude >
TWO_PI))
293 dlam = longitude - Orth_Origin_Long;
294 clat_cdlam = clat * cos(dlam);
295 cos_c = Sin_Orth_Origin_Lat * slat + Cos_Orth_Origin_Lat * clat_cdlam;
310 double easting = Ra * clat * sin(dlam) + Orth_False_Easting;
311 double northing = Ra * (Cos_Orth_Origin_Lat * slat - Sin_Orth_Origin_Lat * clat_cdlam) +
334 double cos_cc, sin_cc;
339 double longitude, latitude;
341 double easting = mapProjectionCoordinates->
easting();
342 double northing = mapProjectionCoordinates->
northing();
344 if ((easting > (Orth_False_Easting + Ra)) ||
345 (easting < (Orth_False_Easting - Ra)))
349 if ((northing > (Orth_False_Northing + Ra)) ||
350 (northing < (Orth_False_Northing - Ra)))
355 temp = sqrt(easting * easting + northing * northing);
357 if((temp > (Orth_False_Easting + Ra)) ||
358 (temp > (Orth_False_Northing + Ra)) ||
359 (temp < (Orth_False_Easting - Ra)) ||
360 (temp < (Orth_False_Northing - Ra)))
365 dx = easting - Orth_False_Easting;
366 dy = northing - Orth_False_Northing;
367 rho = sqrt(dx * dx + dy * dy);
370 latitude = Orth_Origin_Lat;
371 longitude = Orth_Origin_Long;
375 rho_OVER_Ra = rho / Ra;
377 if (rho_OVER_Ra > 1.0)
379 else if (rho_OVER_Ra < -1.0)
382 cc = asin(rho_OVER_Ra);
385 latitude = asin(cos_cc * Sin_Orth_Origin_Lat + (dy * sin_cc * Cos_Orth_Origin_Lat / rho));
387 if (Orth_Origin_Lat ==
MAX_LAT)
388 longitude = Orth_Origin_Long + atan2(dx, -dy);
389 else if (Orth_Origin_Lat == -
MAX_LAT)
390 longitude = Orth_Origin_Long + atan2(dx, dy);
392 longitude = Orth_Origin_Long + atan2(dx * sin_cc, (rho *
393 Cos_Orth_Origin_Lat * cos_cc - dy * Sin_Orth_Origin_Lat * sin_cc));
407 else if (longitude < -
PI)