[Liblas-commits] hg: update gt_wkt_srs.cpp machinery to match GDAL 1.8

liblas-commits at liblas.org liblas-commits at liblas.org
Fri Jan 28 11:11:43 EST 2011


details:   http://hg.liblas.orghg/rev/a1e44c4f15f1
changeset: 2834:a1e44c4f15f1
user:      warmerdam at pobox.com
date:      Fri Jan 28 11:11:16 2011 -0500
description:
update gt_wkt_srs.cpp machinery to match GDAL 1.8

diffstat:

 src/gt_citation.h         |  50 +++++++++++++++++++++++++++++++
 src/gt_wkt_srs.cpp        |  74 +++++++++++++++++++++++++---------------------
 src/gt_wkt_srs.h          |  46 +++++++++++++++++++++++++++++
 src/gt_wkt_srs_for_gdal.h |  48 ++++++++++++++++++++++++++++++
 src/tifvsi.h              |  39 ++++++++++++++++++++++++
 5 files changed, 223 insertions(+), 34 deletions(-)

diffs (truncated from 339 to 300 lines):

diff -r 9c1c96b61f0e -r a1e44c4f15f1 src/gt_citation.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/gt_citation.h	Fri Jan 28 11:11:16 2011 -0500
@@ -0,0 +1,50 @@
+/******************************************************************************
+ * $Id: gt_citation.h 21102 2010-11-08 20:47:38Z rouault $
+ *
+ * Project:  GeoTIFF Driver
+ * Purpose:  Implements special parsing of Imagine citation strings, and
+ *           to encode PE String info in citation fields as needed.
+ * Author:   Xiuguang Zhou (ESRI)
+ *
+ ******************************************************************************
+ * Copyright (c) 2008, Xiuguang Zhou (ESRI)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ ****************************************************************************/
+
+#ifndef GT_CITATION_H_INCLUDED
+#define GT_CITATION_H_INCLUDED
+
+#include "cpl_port.h"
+#include "geo_normalize.h"
+#include "ogr_spatialref.h"
+
+void SetLinearUnitCitation(GTIF* psGTIF, char* pszLinearUOMName);
+void SetGeogCSCitation(GTIF * psGTIF, OGRSpatialReference *poSRS, char* angUnitName, int nDatum, short nSpheroid);
+OGRBoolean SetCitationToSRS(GTIF* hGTIF, char* szCTString, int nCTStringLen,
+                            geokey_t geoKey, OGRSpatialReference* poSRS, OGRBoolean* linearUnitIsSet);
+void GetGeogCSFromCitation(char* szGCSName, int nGCSName,
+                           geokey_t geoKey,
+                          char  **ppszGeogName,
+                          char  **ppszDatumName,
+                          char  **ppszPMName,
+                          char  **ppszSpheroidName,
+                          char  **ppszAngularUnits);
+
+#endif // GT_CITATION_H_INCLUDED
diff -r 9c1c96b61f0e -r a1e44c4f15f1 src/gt_wkt_srs.cpp
--- a/src/gt_wkt_srs.cpp	Thu Jan 27 14:31:06 2011 -0600
+++ b/src/gt_wkt_srs.cpp	Fri Jan 28 11:11:16 2011 -0500
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id$
+ * $Id: gt_wkt_srs.cpp 21448 2011-01-09 18:28:40Z rouault $
  *
  * Project:  GeoTIFF Driver
  * Purpose:  Implements translation between GeoTIFF normalized projection
@@ -30,24 +30,38 @@
  * DEALINGS IN THE SOFTWARE.
  ****************************************************************************/
 
-#include "cpl_port.h"
 #include "cpl_serv.h"
 #include "geo_tiffp.h"
 #define CPL_ERROR_H_INCLUDED
 
-#include "geo_normalize.h"
 #include "geovalues.h"
 #include "ogr_spatialref.h"
 #include "gdal.h"
 #include "xtiffio.h"
 #include "cpl_multiproc.h"
+#include "tifvsi.h"
+#include "gt_wkt_srs.h"
+#include "gt_wkt_srs_for_gdal.h"
+#include "gt_citation.h"
 
-CPL_CVSID("$Id$")
+CPL_CVSID("$Id: gt_wkt_srs.cpp 21448 2011-01-09 18:28:40Z rouault $")
 
 CPL_C_START
-int CPL_DLL VSIFCloseL( FILE * );
+#ifndef CPL_SERV_H_INTERNAL
+/* Make VSIL_STRICT_ENFORCE active in DEBUG builds */
+#ifdef DEBUG
+#define VSIL_STRICT_ENFORCE
+#endif
+
+#ifdef VSIL_STRICT_ENFORCE
+typedef struct _VSILFILE VSILFILE;
+#else
+typedef FILE VSILFILE;
+#endif
+
+int CPL_DLL VSIFCloseL( VSILFILE * );
 int CPL_DLL VSIUnlink( const char * );
