[Liblas-commits] r1040 - in trunk: include/liblas src

liblas-commits at liblas.org liblas-commits at liblas.org
Tue Feb 17 14:19:31 EST 2009


Author: hobu
Date: Tue Feb 17 14:19:31 2009
New Revision: 1040
URL: http://liblas.org/changeset/1040

Log:
allow building without libgeotiff or GDAL

Modified:
   trunk/include/liblas/lassrs.hpp
   trunk/src/lassrs.cpp

Modified: trunk/include/liblas/lassrs.hpp
==============================================================================
--- trunk/include/liblas/lassrs.hpp	(original)
+++ trunk/include/liblas/lassrs.hpp	Tue Feb 17 14:19:31 2009
@@ -80,6 +80,12 @@
 #include <cstdlib> // std::size_t
 #include <string>
 
+// Fake out the compiler if we don't have libgeotiff
+#ifndef HAVE_LIBGEOTIFF
+    typedef struct GTIFS * GTIF;
+    typedef struct ST_TIFFS * ST_TIFF;
+#endif
+
 namespace liblas {
 
 /// Spatial Reference System container for libLAS
@@ -96,11 +102,9 @@
     LASSRS& operator=(LASSRS const& rhs);
     
 
-#ifdef HAVE_LIBGEOTIFF
     /// Returns a pointer to the internal GTIF*.  Only available if 
     /// you have libgeotiff linked in.
     const GTIF* GetGTIF();
-#endif
 
     /// Reset the VLRs of the LASSRS using the existing GTIF* and ST_TIF*
     /// Until this method is called, 
@@ -146,10 +150,10 @@
     
 
 private:
-  
+
     GTIF* m_gtiff;
     ST_TIFF* m_tiff;
-  
+
     std::vector<LASVLR> m_vlrs;
 
 protected:

Modified: trunk/src/lassrs.cpp
==============================================================================
--- trunk/src/lassrs.cpp	(original)
+++ trunk/src/lassrs.cpp	Tue Feb 17 14:19:31 2009
@@ -48,6 +48,7 @@
 LASSRS::LASSRS() 
 
 {
+
     m_tiff = NULL;
     m_gtiff = NULL;
 }
@@ -129,6 +130,12 @@
 void LASSRS::ResetVLRs()
 {
 
+    m_vlrs.clear();
+
+#ifndef HAVE_LIBGEOTIFF
+    return;
+#else
+
     int ret = 0;
     short* kdata = NULL;
     short kvalue = 0;
@@ -138,8 +145,6 @@
     int dcount = 0;
     int ktype = 0;
     int kcount = 0;
-
-    m_vlrs.clear();
     
     if (!m_tiff) throw std::invalid_argument("m_tiff was null");
     if (!m_gtiff) throw std::invalid_argument("m_gtiff was null");
@@ -245,12 +250,16 @@
         record.SetData(data);
         m_vlrs.push_back(record);
 
-    }    
+    }
+#endif // ndef HAVE_LIBGEOTIFF
+
 }
 
 const GTIF* LASSRS::GetGTIF(){
 
+#ifdef HAVE_LIBGEOTIFF
     // if we're already set, don't overwrite
+    // FIXME this is a bug.
     if (m_gtiff) return m_gtiff;
 
     m_tiff = ST_Create();
@@ -289,6 +298,9 @@
         m_tiff = NULL;
         return NULL;
     }
+#endif
+
+    return NULL;
 }
 
 
@@ -351,7 +363,10 @@
 
 #endif
 
+// if we have libgeotiff but not GDAL, we'll use the 
+// simple method in libgeotiff
 #ifdef HAVE_LIBGEOTIFF
+#ifndef HAVE_GDAL
     GTIFDefn defn;
 
     if (m_gtiff && GTIFGetDefn(m_gtiff, &defn)) 
@@ -363,6 +378,7 @@
         return tmp;
     }
 #endif
+#endif
 
 // If we have neither GDAL nor proj.4, we can't do squat
     return std::string("");


More information about the Liblas-commits mailing list