[Liblas-commits] hg: revert -r1949 and clean up to work with <liblas/liblas.hpp> ...

liblas-commits at liblas.org liblas-commits at liblas.org
Mon Aug 2 12:39:08 EDT 2010


changeset d0cfd54c9995 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=d0cfd54c9995
summary: revert -r1949 and clean up to work with <liblas/liblas.hpp> header  only

diffstat:

 apps/kdx_util.cpp |  1662 +----------------------------------------------------
 apps/kdx_util.hpp |     4 +-
 apps/las2oci.cpp  |   526 +---------------
 apps/las2oci.hpp  |     7 +-
 apps/oci_util.cpp |  1590 +-------------------------------------------------
 5 files changed, 81 insertions(+), 3708 deletions(-)

diffs (truncated from 4130 to 300 lines):

diff -r a34577812df9 -r d0cfd54c9995 apps/kdx_util.cpp
--- a/apps/kdx_util.cpp	Mon Aug 02 17:09:01 2010 +0100
+++ b/apps/kdx_util.cpp	Mon Aug 02 11:39:02 2010 -0500
@@ -1,116 +1,7 @@
+#include "kdx_util.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 <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;
@@ -153,7 +44,7 @@
         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));
+        IndexResult result(static_cast<uint32_t>(id));
         result.SetIDs(ids);
         result.SetBounds(b);
         m_results.push_back(result);
@@ -178,1553 +69,4 @@
     return output;
 }
 
-std::istream* OpenInput(std::string filename, bool bEnd) 
-{
-    std::ios::openmode mode = std::ios::in | std::ios::binary;
-    if (bEnd == true) {
-        mode = mode | std::ios::ate;
-    }
-    std::istream* istrm;
-    if (compare_no_case(filename.c_str(),"STDIN",5) == 0)
-    {
-        istrm = &std::cin;
-    }
-    else 
-    {
-        istrm = new std::ifstream(filename.c_str(), mode);
-    }
-    
-    if (!istrm->good())
-    {
-        delete istrm;
-        throw std::runtime_error("Reading stream was not able to be created");
-        exit(1);
-    }
-    return istrm;
-}
-
-std::string ReadSQLData(char const* filename)
-{
-    std::istream* infile = OpenInput(filename, true);
-    ifstream::pos_type size;
-    char* data;
-    if (infile->good()){
-        size = infile->tellg();
-        data = new char [size];
-        infile->seekg (0, ios::beg);
-        infile->read (data, size);
-        // infile->close();
-
-        std::string output = std::string(data);
-        delete[] data;
-        delete infile;
-        return output;
-    } 
-    else 
-    {   
-        delete infile;
-        return std::string("");
-    }
-}
-
-bool EnableTracing(OWConnection* connection)
-{
-    ostringstream oss;
-// http://www.oracle-base.com/articles/10g/SQLTrace10046TrcsessAndTkprof10g.php
-    oss << "ALTER SESSION SET EVENTS '10046 trace name context forever, level 12'";
-
-    OWStatement* statement = 0;
-    
-    statement = connection->CreateStatement(oss.str().c_str());
-    
-    if (statement->Execute() == false) {
-        
-        std::cout << "statement execution failed "  << CPLGetLastErrorMsg() << std::endl;
-        delete statement;
-        return 0;
-    }    
-    
-    return true;
-}
-
-bool IsGeographic(OWConnection* connection, long srid) {
-
-    ostringstream oss;
-    char* kind = (char* ) malloc (OWNAME * sizeof(char));
-    oss << "SELECT COORD_REF_SYS_KIND from MDSYS.SDO_COORD_REF_SYSTEM WHERE SRID = :1";
-    
-    OWStatement* statement = 0;
-
-    statement = connection->CreateStatement(oss.str().c_str());
-    long* p_srid = (long*) malloc( 1 * sizeof(long));
-    p_srid[0] = srid;
-    
-    statement->Bind(p_srid);
-    statement->Define(kind);    
-    if (statement->Execute() == false) {
-        
-        std::cout << "statement execution failed "  << CPLGetLastErrorMsg() << std::endl;
-        delete statement;
-        return false;
-    }
-    
-    if (compare_no_case(kind, "GEOGRAPHIC2D",12) == 0) {
-        delete statement;
-        free(kind);
-        return true;
-    }
-    if (compare_no_case(kind, "GEOGRAPHIC3D",12) == 0) {
-        delete statement;
-        free(kind);
-        return true;
-    }
-
-    free(kind);
-
-    return false;
-}
-
-OWStatement* Run(OWConnection* connection, ostringstream& command) 
-{
-    OWStatement* statement = 0;
-    statement = connection->CreateStatement(command.str().c_str());
-    
-    if (statement->Execute() == false) {
-        
-        std::cout << "statement execution failed "  << CPLGetLastErrorMsg() << std::endl;
-        delete statement;
-        return 0;
-    }
-    
-    return statement;    
-}
-
-bool Cleanup(OWConnection* connection, const char* tableName)
-{
-    ostringstream oss;
-    OWStatement* statement = 0;
-    
-    oss << "DELETE FROM " << tableName;
-    statement = Run(connection, oss);
-    if (statement != 0) delete statement;
-    oss.str("");
-
-    oss << "DROP TABLE " << tableName;
-    cout << oss.str() << endl;
-    statement = Run(connection, oss);
-    if (statement != 0) delete statement; 
-    oss.str("");       
-
-    oss << "DELETE FROM USER_SDO_GEOM_METADATA WHERE TABLE_NAME='"<< tableName << "'";
-    statement = Run(connection, oss);
-    if (statement != 0) delete statement; 
-    oss.str("");
-
-    connection->Commit();
-    
-    return true;    
-}
-
-bool CreateBlockTable(OWConnection* connection, const char* tableName)
-{
-    ostringstream oss;
-    OWStatement* statement = 0;
-    
-    oss << "CREATE TABLE " << tableName << " AS SELECT * FROM MDSYS.SDO_PC_BLK_TABLE";
-
-    statement = Run(connection, oss);
-    if (statement != 0) delete statement; else return false;
-    oss.str("");
-
-    connection->Commit();
-    
-    return true;
-
-}
-
-bool DeleteTable(   OWConnection* connection, 
-                    const char* tableName, 


More information about the Liblas-commits mailing list