-FILE CPL_DLL *VSIFileFromMemBuffer( const char *pszFilename, 
+VSILFILE CPL_DLL *VSIFileFromMemBuffer( const char *pszFilename,
                                     GByte *pabyData, 
                                     GUIntBig nDataLength,
                                     int bTakeOwnership );
@@ -55,26 +69,30 @@
                                     GUIntBig *pnDataLength, 
                                     int bUnlinkAndSeize );
 
-char CPL_DLL *  GTIFGetOGISDefn( GTIF *, GTIFDefn * );
-int  CPL_DLL   GTIFSetFromOGISDefn( GTIF *, const char * );
-
-CPLErr CPL_DLL GTIFMemBufFromWkt( const char *pszWKT, 
-                                  const double *padfGeoTransform,
-                                  int nGCPCount, const GDAL_GCP *pasGCPList,
-                                  int *pnSize, unsigned char **ppabyBuffer );
-CPLErr CPL_DLL GTIFWktFromMemBuf( int nSize, unsigned char *pabyBuffer, 
-                          char **ppszWKT, double *padfGeoTransform,
-                          int *pnGCPCount, GDAL_GCP **ppasGCPList );
+/* Those stuff are redefined in external libgeotiff cpl_serv.h */
+/* as macros. Let's use GDAL functions instead */
+/* E.Rouault : I'm wondering why we just don't #define CPL_SERV_H_INCLUDED */
+/* at the beginning of this file to avoid cpl_serv.h to be used at all ??? */
 
 #undef CSVReadParseLine
 char CPL_DLL  **CSVReadParseLine( FILE *fp);
 #undef CSLDestroy
 void CPL_DLL CPL_STDCALL CSLDestroy(char **papszStrList);
+#undef VSIFree
+void CPL_DLL    VSIFree( void * );
+#undef CPLFree
+#define CPLFree VSIFree
+#undef CPLMalloc
+void CPL_DLL *CPLMalloc( size_t );
+#undef CPLCalloc
+void CPL_DLL *CPLCalloc( size_t, size_t );
+#undef CPLStrdup
+char CPL_DLL *CPLStrdup( const char * );
+
+#endif /* CPL_SERV_H_INTERNAL */
 
 CPL_C_END
 
