From: <js...@us...> - 2007-12-28 19:45:03
|
Revision: 4794 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4794&view=rev Author: jswhit Date: 2007-12-28 11:44:55 -0800 (Fri, 28 Dec 2007) Log Message: ----------- update proj4 sources to version 4.6.0 Modified Paths: -------------- trunk/toolkits/basemap/src/PJ_gn_sinu.c trunk/toolkits/basemap/src/PJ_krovak.c trunk/toolkits/basemap/src/PJ_laea.c trunk/toolkits/basemap/src/PJ_wag3.c trunk/toolkits/basemap/src/emess.c trunk/toolkits/basemap/src/geocent.c trunk/toolkits/basemap/src/geocent.h trunk/toolkits/basemap/src/geod.c trunk/toolkits/basemap/src/nad_init.c trunk/toolkits/basemap/src/pj_datum_set.c trunk/toolkits/basemap/src/pj_factors.c trunk/toolkits/basemap/src/pj_gridinfo.c trunk/toolkits/basemap/src/pj_gridlist.c trunk/toolkits/basemap/src/pj_init.c trunk/toolkits/basemap/src/pj_latlong.c trunk/toolkits/basemap/src/pj_list.h trunk/toolkits/basemap/src/pj_open_lib.c trunk/toolkits/basemap/src/pj_release.c trunk/toolkits/basemap/src/pj_transform.c trunk/toolkits/basemap/src/pj_utils.c trunk/toolkits/basemap/src/proj_api.h trunk/toolkits/basemap/src/projects.h trunk/toolkits/basemap/src/rtodms.c Modified: trunk/toolkits/basemap/src/PJ_gn_sinu.c =================================================================== --- trunk/toolkits/basemap/src/PJ_gn_sinu.c 2007-12-27 13:05:41 UTC (rev 4793) +++ trunk/toolkits/basemap/src/PJ_gn_sinu.c 2007-12-28 19:44:55 UTC (rev 4794) @@ -75,7 +75,6 @@ if (!(P->en = pj_enfn(P->es))) E_ERROR_0; if (P->es) { - P->en = pj_enfn(P->es); P->inv = e_inverse; P->fwd = e_forward; } else { Modified: trunk/toolkits/basemap/src/PJ_krovak.c =================================================================== --- trunk/toolkits/basemap/src/PJ_krovak.c 2007-12-27 13:05:41 UTC (rev 4793) +++ trunk/toolkits/basemap/src/PJ_krovak.c 2007-12-28 19:44:55 UTC (rev 4794) @@ -1,5 +1,5 @@ /****************************************************************************** - * $Id: PJ_krovak.c,v 1.6 2006/09/14 13:10:50 fwarmerdam Exp $ + * $Id: PJ_krovak.c,v 1.9 2007/03/07 17:32:32 fwarmerdam Exp $ * * Project: PROJ.4 * Purpose: Implementation of the krovak (Krovak) projection. @@ -30,6 +30,15 @@ ****************************************************************************** * * $Log: PJ_krovak.c,v $ + * Revision 1.9 2007/03/07 17:32:32 fwarmerdam + * remove orphan semicolon. + * + * Revision 1.8 2007/03/07 17:28:08 fwarmerdam + * Make it reasonably clear that this is ellipsoidal in the code. + * + * Revision 1.7 2007/03/07 17:25:34 fwarmerdam + * report krovak as ellipsoidal, not spherical + * * Revision 1.6 2006/09/14 13:10:50 fwarmerdam * Add +czech flag to control reversal of signs (bug 1133,147) * @@ -55,9 +64,9 @@ #include <string.h> #include <stdio.h> -PJ_CVSID("$Id: PJ_krovak.c,v 1.6 2006/09/14 13:10:50 fwarmerdam Exp $"); +PJ_CVSID("$Id: PJ_krovak.c,v 1.9 2007/03/07 17:32:32 fwarmerdam Exp $"); -PROJ_HEAD(krovak, "Krovak") "\n\tPCyl., Sph."; +PROJ_HEAD(krovak, "Krovak") "\n\tPCyl., Ellps."; /** NOTES: According to EPSG the full Krovak projection method should have @@ -84,7 +93,7 @@ -FORWARD(s_forward); /* spheroid */ +FORWARD(e_forward); /* ellipsoid */ /* calculate xy from lat/lon */ char errmess[255]; @@ -153,7 +162,7 @@ -INVERSE(s_inverse); /* spheroid */ +INVERSE(e_inverse); /* ellipsoid */ /* calculate lat/lon from xy */ /* Constants, identisch wie in der Umkehrfunktion */ @@ -258,15 +267,14 @@ /* as input and output, instead of lat/long relative to Ferro */ if (!pj_param(P->params, "tlon_0").i) P->lam0 = 0.7417649320975901 - 0.308341501185665; -; /* if scale not set default to 0.9999 */ if (!pj_param(P->params, "tk").i) P->k0 = 0.9999; /* always the same */ - P->inv = s_inverse; - P->fwd = s_forward; + P->inv = e_inverse; + P->fwd = e_forward; ENDENTRY(P) Modified: trunk/toolkits/basemap/src/PJ_laea.c =================================================================== --- trunk/toolkits/basemap/src/PJ_laea.c 2007-12-27 13:05:41 UTC (rev 4793) +++ trunk/toolkits/basemap/src/PJ_laea.c 2007-12-28 19:44:55 UTC (rev 4794) @@ -179,8 +179,14 @@ 0. : atan2(xy.x, xy.y); return (lp); } -FREEUP; if (P) pj_dalloc(P); } -ENTRY0(laea) +FREEUP; + if (P) { + if (P->apa) + pj_dalloc(P->apa); + pj_dalloc(P); + } +} +ENTRY1(laea,apa) double t; if (fabs((t = fabs(P->phi0)) - HALFPI) < EPS10) Modified: trunk/toolkits/basemap/src/PJ_wag3.c =================================================================== --- trunk/toolkits/basemap/src/PJ_wag3.c 2007-12-27 13:05:41 UTC (rev 4793) +++ trunk/toolkits/basemap/src/PJ_wag3.c 2007-12-28 19:44:55 UTC (rev 4794) @@ -5,7 +5,7 @@ double C_x; #define PJ_LIB__ # include <projects.h> -PROJ_HEAD(wag3, "Wagner III") "\n\tPCyl., Sph."; +PROJ_HEAD(wag3, "Wagner III") "\n\tPCyl., Sph.\n\tlat_ts="; #define TWOTHIRD 0.6666666666666666666667 FORWARD(s_forward); /* spheroid */ xy.x = P->C_x * lp.lam * cos(TWOTHIRD * lp.phi); Modified: trunk/toolkits/basemap/src/emess.c =================================================================== --- trunk/toolkits/basemap/src/emess.c 2007-12-27 13:05:41 UTC (rev 4793) +++ trunk/toolkits/basemap/src/emess.c 2007-12-28 19:44:55 UTC (rev 4794) @@ -3,6 +3,15 @@ static const char SCCSID[]="@(#)emess.c 4.6 94/05/24 GIE REL"; #endif +#ifdef _MSC_VER +# ifndef _CRT_SECURE_NO_DEPRECATE +# define _CRT_SECURE_NO_DEPRECATE +# endif +# ifndef _CRT_NONSTDC_NO_DEPRECATE +# define _CRT_NONSTDC_NO_DEPRECATE +# endif +#endif + #include <stdio.h> #include <stdlib.h> #include <stdarg.h> Modified: trunk/toolkits/basemap/src/geocent.c =================================================================== --- trunk/toolkits/basemap/src/geocent.c 2007-12-27 13:05:41 UTC (rev 4793) +++ trunk/toolkits/basemap/src/geocent.c 2007-12-28 19:44:55 UTC (rev 4794) @@ -65,6 +65,9 @@ * 25-02-97 Original Code * * $Log: geocent.c,v $ + * Revision 1.7 2007/09/11 20:19:36 fwarmerdam + * avoid use of static variables to make reentrant + * * Revision 1.6 2006/01/12 22:29:01 fwarmerdam * make geocent.c globals static to avoid conflicts * @@ -109,29 +112,11 @@ /***************************************************************************/ /* - * GLOBAL DECLARATIONS - */ -/* Ellipsoid parameters, default to WGS 84 */ -static double Geocent_a = 6378137.0; /* Semi-major axis of ellipsoid in meters */ -static double Geocent_b = 6356752.3142; /* Semi-minor axis of ellipsoid */ - -static double Geocent_a2 = 40680631590769.0; /* Square of semi-major axis */ -static double Geocent_b2 = 40408299984087.05; /* Square of semi-minor axis */ -static double Geocent_e2 = 0.0066943799901413800; /* Eccentricity squared */ -static double Geocent_ep2 = 0.00673949675658690300; /* 2nd eccentricity squared */ -/* - * These state variables are for optimization purposes. The only function - * that should modify them is Set_Geocentric_Parameters. - */ - - -/***************************************************************************/ -/* * FUNCTIONS */ -long pj_Set_Geocentric_Parameters (double a, double b) +long pj_Set_Geocentric_Parameters (GeocentricInfo *gi, double a, double b) { /* BEGIN Set_Geocentric_Parameters */ /* @@ -141,29 +126,30 @@ * a : Semi-major axis, in meters. (input) * b : Semi-minor axis, in meters. (input) */ - long Error_Code = GEOCENT_NO_ERROR; + long Error_Code = GEOCENT_NO_ERROR; - if (a <= 0.0) - Error_Code |= GEOCENT_A_ERROR; - if (b <= 0.0) - Error_Code |= GEOCENT_B_ERROR; - if (a < b) - Error_Code |= GEOCENT_A_LESS_B_ERROR; - if (!Error_Code) - { - Geocent_a = a; - Geocent_b = b; - Geocent_a2 = a * a; - Geocent_b2 = b * b; - Geocent_e2 = (Geocent_a2 - Geocent_b2) / Geocent_a2; - Geocent_ep2 = (Geocent_a2 - Geocent_b2) / Geocent_b2; - } - return (Error_Code); + if (a <= 0.0) + Error_Code |= GEOCENT_A_ERROR; + if (b <= 0.0) + Error_Code |= GEOCENT_B_ERROR; + if (a < b) + Error_Code |= GEOCENT_A_LESS_B_ERROR; + if (!Error_Code) + { + gi->Geocent_a = a; + gi->Geocent_b = b; + gi->Geocent_a2 = a * a; + gi->Geocent_b2 = b * b; + gi->Geocent_e2 = (gi->Geocent_a2 - gi->Geocent_b2) / gi->Geocent_a2; + gi->Geocent_ep2 = (gi->Geocent_a2 - gi->Geocent_b2) / gi->Geocent_b2; + } + return (Error_Code); } /* END OF Set_Geocentric_Parameters */ -void pj_Get_Geocentric_Parameters (double *a, - double *b) +void pj_Get_Geocentric_Parameters (GeocentricInfo *gi, + double *a, + double *b) { /* BEGIN Get_Geocentric_Parameters */ /* * The function Get_Geocentric_Parameters returns the ellipsoid parameters @@ -173,17 +159,18 @@ * b : Semi-minor axis, in meters. (output) */ - *a = Geocent_a; - *b = Geocent_b; + *a = gi->Geocent_a; + *b = gi->Geocent_b; } /* END OF Get_Geocentric_Parameters */ -long pj_Convert_Geodetic_To_Geocentric (double Latitude, - double Longitude, - double Height, - double *X, - double *Y, - double *Z) +long pj_Convert_Geodetic_To_Geocentric (GeocentricInfo *gi, + double Latitude, + double Longitude, + double Height, + double *X, + double *Y, + double *Z) { /* BEGIN Convert_Geodetic_To_Geocentric */ /* * The function Convert_Geodetic_To_Geocentric converts geodetic coordinates @@ -225,10 +212,10 @@ Sin_Lat = sin(Latitude); Cos_Lat = cos(Latitude); Sin2_Lat = Sin_Lat * Sin_Lat; - Rn = Geocent_a / (sqrt(1.0e0 - Geocent_e2 * Sin2_Lat)); + Rn = gi->Geocent_a / (sqrt(1.0e0 - gi->Geocent_e2 * Sin2_Lat)); *X = (Rn + Height) * Cos_Lat * cos(Longitude); *Y = (Rn + Height) * Cos_Lat * sin(Longitude); - *Z = ((Rn * (1 - Geocent_e2)) + Height) * Sin_Lat; + *Z = ((Rn * (1 - gi->Geocent_e2)) + Height) * Sin_Lat; } return (Error_Code); @@ -249,12 +236,13 @@ #define USE_ITERATIVE_METHOD -void pj_Convert_Geocentric_To_Geodetic (double X, - double Y, - double Z, - double *Latitude, - double *Longitude, - double *Height) +void pj_Convert_Geocentric_To_Geodetic (GeocentricInfo *gi, + double X, + double Y, + double Z, + double *Latitude, + double *Longitude, + double *Height) { /* BEGIN Convert_Geocentric_To_Geodetic */ #if !defined(USE_ITERATIVE_METHOD) /* @@ -321,12 +309,12 @@ Sin_B0 = T0 / S0; Cos_B0 = W / S0; Sin3_B0 = Sin_B0 * Sin_B0 * Sin_B0; - T1 = Z + Geocent_b * Geocent_ep2 * Sin3_B0; - Sum = W - Geocent_a * Geocent_e2 * Cos_B0 * Cos_B0 * Cos_B0; + T1 = Z + gi->Geocent_b * gi->Geocent_ep2 * Sin3_B0; + Sum = W - gi->Geocent_a * gi->Geocent_e2 * Cos_B0 * Cos_B0 * Cos_B0; S1 = sqrt(T1*T1 + Sum * Sum); Sin_p1 = T1 / S1; Cos_p1 = Sum / S1; - Rn = Geocent_a / sqrt(1.0 - Geocent_e2 * Sin_p1 * Sin_p1); + Rn = gi->Geocent_a / sqrt(1.0 - gi->Geocent_e2 * Sin_p1 * Sin_p1); if (Cos_p1 >= COS_67P5) { *Height = W / Cos_p1 - Rn; @@ -337,7 +325,7 @@ } else { - *Height = Z / Sin_p1 + Rn * (Geocent_e2 - 1.0); + *Height = Z / Sin_p1 + Rn * (gi->Geocent_e2 - 1.0); } if (At_Pole == FALSE) { @@ -401,7 +389,7 @@ RR = sqrt(X*X+Y*Y+Z*Z); /* special cases for latitude and longitude */ - if (P/Geocent_a < genau) { + if (P/gi->Geocent_a < genau) { /* special case, if P=0. (X=0., Y=0.) */ At_Pole = TRUE; @@ -409,9 +397,9 @@ /* if (X,Y,Z)=(0.,0.,0.) then Height becomes semi-minor axis * of ellipsoid (=center of mass), Latitude becomes PI/2 */ - if (RR/Geocent_a < genau) { + if (RR/gi->Geocent_a < genau) { *Latitude = PI_OVER_2; - *Height = -Geocent_b; + *Height = -gi->Geocent_b; return ; } @@ -433,8 +421,8 @@ */ CT = Z/RR; ST = P/RR; - RX = 1.0/sqrt(1.0-Geocent_e2*(2.0-Geocent_e2)*ST*ST); - CPHI0 = ST*(1.0-Geocent_e2)*RX; + RX = 1.0/sqrt(1.0-gi->Geocent_e2*(2.0-gi->Geocent_e2)*ST*ST); + CPHI0 = ST*(1.0-gi->Geocent_e2)*RX; SPHI0 = CT*RX; iter = 0; @@ -443,12 +431,12 @@ do { iter++; - RN = Geocent_a/sqrt(1.0-Geocent_e2*SPHI0*SPHI0); + RN = gi->Geocent_a/sqrt(1.0-gi->Geocent_e2*SPHI0*SPHI0); /* ellipsoidal (geodetic) height */ - *Height = P*CPHI0+Z*SPHI0-RN*(1.0-Geocent_e2*SPHI0*SPHI0); + *Height = P*CPHI0+Z*SPHI0-RN*(1.0-gi->Geocent_e2*SPHI0*SPHI0); - RK = Geocent_e2*RN/(RN+*Height); + RK = gi->Geocent_e2*RN/(RN+*Height); RX = 1.0/sqrt(1.0-RK*(2.0-RK)*ST*ST); CPHI = ST*(1.0-RK)*RX; SPHI = CT*RX; Modified: trunk/toolkits/basemap/src/geocent.h =================================================================== --- trunk/toolkits/basemap/src/geocent.h 2007-12-27 13:05:41 UTC (rev 4793) +++ trunk/toolkits/basemap/src/geocent.h 2007-12-28 19:44:55 UTC (rev 4794) @@ -92,9 +92,21 @@ extern "C" { #endif +typedef struct +{ + double Geocent_a; /* Semi-major axis of ellipsoid in meters */ + double Geocent_b; /* Semi-minor axis of ellipsoid */ + double Geocent_a2; /* Square of semi-major axis */ + double Geocent_b2; /* Square of semi-minor axis */ + double Geocent_e2; /* Eccentricity squared */ + double Geocent_ep2; /* 2nd eccentricity squared */ +} GeocentricInfo; - long pj_Set_Geocentric_Parameters (double a, - double b); +void pj_Init_Geocentric( GeocentricInfo *gi ); +long pj_Set_Geocentric_Parameters( GeocentricInfo *gi, + double a, + double b); + /* * The function Set_Geocentric_Parameters receives the ellipsoid parameters * as inputs and sets the corresponding state variables. @@ -104,8 +116,10 @@ */ - void pj_Get_Geocentric_Parameters (double *a, - double *b); +void pj_Get_Geocentric_Parameters ( GeocentricInfo *gi, + double *a, + double *b); + /* * The function Get_Geocentric_Parameters returns the ellipsoid parameters * to be used in geocentric coordinate conversions. @@ -115,12 +129,13 @@ */ - long pj_Convert_Geodetic_To_Geocentric (double Latitude, - double Longitude, - double Height, - double *X, - double *Y, - double *Z); +long pj_Convert_Geodetic_To_Geocentric ( GeocentricInfo *gi, + double Latitude, + double Longitude, + double Height, + double *X, + double *Y, + double *Z); /* * The function Convert_Geodetic_To_Geocentric converts geodetic coordinates * (latitude, longitude, and height) to geocentric coordinates (X, Y, Z), @@ -136,12 +151,13 @@ */ - void pj_Convert_Geocentric_To_Geodetic (double X, - double Y, - double Z, - double *Latitude, - double *Longitude, - double *Height); +void pj_Convert_Geocentric_To_Geodetic (GeocentricInfo *gi, + double X, + double Y, + double Z, + double *Latitude, + double *Longitude, + double *Height); /* * The function Convert_Geocentric_To_Geodetic converts geocentric * coordinates (X, Y, Z) to geodetic coordinates (latitude, longitude, Modified: trunk/toolkits/basemap/src/geod.c =================================================================== --- trunk/toolkits/basemap/src/geod.c 2007-12-27 13:05:41 UTC (rev 4793) +++ trunk/toolkits/basemap/src/geod.c 2007-12-28 19:44:55 UTC (rev 4794) @@ -2,11 +2,11 @@ static const char SCCSID[]="@(#)geod.c 4.8 95/09/23 GIE REL"; #endif /* <<<< Geodesic filter program >>>> */ -# include <ctype.h> -# include <stdio.h> # include "projects.h" # include "geodesic.h" # include "emess.h" +# include <ctype.h> +# include <stdio.h> # include <string.h> # define MAXLINE 200 Modified: trunk/toolkits/basemap/src/nad_init.c =================================================================== --- trunk/toolkits/basemap/src/nad_init.c 2007-12-27 13:05:41 UTC (rev 4793) +++ trunk/toolkits/basemap/src/nad_init.c 2007-12-28 19:44:55 UTC (rev 4794) @@ -1,5 +1,5 @@ /****************************************************************************** - * $Id: nad_init.c,v 1.8 2003/03/17 18:56:01 warmerda Exp $ + * $Id: nad_init.c,v 1.10 2007/09/11 20:16:33 fwarmerdam Exp $ * * Project: PROJ.4 * Purpose: Load datum shift files into memory. @@ -28,6 +28,12 @@ ****************************************************************************** * * $Log: nad_init.c,v $ + * Revision 1.10 2007/09/11 20:16:33 fwarmerdam + * Improve error recovery if ctable datum shift files fails to load. + * + * Revision 1.9 2006/11/17 22:16:30 mloskot + * Uploaded PROJ.4 port for Windows CE. + * * Revision 1.8 2003/03/17 18:56:01 warmerda * implement delayed loading of ctable format files * @@ -53,9 +59,18 @@ #include <projects.h> #include <stdio.h> #include <errno.h> -#include <assert.h> #include <string.h> +#ifdef _WIN32_WCE +/* assert.h includes all Windows API headers and causes 'LP' name clash. + * Here assert we disable assert() for Windows CE. + * TODO - mloskot: re-implement porting friendly assert + */ +# define assert(exp) ((void)0) +#else +# include <assert.h> +#endif /* _WIN32_WCE */ + /************************************************************************/ /* nad_ctable_load() */ /* */ @@ -75,6 +90,15 @@ if( ct->cvs == NULL || fread(ct->cvs, sizeof(FLP), a_size, fid) != a_size ) { + pj_dalloc( ct->cvs ); + ct->cvs = NULL; + + if( getenv("PROJ_DEBUG") != NULL ) + { + fprintf( stderr, + "ctable loading failed on fread() - binary incompatible?\n" ); + } + pj_errno = -38; return 0; } Modified: trunk/toolkits/basemap/src/pj_datum_set.c =================================================================== --- trunk/toolkits/basemap/src/pj_datum_set.c 2007-12-27 13:05:41 UTC (rev 4793) +++ trunk/toolkits/basemap/src/pj_datum_set.c 2007-12-28 19:44:55 UTC (rev 4794) @@ -1,5 +1,5 @@ /****************************************************************************** - * $Id: pj_datum_set.c,v 1.2 2001/04/04 21:13:21 warmerda Exp $ + * $Id: pj_datum_set.c,v 1.4 2007/11/29 21:06:50 fwarmerdam Exp $ * * Project: PROJ.4 * Purpose: Apply datum definition to PJ structure from initialization string. @@ -28,6 +28,12 @@ ****************************************************************************** * * $Log: pj_datum_set.c,v $ + * Revision 1.4 2007/11/29 21:06:50 fwarmerdam + * make sure we only look for 7 parameters + * + * Revision 1.3 2007/01/31 06:41:01 fwarmerdam + * dont parse more datum parameters than we have room for in datum_params[] + * * Revision 1.2 2001/04/04 21:13:21 warmerda * do arcsecond/radian and ppm datum parm transformation in pj_set_datum() * @@ -113,7 +119,7 @@ /* parse out the parameters */ s = towgs84; - for( s = towgs84; *s != '\0'; ) + for( s = towgs84; *s != '\0' && parm_count < 7; ) { projdef->datum_params[parm_count++] = atof(s); while( *s != '\0' && *s != ',' ) Modified: trunk/toolkits/basemap/src/pj_factors.c =================================================================== --- trunk/toolkits/basemap/src/pj_factors.c 2007-12-27 13:05:41 UTC (rev 4793) +++ trunk/toolkits/basemap/src/pj_factors.c 2007-12-28 19:44:55 UTC (rev 4794) @@ -20,15 +20,16 @@ return 1; } else { /* proceed */ errno = pj_errno = 0; - if (fabs(t) <= EPS) /* adjust to pi/2 */ - lp.phi = lp.phi < 0. ? -HALFPI : HALFPI; + if (h < EPS) + h = DEFAULT_H; + if (fabs(lp.phi) > (HALFPI - h)) + /* adjust to value around pi/2 where derived still exists*/ + lp.phi = lp.phi < 0. ? (-HALFPI+h) : (HALFPI-h); else if (P->geoc) lp.phi = atan(P->rone_es * tan(lp.phi)); lp.lam -= P->lam0; /* compute del lp.lam */ if (!P->over) lp.lam = adjlon(lp.lam); /* adjust del longitude */ - if (h <= 0.) - h = DEFAULT_H; if (P->spc) /* get what projection analytic values */ P->spc(lp, P, fac); if (((fac->code & (IS_ANAL_XL_YL+IS_ANAL_XP_YP)) != Modified: trunk/toolkits/basemap/src/pj_gridinfo.c =================================================================== --- trunk/toolkits/basemap/src/pj_gridinfo.c 2007-12-27 13:05:41 UTC (rev 4793) +++ trunk/toolkits/basemap/src/pj_gridinfo.c 2007-12-28 19:44:55 UTC (rev 4794) @@ -1,5 +1,5 @@ /****************************************************************************** - * $Id: pj_gridinfo.c,v 1.7 2005/07/07 00:16:03 fwarmerdam Exp $ + * $Id: pj_gridinfo.c,v 1.8 2006/11/17 22:16:30 mloskot Exp $ * * Project: PROJ.4 * Purpose: Functions for handling individual PJ_GRIDINFO's. Includes @@ -29,6 +29,9 @@ ****************************************************************************** * * $Log: pj_gridinfo.c,v $ + * Revision 1.8 2006/11/17 22:16:30 mloskot + * Uploaded PROJ.4 port for Windows CE. + * * Revision 1.7 2005/07/07 00:16:03 fwarmerdam * Fixed debug fprintf syntax per: * http://bugzilla.remotesensing.org/show_bug.cgi?id=886 @@ -59,8 +62,17 @@ #include <string.h> #include <math.h> #include <errno.h> -#include <assert.h> +#ifdef _WIN32_WCE +/* assert.h includes all Windows API headers and causes 'LP' name clash. + * Here assert we disable assert() for Windows CE. + * TODO - mloskot: re-implement porting friendly assert + */ +# define assert(exp) ((void)0) +#else +# include <assert.h> +#endif /* _WIN32_WCE */ + /************************************************************************/ /* swap_words() */ /* */ Modified: trunk/toolkits/basemap/src/pj_gridlist.c =================================================================== --- trunk/toolkits/basemap/src/pj_gridlist.c 2007-12-27 13:05:41 UTC (rev 4793) +++ trunk/toolkits/basemap/src/pj_gridlist.c 2007-12-28 19:44:55 UTC (rev 4794) @@ -1,5 +1,5 @@ /****************************************************************************** - * $Id: pj_gridlist.c,v 1.4 2005/11/01 05:56:13 fwarmerdam Exp $ + * $Id: pj_gridlist.c,v 1.5 2006/11/17 22:16:30 mloskot Exp $ * * Project: PROJ.4 * Purpose: Code to manage the list of currently loaded (cached) PJ_GRIDINFOs @@ -29,6 +29,9 @@ ****************************************************************************** * * $Log: pj_gridlist.c,v $ + * Revision 1.5 2006/11/17 22:16:30 mloskot + * Uploaded PROJ.4 port for Windows CE. + * * Revision 1.4 2005/11/01 05:56:13 fwarmerdam * improved error handling if gridcount is zero * @@ -48,8 +51,17 @@ #include <projects.h> #include <string.h> #include <math.h> -#include <assert.h> +#ifdef _WIN32_WCE +/* assert.h includes all Windows API headers and causes 'LP' name clash. + * Here assert we disable assert() for Windows CE. + * TODO - mloskot: re-implement porting friendly assert + */ +# define assert(exp) ((void)0) +#else +# include <assert.h> +#endif /* _WIN32_WCE */ + static PJ_GRIDINFO *grid_list = NULL; /* used only by pj_load_nadgrids() and pj_deallocate_grids() */ Modified: trunk/toolkits/basemap/src/pj_init.c =================================================================== --- trunk/toolkits/basemap/src/pj_init.c 2007-12-27 13:05:41 UTC (rev 4793) +++ trunk/toolkits/basemap/src/pj_init.c 2007-12-28 19:44:55 UTC (rev 4794) @@ -1,5 +1,5 @@ /****************************************************************************** - * $Id: pj_init.c,v 1.18 2006/10/12 21:04:39 fwarmerdam Exp $ + * $Id: pj_init.c,v 1.19 2007/11/26 00:21:59 fwarmerdam Exp $ * * Project: PROJ.4 * Purpose: Initialize projection object from string definition. Includes @@ -30,6 +30,15 @@ ****************************************************************************** * * $Log: pj_init.c,v $ + * Revision 1.19 2007/11/26 00:21:59 fwarmerdam + * Modified PJ structure to hold a_orig, es_orig, ellipsoid definition before + * adjustment for spherical projections. + * Modified pj_datum_transform() to use the original ellipsoid parameters, + * not the ones adjusted for spherical projections. + * Modified pj_datum_transform() to not attempt any datum shift via + * geocentric coordinates if the source *or* destination are raw ellipsoids + * (ie. PJD_UNKNOWN). All per PROJ bug #1602, GDAL bug #2025. + * * Revision 1.18 2006/10/12 21:04:39 fwarmerdam * Added experimental +lon_wrap argument to set a "center point" for * longitude wrapping of longitude values coming out of pj_transform(). @@ -73,7 +82,7 @@ #include <string.h> #include <errno.h> -PJ_CVSID("$Id: pj_init.c,v 1.18 2006/10/12 21:04:39 fwarmerdam Exp $"); +PJ_CVSID("$Id: pj_init.c,v 1.19 2007/11/26 00:21:59 fwarmerdam Exp $"); extern FILE *pj_open_lib(char *, char *); @@ -282,6 +291,9 @@ /* set ellipsoid/sphere parameters */ if (pj_ell_set(start, &PIN->a, &PIN->es)) goto bum_call; + PIN->a_orig = PIN->a; + PIN->es_orig = PIN->es; + PIN->e = sqrt(PIN->es); PIN->ra = 1. / PIN->a; PIN->one_es = 1. - PIN->es; Modified: trunk/toolkits/basemap/src/pj_latlong.c =================================================================== --- trunk/toolkits/basemap/src/pj_latlong.c 2007-12-27 13:05:41 UTC (rev 4793) +++ trunk/toolkits/basemap/src/pj_latlong.c 2007-12-28 19:44:55 UTC (rev 4794) @@ -1,5 +1,5 @@ /****************************************************************************** - * $Id: pj_latlong.c,v 1.2 2000/07/07 06:04:23 warmerda Exp $ + * $Id: pj_latlong.c,v 1.3 2007/11/30 20:02:31 fwarmerdam Exp $ * * Project: PROJ.4 * Purpose: Stub projection implementation for lat/long coordinates. We @@ -30,6 +30,9 @@ ****************************************************************************** * * $Log: pj_latlong.c,v $ + * Revision 1.3 2007/11/30 20:02:31 fwarmerdam + * add latlon and lonlat aliases + * * Revision 1.2 2000/07/07 06:04:23 warmerda * added longlat alias * @@ -41,8 +44,10 @@ /* very loosely based upon DMA code by Bradford W. Drew */ #define PJ_LIB__ #include <projects.h> -PROJ_HEAD(latlong, "Lat/long (Geodetic)") "\n\t"; -PROJ_HEAD(longlat, "Lat/long (Geodetic)") "\n\t"; +PROJ_HEAD(lonlat, "Lat/long (Geodetic)") "\n\t"; +PROJ_HEAD(latlon, "Lat/long (Geodetic alias)") "\n\t"; +PROJ_HEAD(latlong, "Lat/long (Geodetic alias)") "\n\t"; +PROJ_HEAD(longlat, "Lat/long (Geodetic alias)") "\n\t"; FORWARD(forward); @@ -71,3 +76,17 @@ P->y0 = 0.0; P->inv = inverse; P->fwd = forward; ENDENTRY(P) + +ENTRY0(latlon) + P->is_latlong = 1; + P->x0 = 0.0; + P->y0 = 0.0; + P->inv = inverse; P->fwd = forward; +ENDENTRY(P) + +ENTRY0(lonlat) + P->is_latlong = 1; + P->x0 = 0.0; + P->y0 = 0.0; + P->inv = inverse; P->fwd = forward; +ENDENTRY(P) Modified: trunk/toolkits/basemap/src/pj_list.h =================================================================== --- trunk/toolkits/basemap/src/pj_list.h 2007-12-27 13:05:41 UTC (rev 4793) +++ trunk/toolkits/basemap/src/pj_list.h 2007-12-28 19:44:55 UTC (rev 4794) @@ -55,8 +55,10 @@ PROJ_HEAD(lagrng, "Lagrange") PROJ_HEAD(larr, "Larrivee") PROJ_HEAD(lask, "Laskowski") -PROJ_HEAD(latlong, "Lat/long (Geodetic)") -PROJ_HEAD(longlat, "Lat/long (Geodetic)") +PROJ_HEAD(lonlat, "Lat/long (Geodetic)") +PROJ_HEAD(latlon, "Lat/long (Geodetic alias)") +PROJ_HEAD(latlong, "Lat/long (Geodetic alias)") +PROJ_HEAD(longlat, "Lat/long (Geodetic alias)") PROJ_HEAD(lcc, "Lambert Conformal Conic") PROJ_HEAD(lcca, "Lambert Conformal Conic Alternative") PROJ_HEAD(leac, "Lambert Equal Area Conic") @@ -71,7 +73,6 @@ PROJ_HEAD(merc, "Mercator") PROJ_HEAD(mil_os, "Miller Oblated Stereographic") PROJ_HEAD(mill, "Miller Cylindrical") -PROJ_HEAD(mpoly, "Modified Polyconic") PROJ_HEAD(moll, "Mollweide") PROJ_HEAD(murd1, "Murdoch I") PROJ_HEAD(murd2, "Murdoch II") Modified: trunk/toolkits/basemap/src/pj_open_lib.c =================================================================== --- trunk/toolkits/basemap/src/pj_open_lib.c 2007-12-27 13:05:41 UTC (rev 4793) +++ trunk/toolkits/basemap/src/pj_open_lib.c 2007-12-28 19:44:55 UTC (rev 4794) @@ -1,5 +1,5 @@ /****************************************************************************** - * $Id: pj_open_lib.c,v 1.6 2004/09/16 15:14:01 fwarmerdam Exp $ + * $Id: pj_open_lib.c,v 1.9 2007/07/06 14:58:03 fwarmerdam Exp $ * * Project: PROJ.4 * Purpose: Implementation of pj_open_lib(), and pj_set_finder(). These @@ -31,6 +31,15 @@ ****************************************************************************** * * $Log: pj_open_lib.c,v $ + * Revision 1.9 2007/07/06 14:58:03 fwarmerdam + * improve searchpath clearning with pj_set_searchpath() + * + * Revision 1.8 2007/03/11 17:03:18 fwarmerdam + * support drive letter prefixes on win32 and related fixes (bug 1499) + * + * Revision 1.7 2006/11/17 22:16:30 mloskot + * Uploaded PROJ.4 port for Windows CE. + * * Revision 1.6 2004/09/16 15:14:01 fwarmerdam * * src/pj_open_lib.c: added pj_set_searchpath() provided by Eric Miller. * @@ -45,7 +54,7 @@ #include <string.h> #include <errno.h> -PJ_CVSID("$Id: pj_open_lib.c,v 1.6 2004/09/16 15:14:01 fwarmerdam Exp $"); +PJ_CVSID("$Id: pj_open_lib.c,v 1.9 2007/07/06 14:58:03 fwarmerdam Exp $"); static const char *(*pj_finder)(const char *) = NULL; static int path_count = 0; @@ -71,7 +80,8 @@ /* pj_set_searchpath() */ /* */ /* Path control for callers that can't practically provide */ -/* pj_set_finder() style callbacks. */ +/* pj_set_finder() style callbacks. Call with (0,NULL) as args */ +/* to clear the searchpath set. */ /************************************************************************/ void pj_set_searchpath ( int count, const char **path ) @@ -89,13 +99,16 @@ search_path = NULL; } - search_path = pj_malloc(sizeof *search_path * count); - for (i = 0; i < count; i++) + if( count > 0 ) { - search_path[i] = pj_malloc(strlen(path[i]) + 1); - strcpy(search_path[i], path[i]); + search_path = pj_malloc(sizeof *search_path * count); + for (i = 0; i < count; i++) + { + search_path[i] = pj_malloc(strlen(path[i]) + 1); + strcpy(search_path[i], path[i]); + } } - + path_count = count; } @@ -110,9 +123,16 @@ FILE *fid; int n = 0; int i; +#ifdef WIN32 + static const char dir_chars[] = "/\\"; +#else + static const char dir_chars[] = "/"; +#endif +#ifndef _WIN32_WCE + /* check if ~/name */ - if (*name == '~' && name[1] == DIR_CHAR) + if (*name == '~' && strchr(dir_chars,name[1]) ) if (sysname = getenv("HOME")) { (void)strcpy(fname, sysname); fname[n = strlen(fname)] = DIR_CHAR; @@ -123,8 +143,10 @@ return NULL; /* or fixed path: /name, ./name or ../name */ - else if (*name == DIR_CHAR || (*name == '.' && name[1] == DIR_CHAR) || - (!strncmp(name, "..", 2) && name[2] == DIR_CHAR) ) + else if (strchr(dir_chars,*name) + || (*name == '.' && strchr(dir_chars,name[1])) + || (!strncmp(name, "..", 2) && strchr(dir_chars,name[2])) + || (name[1] == ':' && strchr(dir_chars,name[2])) ) sysname = name; /* or try to use application provided file finder */ @@ -163,4 +185,7 @@ fid == NULL ? "failed" : "succeeded" ); return(fid); +#else + return NULL; +#endif /* _WIN32_WCE */ } Modified: trunk/toolkits/basemap/src/pj_release.c =================================================================== --- trunk/toolkits/basemap/src/pj_release.c 2007-12-27 13:05:41 UTC (rev 4793) +++ trunk/toolkits/basemap/src/pj_release.c 2007-12-28 19:44:55 UTC (rev 4794) @@ -2,7 +2,7 @@ #include <projects.h> -char const pj_release[]="Rel. 4.5.0, 22 Oct 2006"; +char const pj_release[]="Rel. 4.6.0, 21 Dec 2007"; const char *pj_get_release() Modified: trunk/toolkits/basemap/src/pj_transform.c =================================================================== --- trunk/toolkits/basemap/src/pj_transform.c 2007-12-27 13:05:41 UTC (rev 4793) +++ trunk/toolkits/basemap/src/pj_transform.c 2007-12-28 19:44:55 UTC (rev 4794) @@ -1,5 +1,5 @@ /****************************************************************************** - * $Id: pj_transform.c,v 1.20 2006/10/12 21:04:39 fwarmerdam Exp $ + * $Id: pj_transform.c,v 1.24 2007/12/03 15:48:20 fwarmerdam Exp $ * * Project: PROJ.4 * Purpose: Perform overall coordinate system to coordinate system @@ -30,6 +30,24 @@ ****************************************************************************** * * $Log: pj_transform.c,v $ + * Revision 1.24 2007/12/03 15:48:20 fwarmerdam + * Improve WGS84 ES precision to avoid unnecesary transformation (#1531) + * + * Revision 1.23 2007/11/26 00:21:59 fwarmerdam + * Modified PJ structure to hold a_orig, es_orig, ellipsoid definition before + * adjustment for spherical projections. + * Modified pj_datum_transform() to use the original ellipsoid parameters, + * not the ones adjusted for spherical projections. + * Modified pj_datum_transform() to not attempt any datum shift via + * geocentric coordinates if the source *or* destination are raw ellipsoids + * (ie. PJD_UNKNOWN). All per PROJ bug #1602, GDAL bug #2025. + * + * Revision 1.22 2007/09/11 20:32:25 fwarmerdam + * mark the transient error array const + * + * Revision 1.21 2007/09/11 20:19:36 fwarmerdam + * avoid use of static variables to make reentrant + * * Revision 1.20 2006/10/12 21:04:39 fwarmerdam * Added experimental +lon_wrap argument to set a "center point" for * longitude wrapping of longitude values coming out of pj_transform(). @@ -110,14 +128,14 @@ #include <math.h> #include "geocent.h" -PJ_CVSID("$Id: pj_transform.c,v 1.20 2006/10/12 21:04:39 fwarmerdam Exp $"); +PJ_CVSID("$Id: pj_transform.c,v 1.24 2007/12/03 15:48:20 fwarmerdam Exp $"); #ifndef SRS_WGS84_SEMIMAJOR #define SRS_WGS84_SEMIMAJOR 6378137.0 #endif #ifndef SRS_WGS84_ESQUARED -#define SRS_WGS84_ESQUARED 0.006694379990 +#define SRS_WGS84_ESQUARED 0.0066943799901413165 #endif #define Dx_BF (defn->datum_params[0]) @@ -139,7 +157,7 @@ ** list or something, but while experimenting with it this should be fine. */ -static int transient_error[45] = { +static const int transient_error[45] = { /* 0 1 2 3 4 5 6 7 8 9 */ /* 0 to 9 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 10 to 19 */ 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, @@ -191,7 +209,7 @@ } } - if( pj_geocentric_to_geodetic( srcdefn->a, srcdefn->es, + if( pj_geocentric_to_geodetic( srcdefn->a_orig, srcdefn->es_orig, point_count, point_offset, x, y, z ) != 0) return pj_errno; @@ -288,7 +306,7 @@ return PJD_ERR_GEOCENTRIC; } - pj_geodetic_to_geocentric( dstdefn->a, dstdefn->es, + pj_geodetic_to_geocentric( dstdefn->a_orig, dstdefn->es_orig, point_count, point_offset, x, y, z ); if( dstdefn->fr_meter != 1.0 ) @@ -372,6 +390,7 @@ { double b; int i; + GeocentricInfo gi; pj_errno = 0; @@ -380,7 +399,7 @@ else b = a * sqrt(1-es); - if( pj_Set_Geocentric_Parameters( a, b ) != 0 ) + if( pj_Set_Geocentric_Parameters( &gi, a, b ) != 0 ) { pj_errno = PJD_ERR_GEOCENTRIC; return pj_errno; @@ -393,7 +412,7 @@ if( x[io] == HUGE_VAL ) continue; - if( pj_Convert_Geodetic_To_Geocentric( y[io], x[io], z[io], + if( pj_Convert_Geodetic_To_Geocentric( &gi, y[io], x[io], z[io], x+io, y+io, z+io ) != 0 ) { pj_errno = -14; @@ -416,13 +435,14 @@ { double b; int i; + GeocentricInfo gi; if( es == 0.0 ) b = a; else b = a * sqrt(1-es); - if( pj_Set_Geocentric_Parameters( a, b ) != 0 ) + if( pj_Set_Geocentric_Parameters( &gi, a, b ) != 0 ) { pj_errno = PJD_ERR_GEOCENTRIC; return pj_errno; @@ -435,8 +455,8 @@ if( x[io] == HUGE_VAL ) continue; - pj_Convert_Geocentric_To_Geodetic( x[io], y[io], z[io], - y+io, x+io, z+io ); + pj_Convert_Geocentric_To_Geodetic( &gi, x[io], y[io], z[io], + y+io, x+io, z+io ); } return 0; @@ -456,8 +476,8 @@ { return 0; } - else if( srcdefn->a != dstdefn->a - || ABS(srcdefn->es - dstdefn->es) > 0.000000000050 ) + else if( srcdefn->a_orig != dstdefn->a_orig + || ABS(srcdefn->es_orig - dstdefn->es_orig) > 0.000000000050 ) { /* the tolerence for es is to ensure that GRS80 and WGS84 are considered identical */ @@ -590,6 +610,10 @@ /************************************************************************/ /* pj_datum_transform() */ +/* */ +/* The input should be long/lat/z coordinates in radians in the */ +/* source datum, and the output should be long/lat/z */ +/* coordinates in radians in the destination datum. */ /************************************************************************/ int pj_datum_transform( PJ *srcdefn, PJ *dstdefn, @@ -603,16 +627,26 @@ pj_errno = 0; /* -------------------------------------------------------------------- */ +/* We cannot do any meaningful datum transformation if either */ +/* the source or destination are of an unknown datum type */ +/* (ie. only a +ellps declaration, no +datum). This is new */ +/* behavior for PROJ 4.6.0. */ +/* -------------------------------------------------------------------- */ + if( srcdefn->datum_type == PJD_UNKNOWN + || dstdefn->datum_type == PJD_UNKNOWN ) + return 0; + +/* -------------------------------------------------------------------- */ /* Short cut if the datums are identical. */ /* -------------------------------------------------------------------- */ if( pj_compare_datums( srcdefn, dstdefn ) ) return 0; - src_a = srcdefn->a; - src_es = srcdefn->es; + src_a = srcdefn->a_orig; + src_es = srcdefn->es_orig; - dst_a = dstdefn->a; - dst_es = dstdefn->es; + dst_a = dstdefn->a_orig; + dst_es = dstdefn->es_orig; /* -------------------------------------------------------------------- */ /* Create a temporary Z array if one is not provided. */ Modified: trunk/toolkits/basemap/src/pj_utils.c =================================================================== --- trunk/toolkits/basemap/src/pj_utils.c 2007-12-27 13:05:41 UTC (rev 4793) +++ trunk/toolkits/basemap/src/pj_utils.c 2007-12-28 19:44:55 UTC (rev 4794) @@ -1,5 +1,5 @@ /****************************************************************************** - * $Id: pj_utils.c,v 1.4 2005/07/06 14:04:09 fwarmerdam Exp $ + * $Id: pj_utils.c,v 1.5 2007/03/12 14:05:35 fwarmerdam Exp $ * * Project: PROJ.4 * Purpose: Some utility functions we don't want to bother putting in @@ -29,6 +29,9 @@ ****************************************************************************** * * $Log: pj_utils.c,v $ + * Revision 1.5 2007/03/12 14:05:35 fwarmerdam + * Removed duplicate towgs84 definition code. + * * Revision 1.4 2005/07/06 14:04:09 fwarmerdam * Improved precision of es encoding for pj_latlong_from_proj() per: * http://bugzilla.remotesensing.org/show_bug.cgi?id=881 @@ -135,10 +138,6 @@ sprintf( defn+strlen(defn), " +towgs84=%s", pj_param(pj_in->params,"stowgs84").s ); - if( pj_param(pj_in->params, "ttowgs84").i ) - sprintf( defn+strlen(defn), " +towgs84=%s", - pj_param(pj_in->params,"stowgs84").s ); - if( pj_param(pj_in->params, "tnadgrids").i ) sprintf( defn+strlen(defn), " +nadgrids=%s", pj_param(pj_in->params,"snadgrids").s ); Modified: trunk/toolkits/basemap/src/proj_api.h =================================================================== --- trunk/toolkits/basemap/src/proj_api.h 2007-12-27 13:05:41 UTC (rev 4793) +++ trunk/toolkits/basemap/src/proj_api.h 2007-12-28 19:44:55 UTC (rev 4794) @@ -28,6 +28,12 @@ ****************************************************************************** * * $Log: proj_api.h,v $ + * Revision 1.16 2007/11/29 21:07:49 fwarmerdam + * prepare for 4.6.0 release + * + * Revision 1.15 2007/08/20 13:40:06 fwarmerdam + * avoid warnings in c++ for some prototypes + * * Revision 1.14 2006/04/20 04:19:59 fwarmerdam * updated version * @@ -86,7 +92,7 @@ #endif /* Try to update this every version! */ -#define PJ_VERSION 450 +#define PJ_VERSION 460 extern char const pj_release[]; /* global release id string */ @@ -126,7 +132,7 @@ int pj_apply_gridshift( const char *, int, long point_count, int point_offset, double *x, double *y, double *z ); -void pj_deallocate_grids(); +void pj_deallocate_grids(void); int pj_is_latlong(projPJ); int pj_is_geocent(projPJ); void pj_pr_list(projPJ); @@ -140,8 +146,8 @@ void *pj_malloc(size_t); void pj_dalloc(void *); char *pj_strerrno(int); -int *pj_get_errno_ref(); -const char *pj_get_release(); +int *pj_get_errno_ref(void); +const char *pj_get_release(void); #ifdef __cplusplus } Modified: trunk/toolkits/basemap/src/projects.h =================================================================== --- trunk/toolkits/basemap/src/projects.h 2007-12-27 13:05:41 UTC (rev 4793) +++ trunk/toolkits/basemap/src/projects.h 2007-12-28 19:44:55 UTC (rev 4794) @@ -28,6 +28,21 @@ ****************************************************************************** * * $Log: projects.h,v $ + * Revision 1.27 2007/11/26 00:21:59 fwarmerdam + * Modified PJ structure to hold a_orig, es_orig, ellipsoid definition before + * adjustment for spherical projections. + * Modified pj_datum_transform() to use the original ellipsoid parameters, + * not the ones adjusted for spherical projections. + * Modified pj_datum_transform() to not attempt any datum shift via + * geocentric coordinates if the source *or* destination are raw ellipsoids + * (ie. PJD_UNKNOWN). All per PROJ bug #1602, GDAL bug #2025. + * + * Revision 1.26 2007/03/11 17:03:18 fwarmerdam + * support drive letter prefixes on win32 and related fixes (bug 1499) + * + * Revision 1.25 2006/11/17 22:16:30 mloskot + * Uploaded PROJ.4 port for Windows CE. + * * Revision 1.24 2006/10/18 04:34:03 fwarmerdam * added mlist functions from libproj4 * @@ -149,6 +164,15 @@ extern double hypot(double, double); #endif +#ifdef _WIN32_WCE +# include <wce_stdlib.h> +# include <wce_stdio.h> +# define rewind wceex_rewind +# define getenv wceex_getenv +# define strdup _strdup +# define hypot _hypot +#endif + /* some useful constants */ #define HALFPI 1.5707963267948966 #define FORTPI 0.78539816339744833 @@ -164,8 +188,17 @@ #define ID_TAG_MAX 50 #endif +/* Use WIN32 as a standard windows 32 bit declaration */ +#if defined(_WIN32) && !defined(WIN32) && !defined(_WIN32_WCE) +# define WIN32 +#endif + +#if defined(_WINDOWS) && !defined(WIN32) && !defined(_WIN32_WCE) +# define WIN32 +#endif + /* directory delimiter for DOS support */ -#ifdef DOS +#ifdef WIN32 #define DIR_CHAR '\\' #else #define DIR_CHAR '/' @@ -265,8 +298,10 @@ int is_geocent; /* proj=geocent ... not really a projection at all */ double a, /* major axis or radius if es==0 */ + a_orig, /* major axis before any +proj related adjustment */ + es, /* e ^ 2 */ + es_orig, /* es before any +proj related adjustment */ e, /* eccentricity */ - es, /* e ^ 2 */ ra, /* 1/A */ one_es, /* 1 - e^2 */ rone_es, /* 1/one_es */ @@ -274,7 +309,7 @@ x0, y0, /* easting and northing */ k0, /* general scaling factor */ to_meter, fr_meter; /* cartesian scaling */ - + int datum_type; /* PJD_UNKNOWN/3PARAM/7PARAM/GRIDSHIFT/WGS84 */ double datum_params[7]; double from_greenwich; /* prime meridian offset (in radians) */ Modified: trunk/toolkits/basemap/src/rtodms.c =================================================================== --- trunk/toolkits/basemap/src/rtodms.c 2007-12-27 13:05:41 UTC (rev 4793) +++ trunk/toolkits/basemap/src/rtodms.c 2007-12-28 19:44:55 UTC (rev 4794) @@ -53,7 +53,9 @@ sec = fmod(r / RES, 60.); r = floor(r / RES60); min = fmod(r, 60.); - deg = r / 60.; + r = floor(r / 60.); + deg = r; + if (dolong) (void)sprintf(ss,format,deg,min,sec,sign); else if (sec) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |