[Liblas-commits] hg: start cleaning this shitpile up
liblas-commits at liblas.org
liblas-commits at liblas.org
Fri Jul 30 22:06:32 EDT 2010
changeset 83a765bb3245 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=83a765bb3245
summary: start cleaning this shitpile up
diffstat:
apps/CMakeLists.txt | 2 +-
apps/kdx_util.cpp | 72 +++++++
apps/kdx_util.hpp | 61 ++++++
apps/las2oci.cpp | 514 ++-------------------------------------------------
apps/las2oci.hpp | 85 ++++++++
apps/oci_util.cpp | 228 +++++++++++++++++++++++
apps/oci_util.hpp | 37 +++
7 files changed, 508 insertions(+), 491 deletions(-)
diffs (truncated from 1199 to 300 lines):
diff -r a21a73d99c7c -r 83a765bb3245 apps/CMakeLists.txt
--- a/apps/CMakeLists.txt Fri Jul 30 19:38:24 2010 -0500
+++ b/apps/CMakeLists.txt Fri Jul 30 21:06:21 2010 -0500
@@ -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 a21a73d99c7c -r 83a765bb3245 apps/kdx_util.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/apps/kdx_util.cpp Fri Jul 30 21:06:21 2010 -0500
@@ -0,0 +1,72 @@
+#include "kdx_util.hpp"
+
+
+
+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<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";
+
+ std::string indexname = os.str();
+
+ // ret is -1 for no file existing and 0 for existing
+ int ret = stat(indexname.c_str(),&stats);
+
+ bool output = false;
+ if (ret == 0) output= true; else output =false;
+ return output;
+}
+
+
diff -r a21a73d99c7c -r 83a765bb3245 apps/kdx_util.hpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/apps/kdx_util.hpp Fri Jul 30 21:06:21 2010 -0500
@@ -0,0 +1,61 @@
+#ifndef KDX_UTIL_HPP_INCLUDED
+#define KDX_UTIL_HPP_INCLUDED
+
+#include <boost/shared_ptr.hpp>
+
+#include <liblas/lasbounds.hpp>
+
+#include <fstream>
+#include <exception>
+#include <vector>
+#include <sys/stat.h>
+
+
+
+
+typedef std::vector<uint32_t> IDVector;
+typedef boost::shared_ptr< IDVector > IDVectorPtr;
+
+class IndexResult
+{
+public:
+ IndexResult(uint32_t id) : bounds(), m_id(id) {}
+
+ 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;}
+ uint32_t GetID() const {return m_id;}
+ void SetID(uint32_t v) {m_id = v;}
+
+private:
+
+ // /// Copy constructor.
+ // IndexResult(IndexResult const& other);
+ //
+ // /// Assignment operator.
+ // IndexResult& operator=(IndexResult const& rhs);
+
+ IDVector ids;
+ liblas::Bounds bounds;
+ 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;
+};
+
+bool KDTreeIndexExists(std::string& filename);
+
+
+#endif // KDX_UTIL_HPP_INCLUDED
+
diff -r a21a73d99c7c -r 83a765bb3245 apps/las2oci.cpp
--- a/apps/las2oci.cpp Fri Jul 30 19:38:24 2010 -0500
+++ b/apps/las2oci.cpp Fri Jul 30 21:06:21 2010 -0500
@@ -1,350 +1,15 @@
+#include "las2oci.hpp"
-#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 <liblas/laspoint.hpp>
-#include <liblas/lasreader.hpp>
-#include <liblas/lasheader.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<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<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(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;}
- uint32_t GetID() const {return m_id;}
- void SetID(uint32_t v) {m_id = v;}
-
-private:
- IDVector ids;
- liblas::Bounds bounds;
- 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;
More information about the Liblas-commits
mailing list