[Liblas-commits] hg: 22 new changesets

liblas-commits at liblas.org liblas-commits at liblas.org
Sat Jul 31 16:12:48 EDT 2010


changeset e24e95880cf7 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=e24e95880cf7
summary: Changed Color class to use internally 3-element array instead of 3 separate members. Continuing headers cleanup in lascolor.[c|h]pp files.

changeset 862aa8145bac in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=862aa8145bac
summary: Color constructor throws if color component value is out of range

changeset 5395757d4ef2 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=5395757d4ef2
summary: Updated Color class comments.

changeset 0fe68d8ce62c in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=0fe68d8ce62c
summary: Missing <string> header.

changeset f3b59df01fc0 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=f3b59df01fc0
summary: Extracted PointRecord to separate header.

changeset 0754e8fca0a4 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=0754e8fca0a4
summary: Declare HeaderPtr and PointPtr in detail/fwd.hpp - shared_ptr is happy with incomplete types.

changeset 55250144b728 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=55250144b728
summary: Removed fwd.hpp header - seems redundant.

changeset e3bee9427be4 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=e3bee9427be4
summary: Declare Color comparison operators as inline

changeset d3519e09b824 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=d3519e09b824
summary: Use std::size_t as type of index. Tidy up to make definition readable.

changeset 7eaf6524116f in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=7eaf6524116f
summary: Include laspoint.hpp and boost/array.hpp in lasbounds.cpp

changeset e843aec24a88 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=e843aec24a88
summary: Declare Point::GetHeaderPtr() as const-qualified. Moved Set/GetHeader definitions to .cpp file. Renamed Point::m_hdr to Point::m_header. Include missing headers in laspoint.cpp.

changeset f3742cdf7bfe in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=f3742cdf7bfe
summary: Declare Point::GetHeaderPtr() as const-qualified. Moved Set/GetHeader definitions to .cpp file. Renamed Point::m_hdr to Point::m_header. Include missing headers in laspoint.cpp.

changeset c097ab17c895 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=c097ab17c895
summary: Moved definition of Header::Get/SetExtent to .cpp

changeset 9d07311f5872 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=9d07311f5872
summary: Moved FilterI definition to lasfilter.hpp

changeset f7d08ba5f706 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=f7d08ba5f706
summary: Moved TransformI definition and TransformPtr declaration to lastransform.hpp. Do not include liblas/liblas.hpp - it is for client only. Include boost/shared_ptr.

changeset b8555ddb9702 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=b8555ddb9702
summary: Headers clean-up. Do not include liblas/liblas.hpp - it is for client only.

changeset 3ed5ec3275cf in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=3ed5ec3275cf
summary: Removed TransformPtr declaration from laswriter.hpp. Headers clean-up.

changeset 68f35e1d1e10 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=68f35e1d1e10
summary: Removed fwd.hpp from lasschema.hpp - seems unnecessary.

changeset b5dec99f3200 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=b5dec99f3200
summary: Refactored liblas/liblas.hpp header to serve as libLAS main header including all necessary internal and external dependencies. Removed type definitions from liblas.hpp header.

changeset ba2b3736ce28 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=ba2b3736ce28
summary: Headers update

changeset 01d45dc4e72a in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=01d45dc4e72a
summary: Updated apps to catch up with the seriece of recent commits with big headers clean-up.

changeset 45aefb0c99a3 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=45aefb0c99a3
summary: merge - all tests pass on Linux 64-bit and GCC 4.4.3