-TIFF* VSI_TIFFOpen(const char* name, const char* mode);
-
 static const char *papszDatumEquiv[] =
 {
     "Militar_Geographische_Institut",
@@ -95,18 +113,6 @@
 # define CT_CylindricalEqualArea 28
 #endif
 
-void SetLinearUnitCitation(GTIF* psGTIF, char* pszLinearUOMName);
-void SetGeogCSCitation(GTIF * psGTIF, OGRSpatialReference *poSRS, char* angUnitName, int nDatum, short nSpheroid);
-OGRBoolean SetCitationToSRS(GTIF* hGTIF, char* szCTString, int nCTStringLen,
-                            geokey_t geoKey, OGRSpatialReference* poSRS, OGRBoolean* linearUnitIsSet);
-void GetGeogCSFromCitation(char* szGCSName, int nGCSName,
-                           geokey_t geoKey, 
-                          char	**ppszGeogName,
-                          char	**ppszDatumName,
-                          char	**ppszPMName,
-                          char	**ppszSpheroidName,
-                          char	**ppszAngularUnits);
-
 /************************************************************************/
 /*                       GTIFToCPLRecyleString()                        */
 /*                                                                      */
@@ -196,11 +202,11 @@
 /************************************************************************/
 
 /* For example:
-   GTCitationGeoKey (Ascii,215): "IMAGINE GeoTIFF Support\nCopyright 1991 - 2001 by ERDAS, Inc. All Rights Reserved\n@(#)$RCSfile$ $Revision$ $Date$\nProjection Name = UTM\nUnits = meters\nGeoTIFF Units = meters"
+   GTCitationGeoKey (Ascii,215): "IMAGINE GeoTIFF Support\nCopyright 1991 - 2001 by ERDAS, Inc. All Rights Reserved\n@(#)$RCSfile$ $Revision: 21448 $ $Date: 2011-01-09 13:28:40 -0500 (Sun, 09 Jan 2011) $\nProjection Name = UTM\nUnits = meters\nGeoTIFF Units = meters"
 
-   GeogCitationGeoKey (Ascii,267): "IMAGINE GeoTIFF Support\nCopyright 1991 - 2001 by ERDAS, Inc. All Rights Reserved\n@(#)$RCSfile$ $Revision$ $Date$\nUnable to match Ellipsoid (Datum) to a GeographicTypeGeoKey value\nEllipsoid = Clarke 1866\nDatum = NAD27 (CONUS)"
+   GeogCitationGeoKey (Ascii,267): "IMAGINE GeoTIFF Support\nCopyright 1991 - 2001 by ERDAS, Inc. All Rights Reserved\n@(#)$RCSfile$ $Revision: 21448 $ $Date: 2011-01-09 13:28:40 -0500 (Sun, 09 Jan 2011) $\nUnable to match Ellipsoid (Datum) to a GeographicTypeGeoKey value\nEllipsoid = Clarke 1866\nDatum = NAD27 (CONUS)"
 
-   PCSCitationGeoKey (Ascii,214): "IMAGINE GeoTIFF Support\nCopyright 1991 - 2001 by ERDAS, Inc. All Rights Reserved\n@(#)$RCSfile$ $Revision$ $Date$\nUTM Zone 10N\nEllipsoid = Clarke 1866\nDatum = NAD27 (CONUS)"
+   PCSCitationGeoKey (Ascii,214): "IMAGINE GeoTIFF Support\nCopyright 1991 - 2001 by ERDAS, Inc. All Rights Reserved\n@(#)$RCSfile$ $Revision: 21448 $ $Date: 2011-01-09 13:28:40 -0500 (Sun, 09 Jan 2011) $\nUTM Zone 10N\nEllipsoid = Clarke 1866\nDatum = NAD27 (CONUS)"
  
 */
 
@@ -2047,7 +2053,7 @@
 /* -------------------------------------------------------------------- */
 /*      Create a memory file from the buffer.                           */
 /* -------------------------------------------------------------------- */
-    FILE *fp = VSIFileFromMemBuffer( szFilename, pabyBuffer, nSize, FALSE );
+    VSILFILE *fp = VSIFileFromMemBuffer( szFilename, pabyBuffer, nSize, FALSE );
     if( fp == NULL )
         return CE_Failure;
     VSIFCloseL( fp );
diff -r 9c1c96b61f0e -r a1e44c4f15f1 src/gt_wkt_srs.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/gt_wkt_srs.h	Fri Jan 28 11:11:16 2011 -0500
@@ -0,0 +1,46 @@
+/******************************************************************************
+ * $Id: gt_wkt_srs.h 21595 2011-01-28 04:21:40Z warmerdam $
+ *
+ * Project:  GeoTIFF Driver
+ * Purpose:  Implements translation between GeoTIFF normalized projection
+ *           definitions and OpenGIS WKT SRS format.  This code is
+ *           deliberately GDAL free, and it is intended to be moved into
+ *           libgeotiff someday if possible.
+ * Author:   Even Rouault
+ *
+ ******************************************************************************
+ * Copyright (c) 2010, Even Rouault
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ ****************************************************************************/
+
+#ifndef GT_WKT_SRS_H_INCLUDED
+#define GT_WKT_SRS_H_INCLUDED
+
+#include "cpl_port.h"
+
+#include "geotiff.h"
+#include "geo_normalize.h"
+
+CPL_C_START
+char CPL_DLL *  GTIFGetOGISDefn( GTIF *, GTIFDefn * );
+int  CPL_DLL   GTIFSetFromOGISDefn( GTIF *, const char * );
+CPL_C_END;
+
+#endif // GT_WKT_SRS_H_INCLUDED
diff -r 9c1c96b61f0e -r a1e44c4f15f1 src/gt_wkt_srs_for_gdal.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/gt_wkt_srs_for_gdal.h	Fri Jan 28 11:11:16 2011 -0500
@@ -0,0 +1,48 @@
+/******************************************************************************
+ * $Id: gt_wkt_srs_for_gdal.h 21595 2011-01-28 04:21:40Z warmerdam $
+ *
+ * Project:  GeoTIFF Driver
+ * Purpose:  Read/Write in-memory GeoTIFF file
+ * Author:   Even Rouault
+ *
+ ******************************************************************************
+ * Copyright (c) 2010, Even Rouault
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ ****************************************************************************/
+
+#ifndef GT_WKT_SRS_FOR_GDAL_H_INCLUDED
+#define GT_WKT_SRS_FOR_GDAL_H_INCLUDED
+
+#include "cpl_port.h"
+#include "gdal.h"
+
+CPL_C_START
+
+CPLErr CPL_DLL GTIFMemBufFromWkt( const char *pszWKT,
+                                  const double *padfGeoTransform,
+                                  int nGCPCount, const GDAL_GCP *pasGCPList,
+                                  int *pnSize, unsigned char **ppabyBuffer );
+CPLErr CPL_DLL GTIFWktFromMemBuf( int nSize, unsigned char *pabyBuffer,
+                          char **ppszWKT, double *padfGeoTransform,
+                          int *pnGCPCount, GDAL_GCP **ppasGCPList );
+
+CPL_C_END;
+
+#endif // GT_WKT_SRS_FOR_GDAL_H_INCLUDED
diff -r 9c1c96b61f0e -r a1e44c4f15f1 src/tifvsi.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/tifvsi.h	Fri Jan 28 11:11:16 2011 -0500
@@ -0,0 +1,39 @@


More information about the Liblas-commits mailing list