[Liblas-commits] hg: #ifdef newish GDAL out of the way

liblas-commits at liblas.org liblas-commits at liblas.org
Tue Mar 15 13:52:37 EDT 2011


details:   http://hg.liblas.orghg/rev/cc1d6f849e62
changeset: 2901:cc1d6f849e62
user:      Howard Butler <hobu.inc at gmail.com>
date:      Tue Mar 15 12:52:28 2011 -0500
description:
#ifdef newish GDAL out of the way

diffstat:

 src/gt_citation.cpp |   8 +++++++-
 src/gt_wkt_srs.cpp  |  18 +++++++++++++++---
 2 files changed, 22 insertions(+), 4 deletions(-)

diffs (112 lines):

diff -r 75811ed2ed8e -r cc1d6f849e62 src/gt_citation.cpp
--- a/src/gt_citation.cpp	Thu Mar 10 22:59:22 2011 -0500
+++ b/src/gt_citation.cpp	Tue Mar 15 12:52:28 2011 -0500
@@ -34,7 +34,7 @@
 #include "geovalues.h"
 #include "gt_citation.h"
 
-CPL_CVSID("$Id: gt_citation.cpp 21848 2011-02-25 16:41:38Z warmerdam $");
+CPL_CVSID("$Id: gt_citation.cpp 21848 2011-02-25 16:41:38Z warmerdam $")
 
 static const char *apszUnitMap[] = {
     "meters", "1.0",
@@ -575,6 +575,7 @@
       char CSName[128];
       strncpy(CSName, pStr, pReturn-pStr);
       CSName[pReturn-pStr] = '\0';
+#if GDAL_VERSION_NUM >=1900
       if( poSRS->ImportFromESRIStatePlaneWKT(0, NULL, NULL, 32767, CSName) == OGRERR_NONE )
       {
         // for some erdas citation keys, the state plane CS name is incomplete, the unit check is necessary.
@@ -606,6 +607,7 @@
         if (done)
           return TRUE;
       }
+#endif
     }
   }
   if( !hasUnits )
@@ -650,8 +652,10 @@
           strcpy(nad, "NAD83");
         else if( strstr(szCTString, "NAD27") || strstr(szCTString, "NAD = 27") )
           strcpy(nad, "NAD27");
+#if GDAL_VERSION_NUM >=1900
         if( poSRS->ImportFromESRIStatePlaneWKT(statePlaneZone, (const char*)nad, (const char*)units, psDefn->PCS) == OGRERR_NONE )
           return TRUE;
+#endif
       }
       else if( pcsName && (pStr = strstr(pcsName, "UTM Zone ")) != NULL )
         CheckUTM( psDefn, szCTString );
@@ -660,8 +664,10 @@
   /* check state plane again to see if a pe string is available */
   if( psDefn->PCS != KvUserDefined )
   {
+#if GDAL_VERSION_NUM >=1900
     if( poSRS->ImportFromESRIStatePlaneWKT(0, NULL, (const char*)units, psDefn->PCS) == OGRERR_NONE )
       return TRUE;
+#endif
   }
   return FALSE;
 }
diff -r 75811ed2ed8e -r cc1d6f849e62 src/gt_wkt_srs.cpp
--- a/src/gt_wkt_srs.cpp	Thu Mar 10 22:59:22 2011 -0500
+++ b/src/gt_wkt_srs.cpp	Tue Mar 15 12:52:28 2011 -0500
@@ -338,8 +338,9 @@
             GTIFKeyGet( hGTIF, GeogCitationGeoKey, szName, 
                         0, sizeof(szName) );
 
+#if GDAL_VERSION_NUM >=1900
         oSRS.SetGeocCS( szName );
-
+#endif
         char	*pszUnitsName = NULL;
           
         GTIFGetUOMLengthInfo( psDefn->UOMLength, &pszUnitsName, NULL );
@@ -1180,11 +1181,13 @@
                    ModelTypeProjected);
         GTIFKeySet(psGTIF, ProjectedCSTypeGeoKey, TYPE_SHORT, 1, nPCS );
     }
+#if GDAL_VERSION_NUM >=1900
     else if( poSRS->IsGeocentric() )
     {
         GTIFKeySet(psGTIF, GTModelTypeGeoKey, TYPE_SHORT, 1, 
                    ModelTypeGeocentric );
     }
+#endif
     else if( pszProjection == NULL )
     {
         if( poSRS->IsGeographic() )
@@ -1949,6 +1952,8 @@
 /* -------------------------------------------------------------------- */
 /*      Write linear units information.                                 */
 /* -------------------------------------------------------------------- */
+#if GDAL_VERSION_NUM >=1900
+
     if( poSRS->IsGeocentric() )
     {
         GTIFKeySet(psGTIF, GeogLinearUnitsGeoKey, TYPE_SHORT, 1, 
@@ -1957,7 +1962,9 @@
             GTIFKeySet( psGTIF, GeogLinearUnitSizeGeoKey, TYPE_DOUBLE, 1, 
                         dfLinearUOM);
     }
-    else if( !poSRS->IsGeographic() )
+    else 
+#endif
+    if( !poSRS->IsGeographic() )
     {
         GTIFKeySet(psGTIF, ProjLinearUnitsGeoKey, TYPE_SHORT, 1, 
                    nUOMLengthCode );
@@ -1994,7 +2001,12 @@
 /* -------------------------------------------------------------------- */
     if( poSRS->GetRoot() != NULL
         && poSRS->GetRoot()->GetChild(0) != NULL 
-        && (poSRS->IsProjected() || poSRS->IsLocal() || poSRS->IsGeocentric()) )
+        && (poSRS->IsProjected() || poSRS->IsLocal()  
+
+#if GDAL_VERSION_NUM >=1900
+        || poSRS->IsGeocentric()
+#endif        
+        ) )
     {
         GTIFKeySet( psGTIF, GTCitationGeoKey, TYPE_ASCII, 0, 
                     poSRS->GetRoot()->GetChild(0)->GetValue() );


More information about the Liblas-commits mailing list