diffstat:

 apps/CMakeLists.txt                     |     2 +-
 apps/chipper.cpp                        |     7 +-
 apps/chipper.hpp                        |    35 +-
 apps/kdx_util.cpp                       |  1730 +++++++++++++++++++++++++++++++
 apps/kdx_util.hpp                       |    61 +
 apps/las2las2.cpp                       |     5 -
 apps/las2oci.cpp                        |     4 -
 apps/las2oci.hpp                        |    85 +
 apps/las2ogr.cpp                        |     6 +-
 apps/lasblock.cpp                       |     2 -
 apps/lasindex.cpp                       |    10 +-
 apps/oci_util.cpp                       |  1730 +++++++++++++++++++++++++++++++
 apps/oci_util.hpp                       |    37 +
 include/liblas/detail/fwd.hpp           |    23 +-
 include/liblas/detail/pointrecord.hpp   |    77 +
 include/liblas/detail/reader/header.hpp |     3 -
 include/liblas/detail/utility.hpp       |    24 +-
 include/liblas/lasbounds.hpp            |    49 +-
 include/liblas/lascolor.hpp             |    84 +-
 include/liblas/laserror.hpp             |     2 +-
 include/liblas/lasfilter.hpp            |    30 +
 include/liblas/lasheader.hpp            |    18 +-
 include/liblas/laspoint.hpp             |    27 +-
 include/liblas/lasreader.hpp            |     7 +-
 include/liblas/lasschema.hpp            |     1 -
 include/liblas/lastransform.hpp         |    31 +-
 include/liblas/lasversion.hpp           |    33 +-
 include/liblas/laswriter.hpp            |    14 +-
 include/liblas/liblas.hpp               |   101 +-
 src/CMakeLists.txt                      |     4 +-
 src/lasbounds.cpp                       |     2 +
 src/lascolor.cpp                        |    52 +-
 src/laserror.cpp                        |     2 +
 src/lasheader.cpp                       |    10 +-
 src/laspoint.cpp                        |    56 +-
 src/lastransform.cpp                    |     2 +-
 36 files changed, 4031 insertions(+), 335 deletions(-)

diffs (truncated from 5051 to 300 lines):

diff -r 646bcc90c951 -r 45aefb0c99a3 apps/CMakeLists.txt
--- a/apps/CMakeLists.txt	Sat Jul 31 01:29:00 2010 +0100
+++ b/apps/CMakeLists.txt	Sat Jul 31 21:12:10 2010 +0100
@@ -128,7 +128,7 @@
 
 # Build las2oci
 if(LAS2OCI)
-    add_executable(${LAS2OCI} las2oci.cpp oci_wrapper.cpp)
+    add_executable(${LAS2OCI} las2oci.cpp oci_wrapper.cpp kdx_util.cpp oci_util.cpp)
     target_link_libraries(${LAS2OCI} ${APPS_CPP_DEPENDENCIES})
 endif()
 
diff -r 646bcc90c951 -r 45aefb0c99a3 apps/chipper.cpp
--- a/apps/chipper.cpp	Sat Jul 31 01:29:00 2010 +0100
+++ b/apps/chipper.cpp	Sat Jul 31 21:12:10 2010 +0100
@@ -41,9 +41,7 @@
 
 #include "chipper.hpp"
 
