[Liblas-commits] r1280 - in trunk: apps include include/liblas
include/liblas/index
liblas-commits at liblas.org
liblas-commits at liblas.org
Mon Jun 8 21:52:13 EDT 2009
Author: hobu
Date: Wed May 20 15:56:34 2009
New Revision: 1280
URL: http://liblas.org/changeset/1280
Log:
reorganize indexing headers, source code reorg yet to come
Added:
trunk/include/liblas/index/
trunk/include/liblas/index/datastream.hpp
- copied, changed from r1273, /trunk/include/liblas/lasindex.hpp
trunk/include/liblas/index/index.hpp
- copied, changed from r1273, /trunk/include/liblas/lasindex.hpp
trunk/include/liblas/index/storage.hpp
- copied, changed from r1273, /trunk/include/liblas/lasindex.hpp
trunk/include/liblas/index/visitor.hpp
- copied, changed from r1273, /trunk/include/liblas/lasindex.hpp
Removed:
trunk/include/liblas/lasindex.hpp
Modified:
trunk/apps/lasindex.cpp
trunk/include/Makefile.am
Modified: trunk/apps/lasindex.cpp
==============================================================================
--- trunk/apps/lasindex.cpp (original)
+++ trunk/apps/lasindex.cpp Wed May 20 15:56:34 2009
@@ -6,7 +6,7 @@
#include <liblas/lascolor.hpp>
#include <liblas/lasreader.hpp>
#include <liblas/lasheader.hpp>
-#include <liblas/lasindex.hpp>
+#include <liblas/index/index.hpp>
#ifdef HAVE_SPATIALINDEX
#include <spatialindex/SpatialIndex.h>
Modified: trunk/include/Makefile.am
==============================================================================
--- trunk/include/Makefile.am (original)
+++ trunk/include/Makefile.am Wed May 20 15:56:34 2009
@@ -10,7 +10,6 @@
liblas/laserror.hpp \
liblas/lasfile.hpp \
liblas/lasheader.hpp \
- liblas/lasindex.hpp \
liblas/laspoint.hpp \
liblas/lasreader.hpp \
liblas/lasvariablerecord.hpp \
@@ -34,4 +33,8 @@
liblas/detail/writer.hpp \
liblas/detail/writer10.hpp \
liblas/detail/writer11.hpp \
- liblas/detail/writer12.hpp
\ No newline at end of file
+ liblas/detail/writer12.hpp \
+ liblas/index/datastream.hpp \
+ liblas/index/index.hpp \
+ liblas/index/storage.hpp \
+ liblas/index/visitor.hpp
\ No newline at end of file
Copied: trunk/include/liblas/index/datastream.hpp (from r1273, /trunk/include/liblas/lasindex.hpp)
==============================================================================
--- /trunk/include/liblas/lasindex.hpp (original)
+++ trunk/include/liblas/index/datastream.hpp Wed May 20 15:56:34 2009
@@ -2,7 +2,7 @@
* $Id$
*
* Project: libLAS - http://liblas.org - A BSD library for LAS format data.
- * Purpose: LAS indexing class
+ * Purpose: LAS indexing data stream class
* Author: Howard Butler, hobu.inc at gmail.com
*
******************************************************************************
@@ -39,8 +39,8 @@
* OF SUCH DAMAGE.
****************************************************************************/
-#ifndef LIBLAS_LASINDEX_HPP_INCLUDED
-#define LIBLAS_LASINDEX_HPP_INCLUDED
+#ifndef LIBLAS_INDEX_DATASTREAM_HPP_INCLUDED
+#define LIBLAS_INDEX_DATASTREAM_HPP_INCLUDED
#include <liblas/lasvariablerecord.hpp>
#include <liblas/laspoint.hpp>
@@ -56,114 +56,7 @@
namespace liblas {
-class LASIndexDataStream;
-class LASIndex
-{
-public:
-
- enum IndexType
- {
- eMemoryIndex = 1, ///< A transient memory index that will go away
- eVLRIndex = 2, ///< An index that will store its data in VLR records
- eExternalIndex = 3 ///< An index that will store its data in files alongside the .las file (.las.dat & .las.idx)
- };
-
- LASIndex();
- LASIndex(std::string& filename);
- /// Copy constructor.
- LASIndex(LASIndex const& other);
- ~LASIndex();
-
- void Initialize(LASIndexDataStream& strm);
- void Initialize();
-
- /// Assignment operator.
- LASIndex& operator=(LASIndex const& rhs);
-
- /// Comparison operator.
- bool operator==(const LASIndex& other) const;
-
-
- /// Inserts a LASPoint into the index with a given id
- /// \param p the LASPoint to insert
- /// \param id the id to associate with the point
- void insert(LASPoint& p, int64_t id);
-
- /// Intersects the index with the given cube and returns a
- /// std::vector of ids. Caller has ownership of the vector.
- /// \param minx minimum X value of the cube
- /// \param maxx maximum X value of the cube
- /// \param miny minimum Y value of the cube
- /// \param maxy maximum Y value of the cube
- /// \param minz minimum Z value of the cube
- /// \param maxz maximum Z value of the cube
- /// \return std::vector<uint32_t> that the caller owns containing the ids that intersect the query.
- std::vector<uint32_t>* intersects(double minx, double miny, double maxx, double maxy, double minz, double maxz);
-
- /// Sets the page size for the index when stored externally
- /// \param v - page value. Defaults to 4096.
- void SetPageSize(uint32_t v) { m_Pagesize = v; }
-
- /// Get index page size for indexes that are stored externally
- /// \return index page size.
- uint32_t GetPageSize() { return m_Pagesize; }
-
- /// Sets the index type
- /// \param v - index type. Defaults to eExternalIndex.
- void SetIndexType(IndexType v) { m_idxType = v; }
-
- /// Gets the index type
- /// \return index type.
- IndexType GetIndexType() { return m_idxType; }
-
-private:
-
- SpatialIndex::IStorageManager* m_storage;
- SpatialIndex::StorageManager::IBuffer* m_buffer;
- SpatialIndex::ISpatialIndex* m_rtree;
-
- uint32_t m_Pagesize;
- IndexType m_idxType;
- SpatialIndex::id_type m_idxId;
- uint32_t m_idxCapacity;
- uint32_t m_idxLeafCap;
- uint32_t m_idxDimension;
- double m_idxFillFactor;
- bool m_idxExists;
-
- std::string m_idxFilename;
-
- uint16_t m_bufferCapacity;
- bool m_bufferWriteThrough;
-
- bool m_Initialized;
-
-
- void Setup();
- SpatialIndex::IStorageManager* CreateStorage(std::string& filename);
- SpatialIndex::StorageManager::IBuffer* CreateIndexBuffer(SpatialIndex::IStorageManager& storage);
- SpatialIndex::ISpatialIndex* CreateIndex(LASIndexDataStream& strm);
- SpatialIndex::ISpatialIndex* LoadIndex();
- bool ExternalIndexExists(std::string& filename);
-};
-
-class LASVisitor : public SpatialIndex::IVisitor
-{
-private:
- size_t m_indexIO;
- size_t m_leafIO;
- std::vector<uint32_t>* m_vector;
-
-
-public:
-
- LASVisitor(std::vector<uint32_t>* vect);
-
- void visitNode(const SpatialIndex::INode& n);
- void visitData(const SpatialIndex::IData& d);
- void visitData(std::vector<const SpatialIndex::IData*>& v);
-};
class LASIndexDataStream : public SpatialIndex::IDataStream
{
@@ -187,42 +80,6 @@
-
-extern SpatialIndex::IStorageManager* returnLASStorageManager(Tools::PropertySet& in);
-extern SpatialIndex::IStorageManager* createNewLASStorageManager();
-
-class LASStorageManager : public SpatialIndex::IStorageManager
-{
-public:
- LASStorageManager(Tools::PropertySet&);
-
- virtual ~LASStorageManager();
-
- virtual void loadByteArray(const SpatialIndex::id_type id, size_t& len, uint8_t** data);
- virtual void storeByteArray(SpatialIndex::id_type& id, const size_t len, const uint8_t* const data);
- virtual void deleteByteArray(const SpatialIndex::id_type id);
-
-private:
- class Entry
- {
- public:
- byte* m_pData;
- size_t m_length;
-
- Entry(size_t l, const uint8_t* const d) : m_pData(0), m_length(l)
- {
- m_pData = new uint8_t[m_length];
- memcpy(m_pData, d, m_length);
- }
-
- ~Entry() { delete[] m_pData; }
- }; // Entry
-
- std::vector<Entry*> m_buffer;
- std::stack<SpatialIndex::id_type> m_emptyPages;
-}; // MemoryStorageManager
-
-
}
-#endif // LIBLAS_LASINDEX_HPP_INCLUDED
+#endif // LIBLAS_INDEX_DATASTREAM_HPP_INCLUDED
Copied: trunk/include/liblas/index/index.hpp (from r1273, /trunk/include/liblas/lasindex.hpp)
==============================================================================
--- /trunk/include/liblas/lasindex.hpp (original)
+++ trunk/include/liblas/index/index.hpp Wed May 20 15:56:34 2009
@@ -39,14 +39,18 @@
* OF SUCH DAMAGE.
****************************************************************************/
-#ifndef LIBLAS_LASINDEX_HPP_INCLUDED
-#define LIBLAS_LASINDEX_HPP_INCLUDED
+#ifndef LIBLAS_INDEX_INDEX_HPP_INCLUDED
+#define LIBLAS_INDEX_INDEX_HPP_INCLUDED
#include <liblas/lasvariablerecord.hpp>
#include <liblas/laspoint.hpp>
#include <spatialindex/SpatialIndex.h>
+#include <liblas/index/datastream.hpp>
+#include <liblas/index/storage.hpp>
+#include <liblas/index/visitor.hpp>
+
//std
#include <string>
@@ -56,8 +60,6 @@
namespace liblas {
-class LASIndexDataStream;
-
class LASIndex
{
public:
@@ -148,81 +150,8 @@
bool ExternalIndexExists(std::string& filename);
};
-class LASVisitor : public SpatialIndex::IVisitor
-{
-private:
- size_t m_indexIO;
- size_t m_leafIO;
- std::vector<uint32_t>* m_vector;
-
-
-public:
-
- LASVisitor(std::vector<uint32_t>* vect);
-
- void visitNode(const SpatialIndex::INode& n);
- void visitData(const SpatialIndex::IData& d);
- void visitData(std::vector<const SpatialIndex::IData*>& v);
-};
-
-class LASIndexDataStream : public SpatialIndex::IDataStream
-{
-public:
- LASIndexDataStream(LASReader* reader);
- ~LASIndexDataStream();
-
- SpatialIndex::IData* getNext();
- bool hasNext() throw (Tools::NotSupportedException);
-
- size_t size() throw (Tools::NotSupportedException);
- void rewind() throw (Tools::NotSupportedException);
-
- bool readPoint();
-
-protected:
- liblas::LASReader* m_reader;
- SpatialIndex::RTree::Data* m_pNext;
- SpatialIndex::id_type m_id;
-};
-
-
-
-
-extern SpatialIndex::IStorageManager* returnLASStorageManager(Tools::PropertySet& in);
-extern SpatialIndex::IStorageManager* createNewLASStorageManager();
-
-class LASStorageManager : public SpatialIndex::IStorageManager
-{
-public:
- LASStorageManager(Tools::PropertySet&);
-
- virtual ~LASStorageManager();
-
- virtual void loadByteArray(const SpatialIndex::id_type id, size_t& len, uint8_t** data);
- virtual void storeByteArray(SpatialIndex::id_type& id, const size_t len, const uint8_t* const data);
- virtual void deleteByteArray(const SpatialIndex::id_type id);
-
-private:
- class Entry
- {
- public:
- byte* m_pData;
- size_t m_length;
-
- Entry(size_t l, const uint8_t* const d) : m_pData(0), m_length(l)
- {
- m_pData = new uint8_t[m_length];
- memcpy(m_pData, d, m_length);
- }
-
- ~Entry() { delete[] m_pData; }
- }; // Entry
-
- std::vector<Entry*> m_buffer;
- std::stack<SpatialIndex::id_type> m_emptyPages;
-}; // MemoryStorageManager
}
-#endif // LIBLAS_LASINDEX_HPP_INCLUDED
+#endif // LIBLAS_INDEX_INDEX_HPP_INCLUDED
Copied: trunk/include/liblas/index/storage.hpp (from r1273, /trunk/include/liblas/lasindex.hpp)
==============================================================================
--- /trunk/include/liblas/lasindex.hpp (original)
+++ trunk/include/liblas/index/storage.hpp Wed May 20 15:56:34 2009
@@ -2,7 +2,7 @@
* $Id$
*
* Project: libLAS - http://liblas.org - A BSD library for LAS format data.
- * Purpose: LAS indexing class
+ * Purpose: LAS indexing storage class
* Author: Howard Butler, hobu.inc at gmail.com
*
******************************************************************************
@@ -39,11 +39,8 @@
* OF SUCH DAMAGE.
****************************************************************************/
-#ifndef LIBLAS_LASINDEX_HPP_INCLUDED
-#define LIBLAS_LASINDEX_HPP_INCLUDED
-
-#include <liblas/lasvariablerecord.hpp>
-#include <liblas/laspoint.hpp>
+#ifndef LIBLAS_INDEX_STORAGE_HPP_INCLUDED
+#define LIBLAS_INDEX_STORAGE_HPP_INCLUDED
#include <spatialindex/SpatialIndex.h>
@@ -56,136 +53,6 @@
namespace liblas {
-class LASIndexDataStream;
-
-class LASIndex
-{
-public:
-
- enum IndexType
- {
- eMemoryIndex = 1, ///< A transient memory index that will go away
- eVLRIndex = 2, ///< An index that will store its data in VLR records
- eExternalIndex = 3 ///< An index that will store its data in files alongside the .las file (.las.dat & .las.idx)
- };
-
- LASIndex();
- LASIndex(std::string& filename);
- /// Copy constructor.
- LASIndex(LASIndex const& other);
- ~LASIndex();
-
- void Initialize(LASIndexDataStream& strm);
- void Initialize();
-
- /// Assignment operator.
- LASIndex& operator=(LASIndex const& rhs);
-
- /// Comparison operator.
- bool operator==(const LASIndex& other) const;
-
-
- /// Inserts a LASPoint into the index with a given id
- /// \param p the LASPoint to insert
- /// \param id the id to associate with the point
- void insert(LASPoint& p, int64_t id);
-
- /// Intersects the index with the given cube and returns a
- /// std::vector of ids. Caller has ownership of the vector.
- /// \param minx minimum X value of the cube
- /// \param maxx maximum X value of the cube
- /// \param miny minimum Y value of the cube
- /// \param maxy maximum Y value of the cube
- /// \param minz minimum Z value of the cube
- /// \param maxz maximum Z value of the cube
- /// \return std::vector<uint32_t> that the caller owns containing the ids that intersect the query.
- std::vector<uint32_t>* intersects(double minx, double miny, double maxx, double maxy, double minz, double maxz);
-
- /// Sets the page size for the index when stored externally
- /// \param v - page value. Defaults to 4096.
- void SetPageSize(uint32_t v) { m_Pagesize = v; }
-
- /// Get index page size for indexes that are stored externally
- /// \return index page size.
- uint32_t GetPageSize() { return m_Pagesize; }
-
- /// Sets the index type
- /// \param v - index type. Defaults to eExternalIndex.
- void SetIndexType(IndexType v) { m_idxType = v; }
-
- /// Gets the index type
- /// \return index type.
- IndexType GetIndexType() { return m_idxType; }
-
-private:
-
- SpatialIndex::IStorageManager* m_storage;
- SpatialIndex::StorageManager::IBuffer* m_buffer;
- SpatialIndex::ISpatialIndex* m_rtree;
-
- uint32_t m_Pagesize;
- IndexType m_idxType;
- SpatialIndex::id_type m_idxId;
- uint32_t m_idxCapacity;
- uint32_t m_idxLeafCap;
- uint32_t m_idxDimension;
- double m_idxFillFactor;
- bool m_idxExists;
-
- std::string m_idxFilename;
-
- uint16_t m_bufferCapacity;
- bool m_bufferWriteThrough;
-
- bool m_Initialized;
-
-
- void Setup();
- SpatialIndex::IStorageManager* CreateStorage(std::string& filename);
- SpatialIndex::StorageManager::IBuffer* CreateIndexBuffer(SpatialIndex::IStorageManager& storage);
- SpatialIndex::ISpatialIndex* CreateIndex(LASIndexDataStream& strm);
- SpatialIndex::ISpatialIndex* LoadIndex();
- bool ExternalIndexExists(std::string& filename);
-};
-
-class LASVisitor : public SpatialIndex::IVisitor
-{
-private:
- size_t m_indexIO;
- size_t m_leafIO;
- std::vector<uint32_t>* m_vector;
-
-
-public:
-
- LASVisitor(std::vector<uint32_t>* vect);
-
- void visitNode(const SpatialIndex::INode& n);
- void visitData(const SpatialIndex::IData& d);
- void visitData(std::vector<const SpatialIndex::IData*>& v);
-};
-
-class LASIndexDataStream : public SpatialIndex::IDataStream
-{
-public:
- LASIndexDataStream(LASReader* reader);
- ~LASIndexDataStream();
-
- SpatialIndex::IData* getNext();
- bool hasNext() throw (Tools::NotSupportedException);
-
- size_t size() throw (Tools::NotSupportedException);
- void rewind() throw (Tools::NotSupportedException);
-
- bool readPoint();
-
-protected:
- liblas::LASReader* m_reader;
- SpatialIndex::RTree::Data* m_pNext;
- SpatialIndex::id_type m_id;
-};
-
-
extern SpatialIndex::IStorageManager* returnLASStorageManager(Tools::PropertySet& in);
@@ -225,4 +92,4 @@
}
-#endif // LIBLAS_LASINDEX_HPP_INCLUDED
+#endif // LIBLAS_INDEX_STORAGE_HPP_INCLUDED
Copied: trunk/include/liblas/index/visitor.hpp (from r1273, /trunk/include/liblas/lasindex.hpp)
==============================================================================
--- /trunk/include/liblas/lasindex.hpp (original)
+++ trunk/include/liblas/index/visitor.hpp Wed May 20 15:56:34 2009
@@ -39,11 +39,8 @@
* OF SUCH DAMAGE.
****************************************************************************/
-#ifndef LIBLAS_LASINDEX_HPP_INCLUDED
-#define LIBLAS_LASINDEX_HPP_INCLUDED
-
-#include <liblas/lasvariablerecord.hpp>
-#include <liblas/laspoint.hpp>
+#ifndef LIBLAS_INDEX_VISITOR_HPP_INCLUDED
+#define LIBLAS_INDEX_VISITOR_HPP_INCLUDED
#include <spatialindex/SpatialIndex.h>
@@ -56,97 +53,6 @@
namespace liblas {
-class LASIndexDataStream;
-
-class LASIndex
-{
-public:
-
- enum IndexType
- {
- eMemoryIndex = 1, ///< A transient memory index that will go away
- eVLRIndex = 2, ///< An index that will store its data in VLR records
- eExternalIndex = 3 ///< An index that will store its data in files alongside the .las file (.las.dat & .las.idx)
- };
-
- LASIndex();
- LASIndex(std::string& filename);
- /// Copy constructor.
- LASIndex(LASIndex const& other);
- ~LASIndex();
-
- void Initialize(LASIndexDataStream& strm);
- void Initialize();
-
- /// Assignment operator.
- LASIndex& operator=(LASIndex const& rhs);
-
- /// Comparison operator.
- bool operator==(const LASIndex& other) const;
-
-
- /// Inserts a LASPoint into the index with a given id
- /// \param p the LASPoint to insert
- /// \param id the id to associate with the point
- void insert(LASPoint& p, int64_t id);
-
- /// Intersects the index with the given cube and returns a
- /// std::vector of ids. Caller has ownership of the vector.
- /// \param minx minimum X value of the cube
- /// \param maxx maximum X value of the cube
- /// \param miny minimum Y value of the cube
- /// \param maxy maximum Y value of the cube
- /// \param minz minimum Z value of the cube
- /// \param maxz maximum Z value of the cube
- /// \return std::vector<uint32_t> that the caller owns containing the ids that intersect the query.
- std::vector<uint32_t>* intersects(double minx, double miny, double maxx, double maxy, double minz, double maxz);
-
- /// Sets the page size for the index when stored externally
- /// \param v - page value. Defaults to 4096.
- void SetPageSize(uint32_t v) { m_Pagesize = v; }
-
- /// Get index page size for indexes that are stored externally
- /// \return index page size.
- uint32_t GetPageSize() { return m_Pagesize; }
-
- /// Sets the index type
- /// \param v - index type. Defaults to eExternalIndex.
- void SetIndexType(IndexType v) { m_idxType = v; }
-
- /// Gets the index type
- /// \return index type.
- IndexType GetIndexType() { return m_idxType; }
-
-private:
-
- SpatialIndex::IStorageManager* m_storage;
- SpatialIndex::StorageManager::IBuffer* m_buffer;
- SpatialIndex::ISpatialIndex* m_rtree;
-
- uint32_t m_Pagesize;
- IndexType m_idxType;
- SpatialIndex::id_type m_idxId;
- uint32_t m_idxCapacity;
- uint32_t m_idxLeafCap;
- uint32_t m_idxDimension;
- double m_idxFillFactor;
- bool m_idxExists;
-
- std::string m_idxFilename;
-
- uint16_t m_bufferCapacity;
- bool m_bufferWriteThrough;
-
- bool m_Initialized;
-
-
- void Setup();
- SpatialIndex::IStorageManager* CreateStorage(std::string& filename);
- SpatialIndex::StorageManager::IBuffer* CreateIndexBuffer(SpatialIndex::IStorageManager& storage);
- SpatialIndex::ISpatialIndex* CreateIndex(LASIndexDataStream& strm);
- SpatialIndex::ISpatialIndex* LoadIndex();
- bool ExternalIndexExists(std::string& filename);
-};
class LASVisitor : public SpatialIndex::IVisitor
{
@@ -165,64 +71,8 @@
void visitData(std::vector<const SpatialIndex::IData*>& v);
};
-class LASIndexDataStream : public SpatialIndex::IDataStream
-{
-public:
- LASIndexDataStream(LASReader* reader);
- ~LASIndexDataStream();
-
- SpatialIndex::IData* getNext();
- bool hasNext() throw (Tools::NotSupportedException);
-
- size_t size() throw (Tools::NotSupportedException);
- void rewind() throw (Tools::NotSupportedException);
-
- bool readPoint();
-
-protected:
- liblas::LASReader* m_reader;
- SpatialIndex::RTree::Data* m_pNext;
- SpatialIndex::id_type m_id;
-};
-
-
-
-
-extern SpatialIndex::IStorageManager* returnLASStorageManager(Tools::PropertySet& in);
-extern SpatialIndex::IStorageManager* createNewLASStorageManager();
-
-class LASStorageManager : public SpatialIndex::IStorageManager
-{
-public:
- LASStorageManager(Tools::PropertySet&);
-
- virtual ~LASStorageManager();
-
- virtual void loadByteArray(const SpatialIndex::id_type id, size_t& len, uint8_t** data);
- virtual void storeByteArray(SpatialIndex::id_type& id, const size_t len, const uint8_t* const data);
- virtual void deleteByteArray(const SpatialIndex::id_type id);
-
-private:
- class Entry
- {
- public:
- byte* m_pData;
- size_t m_length;
-
- Entry(size_t l, const uint8_t* const d) : m_pData(0), m_length(l)
- {
- m_pData = new uint8_t[m_length];
- memcpy(m_pData, d, m_length);
- }
-
- ~Entry() { delete[] m_pData; }
- }; // Entry
-
- std::vector<Entry*> m_buffer;
- std::stack<SpatialIndex::id_type> m_emptyPages;
-}; // MemoryStorageManager
}
-#endif // LIBLAS_LASINDEX_HPP_INCLUDED
+#endif // LIBLAS_INDEX_VISITOR_HPP_INCLUDED
More information about the Liblas-commits
mailing list