[Liblas-commits] hg-main-tree: start of srs work

liblas-commits at liblas.org liblas-commits at liblas.org
Fri Apr 22 11:47:52 EDT 2011


details:   http://hg.libpc.orghg-main-tree/rev/081a502de5fd
changeset: 617:081a502de5fd
user:      Michael P. Gerlek <mpg at flaxen.com>
date:      Fri Apr 22 08:43:47 2011 -0700
description:
start of srs work
Subject: hg-main-tree: merge

details:   http://hg.libpc.orghg-main-tree/rev/71bbf3198a88
changeset: 618:71bbf3198a88
user:      Michael P. Gerlek <mpg at flaxen.com>
date:      Fri Apr 22 08:46:29 2011 -0700
description:
merge
Subject: hg-main-tree: move compare_no_case to Utils

details:   http://hg.libpc.orghg-main-tree/rev/ef67b7003c76
changeset: 619:ef67b7003c76
user:      Michael P. Gerlek <mpg at flaxen.com>
date:      Fri Apr 22 08:47:39 2011 -0700
description:
move compare_no_case to Utils

diffstat:

 include/libpc/SpatialReference.hpp      |   156 ++--
 include/libpc/Utils.hpp                 |     8 +
 include/libpc/drivers/liblas/Reader.hpp |     6 +-
 include/libpc/drivers/oci/Common.hpp    |     8 -
 src/SpatialReference.cpp                |  1059 ++++++++++++++----------------
 src/Stage.cpp                           |     2 +-
 src/drivers/oci/Reader.cpp              |    24 +-
 src/drivers/oci/Schema.cpp              |    94 +-
 src/drivers/oci/Writer.cpp              |     4 +-
 test/unit/CMakeLists.txt                |     1 +
 test/unit/SpatialReferenceTest.cpp      |   323 +++++++++
 11 files changed, 966 insertions(+), 719 deletions(-)

diffs (truncated from 2091 to 300 lines):

diff -r 61902169d63b -r ef67b7003c76 include/libpc/SpatialReference.hpp
--- a/include/libpc/SpatialReference.hpp	Thu Apr 21 14:28:58 2011 -0700
+++ b/include/libpc/SpatialReference.hpp	Fri Apr 22 08:47:39 2011 -0700
@@ -37,54 +37,17 @@
 
 #include <libpc/libpc.hpp>
 
+// We have two modes: with GDAL and geotiff, SRS is enabled -- otherwise, it's disabled
+// we use one macro to simplify the control
+#if defined(LIBPC_HAVE_GDAL) && defined(LIBPC_HAVE_LIBGEOTIFF)
+#define LIBPC_SRS_ENABLED
+#endif
+
+#include <boost/property_tree/ptree.hpp>
+
 #include <string>
 #include <ostream>
 
-namespace libpc
-{
-
-class LIBPC_DLL SpatialReference
-{
-public:
-    SpatialReference();
-    SpatialReference(std::string wkt);
-    SpatialReference(const SpatialReference&);
-
-    SpatialReference& operator=(SpatialReference const& rhs);
-
-    bool operator==(SpatialReference const& rhs) const;
-
-    const std::string& getWKT() const;
-
-private:
-    // for now, we'll just fake it
-    std::string m_wkt;
-};
-
-
-std::ostream& operator<<(std::ostream& ostr, const SpatialReference& srs);
-
-
-} // namespace libpc
-
-#endif
-
-
-#if 0
-
-#include <liblas/detail/fwd.hpp>
-#include <liblas/detail/private_utility.hpp>
-#include <liblas/variablerecord.hpp>
-#include <liblas/exception.hpp>
-#include <liblas/capi/las_config.h>
-#include <liblas/export.hpp>
-#include <liblas/external/property_tree/ptree.hpp>
-
-// std
-#include <stdexcept> // std::out_of_range
-#include <cstdlib> // std::size_t
-#include <string>
-
 // Fake out the compiler if we don't have libgeotiff includes already
 #if !defined(__geotiff_h_)
 typedef struct GTIFS *GTIF;
@@ -93,10 +56,11 @@
 typedef struct ST_TIFFS *ST_TIFF;
 #endif
 