-#include <math.h>
-
-using namespace std;
+#include <cmath>
 
 /**
 The objective is to split the region into non-overlapping blocks, each
@@ -78,6 +76,9 @@
 namespace liblas
 {
 
+using namespace std;
+using namespace boost;
+
 namespace chipper
 {
 
diff -r 646bcc90c951 -r 45aefb0c99a3 apps/chipper.hpp
--- a/apps/chipper.hpp	Sat Jul 31 01:29:00 2010 +0100
+++ b/apps/chipper.hpp	Sat Jul 31 21:12:10 2010 +0100
@@ -1,9 +1,8 @@
 #ifndef LIBLAS_CHIPPER_H
 #define LIBLAS_CHIPPER_H
 
+#include <liblas/liblas.hpp>
 #include <vector>
-#include <liblas/lasreader.hpp>
-#include <liblas/detail/utility.hpp>
 
 namespace liblas
 {
@@ -22,8 +21,8 @@
 {
 public:
     double m_pos;
-    uint32_t m_ptindex;
-    uint32_t m_oindex;
+    boost::uint32_t m_ptindex;
+    boost::uint32_t m_oindex;
 
     bool operator < (const PtRef& pt) const
         { return m_pos < pt.m_pos; }
@@ -68,15 +67,15 @@
 
 private:
     RefList *m_list_p;
-    uint32_t m_left;
-    uint32_t m_right;
+    boost::uint32_t m_left;
+    boost::uint32_t m_right;
     double m_xmin;
     double m_ymin;
     double m_xmax;
     double m_ymax;
 
 public:
-    std::vector<uint32_t> GetIDs() const; 
+    std::vector<boost::uint32_t> GetIDs() const; 
     double GetXmin() const
         { return m_xmin; }
     double GetYmin() const
@@ -90,34 +89,34 @@
 class Chipper
 {
 public:
-    Chipper(Reader *reader, uint32_t max_partition_size) :
+    Chipper(Reader *reader, boost::uint32_t max_partition_size) :
         m_reader(reader), m_threshold(max_partition_size),
         m_xvec(DIR_X), m_yvec(DIR_Y), m_spare(DIR_NONE)
     {}
 
     void Chip();
-    uint32_t GetBlockCount()
+    boost::uint32_t GetBlockCount()
         { return m_blocks.size(); }
-    const Block& GetBlock(uint32_t i)
+    const Block& GetBlock(boost::uint32_t i)
         { return m_blocks[i]; }
 
 private:
     void Load(RefList& xvec, RefList& yvec, RefList& spare);
-    void Partition(uint32_t size);
+    void Partition(boost::uint32_t size);
     void Split(RefList& xvec, RefList& yvec, RefList& spare);
     void DecideSplit(RefList& v1, RefList& v2, RefList& spare,
-        uint32_t left, uint32_t right);
+        boost::uint32_t left, boost::uint32_t right);
     void Split(RefList& wide, RefList& narrow, RefList& spare,
-        uint32_t left, uint32_t right);
+        boost::uint32_t left, boost::uint32_t right);
     void FinalSplit(RefList& wide, RefList& narrow,
-        uint32_t pleft, uint32_t pcenter);
-    void Emit(RefList& wide, uint32_t widemin, uint32_t widemax,
-        RefList& narrow, uint32_t narrowmin, uint32_t narrowmax );
+        boost::uint32_t pleft, boost::uint32_t pcenter);
+    void Emit(RefList& wide, boost::uint32_t widemin, boost::uint32_t widemax,
+        RefList& narrow, boost::uint32_t narrowmin, boost::uint32_t narrowmax );
 
     Reader *m_reader;
-    uint32_t m_threshold;
+    boost::uint32_t m_threshold;
     std::vector<Block> m_blocks;
-    std::vector<uint32_t> m_partitions;
+    std::vector<boost::uint32_t> m_partitions;
     RefList m_xvec;
     RefList m_yvec;
     RefList m_spare;
diff -r 646bcc90c951 -r 45aefb0c99a3 apps/kdx_util.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apps/kdx_util.cpp	Sat Jul 31 21:12:10 2010 +0100
@@ -0,0 +1,1730 @@
+
+#include <stdlib.h>
+
+
+// god-awful hack because of GDAL/GeoTIFF's shitty include structure
+#define CPL_SERV_H_INCLUDED
+
+#include "oci_wrapper.h"
+
+#include <liblas/detail/utility.hpp>
+
+#include <string>
+#include <sstream>
+#include <iostream>
+#include <fstream>
+#include <exception>
+#include <algorithm>
+#include <vector>
+#include <cctype>
+#include <cmath>
+
+#include <sys/stat.h>
+
+#include <liblas/lasbounds.hpp>
+
+#include <oci.h>
+
+using namespace std;
+using namespace liblas;
+
+#ifdef _WIN32
+#define compare_no_case(a,b,n)  _strnicmp( (a), (b), (n) )
+#else
+#define compare_no_case(a,b,n)  strncasecmp( (a), (b), (n) )
+#endif
+
+// #define MAX_POINTS_PER_ROW 1000
+
+
+#include <boost/array.hpp>
+#include <boost/shared_ptr.hpp>
+
+typedef std::vector<liblas::uint32_t> IDVector;
+typedef boost::shared_ptr< IDVector > IDVectorPtr;
+
+typedef struct
+{
+    long* pc_ids;
+    long* block_ids;
+    long* num_points;
+    OCILobLocator** locators; // =(OCILobLocator**) VSIMalloc( sizeof(OCILobLocator*) * 1 );
+
+    std::vector<liblas::uint8_t>** blobs;
+
+    long* srids;
+    long* gtypes;
+    OCIArray** element_arrays;
+    OCIArray** coordinate_arrays;
+    
+    long size;
+        
+} blocks;
+
+typedef struct
+{
+    double x0;
+    double x1;
+    double y0;
+    double y1;
+    double z0;
+    double z1;
+    bool bUse3d;
+   
+} extent;
+
+
+class IndexResult 
+{
+public:
+    IndexResult(liblas::uint32_t id) : bounds(), m_id(id) {}
+    // 
+    // /// Copy constructor.
+    // IndexResult(IndexResult const& other);
+
+    // /// Assignment operator.
+    // IndexResult& operator=(IndexResult const& rhs);
+        
+    IDVector const& GetIDs() const { return ids; }
+    void SetIDs(IDVector& v) {ids = v;}
+    const liblas::Bounds GetBounds() const { return bounds; }
+    void SetBounds(const liblas::Bounds b) {bounds = b;}
+    liblas::uint32_t GetID() const {return m_id;}
+    void SetID(liblas::uint32_t v) {m_id = v;}
+
+private:
+    IDVector ids;
+    liblas::Bounds bounds;
+    liblas::uint32_t m_id;
+
+};
+
+typedef std::vector<IndexResult> ResultsVector;
+class KDXIndexSummary
+{
+public:
+    KDXIndexSummary(std::istream& input);    
+    boost::shared_ptr<liblas::Bounds> bounds;
+    ResultsVector& GetResults() { return m_results; }
+private:
+    ResultsVector m_results;
+    bool m_first;    
+};
+
+KDXIndexSummary::KDXIndexSummary(std::istream& input) :  bounds(), m_first(true)
+{
+    long id_count = 0;
+    long id = 0;
+    long i = 0;
+
+    
+    double low[2];
+    double high[2];
+    
+    double mins[2];
+    double maxs[2];
+    
+    bool first = true;
+    
+    while(input) {
+        input >> id >> id_count >> low[0] >> low[1] >> high[0] >> high[1];
+        // printf("count:%d %.2f %.2f %.2f %.2f\n", id_count, low[0], low[1], high[0], high[1]);
+        
+        if (first) {
+            mins[0] = low[0];
+            mins[1] = low[1];
+            maxs[0] = high[0];
+            maxs[1] = high[1];
+            first = false;
+        }
+        
+        mins[0] = std::min(mins[0], low[0]);
+        mins[1] = std::min(mins[1], low[1]);
+        
+        maxs[0] = std::max(maxs[0], high[0]);
+        maxs[1] = std::max(maxs[1], high[1]);
+        // if (!input.good()) continue;
+        
+        IDVector ids;
+        for (int j=0; j<id_count; j++) {
+            input >> i;
+            ids.push_back(i);
+        }
+        liblas::Bounds b(low[0], low[1], high[0],high[1]);
+        // SpatialIndex::Region* pr = new SpatialIndex::Region(low, high, 2);
+        // printf("Ids size: %d %.3f\n", ids.size(), pr->getLow(0));
+        IndexResult result(static_cast<liblas::uint32_t>(id));
+        result.SetIDs(ids);
+        result.SetBounds(b);
+        m_results.push_back(result);
+    }
+
+    bounds = boost::shared_ptr<liblas::Bounds>(new liblas::Bounds(mins[0], mins[1], maxs[0], maxs[1]));
+}
+
+bool KDTreeIndexExists(std::string& filename)
+{
+    struct stat stats;
+    std::ostringstream os;
+    os << filename << ".kdx";
+


More information about the Liblas-commits mailing list