int CStest8 (int verbose,int crypt) { extern char cs_MeKynm [128]; extern char cs_MeFunc [128]; extern double cs_Coords [3]; extern struct cs_Grptbl_ cs_CsGrptbl []; extern int cs_Error; int err_cnt; struct cs_Grptbl_ *tp; struct cs_Csgrplst_ *gp; struct cs_Csgrplst_ *grp_list; struct cs_Csprm_ *csprm; double xy [3]; double ll [3]; printf ("Exercising each coordinate system definition at least once.\n"); /* Loop through the group table and fetch a linked list for each group. Count the number in the group and add to the total in the group. */ err_cnt = 0; for (tp = cs_CsGrptbl;tp->group [0] != 0;tp += 1) { if (!CS_stricmp (tp->group,"LEGACY")) { continue; } CS_csgrp (tp->group,&grp_list); for (gp = grp_list;gp != NULL;gp = gp->next) { /* Activate this coordinate system. This ensures that every coordinate system is "set up" at least once in all of this. */ if (verbose) { printf ("Exercising coordinate system named %s.\n", gp->key_nm); } csprm = CS_csloc (gp->key_nm); if (csprm == NULL) { printf ("Couldn't setup coordinate system named %s.\n",gp->key_nm); err_cnt += 1; } else { /* Set information in case there is a floating point exception. */ CS_stncp (cs_MeKynm,gp->key_nm,sizeof (cs_MeKynm)); cs_Coords [0] = csprm->csdef.x_off; cs_Coords [1] = csprm->csdef.y_off; cs_Coords [2] = 0.0; /* Convert a coordinate, the false origin should be a safe one. */ xy [0] = csprm->csdef.x_off; xy [1] = csprm->csdef.y_off; xy [2] = 0.0; cs_Error = 0; CS_stncp (cs_MeFunc,"CS_cs2ll",sizeof (cs_MeFunc)); CS_cs2ll (csprm,ll,xy); CS_stncp (cs_MeFunc,"CS_ll2cs",sizeof (cs_MeFunc)); CS_ll2cs (csprm,xy,ll); CS_stncp (cs_MeFunc,"CS_csscl",sizeof (cs_MeFunc)); CS_csscl (csprm,ll); CS_stncp (cs_MeFunc,"CS_cscnv",sizeof (cs_MeFunc)); CS_cscnv (csprm,ll); if (cs_Error != 0) { printf ("Exercise of coordinate system %s failed.\n", csprm->csdef.key_nm); err_cnt += 1; } CS_free (csprm); } } CS_csgrpf (grp_list); } cs_MeKynm [0] = '\0'; cs_MeFunc [0] = '\0'; cs_Coords [0] = 0.0; cs_Coords [1] = 0.0; cs_Coords [2] = 0.0; return (err_cnt); }
int CStestC (bool verbose,long32_t duration) { int err_cnt; unsigned sequencer; struct cs_Grptbl_ *tp; struct cs_Csgrplst_ *gp; struct cs_Csgrplst_ *grp_list; struct cs_Csprm_ *csprm; double ll [3]; double xy [3]; double falseOrg [2]; double llAry [1][3]; double xyAry [1][3]; duration *= 10L; printf ("Trying very hard to produce a floating point exception.\n"); /* Loop through the group table and fetch a linked list for each group. Count the number in the group and add to the total in the group. */ err_cnt = 0; csprm = NULL; for (tp = cs_CsGrptbl;tp->group [0] != 0;tp += 1) { if (csprm != NULL) { CS_free (csprm); csprm = NULL; } if (!CS_stricmp (tp->group,"LEGACY")) { continue; } CS_csgrp (tp->group,&grp_list); for (gp = grp_list;gp != NULL;gp = gp->next) { if (csprm != NULL) { CS_free (csprm); csprm = NULL; } if (verbose) { printf ("Trying to cause a floating exception using %s.\n", gp->key_nm); } else { printf ("%s \r",gp->key_nm); } csprm = CS_csloc (gp->key_nm); if (csprm == NULL) { printf ("Couldn't setup coordinate system named %s.\n",gp->key_nm); err_cnt += 1; strcpy (cs_MeKynm,"???"); continue; } cs_MeFlag = 0; strcpy (cs_MeKynm,csprm->csdef.key_nm); sequencer = 0; while (CStestLLH (ll,csprm->cent_mer,&sequencer) == 0) { cs_Coords [LNG] = ll [0]; cs_Coords [LAT] = ll [1]; cs_Coords [HGT] = ll [2]; strcpy (cs_MeFunc,"CS_cssck"); CS_cssck (csprm,ll); if (cs_MeFlag) break; strcpy (cs_MeFunc,"CS_cssch"); CS_cssch (csprm,ll); if (cs_MeFlag) break; strcpy (cs_MeFunc,"CS_cscnv"); CS_cscnv (csprm,ll); if (cs_MeFlag) break; strcpy (cs_MeFunc,"CS_ll2cs"); CS_ll2cs (csprm,xy,ll); if (cs_MeFlag) break; llAry [0][0] = ll [0]; /* keep gcc compiler happy */ llAry [0][1] = ll [1]; llAry [0][2] = ll [2]; strcpy (cs_MeFunc,"CS_llchk"); CS_llchk (csprm,1,llAry); if (cs_MeFlag) break; } if (cs_MeFlag) { if (verbose) { printf ("\tLNG = %g, LAT = %g, HGT = %g \n",ll [0],ll [1],ll [2]); } err_cnt += 1; continue; } sequencer = 0; falseOrg [0] = csprm->csdef.x_off; falseOrg [1] = csprm->csdef.y_off; while (CStestXYZ (xy,falseOrg,&sequencer) == 0) { cs_Coords [XX] = xy [XX]; cs_Coords [YY] = xy [YY]; cs_Coords [ZZ] = xy [ZZ]; strcpy (cs_MeFunc,"CS_cs2ll"); CS_cs2ll (csprm,ll,xy); if (cs_MeFlag) break; strcpy (cs_MeFunc,"CS_llchk"); xyAry [0][0] = xy [0]; /* keep gcc compiler happy */ xyAry [0][1] = xy [1]; xyAry [0][2] = xy [2]; CS_xychk (csprm,1,xyAry); if (cs_MeFlag) break; } if (cs_MeFlag) { if (verbose) { printf ("\tXX = %g, YY = %g, ZZ = %g \n",xy [XX],xy [YY],xy [ZZ]); } err_cnt += 1; continue; } if (verbose) { printf (" \r"); } CS_free (csprm); csprm = NULL; } CS_csgrpf (grp_list); } printf (" \r"); return (err_cnt); }
int CStestE (bool verbose,long32_t duration) { bool special; int index; int status; int err_cnt; int isPseudo; long32_t il; struct cs_Grptbl_ *tp; struct cs_Csgrplst_ *gp; struct cs_Csgrplst_ *grp_list; struct cs_Csprm_ *csprm; double ll [3]; double xy [3]; double ll1 [3]; double lat_del; double low_lng; double low_lat; double hi_lng; double hi_lat; double ll_tol; double del_lng; double del_lat; duration *= 100L; printf ("Checking reversibility of all projections, smaller region/tolerance.\n"); /* Loop through the group table and fetch a linked list for each group. Count the number in the group and add to the total in the group. */ err_cnt = 0; csprm = NULL; for (tp = cs_CsGrptbl; tp->group [0] != 0; tp += 1) { if (csprm != NULL) { CS_free (csprm); csprm = NULL; } if (!CS_stricmp (tp->group,"LEGACY")) { continue; } CS_csgrp (tp->group,&grp_list); for (gp = grp_list; gp != NULL; gp = gp->next) { if (csprm != NULL) { CS_free (csprm); csprm = NULL; } if (verbose) { printf ("Testing %s for reversibility.\n", gp->key_nm); } else { printf ("%s \r",gp->key_nm); } csprm = CS_csloc (gp->key_nm); if (csprm == NULL) { printf ("Couldn't setup coordinate system named %s.\n",gp->key_nm); err_cnt += 1; continue; } strcpy (cs_MeKynm,csprm->csdef.key_nm); /* Is this one on the "special" list? */ special = false; for (index = 0; KcsTestEspecialList [index][0] != '\0'; index += 1) { if (!CS_stricmp (csprm->csdef.key_nm,KcsTestEspecialList [index])) { special = true; break; } } isPseudo = FALSE; if (csprm->prj_code == cs_PRJCOD_MRCATPV) { isPseudo = TRUE; } /* Get the useful range of the coordinate system and reduce it by about one half. */ if (special) { /* here to reduce by two thirds. */ low_lng = csprm->cent_mer + csprm->min_ll [LNG] + fabs (csprm->min_ll [LNG] * 0.6666); hi_lng = csprm->cent_mer + csprm->max_ll [LNG] - fabs (csprm->min_ll [LNG] * 0.6666); lat_del = csprm->max_ll [LAT] - csprm->min_ll [LAT]; low_lat = csprm->min_ll [LAT] + lat_del * 0.333333; hi_lat = csprm->max_ll [LAT] - lat_del * 0.333333; } else { /* Code that has been used for testE for many years before the "special fix", unedited. */ low_lng = csprm->cent_mer + csprm->min_ll [LNG] + fabs (csprm->min_ll [LNG] * 0.5); hi_lng = csprm->cent_mer + csprm->max_ll [LNG] - fabs (csprm->min_ll [LNG] * 0.5); lat_del = csprm->max_ll [LAT] - csprm->min_ll [LAT]; low_lat = csprm->min_ll [LAT] + lat_del * 0.5; hi_lat = csprm->max_ll [LAT] - lat_del * 0.5; } /* insure that there is a range of some sort. */ if ((hi_lng - low_lng) < cs_One) { low_lng = csprm->cent_mer - cs_Half; hi_lng = csprm->cent_mer + cs_Half; } if ((hi_lat - low_lat) < cs_One) { low_lat = ((csprm->max_ll [LAT] + csprm->min_ll [LAT]) * cs_Half) - cs_Half; hi_lat = low_lat + cs_One; } for (il = 0; il < duration; il += 1) { ll [LNG] = CStestRN (low_lng,hi_lng); ll [LNG] = CS_adj180 (ll [LNG]); ll [LAT] = CStestRN (low_lat,hi_lat); /* The pseudo Mercator cannot convert any point with latitude higher than 84. */ if (isPseudo && fabs (ll [LAT]) > 83.0) { continue; } /* For the two projections which account for 95% of the mapping in the world, we use a very small tolerance which approximates 5 millimeters on the earth. For the less important projections, we use a tolerance which approximates 50 millimeters. That is, for several projections, specifically the whole world type, the mathemagics simply doesn't produce the same level of accuracy as the two biggies do. As the Van der Grinten approaches the central meridian, however, we need to relax the tolerance to account for the mathematical discontinuity encountered there. */ if (csprm->prj_code == cs_PRJCOD_TRMER || csprm->prj_code == cs_PRJCOD_LM2SP) { ll_tol = 4.5E-08; } else if (csprm->prj_code == cs_PRJCOD_CSINI) { /* Cassini doesn't reverse very well. This is well known in the coordinate conversion community. Someone needs to figure out the math involved and improve the projection formulas. */ ll_tol = 2.5E-06; } else { ll_tol = 4.5E-07; } if (csprm->prj_code == cs_PRJCOD_VDGRN) { if (fabs (ll [0] - csprm->cent_mer) < 0.1) ll_tol = 1.0E-05; } /* Due to the polynomials, the Danish stuff does not invert well when you're not within the real domain of the polynomial; i.e. actually in the region being converted. Thus, randomly generated numbers like this do not invert well. The polynomial code uses the inverse to determine if a coordinate pair is within the useful range of the polynomial. The tolerance check is set to 4 centimeters. Adjusting for the latitude of Denmark, we use the following tolerance. */ if (csprm->prj_code == cs_PRJCOD_SYS34 || csprm->prj_code == cs_PRJCOD_SYS34_99 || csprm->prj_code == cs_PRJCOD_SYS34_01) { ll_tol = 7.0E-06; } /* Convert to X and Y, then back again. */ strcpy (cs_MeFunc,"CS_ll2cs"); status = CS_ll2cs (csprm,xy,ll); if (status != cs_CNVRT_NRML) continue; strcpy (cs_MeFunc,"CS_cs2ll"); status = CS_cs2ll (csprm,ll1,xy); if (status != cs_CNVRT_NRML) continue; /* Conversions were OK, see if we ended up with what we started with. */ del_lng = CS_adj180 (ll [0] - ll1 [0]); del_lat = ll [1] - ll1 [1]; if (fabs (del_lng) > ll_tol || fabs (del_lat) > ll_tol) { printf ("%s:: Couldn't reverse %f:%f.\n",csprm->csdef.key_nm,ll[0],ll[1]); printf ("\t\tdel_lng = %g,del_lat = %g.\n",del_lng,del_lat); err_cnt += 1; /* Uncomment the following for easier debugging. */ status = CS_ll2cs (csprm,xy,ll); status = CS_cs2ll (csprm,ll1,xy); } } CS_free (csprm); csprm = NULL; } CS_csgrpf (grp_list); } return (err_cnt); }
struct cs_Csprm_ * EXP_LVL9 CSbcclu (Const char *cs_name) { extern csThread struct csCscach_ *csCscachP; extern csThread int csCscachI; cs_Register struct csCscach_ *ch_ptr; int ii; struct csCscach_ *tmp_ptr; struct csCscach_ *last_chp; struct cs_Csprm_ *cs_ptr; char kyTemp [cs_KEYNM_DEF + 2]; CS_stncp (kyTemp,cs_name,sizeof (kyTemp)); if (CS_nampp (kyTemp) != 0) return ((struct cs_Csprm_ *)0); if (csCscachP == NULL) { /* Here to allocate the cache. */ if (csCscachI <= 1) csCscachI = 2; last_chp = NULL; for (ii = 0;ii < csCscachI;ii++) { ch_ptr = (struct csCscach_ *)CS_malc (sizeof (struct csCscach_)); if (ch_ptr == NULL) { CS_erpt (cs_NO_MEM); ch_ptr = csCscachP; while (ch_ptr != NULL) { tmp_ptr = ch_ptr->next; CS_free (ch_ptr); ch_ptr = tmp_ptr; } csCscachP = NULL; goto error; } if (ii == 0) { csCscachP = ch_ptr; } else { last_chp->next = ch_ptr; /*lint !e613 */ } ch_ptr->prev = last_chp; ch_ptr->next = NULL; ch_ptr->cs_ptr = NULL; ch_ptr->cs_nam [0] = '\0'; last_chp = ch_ptr; } } /* At this point, we have a cache. It may be empty, but it exists and has more than one entry. */ cs_ptr = NULL; ch_ptr = csCscachP; last_chp = NULL; while (ch_ptr != NULL) { if (ch_ptr->cs_ptr == NULL) break; if (!CS_stricmp (ch_ptr->cs_nam,kyTemp)) { cs_ptr = ch_ptr->cs_ptr; break; } last_chp = ch_ptr; ch_ptr = ch_ptr->next; } /* If cs_ptr is NULL, we havn't found the one we are looking for. We must add it to the cache. */ if (cs_ptr == NULL) { /* If ch_ptr is not NULL, it must point to the first element in the linked list which is unused. We simply use this entry. */ if (ch_ptr != NULL) { ch_ptr->cs_ptr = CS_csloc (kyTemp); if (ch_ptr->cs_ptr == NULL) { goto error; } (void)CS_stncp (ch_ptr->cs_nam,kyTemp,sizeof (ch_ptr->cs_nam)); cs_ptr = ch_ptr->cs_ptr; } else { /* We need to reuse an existing entry. We always reuse that the last entry in the linked list as it should be the least recently accessed entry in the list. */ ch_ptr = last_chp; CS_free (ch_ptr->cs_ptr); ch_ptr->cs_nam [0] = '\0'; ch_ptr->cs_ptr = CS_csloc (kyTemp); (void)CS_stncp (ch_ptr->cs_nam,kyTemp,sizeof (ch_ptr->cs_nam)); cs_ptr = ch_ptr->cs_ptr; } } /* OK, we should now have a coordinate system pointer. All we need to do is make this one first on the list as an indication that it was the most recently accessed. Of course, if it is already the first on the list, we do not need to do anything. The following code assumes that the entry being processed is not the first on the list (i.e. ch_ptr->prev is not NULL). */ if (ch_ptr != csCscachP) { /* Remove the current entry from the list. */ ch_ptr->prev->next = ch_ptr->next; /*lint !e613 */ if (ch_ptr->next != NULL) /*lint !e613 */ { ch_ptr->next->prev = ch_ptr->prev; /*lint !e613 */ } /* Now we insert it at the top of the list. */ ch_ptr->prev = NULL; /*lint !e613 */ ch_ptr->next = csCscachP; /*lint !e613 */ csCscachP->prev = ch_ptr; csCscachP = ch_ptr; } /* Return a pointer to the located coordinate system. */ return (cs_ptr); error: return ((struct cs_Csprm_ *)0); }
int CStestT (bool verbose,long32_t duration) { int err_cnt = 0; #ifdef __SKIP__ double xyz [3]; xyz [0] = 0.0; xyz [1] = 20000000.000; xyz [2] = 0.0; int st = CS_cnvrt ("WGS84.PseudoMercator","LL",xyz); if (st != 0) { err_cnt += 1; } #endif #ifndef __SKIP__ char wktOne [1024] = "GEOGCS [ \"NAD83\", DATUM [\"NAD 83\", SPHEROID [\"GRS 80\", 6378137.000000, 298.257222]], PRIMEM [ \"Greenwich\", 0.000000 ], UNIT [\"Degrees\", 0.01745329251994330]]"; // char wktOne [1024] = "PROJCS[\"DHDN / Gauss-Kruger zone 5\",GEOGCS[\"DHDN\",DATUM[\"Deutsches_Hauptdreiecksnetz\",SPHEROID[\"Bessel 1841\",6377397.155,299.1528128,AUTHORITY[\"EPSG\",\"7004\"]],AUTHORITY[\"EPSG\",\"6314\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.01745329251994328,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4314\"]],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin\",0],PARAMETER[\"central_meridian\",15],PARAMETER[\"scale_factor\",1],PARAMETER[\"false_easting\",5500000],PARAMETER[\"false_northing\",0],AUTHORITY[\"EPSG\",\"31469\"]]"; char wktTwo [1024] = "GEOGCS[\"LL84\",DATUM[\"WGS84\",SPHEROID[\"WGS84\",6378137.000,298.25722293]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.01745329251994]]"; char wktThree [1024] = "PROJCS[\"NAD83 / California zone 3 (ftUS)\",GEOGCS[\"NAD83\",DATUM[\"North_American_Datum_1983\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],AUTHORITY[\"EPSG\",\"6269\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.01745329251994328,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4269\"]],UNIT[\"US survey foot\",0.3048006096012192,AUTHORITY[\"EPSG\",\"9003\"]],PROJECTION[\"Lambert_Conformal_Conic_2SP\"],PARAMETER[\"standard_parallel_1\",38.43333333333333],PARAMETER[\"standard_parallel_2\",37.06666666666667],PARAMETER[\"latitude_of_origin\",36.5],PARAMETER[\"central_meridian\",-120.5],PARAMETER[\"false_easting\",6561666.667],PARAMETER[\"false_northing\",1640416.667],AUTHORITY[\"EPSG\",\"2227\"],AXIS[\"X\",EAST],AXIS[\"Y\",NORTH]]"; char wktFour [1024] = "PROJCS[\"DHDN.Berlin/Cassini\",GEOGCS[\"DHDN.LL\",DATUM[\"DHDN\",SPHEROID[\"BESSEL\",6377397.155,299.15281535],TOWGS84[582.0000,105.0000,414.0000,-1.040000,-0.350000,3.080000,8.30000000]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.017453292519943295]],PROJECTION[\"Cassini-Soldner\"],PARAMETER[\"false_easting\",40000.000],PARAMETER[\"false_northing\",10000.000],PARAMETER[\"central_meridian\",13.62720366666667],PARAMETER[\"latitude_of_origin\",52.41864827777778],UNIT[\"Meter\",1.00000000000000]]"; char wktFive [1024] = "PROJCS[\"NAD83 / UTM zone 19N\",GEOGCS[\"NAD83\",DATUM[\"North_American_Datum_1983\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],AUTHORITY[\"EPSG\",\"6269\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.01745329251994328,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4269\"]],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin\",0],PARAMETER[\"central_meridian\",-69],PARAMETER[\"scale_factor\",0.9996],PARAMETER[\"false_easting\",500000],PARAMETER[\"false_northing\",0],AUTHORITY[\"EPSG\",\"26919\"],AXIS[\"Easting\",EAST],AXIS[\"Northing\",NORTH]]"; char wktSix [1024] = "PROJCS[\"NAD_1983_HARN_StatePlane_Hawaii_3_FIPS_5103_Feet\",GEOGCS[\"GCS_North_American_1983_HARN\",DATUM[\"D_North_American_1983_HARN\",SPHEROID[\"GRS_1980\",6378137.0,298.257222101]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"False_Easting\",1640416.666666667],PARAMETER[\"False_Northing\",0.0],PARAMETER[\"Central_Meridian\",-158.0],PARAMETER[\"Scale_Factor\",0.99999],PARAMETER[\"Latitude_Of_Origin\",21.16666666666667],UNIT[\"Foot_US\",0.3048006096012192]]"; char wktSeven [1024] = "PROJCS[\"NAD_1983_UTM_Zone_12N\",GEOGCS[\"GCS_North_American_1983\",DATUM[\"D_North_American_1983\",SPHEROID[\"GRS_1980\",6378137.0,298.257222101]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"False_Easting\",500000.0],PARAMETER[\"False_Northing\",0.0],PARAMETER[\"Central_Meridian\",-111.0],PARAMETER[\"Scale_Factor\",0.9996],PARAMETER[\"Latitude_Of_Origin\",0.0],UNIT[\"Meter\",1.0]]"; char wktEight [1024] = "PROJCS[\"Italian National System (Gauss-Boaga), Zone 1 (West) Peninsular\",GEOGCS [\"Rome 1940\",DATUM [\"Rome 1940\",SPHEROID [\"International 1924\", 6378388, 297], -104.1, -49.1, -9.9, 0.971, -2.917, 0.714, -11.68],PRIMEM [ \"Greenwich\", 0.000000 ],UNIT [\"Decimal Degree\", 0.01745329251994330]],PROJECTION [\"Transverse Mercator\"],PARAMETER [\"Scale_Factor\", 0.999600],PARAMETER [\"Central_Meridian\", 9.000000],PARAMETER [\"False_Easting\", 150000000],UNIT [\"Centimeter\", 0.01]]"; char wktNine [1024] = "PROJCS[\"ENEL GB\",GEOGCS[\"ROME1940-IT-7P\",DATUM[\"ROME1940-IT-7P\",SPHEROID[\"International 1924 (EPSG ID 7022)\",6378388.000,297.00000000],TOWGS84[-104.1000,-49.1000,-9.9000,0.971000,-2.917000,0.714000,-11.68000000]],PRIMEM[\"Greenwich\",0],UNIT[\"Decimal Degree\",0.017453292519943295]],PROJECTION[\"Transverse Mercator\"],PARAMETER[\"False_Easting\",1500000.000],PARAMETER[\"False_Northing\",0.000],PARAMETER[\"Scale_Factor\",1.000000000000],PARAMETER[\"Central_Meridian\",9.00000000000000],PARAMETER[\"Latitude_Of_Origin\",0.00000000000000],UNIT[\"Centimeter\",0.01000000000000]]"; int stOne; struct cs_Csdef_ csDefOne; struct cs_Dtdef_ dtDefOne; struct cs_Eldef_ elDefOne; int stTwo; struct cs_Csdef_ csDefTwo; struct cs_Dtdef_ dtDefTwo; struct cs_Eldef_ elDefTwo; int stThree; struct cs_Csdef_ csDefThree; struct cs_Dtdef_ dtDefThree; struct cs_Eldef_ elDefThree; int stFour; struct cs_Csdef_ csDefFour; struct cs_Dtdef_ dtDefFour; struct cs_Eldef_ elDefFour; int stFive; struct cs_Csdef_ csDefFive; struct cs_Dtdef_ dtDefFive; struct cs_Eldef_ elDefFive; int stSix; struct cs_Csdef_ csDefSix; struct cs_Dtdef_ dtDefSix; struct cs_Eldef_ elDefSix; int stSeven; struct cs_Csdef_ csDefSeven; struct cs_Dtdef_ dtDefSeven; struct cs_Eldef_ elDefSeven; int stEight; struct cs_Csdef_ csDefEight; struct cs_Dtdef_ dtDefEight; struct cs_Eldef_ elDefEight; int stNine; struct cs_Csdef_ csDefNine; struct cs_Dtdef_ dtDefNine; struct cs_Eldef_ elDefNine; csErrmsg [0] = '\0'; stOne = CS_wktToCsEx (&csDefOne,&dtDefOne,&elDefOne,wktFlvrOgc,wktOne,TRUE); if (verbose && stOne < 0) { printf ("WKT1 processing failed! Status = %d; Reason: %s\n",stOne,csErrmsg); } csErrmsg [0] = '\0'; stTwo = CS_wktToCsEx (&csDefTwo,&dtDefTwo,&elDefTwo,wktFlvrNone,wktTwo,FALSE); if (verbose && stTwo < 0) { printf ("WKT2 processing failed! Status = %d; Reason: %s\n",stTwo,csErrmsg); } csErrmsg [0] = '\0'; stThree = CS_wktToCsEx (&csDefThree,&dtDefThree,&elDefThree,wktFlvrOgc,wktThree,TRUE); if (verbose && stThree < 0) { printf ("WKT2 processing failed! Status = %d; Reason: %s\n",stThree,csErrmsg); } csErrmsg [0] = '\0'; stFour = CS_wktToCsEx (&csDefFour,&dtDefFour,&elDefFour,wktFlvrOgc,wktFour,TRUE); if (verbose && stFour < 0) { printf ("WKT2 processing failed! Status = %d; Reason: %s\n",stFour,csErrmsg); } csErrmsg [0] = '\0'; stFive = CS_wktToCsEx (&csDefFive,&dtDefFive,&elDefFive,wktFlvrOgc,wktFive,TRUE); if (verbose && stFive < 0) { printf ("WKT2 processing failed! Status = %d; Reason: %s\n",stFive,csErrmsg); } csErrmsg [0] = '\0'; stSix = CS_wktToCsEx (&csDefSix,&dtDefSix,&elDefSix,wktFlvrEsri,wktSix,TRUE); if (verbose && stSix < 0) { printf ("WKT2 processing failed! Status = %d; Reason: %s\n",stSix,csErrmsg); } csErrmsg [0] = '\0'; stSeven = CS_wktToCsEx (&csDefSeven,&dtDefSeven,&elDefSeven,wktFlvrEsri,wktSeven,TRUE); if (verbose && stSeven < 0) { printf ("WKT2 processing failed! Status = %d; Reason: %s\n",stSeven,csErrmsg); } csErrmsg [0] = '\0'; stEight = CS_wktToCsEx (&csDefEight,&dtDefEight,&elDefEight,wktFlvrEsri,wktEight,TRUE); if (verbose && stEight < 0) { printf ("WKT2 processing failed! Status = %d; Reason: %s\n",stEight,csErrmsg); } csErrmsg [0] = '\0'; stNine = CS_wktToCsEx (&csDefNine,&dtDefNine,&elDefNine,wktFlvrEsri,wktNine,TRUE); if (verbose && stNine < 0) { printf ("WKT2 processing failed! Status = %d; Reason: %s\n",stNine,csErrmsg); } err_cnt += (stOne != 0); err_cnt += (stTwo != 0); err_cnt += (stThree != 0); err_cnt += (stFour != 0); err_cnt += (stFive != 0); err_cnt += (stSix != 0); err_cnt += (stSeven != 0); err_cnt += (stEight != 0); err_cnt += (stNine != 0); #endif #ifdef __SKIP__ int st; unsigned idx; unsigned gxIdxCnt; Const struct cs_GxIndex_* gxIdxPtr; struct cs_GeodeticTransform_ *gxDefPtr; int err_list [8]; gxIdxCnt = CS_getGxIndexCount (); for (idx = 0;idx < gxIdxCnt;idx++) { gxIdxPtr = CS_getGxIndexEntry (idx); if (gxIdxPtr == NULL) { err_cnt += 1; } else { gxDefPtr = CS_gxdef (gxIdxPtr->xfrmName); if (gxDefPtr == NULL) { err_cnt += 1; } else { st = CS_gxchk (gxDefPtr,cs_GXCHK_DATUM | cs_GXCHK_REPORT,err_list,sizeof (err_list) / sizeof (int)); if (st != 0) { printf ("CS_gxchk failed on geodetic transformation named %s.\n",gxDefPtr->xfrmName); err_cnt += 1; } CS_free (gxDefPtr); } } } #endif #ifdef __SKIP__ int st; printf ("Running temporary test code module.\n"); struct cs_GeodeticTransform_* gx_def1; struct cs_GeodeticTransform_* gx_def2; gx_def1 = CS_gxdef ("NAD27_to_NAD83"); gx_def2 = CS_gxdef ("ABIDJAN-87_to_WGS84"); st = CS_gxupd (gx_def1); st = CS_gxupd (gx_def2); gx_def1 = CS_gxdef ("NAD27_to_NAD83"); gx_def2 = CS_gxdef ("ABIDJAN-87_to_WGS84"); #endif #ifdef __SKIP__ int st; const char* csOneName = "LL27"; const char* csTwoName = "Tokyo"; struct cs_Csprm_ *csOne; struct cs_Csprm_ *csTwo; struct cs_Dtcprm_ *dtcPrm; double llTmp [3]; printf ("Running temporary test code module.\n"); csOne = CS_csloc (csOneName); csTwo = CS_csloc (csTwoName); if (csOne == NULL || csTwo == NULL) { return 1; } dtcPrm = CS_dtcsu (csOne,csTwo,cs_DTCFLG_DAT_F,cs_DTCFLG_BLK_W); if (dtcPrm == NULL) { return 1; } llTmp [0] = -122.1509375; llTmp [1] = 36.10875; llTmp [2] = 0.0; st = CS_dtcvt3D (dtcPrm,llTmp,llTmp); if (st != 0) { err_cnt += 1; } CS_dtcls (dtcPrm); #endif #ifdef __SKIP__ int st; int counter; FILE* tstStrm; struct cs_Csprm_ *csOne; struct cs_Csprm_ *csTwo; struct cs_Dtcprm_ *dtcPrm; double lngMin = -5.5000; double lngMax = 10.0000; double latMin = 41.0000; double latMax = 52.0000; double llOne [3]; double llTmp [3]; double llTwo [3]; const char* csOneName = "LL-RGF93"; const char* csTwoName = "NTF.LL"; tstStrm = fopen ("C:\\Tmp\\TestPoints.txt","wt"); if (tstStrm == NULL) { return 1; } csOne = CS_csloc (csOneName); csTwo = CS_csloc (csTwoName); if (csOne == NULL || csTwo == NULL) { return 1; } dtcPrm = CS_dtcsu (csOne,csTwo,cs_DTCFLG_DAT_F,cs_DTCFLG_BLK_W); if (dtcPrm == NULL) { return 1; } for (counter = 0;counter < duration;counter += 1) { st = 0; llOne [0] = CStestRN (lngMin,lngMax); llOne [1] = CStestRN (latMin,latMax); llOne [2] = 0.0; st = CS_cs3ll (csOne,llTmp,llOne); st |= CS_dtcvt (dtcPrm,llTmp,llTmp); st |= CS_ll3cs (csTwo,llTwo,llTmp); fprintf (tstStrm,"%s,%.9f,%.9f,%s,%.9f,%.9f,1.0E-08,1.0E-08\n",csOneName,llOne [0], llOne [1], csTwoName, llTwo [0], llTwo [1]); fprintf (tstStrm,"%s,%.9f,%.9f,%s,%.9f,%.9f,1.0E-08,1.0E-08\n",csTwoName,llTwo [0], llTwo [1], csOneName, llOne [0], llOne [1]); if (st != 0) { err_cnt += 1; } } fclose (tstStrm); #endif #ifdef __SKIP__ int st; const char* dtOneName = "AFGOOYE"; const char* dtTwoName = "WGS84"; struct cs_Datum_ *dtOne; struct cs_Datum_ *dtTwo; struct cs_Dtcprm_ *dtcPrm; double llTmp [3]; printf ("Running temporary test code module.\n"); dtOne = CS_dtloc (dtOneName); dtTwo = CS_dtloc (dtTwoName); if (dtOne == NULL || dtTwo == NULL) { return 1; } dtcPrm = CSdtcsu (dtOne,dtTwo,cs_DTCFLG_DAT_F,cs_DTCFLG_BLK_W); if (dtcPrm == NULL) { return 1; } CS_dtcls (dtcPrm); #endif return err_cnt; }