-namespace liblas {
 
-/// Spatial Reference System container for libLAS
-class LAS_DLL SpatialReference
+namespace libpc
+{
+
+class LIBPC_DLL SpatialReference
 {
 public:
     enum WKTModeFlag
@@ -105,11 +69,6 @@
         eCompoundOK = 2
     };
 
-    enum GeoVLRType
-    {
-        eGeoTIFF = 1,
-        eOGRWKT = 2
-    };
 
     /// Default constructor.
     SpatialReference();
@@ -118,9 +77,6 @@
     /// If libgeotiff is enabled, deallocates libtiff and libgeotiff objects used internally.
     ~SpatialReference();
 
-    /// Constructor creating SpatialReference instance from given Variable-Length Record.
-    SpatialReference(std::vector<VariableRecord> const& vlrs);
-
     /// Copy constryctor.
     SpatialReference(SpatialReference const& other);
 
@@ -186,6 +142,65 @@
     /// \param v - a string containing the Proj.4 string.
     void SetProj4(std::string const& v);
     
+    boost::property_tree::ptree GetPTree() const;    
+
+private:
+
+    // FIXME: Define as shared_ptr<GTIF> with custom deleter to get rid of bloated mem management, unsafe anyway --mloskot
+    GTIF*       m_gtiff;
+    ST_TIFF*    m_tiff;
+
+    std::string m_wkt;
+
+    std::string GetGTIFFText() const;
+
+};
+
+
+std::ostream& operator<<(std::ostream& ostr, const SpatialReference& srs);
+
+} // namespace libpc
+
+
+LIBPC_C_START
+#ifdef __geotiff_h_
+
+#ifdef GEO_NORMALIZE_H_INCLUDED
+char LIBPC_DLL * GTIFGetOGISDefn(GTIF*, GTIFDefn*);
+#endif
+
+int LIBPC_DLL GTIFSetFromOGISDefn(GTIF*, const char*);
+void SetLinearUnitCitation(GTIF* psGTIF, char* pszLinearUOMName);
+
+#ifdef _OGR_SRS_API_H_INCLUDED
+void SetGeogCSCitation(GTIF* psGTIF, OGRSpatialReference* poSRS, char* angUnitName, int nDatum, short nSpheroid);
+#endif // defined _OGR_SRS_API_H_INCLUDED
+
+#endif // defined __geotiff_h_
+LIBPC_C_END
+
+
+#endif
+
+
+#if 0
+#include <liblas/detail/fwd.hpp>
+#include <liblas/detail/private_utility.hpp>
+#include <liblas/variablerecord.hpp>
+#include <liblas/exception.hpp>
+#include <liblas/capi/las_config.h>
+#include <liblas/export.hpp>
+#include <liblas/external/property_tree/ptree.hpp>
+#include <stdexcept> // std::out_of_range
+#include <cstdlib> // std::size_t
+#include <string>
+
+    enum GeoVLRType
+    {
+        eGeoTIFF = 1,
+        eOGRWKT = 2
+    };
+
     /// Set the LASVLRs for the SpatialReference.  SetVLRs will only copy 
     /// VLR records that pertain to the GeoTIFF keys, and extraneous 
     /// VLR records will not be copied.
@@ -200,18 +215,8 @@
 
     void ClearVLRs( GeoVLRType eType );
 
-    liblas::property_tree::ptree GetPTree() const;    
-private:
-
-    // FIXME: Define as shared_ptr<GTIF> with custom deleter to get rid of bloated mem management, unsafe anyway --mloskot
-    GTIF*       m_gtiff;
-    ST_TIFF*    m_tiff;
-
-    std::string m_wkt;
-
     std::vector<VariableRecord> m_vlrs;
     bool IsGeoVLR(VariableRecord const& vlr) const;
-    std::string GetGTIFFText() const;
 
     /// Reset the VLRs of the SpatialReference using the existing GTIF* and ST_TIF*
     /// Until this method is called, 
@@ -219,24 +224,5 @@
     /// that it was first instantiated with.  SetWKT and SetProj4 can 
     /// be used to change the GTIF* 
     void ResetVLRs();
