165 using namespace MSP::CCS;
170 const double PI = 3.14159265358979323e0;
175 CoordinateConversionService::CCSData::CCSData() :
178 ellipsoidLibraryImplementation = EllipsoidLibraryImplementation::getInstance();
180 datumLibraryImplementation = DatumLibraryImplementation::getInstance();
181 datumLibrary =
new DatumLibrary( datumLibraryImplementation );
182 geoidLibrary = GeoidLibrary::getInstance();
186 CoordinateConversionService::CCSData::~CCSData()
188 delete ellipsoidLibrary;
189 ellipsoidLibrary = 0;
191 EllipsoidLibraryImplementation::removeInstance();
192 ellipsoidLibraryImplementation = 0;
197 DatumLibraryImplementation::removeInstance();
198 datumLibraryImplementation = 0;
200 GeoidLibrary::removeInstance();
212 CoordinateConversionService::CoordinateConversionService(
213 const char* sourceDatumCode,
215 const char* targetDatumCode,
217 WGS84_datum_index( 0 )
225 ccsData =
new CCSData();
231 ellipsoidLibraryImplementation = 0;
234 datumLibraryImplementation = 0;
242 ellipsoidLibraryImplementation = ccsData->ellipsoidLibraryImplementation;
243 datumLibraryImplementation = ccsData->datumLibraryImplementation;
244 geoidLibrary = ccsData->geoidLibrary;
250 strcpy(Coordinate_System_Table[0].Name,
"Albers Equal Area Conic");
251 strcpy(Coordinate_System_Table[0].Code,
"AC");
252 Coordinate_System_Table[0].coordinateSystem =
255 strcpy(Coordinate_System_Table[1].Name,
"Azimuthal Equidistant (S)");
256 strcpy(Coordinate_System_Table[1].Code,
"AL");
257 Coordinate_System_Table[1].coordinateSystem =
260 strcpy(Coordinate_System_Table[2].Name,
"Bonne");
261 strcpy(Coordinate_System_Table[2].Code,
"BF");
264 strcpy(Coordinate_System_Table[3].Name,
"British National Grid (BNG)");
265 strcpy(Coordinate_System_Table[3].Code,
"BN");
266 Coordinate_System_Table[3].coordinateSystem =
269 strcpy(Coordinate_System_Table[4].Name,
"Cassini");
270 strcpy(Coordinate_System_Table[4].Code,
"CS");
271 Coordinate_System_Table[4].coordinateSystem =
274 strcpy(Coordinate_System_Table[5].Name,
"Cylindrical Equal Area");
275 strcpy(Coordinate_System_Table[5].Code,
"LI");
276 Coordinate_System_Table[5].coordinateSystem =
279 strcpy(Coordinate_System_Table[6].Name,
"Eckert IV (S)");
280 strcpy(Coordinate_System_Table[6].Code,
"EF");
281 Coordinate_System_Table[6].coordinateSystem =
284 strcpy(Coordinate_System_Table[7].Name,
"Eckert VI (S)");
285 strcpy(Coordinate_System_Table[7].Code,
"ED");
286 Coordinate_System_Table[7].coordinateSystem =
289 strcpy(Coordinate_System_Table[8].Name,
"Equidistant Cylindrical (S)");
290 strcpy(Coordinate_System_Table[8].Code,
"CP");
291 Coordinate_System_Table[8].coordinateSystem =
294 strcpy(Coordinate_System_Table[9].Name,
"Geocentric");
295 strcpy(Coordinate_System_Table[9].Code,
"GC");
296 Coordinate_System_Table[9].coordinateSystem =
299 strcpy(Coordinate_System_Table[10].Name,
"Geodetic");
300 strcpy(Coordinate_System_Table[10].Code,
"GD");
303 strcpy(Coordinate_System_Table[11].Name,
"GEOREF");
304 strcpy(Coordinate_System_Table[11].Code,
"GE");
307 strcpy(Coordinate_System_Table[12].Name,
308 "Global Area Reference System (GARS)");
309 strcpy(Coordinate_System_Table[12].Code,
"GA");
310 Coordinate_System_Table[12].coordinateSystem =
313 strcpy(Coordinate_System_Table[13].Name,
"Gnomonic (S)");
314 strcpy(Coordinate_System_Table[13].Code,
"GN");
317 strcpy(Coordinate_System_Table[14].Name,
318 "Lambert Conformal Conic (1 Standard Parallel)");
319 strcpy(Coordinate_System_Table[14].Code,
"L1");
320 Coordinate_System_Table[14].coordinateSystem =
323 strcpy(Coordinate_System_Table[15].Name,
324 "Lambert Conformal Conic (2 Standard Parallel)");
325 strcpy(Coordinate_System_Table[15].Code,
"L2");
326 Coordinate_System_Table[15].coordinateSystem =
329 strcpy(Coordinate_System_Table[16].Name,
"Local Cartesian");
330 strcpy(Coordinate_System_Table[16].Code,
"LC");
333 strcpy(Coordinate_System_Table[17].Name,
"Mercator (Standard Parallel)");
334 strcpy(Coordinate_System_Table[17].Code,
"MC");
335 Coordinate_System_Table[17].coordinateSystem =
338 strcpy(Coordinate_System_Table[18].Name,
"Mercator (Scale Factor)");
339 strcpy(Coordinate_System_Table[18].Code,
"MF");
340 Coordinate_System_Table[18].coordinateSystem =
343 strcpy(Coordinate_System_Table[19].Name,
"Military Grid Reference System (MGRS)");
344 strcpy(Coordinate_System_Table[19].Code,
"MG");
345 Coordinate_System_Table[19].coordinateSystem =
348 strcpy(Coordinate_System_Table[20].Name,
"Miller Cylindrical (S)");
349 strcpy(Coordinate_System_Table[20].Code,
"MH");
350 Coordinate_System_Table[20].coordinateSystem =
353 strcpy(Coordinate_System_Table[21].Name,
"Mollweide (S)");
354 strcpy(Coordinate_System_Table[21].Code,
"MP");
357 strcpy(Coordinate_System_Table[22].Name,
"New Zealand Map Grid (NZMG)");
358 strcpy(Coordinate_System_Table[22].Code,
"NT");
359 Coordinate_System_Table[22].coordinateSystem =
362 strcpy(Coordinate_System_Table[23].Name,
363 "Ney's (Modified Lambert Conformal Conic)");
364 strcpy(Coordinate_System_Table[23].Code,
"NY");
367 strcpy(Coordinate_System_Table[24].Name,
"Oblique Mercator");
368 strcpy(Coordinate_System_Table[24].Code,
"OC");
369 Coordinate_System_Table[24].coordinateSystem =
372 strcpy(Coordinate_System_Table[25].Name,
"Orthographic (S)");
373 strcpy(Coordinate_System_Table[25].Code,
"OD");
376 strcpy(Coordinate_System_Table[26].Name,
377 "Polar Stereographic (Standard Parallel)");
378 strcpy(Coordinate_System_Table[26].Code,
"PG");
379 Coordinate_System_Table[26].coordinateSystem =
382 strcpy(Coordinate_System_Table[27].Name,
"Polar Stereographic (Scale Factor)");
383 strcpy(Coordinate_System_Table[27].Code,
"PF");
384 Coordinate_System_Table[27].coordinateSystem =
387 strcpy(Coordinate_System_Table[28].Name,
"Polyconic");
388 strcpy(Coordinate_System_Table[28].Code,
"PH");
391 strcpy(Coordinate_System_Table[29].Name,
"Sinusoidal");
392 strcpy(Coordinate_System_Table[29].Code,
"SA");
395 strcpy(Coordinate_System_Table[30].Name,
"Stereographic (S)");
396 strcpy(Coordinate_System_Table[30].Code,
"SD");
399 strcpy(Coordinate_System_Table[31].Name,
"Transverse Cylindrical Equal Area");
400 strcpy(Coordinate_System_Table[31].Code,
"TX");
401 Coordinate_System_Table[31].coordinateSystem =
404 strcpy(Coordinate_System_Table[32].Name,
"Transverse Mercator");
405 strcpy(Coordinate_System_Table[32].Code,
"TC");
406 Coordinate_System_Table[32].coordinateSystem =
409 strcpy(Coordinate_System_Table[33].Name,
410 "Universal Polar Stereographic (UPS)");
411 strcpy(Coordinate_System_Table[33].Code,
"UP");
412 Coordinate_System_Table[33].coordinateSystem =
415 strcpy(Coordinate_System_Table[34].Name,
416 "Universal Transverse Mercator (UTM)");
417 strcpy(Coordinate_System_Table[34].Code,
"UT");
418 Coordinate_System_Table[34].coordinateSystem =
421 strcpy(Coordinate_System_Table[35].Name,
422 "United States National Grid (USNG)");
423 strcpy(Coordinate_System_Table[35].Code,
"US");
424 Coordinate_System_Table[35].coordinateSystem =
427 strcpy(Coordinate_System_Table[36].Name,
"Van der Grinten");
428 strcpy(Coordinate_System_Table[36].Code,
"VA");
431 strcpy(Coordinate_System_Table[37].Name,
"Web Mercator");
432 strcpy(Coordinate_System_Table[37].Code,
"WM");
464 datumLibraryImplementation->
datumIndex(
"WGE", &WGS84_datum_index );
470 ccsData( ccs.ccsData )
476 ellipsoidLibraryImplementation = ccsData->ellipsoidLibraryImplementation;
477 datumLibraryImplementation = ccsData->datumLibraryImplementation;
478 geoidLibrary = ccsData->geoidLibrary;
497 WGS84_datum_index = ccs.WGS84_datum_index;
505 if( --ccsData->refCount == 0 )
511 ellipsoidLibraryImplementation = 0;
514 datumLibraryImplementation = 0;
530 if( ccsData == ccs.ccsData )
533 if( --ccsData->refCount == 0 )
536 ccsData = ccs.ccsData;
539 ellipsoidLibraryImplementation = ccsData->ellipsoidLibraryImplementation;
540 datumLibraryImplementation = ccsData->datumLibraryImplementation;
541 geoidLibrary = ccsData->geoidLibrary;
560 WGS84_datum_index = ccs.WGS84_datum_index;
580 sourceCoordinates, sourceAccuracy, targetCoordinates, targetAccuracy );
599 targetCoordinates, targetAccuracy,
600 sourceCoordinates, sourceAccuracy );
605 const std::vector<MSP::CCS::CoordinateTuple*>& sourceCoordinates,
606 const std::vector<MSP::CCS::Accuracy*>& sourceAccuracy,
607 std::vector<MSP::CCS::CoordinateTuple*>& targetCoordinates,
608 std::vector<MSP::CCS::Accuracy*>& targetAccuracy )
621 sourceCoordinates, sourceAccuracy, targetCoordinates, targetAccuracy );
626 const std::vector<MSP::CCS::CoordinateTuple*>& targetCoordinates,
627 const std::vector<MSP::CCS::Accuracy*>& targetAccuracy,
628 std::vector<MSP::CCS::CoordinateTuple*>& sourceCoordinates,
629 std::vector<MSP::CCS::Accuracy*>& sourceAccuracy )
642 targetCoordinates, targetAccuracy, sourceCoordinates, sourceAccuracy );
654 return ccsData->ellipsoidLibrary;
666 return ccsData->datumLibrary;
689 return coordinateSystemState[direction].datumCode;
705 switch( coordinateSystemState[direction].coordinateType )
709 return coordinateSystemState[direction].parameters.mapProjection6Parameters;
718 return coordinateSystemState[direction].parameters.mapProjection4Parameters;
725 return coordinateSystemState[direction].parameters.mapProjection3Parameters;
727 return coordinateSystemState[direction].parameters.equidistantCylindricalParameters;
729 return coordinateSystemState[direction].parameters.geodeticParameters;
733 return coordinateSystemState[direction].parameters.mapProjection5Parameters;
735 return coordinateSystemState[direction].parameters.localCartesianParameters;
737 return ((
Mercator*)(coordinateSystemState[direction].coordinateSystem))->getStandardParallelParameters();
739 return coordinateSystemState[direction].parameters.mercatorScaleFactorParameters;
741 return coordinateSystemState[direction].parameters.neysParameters;
743 return coordinateSystemState[direction].parameters.obliqueMercatorParameters;
745 return coordinateSystemState[direction].parameters.polarStereographicStandardParallelParameters;
747 return coordinateSystemState[direction].parameters.polarStereographicScaleFactorParameters;
749 return coordinateSystemState[direction].parameters.utmParameters;
759 return coordinateSystemState[direction].parameters.coordinateSystemParameters;
771 void CoordinateConversionService::initCoordinateSystemState(
783 coordinateSystemState[direction].datumIndex = 0;
785 coordinateSystemState[direction].coordinateSystem = 0;
787 coordinateSystemState[direction].parameters.coordinateSystemParameters = 0;
788 coordinateSystemState[direction].parameters.mapProjection3Parameters = 0;
789 coordinateSystemState[direction].parameters.mapProjection4Parameters = 0;
790 coordinateSystemState[direction].parameters.mapProjection5Parameters = 0;
791 coordinateSystemState[direction].parameters.mapProjection6Parameters = 0;
792 coordinateSystemState[direction].parameters.equidistantCylindricalParameters = 0;
793 coordinateSystemState[direction].parameters.geodeticParameters = 0;
794 coordinateSystemState[direction].parameters.localCartesianParameters = 0;
795 coordinateSystemState[direction].parameters.mercatorStandardParallelParameters = 0;
796 coordinateSystemState[direction].parameters.mercatorScaleFactorParameters = 0;
797 coordinateSystemState[direction].parameters.neysParameters = 0;
798 coordinateSystemState[direction].parameters.obliqueMercatorParameters = 0;
799 coordinateSystemState[direction].parameters.polarStereographicStandardParallelParameters = 0;
800 coordinateSystemState[direction].parameters.polarStereographicScaleFactorParameters = 0;
801 coordinateSystemState[direction].parameters.utmParameters = 0;
805 void CoordinateConversionService::setDataLibraries()
816 ellipsoidLibraryImplementation );
818 datumLibraryImplementation );
822 char message[256] =
"Error initializing MSP CCS data: ";
829 void CoordinateConversionService::setDatum(
831 const char* datumCode )
846 strcpy( coordinateSystemState[direction].datumCode, datumCode );
849 datumLibraryImplementation->
datumIndex( datumCode, &datumIndex );
850 coordinateSystemState[direction].datumIndex = datumIndex;
854 void CoordinateConversionService::setCoordinateSystem(
868 coordinateSystemState[direction].coordinateSystem = 0;
873 coordinateSystemState[direction].coordinateType =
875 coordinateSystemState[direction].parameters.mapProjection6Parameters =
877 *dynamic_cast< MapProjection6Parameters* >( parameters ) );
880 coordinateSystemState[direction].coordinateType =
882 coordinateSystemState[direction].parameters.mapProjection4Parameters =
884 *dynamic_cast< MapProjection4Parameters* >( parameters ) );
888 coordinateSystemState[direction].parameters.mapProjection4Parameters =
890 *dynamic_cast< MapProjection4Parameters* >( parameters ) );
893 coordinateSystemState[direction].coordinateType =
895 coordinateSystemState[direction].parameters.coordinateSystemParameters =
897 *dynamic_cast< CoordinateSystemParameters* >( parameters ) );
901 coordinateSystemState[direction].parameters.mapProjection4Parameters =
903 *dynamic_cast< MapProjection4Parameters* >( parameters ) );
906 coordinateSystemState[direction].coordinateType =
908 coordinateSystemState[direction].parameters.mapProjection4Parameters =
910 *dynamic_cast< MapProjection4Parameters* >( parameters ) );
914 coordinateSystemState[direction].parameters.mapProjection3Parameters =
916 *dynamic_cast< MapProjection3Parameters* >( parameters ) );
920 coordinateSystemState[direction].parameters.mapProjection3Parameters =
922 *dynamic_cast< MapProjection3Parameters* >( parameters ) );
925 coordinateSystemState[direction].coordinateType =
927 coordinateSystemState[direction].parameters.equidistantCylindricalParameters =
929 *dynamic_cast< EquidistantCylindricalParameters* >( parameters ) );
932 coordinateSystemState[direction].coordinateType =
934 coordinateSystemState[direction].parameters.coordinateSystemParameters =
936 *dynamic_cast< CoordinateSystemParameters* >( parameters ) );
939 coordinateSystemState[direction].coordinateType =
941 coordinateSystemState[direction].parameters.geodeticParameters =
943 *dynamic_cast< GeodeticParameters* >( parameters ) );
947 coordinateSystemState[direction].parameters.coordinateSystemParameters =
949 *dynamic_cast< CoordinateSystemParameters* >( parameters ) );
952 coordinateSystemState[direction].coordinateType =
954 coordinateSystemState[direction].parameters.coordinateSystemParameters =
956 *dynamic_cast< CoordinateSystemParameters* >( parameters ) );
959 coordinateSystemState[direction].coordinateType =
961 coordinateSystemState[direction].parameters.mapProjection4Parameters =
963 *dynamic_cast< MapProjection4Parameters* >( parameters ) );
967 coordinateSystemState[direction].parameters.mapProjection5Parameters =
969 *dynamic_cast< MapProjection5Parameters* >( parameters ) );
972 coordinateSystemState[direction].coordinateType =
974 coordinateSystemState[direction].parameters.mapProjection6Parameters =
976 *dynamic_cast< MapProjection6Parameters* >( parameters ) );
979 coordinateSystemState[direction].coordinateType =
981 coordinateSystemState[direction].parameters.localCartesianParameters =
983 *dynamic_cast< LocalCartesianParameters* >( parameters ) );
986 coordinateSystemState[direction].coordinateType =
988 coordinateSystemState[direction].parameters.mercatorStandardParallelParameters =
990 *dynamic_cast< MercatorStandardParallelParameters* >( parameters ));
993 coordinateSystemState[direction].coordinateType =
995 coordinateSystemState[direction].parameters.mercatorScaleFactorParameters =
997 *dynamic_cast< MercatorScaleFactorParameters* >( parameters ) );
1000 coordinateSystemState[direction].coordinateType =
1002 coordinateSystemState[direction].parameters.coordinateSystemParameters =
1004 *dynamic_cast< CoordinateSystemParameters* >( parameters ) );
1008 coordinateSystemState[direction].parameters.mapProjection3Parameters =
1010 *dynamic_cast< MapProjection3Parameters* >( parameters ) );
1013 coordinateSystemState[direction].coordinateType =
1015 coordinateSystemState[direction].parameters.mapProjection3Parameters =
1017 *dynamic_cast< MapProjection3Parameters* >( parameters ) );
1020 coordinateSystemState[direction].coordinateType =
1022 coordinateSystemState[direction].parameters.coordinateSystemParameters =
1024 *dynamic_cast< CoordinateSystemParameters* >( parameters ) );
1028 coordinateSystemState[direction].parameters.neysParameters =
1029 new NeysParameters( *dynamic_cast< NeysParameters* >( parameters ) );
1032 coordinateSystemState[direction].coordinateType =
1034 coordinateSystemState[direction].parameters.obliqueMercatorParameters =
1036 *dynamic_cast< ObliqueMercatorParameters* >( parameters ) );
1039 coordinateSystemState[direction].coordinateType =
1041 coordinateSystemState[direction].parameters.mapProjection4Parameters =
1043 *dynamic_cast< MapProjection4Parameters* >( parameters ) );
1046 coordinateSystemState[direction].coordinateType =
1048 coordinateSystemState[direction].parameters.polarStereographicStandardParallelParameters =
1050 *dynamic_cast< PolarStereographicStandardParallelParameters* >(
1054 coordinateSystemState[direction].coordinateType =
1056 coordinateSystemState[direction].parameters.polarStereographicScaleFactorParameters =
1058 *dynamic_cast< PolarStereographicScaleFactorParameters* >( parameters ) );
1061 coordinateSystemState[direction].coordinateType =
1063 coordinateSystemState[direction].parameters.mapProjection4Parameters =
1065 *dynamic_cast< MapProjection4Parameters* >( parameters ) );
1068 coordinateSystemState[direction].coordinateType =
1070 coordinateSystemState[direction].parameters.mapProjection3Parameters =
1072 *dynamic_cast< MapProjection3Parameters* >( parameters ) );
1075 coordinateSystemState[direction].coordinateType =
1077 coordinateSystemState[direction].parameters.mapProjection4Parameters =
1079 *dynamic_cast< MapProjection4Parameters* >( parameters ) );
1082 coordinateSystemState[direction].coordinateType =
1084 coordinateSystemState[direction].parameters.mapProjection5Parameters =
1086 *dynamic_cast< MapProjection5Parameters* >( parameters ) );
1089 coordinateSystemState[direction].coordinateType =
1091 coordinateSystemState[direction].parameters.mapProjection5Parameters =
1093 *dynamic_cast< MapProjection5Parameters* >( parameters ) );
1096 coordinateSystemState[direction].coordinateType =
1098 coordinateSystemState[direction].parameters.coordinateSystemParameters =
1100 *dynamic_cast< CoordinateSystemParameters* >( parameters ) );
1103 coordinateSystemState[direction].coordinateType =
1105 coordinateSystemState[direction].parameters.utmParameters =
1106 new UTMParameters( *dynamic_cast< UTMParameters* >( parameters ) );
1109 coordinateSystemState[direction].coordinateType =
1111 coordinateSystemState[direction].parameters.coordinateSystemParameters =
1113 *dynamic_cast< CoordinateSystemParameters* >( parameters ) );
1116 coordinateSystemState[direction].coordinateType =
1118 coordinateSystemState[direction].parameters.mapProjection3Parameters =
1120 *dynamic_cast< MapProjection3Parameters* >( parameters ) );
1123 coordinateSystemState[direction].coordinateType =
1125 coordinateSystemState[direction].parameters.coordinateSystemParameters =
1127 *dynamic_cast< CoordinateSystemParameters* >( parameters ) );
1133 setParameters( direction );
1136 void CoordinateConversionService::setParameters(
1148 Coordinate_State_Row* row = &coordinateSystemState[direction];
1150 char ellipsoidCode[3];
1151 long ellipsoidIndex;
1152 double semiMajorAxis;
1156 row->datumIndex, ellipsoidCode );
1159 ellipsoidCode, &ellipsoidIndex );
1162 ellipsoidIndex, &semiMajorAxis, &flattening );
1164 switch( coordinateSystemState[direction].coordinateType )
1169 row->parameters.mapProjection6Parameters;
1171 coordinateSystemState[direction].coordinateSystem =
1173 semiMajorAxis, flattening,
1185 row->parameters.mapProjection4Parameters;
1187 coordinateSystemState[direction].coordinateSystem =
1189 semiMajorAxis, flattening,
1200 coordinateSystemState[direction].coordinateSystem =
new Bonne(
1201 semiMajorAxis, flattening,
1210 coordinateSystemState[direction].coordinateSystem =
1218 row->parameters.mapProjection4Parameters;
1220 coordinateSystemState[direction].coordinateSystem =
new Cassini(
1221 semiMajorAxis, flattening,
1231 row->parameters.mapProjection4Parameters;
1233 coordinateSystemState[direction].coordinateSystem =
1235 semiMajorAxis, flattening,
1245 row->parameters.mapProjection3Parameters;
1247 coordinateSystemState[direction].coordinateSystem =
new Eckert4(
1248 semiMajorAxis, flattening,
1257 row->parameters.mapProjection3Parameters;
1259 coordinateSystemState[direction].coordinateSystem =
new Eckert6(
1260 semiMajorAxis, flattening,
1269 row->parameters.equidistantCylindricalParameters;
1271 coordinateSystemState[direction].coordinateSystem =
1273 semiMajorAxis,flattening,
1282 coordinateSystemState[direction].coordinateSystem =
1287 coordinateSystemState[direction].coordinateSystem = 0;
1290 coordinateSystemState[direction].coordinateSystem =
new GEOREF();
1293 coordinateSystemState[direction].coordinateSystem =
new GARS();
1298 row->parameters.mapProjection4Parameters;
1300 coordinateSystemState[direction].coordinateSystem =
new Gnomonic(
1301 semiMajorAxis, flattening,
1312 coordinateSystemState[direction].coordinateSystem =
1314 semiMajorAxis, flattening,
1325 row->parameters.mapProjection6Parameters;
1327 coordinateSystemState[direction].coordinateSystem =
1329 semiMajorAxis, flattening,
1341 row->parameters.localCartesianParameters;
1343 coordinateSystemState[direction].coordinateSystem =
new LocalCartesian(
1344 semiMajorAxis, flattening,
1354 row->parameters.mercatorStandardParallelParameters;
1356 coordinateSystemState[direction].coordinateSystem =
new Mercator(
1357 semiMajorAxis, flattening,
1371 row->parameters.mercatorScaleFactorParameters;
1373 coordinateSystemState[direction].coordinateSystem =
new Mercator(
1374 semiMajorAxis, flattening,
1384 coordinateSystemState[direction].coordinateSystem =
new MGRS(
1385 semiMajorAxis, flattening, ellipsoidCode );
1392 row->parameters.mapProjection3Parameters;
1394 coordinateSystemState[direction].coordinateSystem =
1396 semiMajorAxis, flattening,
1405 row->parameters.mapProjection3Parameters;
1407 coordinateSystemState[direction].coordinateSystem =
new Mollweide(
1408 semiMajorAxis,flattening,
1416 coordinateSystemState[direction].coordinateSystem =
1417 new NZMG( ellipsoidCode );
1425 coordinateSystemState[direction].coordinateSystem =
new Neys(
1426 semiMajorAxis, flattening,
1437 row->parameters.obliqueMercatorParameters;
1439 coordinateSystemState[direction].coordinateSystem =
new ObliqueMercator(
1440 semiMajorAxis, flattening,
1454 row->parameters.mapProjection4Parameters;
1456 coordinateSystemState[direction].coordinateSystem =
new Orthographic(
1457 semiMajorAxis, flattening,
1467 row->parameters.polarStereographicStandardParallelParameters;
1469 coordinateSystemState[direction].coordinateSystem =
1471 semiMajorAxis, flattening,
1482 row->parameters.polarStereographicScaleFactorParameters;
1484 coordinateSystemState[direction].coordinateSystem =
1486 semiMajorAxis, flattening,
1497 row->parameters.mapProjection4Parameters;
1499 coordinateSystemState[direction].coordinateSystem =
new Polyconic(
1500 semiMajorAxis, flattening,
1510 row->parameters.mapProjection3Parameters;
1512 coordinateSystemState[direction].coordinateSystem =
new Sinusoidal(
1513 semiMajorAxis, flattening,
1522 row->parameters.mapProjection4Parameters;
1524 coordinateSystemState[direction].coordinateSystem =
new Stereographic(
1525 semiMajorAxis, flattening,
1535 row->parameters.mapProjection5Parameters;
1537 coordinateSystemState[direction].coordinateSystem =
1539 semiMajorAxis, flattening,
1550 row->parameters.mapProjection5Parameters;
1552 coordinateSystemState[direction].coordinateSystem =
1554 semiMajorAxis, flattening,
1565 coordinateSystemState[direction].coordinateSystem =
new UPS(
1566 semiMajorAxis, flattening );
1584 coordinateSystemState[direction].coordinateSystem =
new UTM(
1585 semiMajorAxis, flattening, ellipsoidCode, param->
zone() );
1588 coordinateSystemState[direction].coordinateSystem =
new UTM(
1589 semiMajorAxis, flattening, ellipsoidCode, 0 );
1595 coordinateSystemState[direction].coordinateSystem =
new USNG(
1596 semiMajorAxis, flattening, ellipsoidCode );
1603 row->parameters.mapProjection3Parameters;
1605 coordinateSystemState[direction].coordinateSystem =
new VanDerGrinten(
1606 semiMajorAxis, flattening,
1614 coordinateSystemState[direction].coordinateSystem =
1624 void CoordinateConversionService::deleteCoordinateSystem(
1634 switch( coordinateSystemState[direction].coordinateType )
1637 if( coordinateSystemState[direction].parameters.mapProjection6Parameters )
1639 delete coordinateSystemState[direction].parameters.mapProjection6Parameters;
1640 coordinateSystemState[direction].parameters.mapProjection6Parameters = 0;
1642 if( coordinateSystemState[direction].coordinateSystem )
1645 coordinateSystemState[direction].coordinateSystem = 0;
1649 if( coordinateSystemState[direction].parameters.mapProjection6Parameters )
1651 delete coordinateSystemState[direction].parameters.mapProjection6Parameters;
1652 coordinateSystemState[direction].parameters.mapProjection6Parameters = 0;
1654 if( coordinateSystemState[direction].coordinateSystem )
1657 coordinateSystemState[direction].coordinateSystem = 0;
1661 if( coordinateSystemState[direction].parameters.mapProjection4Parameters )
1663 delete coordinateSystemState[direction].parameters.mapProjection4Parameters;
1664 coordinateSystemState[direction].parameters.mapProjection4Parameters = 0;
1666 if( coordinateSystemState[direction].coordinateSystem )
1669 coordinateSystemState[direction].coordinateSystem = 0;
1673 if( coordinateSystemState[direction].parameters.mapProjection4Parameters )
1675 delete coordinateSystemState[direction].parameters.mapProjection4Parameters;
1676 coordinateSystemState[direction].parameters.mapProjection4Parameters = 0;
1678 if( coordinateSystemState[direction].coordinateSystem )
1680 delete ((
Bonne*)(coordinateSystemState[direction].coordinateSystem));
1681 coordinateSystemState[direction].coordinateSystem = 0;
1685 if( coordinateSystemState[direction].parameters.mapProjection4Parameters )
1687 delete coordinateSystemState[direction].parameters.mapProjection4Parameters;
1688 coordinateSystemState[direction].parameters.mapProjection4Parameters = 0;
1690 if( coordinateSystemState[direction].coordinateSystem )
1692 delete ((
Cassini*)(coordinateSystemState[direction].coordinateSystem));
1693 coordinateSystemState[direction].coordinateSystem = 0;
1697 if( coordinateSystemState[direction].parameters.mapProjection4Parameters )
1699 delete coordinateSystemState[direction].parameters.mapProjection4Parameters;
1700 coordinateSystemState[direction].parameters.mapProjection4Parameters = 0;
1702 if( coordinateSystemState[direction].coordinateSystem )
1705 coordinateSystemState[direction].coordinateSystem = 0;
1709 if( coordinateSystemState[direction].parameters.mapProjection4Parameters )
1711 delete coordinateSystemState[direction].parameters.mapProjection4Parameters;
1712 coordinateSystemState[direction].parameters.mapProjection4Parameters = 0;
1714 if( coordinateSystemState[direction].coordinateSystem )
1716 delete ((
Gnomonic*)(coordinateSystemState[direction].coordinateSystem));
1717 coordinateSystemState[direction].coordinateSystem = 0;
1721 if( coordinateSystemState[direction].parameters.mapProjection4Parameters )
1723 delete coordinateSystemState[direction].parameters.mapProjection4Parameters;
1724 coordinateSystemState[direction].parameters.mapProjection4Parameters = 0;
1726 if( coordinateSystemState[direction].coordinateSystem )
1728 delete ((
Orthographic*)(coordinateSystemState[direction].coordinateSystem));
1729 coordinateSystemState[direction].coordinateSystem = 0;
1733 if( coordinateSystemState[direction].parameters.mapProjection4Parameters )
1735 delete coordinateSystemState[direction].parameters.mapProjection4Parameters;
1736 coordinateSystemState[direction].parameters.mapProjection4Parameters = 0;
1738 if( coordinateSystemState[direction].coordinateSystem )
1740 delete ((
Polyconic*)(coordinateSystemState[direction].coordinateSystem));
1741 coordinateSystemState[direction].coordinateSystem = 0;
1745 if( coordinateSystemState[direction].parameters.mapProjection4Parameters )
1747 delete coordinateSystemState[direction].parameters.mapProjection4Parameters;
1748 coordinateSystemState[direction].parameters.mapProjection4Parameters = 0;
1750 if( coordinateSystemState[direction].coordinateSystem )
1752 delete ((
Stereographic*)(coordinateSystemState[direction].coordinateSystem));
1753 coordinateSystemState[direction].coordinateSystem = 0;
1757 if( coordinateSystemState[direction].parameters.coordinateSystemParameters )
1759 delete coordinateSystemState[direction].parameters.coordinateSystemParameters;
1760 coordinateSystemState[direction].parameters.coordinateSystemParameters = 0;
1762 if( coordinateSystemState[direction].coordinateSystem )
1765 coordinateSystemState[direction].coordinateSystem = 0;
1769 if( coordinateSystemState[direction].parameters.mapProjection3Parameters )
1771 delete coordinateSystemState[direction].parameters.mapProjection3Parameters;
1772 coordinateSystemState[direction].parameters.mapProjection3Parameters = 0;
1774 if( coordinateSystemState[direction].coordinateSystem )
1776 delete ((
Eckert4*)(coordinateSystemState[direction].coordinateSystem));
1777 coordinateSystemState[direction].coordinateSystem = 0;
1781 if( coordinateSystemState[direction].parameters.mapProjection3Parameters )
1783 delete coordinateSystemState[direction].parameters.mapProjection3Parameters;
1784 coordinateSystemState[direction].parameters.mapProjection3Parameters = 0;
1786 if( coordinateSystemState[direction].coordinateSystem )
1788 delete ((
Eckert6*)(coordinateSystemState[direction].coordinateSystem));
1789 coordinateSystemState[direction].coordinateSystem = 0;
1793 if( coordinateSystemState[direction].parameters.mapProjection3Parameters )
1795 delete coordinateSystemState[direction].parameters.mapProjection3Parameters;
1796 coordinateSystemState[direction].parameters.mapProjection3Parameters = 0;
1798 if( coordinateSystemState[direction].coordinateSystem )
1800 delete ((
MillerCylindrical*)(coordinateSystemState[direction].coordinateSystem));
1801 coordinateSystemState[direction].coordinateSystem = 0;
1805 if( coordinateSystemState[direction].parameters.mapProjection3Parameters )
1807 delete coordinateSystemState[direction].parameters.mapProjection3Parameters;
1808 coordinateSystemState[direction].parameters.mapProjection3Parameters = 0;
1810 if( coordinateSystemState[direction].coordinateSystem )
1812 delete ((
Mollweide*)(coordinateSystemState[direction].coordinateSystem));
1813 coordinateSystemState[direction].coordinateSystem = 0;
1817 if( coordinateSystemState[direction].parameters.mapProjection3Parameters )
1819 delete coordinateSystemState[direction].parameters.mapProjection3Parameters;
1820 coordinateSystemState[direction].parameters.mapProjection3Parameters = 0;
1822 if( coordinateSystemState[direction].coordinateSystem )
1824 delete ((
Sinusoidal*)(coordinateSystemState[direction].coordinateSystem));
1825 coordinateSystemState[direction].coordinateSystem = 0;
1829 if( coordinateSystemState[direction].parameters.mapProjection3Parameters )
1831 delete coordinateSystemState[direction].parameters.mapProjection3Parameters;
1832 coordinateSystemState[direction].parameters.mapProjection3Parameters = 0;
1834 if( coordinateSystemState[direction].coordinateSystem )
1836 delete ((
VanDerGrinten*)(coordinateSystemState[direction].coordinateSystem));
1837 coordinateSystemState[direction].coordinateSystem = 0;
1841 if( coordinateSystemState[direction].parameters.equidistantCylindricalParameters )
1843 delete coordinateSystemState[direction].parameters.equidistantCylindricalParameters;
1844 coordinateSystemState[direction].parameters.equidistantCylindricalParameters = 0;
1846 if( coordinateSystemState[direction].coordinateSystem )
1849 coordinateSystemState[direction].coordinateSystem = 0;
1853 if( coordinateSystemState[direction].parameters.coordinateSystemParameters )
1855 delete coordinateSystemState[direction].parameters.coordinateSystemParameters;
1856 coordinateSystemState[direction].parameters.coordinateSystemParameters = 0;
1858 if( coordinateSystemState[direction].coordinateSystem )
1860 delete ((
Geocentric*)(coordinateSystemState[direction].coordinateSystem));
1861 coordinateSystemState[direction].coordinateSystem = 0;
1865 if( coordinateSystemState[direction].parameters.geodeticParameters )
1867 delete coordinateSystemState[direction].parameters.geodeticParameters;
1868 coordinateSystemState[direction].parameters.geodeticParameters = 0;
1872 if( coordinateSystemState[direction].parameters.coordinateSystemParameters )
1874 delete coordinateSystemState[direction].parameters.coordinateSystemParameters;
1875 coordinateSystemState[direction].parameters.coordinateSystemParameters = 0;
1877 if( coordinateSystemState[direction].coordinateSystem )
1879 delete ((
GEOREF*)(coordinateSystemState[direction].coordinateSystem));
1880 coordinateSystemState[direction].coordinateSystem = 0;
1884 if( coordinateSystemState[direction].parameters.coordinateSystemParameters )
1886 delete coordinateSystemState[direction].parameters.coordinateSystemParameters;
1887 coordinateSystemState[direction].parameters.coordinateSystemParameters = 0;
1889 if( coordinateSystemState[direction].coordinateSystem )
1891 delete ((
GARS*)(coordinateSystemState[direction].coordinateSystem));
1892 coordinateSystemState[direction].coordinateSystem = 0;
1896 if( coordinateSystemState[direction].parameters.mapProjection5Parameters )
1898 delete coordinateSystemState[direction].parameters.mapProjection5Parameters;
1899 coordinateSystemState[direction].parameters.mapProjection5Parameters = 0;
1901 if( coordinateSystemState[direction].coordinateSystem )
1904 coordinateSystemState[direction].coordinateSystem = 0;
1908 if( coordinateSystemState[direction].parameters.mapProjection5Parameters )
1910 delete coordinateSystemState[direction].parameters.mapProjection5Parameters;
1911 coordinateSystemState[direction].parameters.mapProjection5Parameters = 0;
1913 if( coordinateSystemState[direction].coordinateSystem )
1916 coordinateSystemState[direction].coordinateSystem = 0;
1920 if( coordinateSystemState[direction].parameters.mapProjection5Parameters )
1922 delete coordinateSystemState[direction].parameters.mapProjection5Parameters;
1923 coordinateSystemState[direction].parameters.mapProjection5Parameters = 0;
1925 if( coordinateSystemState[direction].coordinateSystem )
1928 coordinateSystemState[direction].coordinateSystem = 0;
1932 if( coordinateSystemState[direction].parameters.localCartesianParameters )
1934 delete coordinateSystemState[direction].parameters.localCartesianParameters;
1935 coordinateSystemState[direction].parameters.localCartesianParameters = 0;
1937 if( coordinateSystemState[direction].coordinateSystem )
1939 delete ((
LocalCartesian*)(coordinateSystemState[direction].coordinateSystem));
1940 coordinateSystemState[direction].coordinateSystem = 0;
1944 if( coordinateSystemState[direction].parameters.mercatorStandardParallelParameters )
1946 delete coordinateSystemState[direction].parameters.mercatorStandardParallelParameters;
1947 coordinateSystemState[direction].parameters.mercatorStandardParallelParameters = 0;
1949 if( coordinateSystemState[direction].coordinateSystem )
1951 delete ((
Mercator*)(coordinateSystemState[direction].coordinateSystem));
1952 coordinateSystemState[direction].coordinateSystem = 0;
1956 if( coordinateSystemState[direction].parameters.mercatorScaleFactorParameters )
1958 delete coordinateSystemState[direction].parameters.mercatorScaleFactorParameters;
1959 coordinateSystemState[direction].parameters.mercatorScaleFactorParameters = 0;
1961 if( coordinateSystemState[direction].coordinateSystem )
1963 delete ((
Mercator*)(coordinateSystemState[direction].coordinateSystem));
1964 coordinateSystemState[direction].coordinateSystem = 0;
1968 if( coordinateSystemState[direction].parameters.coordinateSystemParameters )
1970 delete coordinateSystemState[direction].parameters.coordinateSystemParameters;
1971 coordinateSystemState[direction].parameters.coordinateSystemParameters = 0;
1973 if( coordinateSystemState[direction].coordinateSystem )
1975 delete ((
MGRS*)(coordinateSystemState[direction].coordinateSystem));
1976 coordinateSystemState[direction].coordinateSystem = 0;
1980 if( coordinateSystemState[direction].parameters.coordinateSystemParameters )
1982 delete coordinateSystemState[direction].parameters.coordinateSystemParameters;
1983 coordinateSystemState[direction].parameters.coordinateSystemParameters = 0;
1985 if( coordinateSystemState[direction].coordinateSystem )
1987 delete ((
USNG*)(coordinateSystemState[direction].coordinateSystem));
1988 coordinateSystemState[direction].coordinateSystem = 0;
1992 if( coordinateSystemState[direction].parameters.coordinateSystemParameters )
1994 delete coordinateSystemState[direction].parameters.coordinateSystemParameters;
1995 coordinateSystemState[direction].parameters.coordinateSystemParameters = 0;
1997 if( coordinateSystemState[direction].coordinateSystem )
1999 delete ((
NZMG*)(coordinateSystemState[direction].coordinateSystem));
2000 coordinateSystemState[direction].coordinateSystem = 0;
2004 if( coordinateSystemState[direction].parameters.neysParameters )
2006 delete coordinateSystemState[direction].parameters.neysParameters;
2007 coordinateSystemState[direction].parameters.neysParameters = 0;
2009 if( coordinateSystemState[direction].coordinateSystem )
2011 delete ((
Neys*)(coordinateSystemState[direction].coordinateSystem));
2012 coordinateSystemState[direction].coordinateSystem = 0;
2016 if( coordinateSystemState[direction].parameters.obliqueMercatorParameters )
2018 delete coordinateSystemState[direction].parameters.obliqueMercatorParameters;
2019 coordinateSystemState[direction].parameters.obliqueMercatorParameters = 0;
2021 if( coordinateSystemState[direction].coordinateSystem )
2023 delete ((
ObliqueMercator*)(coordinateSystemState[direction].coordinateSystem));
2024 coordinateSystemState[direction].coordinateSystem = 0;
2028 if( coordinateSystemState[direction].parameters.polarStereographicStandardParallelParameters )
2030 delete coordinateSystemState[direction].parameters.polarStereographicStandardParallelParameters;
2031 coordinateSystemState[direction].parameters.polarStereographicStandardParallelParameters = 0;
2033 if( coordinateSystemState[direction].coordinateSystem )
2036 coordinateSystemState[direction].coordinateSystem = 0;
2040 if( coordinateSystemState[direction].parameters.polarStereographicScaleFactorParameters )
2042 delete coordinateSystemState[direction].parameters.polarStereographicScaleFactorParameters;
2043 coordinateSystemState[direction].parameters.polarStereographicScaleFactorParameters = 0;
2045 if( coordinateSystemState[direction].coordinateSystem )
2048 coordinateSystemState[direction].coordinateSystem = 0;
2052 if( coordinateSystemState[direction].parameters.coordinateSystemParameters )
2054 delete coordinateSystemState[direction].parameters.coordinateSystemParameters;
2055 coordinateSystemState[direction].parameters.coordinateSystemParameters = 0;
2057 if( coordinateSystemState[direction].coordinateSystem )
2059 delete ((
UPS*)(coordinateSystemState[direction].coordinateSystem));
2060 coordinateSystemState[direction].coordinateSystem = 0;
2064 if( coordinateSystemState[direction].parameters.utmParameters )
2066 delete coordinateSystemState[direction].parameters.utmParameters;
2067 coordinateSystemState[direction].parameters.utmParameters = 0;
2069 if( coordinateSystemState[direction].coordinateSystem )
2071 delete ((
UTM*)(coordinateSystemState[direction].coordinateSystem));
2072 coordinateSystemState[direction].coordinateSystem = 0;
2076 if( coordinateSystemState[direction].parameters.coordinateSystemParameters )
2078 delete coordinateSystemState[direction].parameters.coordinateSystemParameters;
2079 coordinateSystemState[direction].parameters.coordinateSystemParameters = 0;
2081 if( coordinateSystemState[direction].coordinateSystem )
2083 delete ((
WebMercator*)(coordinateSystemState[direction].coordinateSystem));
2084 coordinateSystemState[direction].coordinateSystem = 0;
2093 void CoordinateConversionService::copyParameters(
2096 Parameters parameters )
2108 initCoordinateSystemState( direction );
2110 switch( coordinateType )
2114 setCoordinateSystem( direction, parameters.mapProjection6Parameters );
2124 setCoordinateSystem( direction, parameters.mapProjection4Parameters );
2132 setCoordinateSystem( direction, parameters.mapProjection3Parameters );
2135 setCoordinateSystem( direction, parameters.equidistantCylindricalParameters );
2138 setCoordinateSystem( direction, parameters.geodeticParameters );
2143 setCoordinateSystem( direction, parameters.mapProjection5Parameters );
2146 setCoordinateSystem( direction, parameters.localCartesianParameters );
2149 setCoordinateSystem( direction, parameters.mercatorStandardParallelParameters );
2152 setCoordinateSystem( direction, parameters.mercatorScaleFactorParameters );
2155 setCoordinateSystem( direction, parameters.neysParameters );
2158 setCoordinateSystem( direction, parameters.obliqueMercatorParameters );
2161 setCoordinateSystem( direction, parameters.polarStereographicStandardParallelParameters );
2164 setCoordinateSystem( direction, parameters.polarStereographicScaleFactorParameters );
2167 setCoordinateSystem( direction, parameters.utmParameters );
2178 setCoordinateSystem( direction, parameters.coordinateSystemParameters );
2186 void CoordinateConversionService::convert(
2210 bool special =
false;
2212 Coordinate_State_Row* source = &coordinateSystemState[sourceDirection];
2213 Coordinate_State_Row* target = &coordinateSystemState[targetDirection];
2215 char sourceWarningMessage[256] =
"";
2216 char targetWarningMessage[256] =
"";
2232 if (source->datumIndex == target->datumIndex)
2244 target->coordinateSystem))->convertFromGeocentric(
2248 delete cartesianCoordinates;
2259 ((
LocalCartesian*)(source->coordinateSystem))->convertToGeocentric(
2263 delete cartesianCoordinates;
2267 (target->parameters.utmParameters->override() == 0))
2275 ((
MGRS*)(source->coordinateSystem))->convertToUTM( coordinates );
2278 delete utmCoordinates;
2288 UPSCoordinates* upsCoordinates = ((
MGRS*)(source->coordinateSystem))->convertToUPS( coordinates );
2290 delete upsCoordinates;
2298 if (temp_precision < 0)
2300 if (temp_precision > 5)
2305 MGRSorUSNGCoordinates* mgrsOrUSNGCoordinates = ((
MGRS*)(target->coordinateSystem))->convertFromUTM( coordinates, temp_precision );
2307 delete mgrsOrUSNGCoordinates;
2314 if (temp_precision < 0)
2316 if (temp_precision > 5)
2321 MGRSorUSNGCoordinates* mgrsOrUSNGCoordinates = ((
MGRS*)(target->coordinateSystem))->convertFromUPS( coordinates, temp_precision );
2323 delete mgrsOrUSNGCoordinates;
2332 UTMCoordinates* utmCoordinates = ((
USNG*)(source->coordinateSystem))->convertToUTM( coordinates );
2334 delete utmCoordinates;
2342 UPSCoordinates* upsCoordinates = ((
USNG*)(source->coordinateSystem))->convertToUPS( coordinates );
2344 delete upsCoordinates;
2351 if (temp_precision < 0)
2353 if (temp_precision > 5)
2358 MGRSorUSNGCoordinates* mgrsOrUSNGCoordinates = ((
USNG*)(target->coordinateSystem))->convertFromUTM( coordinates, temp_precision );
2360 delete mgrsOrUSNGCoordinates;
2370 if (temp_precision < 0)
2372 if (temp_precision > 5)
2376 sourceCoordinates );
2379 ((
USNG*)(target->coordinateSystem))->convertFromUPS(
2380 coordinates, temp_precision );
2383 delete mgrsOrUSNGCoordinates;
2389 source->parameters.mapProjection5Parameters;
2400 if (temp_precision < 0)
2402 if (temp_precision > 5)
2409 convertFromTransverseMercator( coordinates, temp_precision );
2412 delete bngCoordinates;
2421 target->parameters.mapProjection5Parameters;
2436 source->coordinateSystem))->convertToTransverseMercator(
2440 mapProjectionCoordinates );
2441 delete mapProjectionCoordinates;
2451 Coordinate_System_Table[source->coordinateType].Name,
2461 _convertedGeodetic = convertSourceToGeodetic(
2462 sourceDirection, sourceCoordinates, sourceWarningMessage );
2472 input_height_type = source->parameters.geodeticParameters->heightType();
2479 output_height_type = target->parameters.geodeticParameters->heightType();
2485 if ((source->datumIndex == target->datumIndex) &&
2486 ((input_height_type == output_height_type) ||
2499 if(source->datumIndex != WGS84_datum_index &&
2500 target->datumIndex != WGS84_datum_index)
2506 source->datumIndex, _wgs84Geodetic->
longitude(),
2507 _wgs84Geodetic->
latitude(), &valid );
2515 target->datumIndex, _wgs84Geodetic->
longitude(),
2516 _wgs84Geodetic->
latitude(), &valid );
2525 if (source->datumIndex != WGS84_datum_index)
2528 source->datumIndex, _convertedGeodetic );
2530 switch(input_height_type)
2549 long sourceValid = 0;
2552 source->datumIndex, _wgs84Geodetic->
longitude(),
2553 _wgs84Geodetic->
latitude(), &sourceValid );
2566 if(input_height_type != output_height_type)
2571 switch(input_height_type)
2576 _wgs84Geodetic->
height(), &tempHeight);
2581 _wgs84Geodetic->
height(), &tempHeight);
2586 _wgs84Geodetic->
height(), &tempHeight );
2591 _wgs84Geodetic->
height(), &tempHeight );
2596 _wgs84Geodetic->
height(), &tempHeight );
2601 _wgs84Geodetic->
height(), &tempHeight );
2605 tempHeight = _wgs84Geodetic->
height();
2609 double correctedHeight;
2612 switch(output_height_type)
2617 tempHeight, &correctedHeight );
2622 tempHeight, &correctedHeight );
2627 tempHeight, &correctedHeight );
2632 tempHeight, &correctedHeight );
2637 tempHeight, &correctedHeight );
2642 tempHeight, &correctedHeight );
2646 correctedHeight = tempHeight;
2651 _wgs84Geodetic->
setHeight( correctedHeight );
2654 if (target->datumIndex != WGS84_datum_index)
2658 _wgs84Geodetic, target->datumIndex );
2660 switch(output_height_type)
2679 long targetValid = 0;
2682 target->datumIndex, _wgs84Geodetic->
longitude(),
2683 _wgs84Geodetic->
latitude(), &targetValid );
2698 if( strlen( sourceWarningMessage ) > 0 ||
2699 strlen( targetWarningMessage ) > 0 )
2700 targetAccuracy.
set(-1.0, -1.0, -1.0);
2713 source->datumIndex, target->datumIndex,
2715 _wgs84Geodetic->
latitude(), sourceAccuracy, prec );
2722 delete _targetAccuracy;
2729 convertGeodeticToTarget(
2730 targetDirection, _shiftedGeodetic,
2731 targetCoordinates, targetWarningMessage );
2734 char warningMessage[500] =
"";
2735 bool warning =
false;
2736 if( strlen( sourceWarningMessage ) > 0 )
2738 strcpy( warningMessage,
"Input " );
2739 strcat( warningMessage,
2740 Coordinate_System_Table[source->coordinateType].Name );
2741 strcat( warningMessage,
": \n" );
2742 strcat( warningMessage, sourceWarningMessage );
2746 if( strlen( targetWarningMessage ) > 0 )
2748 if( strlen( warningMessage ) > 0 )
2749 strcat( warningMessage,
"\nOutput " );
2751 strcpy( warningMessage,
"Output " );
2753 strcat( warningMessage,
2754 Coordinate_System_Table[target->coordinateType].Name );
2755 strcat( warningMessage,
": \n" );
2756 strcat( warningMessage, targetWarningMessage );
2762 warningMessage[strlen( warningMessage )] =
'\0';
2769 targetAccuracy.
set(-1.0, -1.0, -1.0);
2773 delete _convertedGeodetic;
2774 delete _shiftedGeodetic;
2775 delete _wgs84Geodetic;
2781 delete _convertedGeodetic;
2782 delete _shiftedGeodetic;
2783 delete _wgs84Geodetic;
2791 char* sourceWarningMessage )
2793 Coordinate_State_Row* source = &coordinateSystemState[sourceDirection];
2800 switch (source->coordinateType)
2807 return ((
Geocentric*)(source->coordinateSystem))->convertToGeodetic(
2814 *dynamic_cast< GeodeticCoordinates* >( sourceCoordinates ) );
2819 return _convertedGeodetic;
2824 sourceCoordinates );
2826 return ((
GEOREF*)(source->coordinateSystem))->convertToGeodetic(
2835 source->coordinateSystem))->convertToGeodetic( coordinates );
2843 source->coordinateSystem))->convertToGeodetic( coordinates );
2849 return ((
BritishNationalGrid*)(source->coordinateSystem))->convertToGeodetic( coordinates );
2856 return ((
Bonne*)(source->coordinateSystem))->convertToGeodetic( coordinates );
2864 ((
Cassini*)(source->coordinateSystem))->convertToGeodetic(
2868 strcat( sourceWarningMessage, _convertedGeodetic->
warningMessage() );
2870 return _convertedGeodetic;
2878 source->coordinateSystem))->convertToGeodetic( coordinates);
2885 return ((
Eckert4*)(source->coordinateSystem))->convertToGeodetic(
2893 return ((
Eckert6*)(source->coordinateSystem))->convertToGeodetic(
2902 source->coordinateSystem))->convertToGeodetic( coordinates );
2908 return ((
GARS*)(source->coordinateSystem))->convertToGeodetic( coordinates );
2914 return ((
Gnomonic*)(source->coordinateSystem))->convertToGeodetic( coordinates );
2932 return ((
LocalCartesian*)(source->coordinateSystem))->convertToGeodetic( coordinates);
2940 return ((
Mercator*)(source->coordinateSystem))->convertToGeodetic( coordinates );
2946 GeodeticCoordinates* _convertedGeodetic = ((
MGRS*)(source->coordinateSystem))->convertToGeodetic( coordinates );
2949 strcat( sourceWarningMessage, _convertedGeodetic->
warningMessage() );
2951 return _convertedGeodetic;
2957 return ((
MillerCylindrical*)(source->coordinateSystem))->convertToGeodetic( coordinates );
2963 return ((
Mollweide*)(source->coordinateSystem))->convertToGeodetic( coordinates );
2969 return ((
Neys*)(source->coordinateSystem))->convertToGeodetic( coordinates );
2975 return ((
NZMG*)(source->coordinateSystem))->convertToGeodetic( coordinates );
2984 strcat( sourceWarningMessage, _convertedGeodetic->
warningMessage() );
2986 return _convertedGeodetic;
2992 return ((
Orthographic*)(source->coordinateSystem))->convertToGeodetic( coordinates );
2999 return ((
PolarStereographic*)(source->coordinateSystem))->convertToGeodetic( coordinates );
3005 return ((
Polyconic*)(source->coordinateSystem))->convertToGeodetic( coordinates );
3011 return ((
Sinusoidal*)(source->coordinateSystem))->convertToGeodetic( coordinates );
3017 return ((
Stereographic*)(source->coordinateSystem))->convertToGeodetic( coordinates );
3032 strcat( sourceWarningMessage, _convertedGeodetic->
warningMessage() );
3034 return _convertedGeodetic;
3040 return ((
UPS*)(source->coordinateSystem))->convertToGeodetic( coordinates );
3046 GeodeticCoordinates* _convertedGeodetic = ((
USNG*)(source->coordinateSystem))->convertToGeodetic( coordinates );
3049 strcat( sourceWarningMessage, _convertedGeodetic->
warningMessage() );
3051 return _convertedGeodetic;
3057 return ((
UTM*)(source->coordinateSystem))->convertToGeodetic( coordinates );
3063 return ((
VanDerGrinten*)(source->coordinateSystem))->convertToGeodetic( coordinates );
3069 return ((
WebMercator*)(source->coordinateSystem))->convertToGeodetic( coordinates );
3076 "Input ", Coordinate_System_Table[source->coordinateType].Name,
3082 void CoordinateConversionService::convertGeodeticToTarget(
3086 char* targetWarningMessage )
3088 Coordinate_State_Row* target = &coordinateSystemState[targetDirection];
3095 switch (target->coordinateType)
3100 ((
Geocentric*)(target->coordinateSystem))->convertFromGeodetic(
3104 coordinates->
x(), coordinates->
y(), coordinates->
z() );
3113 ( dynamic_cast< GeodeticCoordinates& >( targetCoordinates ) ).
set(
3116 ( dynamic_cast< GeodeticCoordinates& >( targetCoordinates ) ).
set(
3118 _shiftedGeodetic->
height() );
3126 targetCoordinates ) ).precision();
3127 if (temp_precision < 0)
3129 if (temp_precision > 5)
3133 ((
GEOREF*)(target->coordinateSystem))->convertFromGeodetic(
3134 _shiftedGeodetic, temp_precision );
3147 target->coordinateSystem))->convertFromGeodetic(
3161 target->coordinateSystem))->convertFromGeodetic(
3174 (
dynamic_cast< BNGCoordinates&
>(targetCoordinates ) ).precision();
3175 if (temp_precision < 0)
3177 if (temp_precision > 5)
3182 target->coordinateSystem))->convertFromGeodetic(
3183 _shiftedGeodetic, temp_precision );
3195 ((
Bonne*)(target->coordinateSystem))->convertFromGeodetic(
3208 ((
Cassini*)(target->coordinateSystem))->convertFromGeodetic(
3217 strcat( targetWarningMessage, targetCoordinates.
warningMessage() );
3228 target->coordinateSystem))->convertFromGeodetic(
3241 ((
Eckert4*)(target->coordinateSystem))->convertFromGeodetic(
3254 ((
Eckert6*)(target->coordinateSystem))->convertFromGeodetic(
3268 target->coordinateSystem))->convertFromGeodetic(
3282 if (temp_precision < 0)
3284 if (temp_precision > 5)
3288 ((
GARS*)(target->coordinateSystem))->convertFromGeodetic(
3289 _shiftedGeodetic, temp_precision );
3301 ((
Gnomonic*)(target->coordinateSystem))->convertFromGeodetic(
3315 target->coordinateSystem))->convertFromGeodetic(
3329 target->coordinateSystem))->convertFromGeodetic(
3342 ((
LocalCartesian*)(target->coordinateSystem))->convertFromGeodetic(
3346 coordinates->
x(), coordinates->
y(), coordinates->
z() );
3356 ((
Mercator*)(target->coordinateSystem))->convertFromGeodetic(
3370 targetCoordinates ) ).precision();
3372 if (temp_precision < 0)
3374 if (temp_precision > 5)
3377 ((
MGRS*)(target->coordinateSystem))->convertFromGeodetic(
3378 _shiftedGeodetic, temp_precision );
3391 target->coordinateSystem))->convertFromGeodetic(
3404 ((
Mollweide*)(target->coordinateSystem))->convertFromGeodetic(
3417 ((
Neys*)(target->coordinateSystem))->convertFromGeodetic(
3430 ((
NZMG*)(target->coordinateSystem))->convertFromGeodetic(
3452 strcat( targetWarningMessage, targetCoordinates.
warningMessage() );
3462 ((
Orthographic*)(target->coordinateSystem))->convertFromGeodetic(
3477 target->coordinateSystem))->convertFromGeodetic(
3490 ((
Polyconic*)(target->coordinateSystem))->convertFromGeodetic(
3499 strcat( targetWarningMessage, targetCoordinates.
warningMessage() );
3509 ((
Sinusoidal*)(target->coordinateSystem))->convertFromGeodetic(
3522 ((
Stereographic*)(target->coordinateSystem))->convertFromGeodetic(
3536 target->coordinateSystem))->convertFromGeodetic(
3545 strcat( targetWarningMessage, targetCoordinates.
warningMessage() );
3556 target->coordinateSystem))->convertFromGeodetic(
3565 strcat( targetWarningMessage, targetCoordinates.
warningMessage() );
3575 ((
UPS*)(target->coordinateSystem))->convertFromGeodetic(
3591 targetCoordinates ) ).precision();
3592 if (temp_precision < 0)
3594 if (temp_precision > 5)
3598 ((
USNG*)(target->coordinateSystem))->convertFromGeodetic(
3599 _shiftedGeodetic, temp_precision );
3611 ((
UTM*)(target->coordinateSystem))->convertFromGeodetic(
3625 ((
VanDerGrinten*)(target->coordinateSystem))->convertFromGeodetic(
3638 ((
WebMercator*)(target->coordinateSystem))->convertFromGeodetic(
3653 "Output ", Coordinate_System_Table[target->coordinateType].Name,
3659 void CoordinateConversionService::convertCollection(
3660 const std::vector<MSP::CCS::CoordinateTuple*>& sourceCoordinatesCollection,
3661 const std::vector<MSP::CCS::Accuracy*>& sourceAccuracyCollection,
3662 std::vector<MSP::CCS::CoordinateTuple*>& targetCoordinatesCollection,
3663 std::vector<MSP::CCS::Accuracy*>& targetAccuracyCollection )
3675 int num = sourceCoordinatesCollection.size();
3676 int numTargetCoordinates = targetCoordinatesCollection.size();
3677 int numTargetAccuracies = targetAccuracyCollection.size();
3684 for(
int i = 0; i < num; i++ )
3687 Accuracy* _sourceAccuracy = sourceAccuracyCollection[i];
3689 bool targetCoordinateExists =
true;
3690 bool targetAccuracyExists =
true;
3692 if(i < numTargetAccuracies)
3693 _targetAccuracy = targetAccuracyCollection[i];
3697 targetAccuracyExists =
false;
3700 if( _sourceCoordinates && _sourceAccuracy )
3702 switch(targetCoordinateType)
3706 if(i < numTargetCoordinates)
3707 _targetCoordinates = targetCoordinatesCollection[i];
3712 targetCoordinateExists =
false;
3719 sourceCoordinatesCollection[i],
3720 sourceAccuracyCollection[i],
3721 *_targetCoordinates, *_targetAccuracy);
3728 if(!targetCoordinateExists)
3729 targetCoordinatesCollection.push_back(_targetCoordinates);
3734 if(i < numTargetCoordinates)
3735 _targetCoordinates = targetCoordinatesCollection[i];
3740 targetCoordinateExists =
false;
3747 sourceCoordinatesCollection[i],
3748 sourceAccuracyCollection[i],
3749 *_targetCoordinates, *_targetAccuracy);
3756 if(!targetCoordinateExists)
3757 targetCoordinatesCollection.push_back(_targetCoordinates);
3762 if(i < numTargetCoordinates)
3763 _targetCoordinates = targetCoordinatesCollection[i];
3768 targetCoordinateExists =
false;
3775 sourceCoordinatesCollection[i],
3776 sourceAccuracyCollection[i],
3777 *_targetCoordinates, *_targetAccuracy);
3784 if(!targetCoordinateExists)
3785 targetCoordinatesCollection.push_back(_targetCoordinates);
3790 if(i < numTargetCoordinates)
3791 _targetCoordinates = targetCoordinatesCollection[i];
3796 targetCoordinateExists =
false;
3803 sourceCoordinatesCollection[i],
3804 sourceAccuracyCollection[i],
3805 *_targetCoordinates, *_targetAccuracy);
3812 if(!targetCoordinateExists)
3813 targetCoordinatesCollection.push_back(_targetCoordinates);
3818 if(i < numTargetCoordinates)
3819 _targetCoordinates = targetCoordinatesCollection[i];
3824 targetCoordinateExists =
false;
3831 sourceCoordinatesCollection[i],
3832 sourceAccuracyCollection[i],
3833 *_targetCoordinates, *_targetAccuracy);
3840 if(!targetCoordinateExists)
3841 targetCoordinatesCollection.push_back(_targetCoordinates);
3846 if(i < numTargetCoordinates)
3847 _targetCoordinates = targetCoordinatesCollection[i];
3852 targetCoordinateExists =
false;
3859 sourceCoordinatesCollection[i],
3860 sourceAccuracyCollection[i],
3861 *_targetCoordinates, *_targetAccuracy);
3868 if(!targetCoordinateExists)
3869 targetCoordinatesCollection.push_back(_targetCoordinates);
3874 if(i < numTargetCoordinates)
3875 _targetCoordinates = targetCoordinatesCollection[i];
3880 targetCoordinateExists =
false;
3887 sourceCoordinatesCollection[i],
3888 sourceAccuracyCollection[i],
3889 *_targetCoordinates, *_targetAccuracy);
3896 if(!targetCoordinateExists)
3897 targetCoordinatesCollection.push_back(_targetCoordinates);
3902 if(i < numTargetCoordinates)
3903 _targetCoordinates = targetCoordinatesCollection[i];
3908 targetCoordinateExists =
false;
3915 sourceCoordinatesCollection[i],
3916 sourceAccuracyCollection[i],
3917 *_targetCoordinates, *_targetAccuracy);
3924 if(!targetCoordinateExists)
3925 targetCoordinatesCollection.push_back(_targetCoordinates);
3930 if(i < numTargetCoordinates)
3931 _targetCoordinates = targetCoordinatesCollection[i];
3936 targetCoordinateExists =
false;
3943 sourceCoordinatesCollection[i],
3944 sourceAccuracyCollection[i],
3945 *_targetCoordinates, *_targetAccuracy);
3952 if(!targetCoordinateExists)
3953 targetCoordinatesCollection.push_back(_targetCoordinates);
3958 if(i < numTargetCoordinates)
3959 _targetCoordinates = targetCoordinatesCollection[i];
3964 targetCoordinateExists =
false;
3970 sourceCoordinatesCollection[i], sourceAccuracyCollection[i],
3971 *_targetCoordinates, *_targetAccuracy);
3978 if(!targetCoordinateExists)
3979 targetCoordinatesCollection.push_back(_targetCoordinates);
3984 if(i < numTargetCoordinates)
3985 _targetCoordinates = targetCoordinatesCollection[i];
3990 targetCoordinateExists =
false;
3996 sourceCoordinatesCollection[i], sourceAccuracyCollection[i],
3997 *_targetCoordinates, *_targetAccuracy);
4004 if(!targetCoordinateExists)
4005 targetCoordinatesCollection.push_back(_targetCoordinates);
4010 if(i < numTargetCoordinates)
4011 _targetCoordinates = targetCoordinatesCollection[i];
4015 targetCoordinateExists =
false;
4022 sourceCoordinatesCollection[i],
4023 sourceAccuracyCollection[i],
4024 *_targetCoordinates, *_targetAccuracy);
4031 if(!targetCoordinateExists)
4032 targetCoordinatesCollection.push_back(_targetCoordinates);
4037 if(i < numTargetCoordinates)
4038 _targetCoordinates = targetCoordinatesCollection[i];
4043 targetCoordinateExists =
false;
4050 sourceCoordinatesCollection[i],
4051 sourceAccuracyCollection[i],
4052 *_targetCoordinates, *_targetAccuracy);
4059 if(!targetCoordinateExists)
4060 targetCoordinatesCollection.push_back(_targetCoordinates);
4065 if(i < numTargetCoordinates)
4066 _targetCoordinates = targetCoordinatesCollection[i];
4071 targetCoordinateExists =
false;
4078 sourceCoordinatesCollection[i],
4079 sourceAccuracyCollection[i],
4080 *_targetCoordinates, *_targetAccuracy);
4087 if(!targetCoordinateExists)
4088 targetCoordinatesCollection.push_back(_targetCoordinates);
4093 if(i < numTargetCoordinates)
4094 _targetCoordinates = targetCoordinatesCollection[i];
4099 targetCoordinateExists =
false;
4106 sourceCoordinatesCollection[i],
4107 sourceAccuracyCollection[i],
4108 *_targetCoordinates,
4116 if(!targetCoordinateExists)
4117 targetCoordinatesCollection.push_back(_targetCoordinates);
4122 if(i < numTargetCoordinates)
4123 _targetCoordinates = targetCoordinatesCollection[i];
4128 targetCoordinateExists =
false;
4135 sourceCoordinatesCollection[i],
4136 sourceAccuracyCollection[i],
4137 *_targetCoordinates, *_targetAccuracy);
4144 if(!targetCoordinateExists)
4145 targetCoordinatesCollection.push_back(_targetCoordinates);
4150 if(i < numTargetCoordinates)
4151 _targetCoordinates = targetCoordinatesCollection[i];
4156 targetCoordinateExists =
false;
4163 sourceCoordinatesCollection[i],
4164 sourceAccuracyCollection[i],
4165 *_targetCoordinates, *_targetAccuracy);
4172 if(!targetCoordinateExists)
4173 targetCoordinatesCollection.push_back(_targetCoordinates);
4178 if(i < numTargetCoordinates)
4179 _targetCoordinates = targetCoordinatesCollection[i];
4184 targetCoordinateExists =
false;
4191 sourceCoordinatesCollection[i],
4192 sourceAccuracyCollection[i],
4193 *_targetCoordinates, *_targetAccuracy);
4200 if(!targetCoordinateExists)
4201 targetCoordinatesCollection.push_back(_targetCoordinates);
4206 if(i < numTargetCoordinates)
4207 _targetCoordinates = targetCoordinatesCollection[i];
4212 targetCoordinateExists =
false;
4219 sourceCoordinatesCollection[i],
4220 sourceAccuracyCollection[i],
4221 *_targetCoordinates, *_targetAccuracy);
4228 if(!targetCoordinateExists)
4229 targetCoordinatesCollection.push_back(_targetCoordinates);
4234 if(i < numTargetCoordinates)
4235 _targetCoordinates = targetCoordinatesCollection[i];
4240 targetCoordinateExists =
false;
4247 sourceCoordinatesCollection[i],
4248 sourceAccuracyCollection[i],
4249 *_targetCoordinates, *_targetAccuracy);
4256 if(!targetCoordinateExists)
4257 targetCoordinatesCollection.push_back(_targetCoordinates);
4262 if(i < numTargetCoordinates)
4263 _targetCoordinates = targetCoordinatesCollection[i];
4268 targetCoordinateExists =
false;
4275 sourceCoordinatesCollection[i],
4276 sourceAccuracyCollection[i],
4277 *_targetCoordinates, *_targetAccuracy);
4284 if(!targetCoordinateExists)
4285 targetCoordinatesCollection.push_back(_targetCoordinates);
4290 if(i < numTargetCoordinates)
4291 _targetCoordinates = targetCoordinatesCollection[i];
4296 targetCoordinateExists =
false;
4303 sourceCoordinatesCollection[i],
4304 sourceAccuracyCollection[i],
4305 *_targetCoordinates, *_targetAccuracy);
4312 if(!targetCoordinateExists)
4313 targetCoordinatesCollection.push_back(_targetCoordinates);
4318 if(i < numTargetCoordinates)
4319 _targetCoordinates = targetCoordinatesCollection[i];
4324 targetCoordinateExists =
false;
4331 sourceCoordinatesCollection[i],
4332 sourceAccuracyCollection[i],
4333 *_targetCoordinates, *_targetAccuracy);
4340 if(!targetCoordinateExists)
4341 targetCoordinatesCollection.push_back(_targetCoordinates);
4346 if(i < numTargetCoordinates)
4347 _targetCoordinates = targetCoordinatesCollection[i];
4352 targetCoordinateExists =
false;
4359 sourceCoordinatesCollection[i],
4360 sourceAccuracyCollection[i],
4361 *_targetCoordinates, *_targetAccuracy);
4368 if(!targetCoordinateExists)
4369 targetCoordinatesCollection.push_back(_targetCoordinates);
4374 if(i < numTargetCoordinates)
4375 _targetCoordinates = targetCoordinatesCollection[i];
4380 targetCoordinateExists =
false;
4387 sourceCoordinatesCollection[i],
4388 sourceAccuracyCollection[i],
4389 *_targetCoordinates, *_targetAccuracy);
4396 if(!targetCoordinateExists)
4397 targetCoordinatesCollection.push_back(_targetCoordinates);
4402 if(i < numTargetCoordinates)
4403 _targetCoordinates = targetCoordinatesCollection[i];
4408 targetCoordinateExists =
false;
4415 sourceCoordinatesCollection[i],
4416 sourceAccuracyCollection[i],
4417 *_targetCoordinates, *_targetAccuracy);
4424 if(!targetCoordinateExists)
4425 targetCoordinatesCollection.push_back(_targetCoordinates);
4430 if(i < numTargetCoordinates)
4431 _targetCoordinates = targetCoordinatesCollection[i];
4436 targetCoordinateExists =
false;
4443 sourceCoordinatesCollection[i],
4444 sourceAccuracyCollection[i],
4445 *_targetCoordinates, *_targetAccuracy);
4452 if(!targetCoordinateExists)
4453 targetCoordinatesCollection.push_back(_targetCoordinates);
4458 if(i < numTargetCoordinates)
4459 _targetCoordinates = targetCoordinatesCollection[i];
4464 targetCoordinateExists =
false;
4471 sourceCoordinatesCollection[i],
4472 sourceAccuracyCollection[i],
4473 *_targetCoordinates, *_targetAccuracy);
4480 if(!targetCoordinateExists)
4481 targetCoordinatesCollection.push_back(_targetCoordinates);
4486 if(i < numTargetCoordinates)
4487 _targetCoordinates = targetCoordinatesCollection[i];
4492 targetCoordinateExists =
false;
4499 sourceCoordinatesCollection[i],
4500 sourceAccuracyCollection[i],
4501 *_targetCoordinates, *_targetAccuracy);
4508 if(!targetCoordinateExists)
4509 targetCoordinatesCollection.push_back(_targetCoordinates);
4514 if(i < numTargetCoordinates)
4515 _targetCoordinates = targetCoordinatesCollection[i];
4520 targetCoordinateExists =
false;
4527 sourceCoordinatesCollection[i],
4528 sourceAccuracyCollection[i],
4529 *_targetCoordinates, *_targetAccuracy);
4536 if(!targetCoordinateExists)
4537 targetCoordinatesCollection.push_back(_targetCoordinates);
4542 if(i < numTargetCoordinates)
4543 _targetCoordinates = targetCoordinatesCollection[i];
4548 targetCoordinateExists =
false;
4555 sourceCoordinatesCollection[i],
4556 sourceAccuracyCollection[i],
4557 *_targetCoordinates, *_targetAccuracy);
4564 if(!targetCoordinateExists)
4565 targetCoordinatesCollection.push_back(_targetCoordinates);
4570 if(i < numTargetCoordinates)
4571 _targetCoordinates = targetCoordinatesCollection[i];
4576 targetCoordinateExists =
false;
4583 sourceCoordinatesCollection[i],
4584 sourceAccuracyCollection[i],
4585 *_targetCoordinates, *_targetAccuracy);
4592 if(!targetCoordinateExists)
4593 targetCoordinatesCollection.push_back(_targetCoordinates);
4598 if(i < numTargetCoordinates)
4599 _targetCoordinates = targetCoordinatesCollection[i];
4604 targetCoordinateExists =
false;
4611 sourceCoordinatesCollection[i],
4612 sourceAccuracyCollection[i],
4613 *_targetCoordinates, *_targetAccuracy);
4620 if(!targetCoordinateExists)
4621 targetCoordinatesCollection.push_back(_targetCoordinates);
4626 if(i < numTargetCoordinates)
4627 _targetCoordinates = targetCoordinatesCollection[i];
4632 targetCoordinateExists =
false;
4641 *_targetCoordinates, *_targetAccuracy);
4648 if(!targetCoordinateExists)
4649 targetCoordinatesCollection.push_back(_targetCoordinates);
4654 if(i < numTargetCoordinates)
4655 _targetCoordinates = targetCoordinatesCollection[i];
4660 targetCoordinateExists =
false;
4667 sourceCoordinatesCollection[i],
4668 sourceAccuracyCollection[i],
4669 *_targetCoordinates, *_targetAccuracy);
4676 if(!targetCoordinateExists)
4677 targetCoordinatesCollection.push_back(_targetCoordinates);
4682 if(i < numTargetCoordinates)
4683 _targetCoordinates = targetCoordinatesCollection[i];
4688 targetCoordinateExists =
false;
4695 sourceCoordinatesCollection[i],
4696 sourceAccuracyCollection[i],
4697 *_targetCoordinates, *_targetAccuracy);
4704 if(!targetCoordinateExists)
4705 targetCoordinatesCollection.push_back(_targetCoordinates);
4710 if(i < numTargetCoordinates)
4711 _targetCoordinates = targetCoordinatesCollection[i];
4716 targetCoordinateExists =
false;
4723 sourceCoordinatesCollection[i],
4724 sourceAccuracyCollection[i],
4725 *_targetCoordinates, *_targetAccuracy);
4732 if(!targetCoordinateExists)
4733 targetCoordinatesCollection.push_back(_targetCoordinates);
4738 if(i < numTargetCoordinates)
4739 _targetCoordinates = targetCoordinatesCollection[i];
4742 _targetCoordinates =
4744 targetCoordinateExists =
false;
4751 sourceCoordinatesCollection[i],
4752 sourceAccuracyCollection[i],
4753 *_targetCoordinates, *_targetAccuracy);
4760 if(!targetCoordinateExists)
4761 targetCoordinatesCollection.push_back(_targetCoordinates);
4768 if(!targetAccuracyExists)
4769 targetAccuracyCollection.push_back( _targetAccuracy );
4773 if(i >= numTargetCoordinates)
4774 targetCoordinateExists =
false;
4776 if( _sourceCoordinates )
4778 if(!targetCoordinateExists)
4779 targetCoordinatesCollection.push_back(
4783 _targetCoordinates = targetCoordinatesCollection[i];
4784 _targetCoordinates->
set(
4792 if(!targetCoordinateExists)
4796 if(!targetAccuracyExists)
4798 if( _sourceAccuracy )
4799 targetAccuracyCollection.push_back( _sourceAccuracy );
4803 targetAccuracyCollection.push_back( __sourceAccuracy );
4809 if(numTargetCoordinates > num)
4811 for(
int i = num; i < numTargetCoordinates; i++)
4813 delete targetCoordinatesCollection[i];
4814 targetCoordinatesCollection.pop_back();
4817 if(numTargetAccuracies > num)
4819 for(
int i = num; i < numTargetAccuracies; i++)
4821 targetAccuracyCollection.pop_back();