-};
-
-} // namespace liblas
-
-LAS_C_START
-#if defined(__geotiff_h_)
-#if defined(GEO_NORMALIZE_H_INCLUDED)
-char LAS_DLL * GTIFGetOGISDefn(GTIF*, GTIFDefn*);
-#endif
-
-int  LAS_DLL   GTIFSetFromOGISDefn(GTIF*, const char*);
-void SetLinearUnitCitation(GTIF* psGTIF, char* pszLinearUOMName);
-
-#if defined(_OGR_SRS_API_H_INCLUDED)
-void SetGeogCSCitation(GTIF* psGTIF, OGRSpatialReference* poSRS, char* angUnitName, int nDatum, short nSpheroid);
-#endif // defined _OGR_SRS_API_H_INCLUDED
-#endif // defined __geotiff_h_
-
-LAS_C_END
 
 #endif 
diff -r 61902169d63b -r ef67b7003c76 include/libpc/Utils.hpp
--- a/include/libpc/Utils.hpp	Thu Apr 21 14:28:58 2011 -0700
+++ b/include/libpc/Utils.hpp	Fri Apr 22 08:47:39 2011 -0700
@@ -192,6 +192,14 @@
     }
 };
 
+
+#ifdef LIBPC_COMPILER_MSVC
+#define compare_no_case(a,b,n)  _strnicmp( (a), (b), (n) )
+#else
+#define compare_no_case(a,b,n)  strncasecmp( (a), (b), (n) )
+#endif
+
+
 } // namespace libpc
 
 #endif
diff -r 61902169d63b -r ef67b7003c76 include/libpc/drivers/liblas/Reader.hpp
--- a/include/libpc/drivers/liblas/Reader.hpp	Thu Apr 21 14:28:58 2011 -0700
+++ b/include/libpc/drivers/liblas/Reader.hpp	Fri Apr 22 08:47:39 2011 -0700
@@ -68,8 +68,8 @@
     boost::uint8_t getVersionMajor() const;
     boost::uint8_t getVersionMinor() const;
 
-    int LiblasReader::getMetadataRecordCount() const;
-    const MetadataRecord& LiblasReader::getMetadataRecord(int index) const;
+    int getMetadataRecordCount() const;
+    const MetadataRecord& getMetadataRecord(int index) const;
 
     bool supportsIterator (StageIteratorType t) const
     {   
@@ -85,7 +85,7 @@
 private:
     void processExternalHeader(::liblas::Reader& externalReader);
     void registerFields(::liblas::Reader& externalReader);
-    MetadataRecord& LiblasReader::getMetadataRecordRef(int index);
+    MetadataRecord& getMetadataRecordRef(int index);
 
     std::string m_filename;
 
diff -r 61902169d63b -r ef67b7003c76 include/libpc/drivers/oci/Common.hpp
--- a/include/libpc/drivers/oci/Common.hpp	Thu Apr 21 14:28:58 2011 -0700
+++ b/include/libpc/drivers/oci/Common.hpp	Fri Apr 22 08:47:39 2011 -0700
@@ -110,14 +110,6 @@
 };
 
 
-
-
-#ifdef LIBPC_COMPILER_MSVC
-#define compare_no_case(a,b,n)  _strnicmp( (a), (b), (n) )
-#else
-#define compare_no_case(a,b,n)  strncasecmp( (a), (b), (n) )
-#endif
-
 struct FiveDimensionOCI
 {
     double x;
diff -r 61902169d63b -r ef67b7003c76 src/SpatialReference.cpp
--- a/src/SpatialReference.cpp	Thu Apr 21 14:28:58 2011 -0700
+++ b/src/SpatialReference.cpp	Fri Apr 22 08:47:39 2011 -0700
@@ -32,83 +32,10 @@
  * OF SUCH DAMAGE.
  ****************************************************************************/
 
-#include <libpc/SpatialReference.hpp>
-
-namespace libpc
-{
-
-
-SpatialReference::SpatialReference()
-    : m_wkt("NONE")
-{
-    return;
-}
-
-
-SpatialReference::SpatialReference(std::string wkt)
-    : m_wkt(wkt)
-{
-    return;
-}
-
-
-SpatialReference::SpatialReference(const SpatialReference& other)


More information about the Liblas-commits mailing list