[Liblas-commits] hg: 3 new changesets
liblas-commits at liblas.org
liblas-commits at liblas.org
Wed Aug 18 10:11:45 EDT 2010
changeset df07406b52de in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=df07406b52de
summary: Fixed case of Boost CMake macros. Incorrect case led to not adding Boost include path to include directories.
changeset c70a97b6ec33 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=c70a97b6ec33
summary: Missing boost:: qualifiers specified for integer types.
changeset 3ef3932dd20a in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=3ef3932dd20a
summary: mege
diffstat:
CMakeLists.txt | 4 +-
include/liblas/detail/index/indexcell.hpp | 2 +-
include/liblas/detail/index/indexoutput.hpp | 53 +-
include/liblas/lasfilter.hpp | 6 +-
include/liblas/lasindex.hpp | 137 +++-
src/CMakeLists.txt | 1 +
src/detail/index/indexoutput.cpp | 415 +++++++--------
src/lasfilter.cpp | 2 +
src/lasindex.cpp | 731 +++++++++++++++++----------
9 files changed, 822 insertions(+), 529 deletions(-)
diffs (truncated from 2090 to 300 lines):
diff -r 5de82dbc68a8 -r 3ef3932dd20a CMakeLists.txt
--- a/CMakeLists.txt Tue Aug 17 22:17:47 2010 +0100
+++ b/CMakeLists.txt Wed Aug 18 15:15:24 2010 +0100
@@ -120,9 +120,9 @@
# Boost C++ Libraries support - required
message(STATUS "Searching for Boost 1.38+ - done")
-find_package(Boost 1.38 REQUIRED program_options)
+find_package(Boost 1.38 COMPONENTS program_options REQUIRED)
-if(Boost_FOUND AND Boost_program_options_FOUND)
+if(Boost_FOUND AND Boost_PROGRAM_OPTIONS_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
endif()
diff -r 5de82dbc68a8 -r 3ef3932dd20a include/liblas/detail/index/indexcell.hpp
--- a/include/liblas/detail/index/indexcell.hpp Tue Aug 17 22:17:47 2010 +0100
+++ b/include/liblas/detail/index/indexcell.hpp Wed Aug 18 15:15:24 2010 +0100
@@ -43,7 +43,7 @@
#ifndef LIBLAS_DETAIL_INDEXCELL_HPP_INCLUDED
#define LIBLAS_DETAIL_INDEXCELL_HPP_INCLUDED
-#include <boost/cstdint.hpp>
+
#include <map>
namespace liblas { namespace detail {
diff -r 5de82dbc68a8 -r 3ef3932dd20a include/liblas/detail/index/indexoutput.hpp
--- a/include/liblas/detail/index/indexoutput.hpp Tue Aug 17 22:17:47 2010 +0100
+++ b/include/liblas/detail/index/indexoutput.hpp Wed Aug 18 15:15:24 2010 +0100
@@ -43,7 +43,6 @@
#ifndef LIBLAS_DETAIL_INDEXOUTPUT_HPP_INCLUDED
#define LIBLAS_DETAIL_INDEXOUTPUT_HPP_INCLUDED
-#include <boost/cstdint.hpp>
#include <liblas/lasindex.hpp>
#include <liblas/detail/index/indexcell.hpp>
@@ -59,8 +58,8 @@
liblas::Index *m_index;
liblas::VariableRecord m_indexVLRHeaderRecord, m_indexVLRCellRecord;
IndexVLRData m_indexVLRHeaderData, m_indexVLRCellPointData, m_indexVLRTempData;
- uint32_t m_VLRCommonDataSize, m_VLRDataSizeLocation, m_FirstCellLocation, m_LastCellLocation, m_DataRecordSize,
- m_TempWritePos;
+ uint32_t m_VLRCommonDataSize, m_VLRDataSizeLocation, m_FirstCellLocation, m_LastCellLocation;
+ uint32_t m_DataRecordSize, m_TempWritePos;
bool m_FirstCellInVLR, m_SomeDataReadyToWrite;
protected:
@@ -71,6 +70,54 @@
};
+template <typename T, typename Q>
+inline void WriteVLRData_n(IndexVLRData& dest, T src, Q& pos)
+{
+ // Fix little-endian
+ LIBLAS_SWAP_BYTES_N(&src, sizeof(T));
+ // error if writing past array end
+ if (static_cast<size_t>(pos) + sizeof(T) > dest.size())
+ throw std::out_of_range("liblas::detail::WriteVLRData_n: array index out of range");
+ // copy sizeof(T) bytes to destination
+ memcpy(&dest[pos], &src, sizeof(T));
+ // increment the write position to end of written data
+ pos += sizeof(T);
+}
+
+template <typename T, typename Q>
+inline void WriteVLRDataNoInc_n(IndexVLRData& dest, T src, Q const& pos)
+{
+ // Fix little-endian
+ LIBLAS_SWAP_BYTES_N(&src, sizeof(T));
+ // error if writing past array end
+ if (static_cast<size_t>(pos) + sizeof(T) > dest.size())
+ throw std::out_of_range("liblas::detail::WriteVLRDataNoInc_n: array index out of range");
+ // copy sizeof(T) bytes to destination
+ memcpy(&dest[pos], &src, sizeof(T));
+}
+
+template <typename T, typename Q>
+inline void WriteVLRData_str(IndexVLRData& dest, char * const src, T const srclen, Q& pos)
+{
+ // copy srclen bytes to destination
+ memcpy(&dest[pos], src, srclen);
+ // error if writing past array end
+ if (static_cast<size_t>(pos) + static_cast<size_t>(srclen) > dest.size())
+ throw std::out_of_range("liblas::detail::WriteVLRData_str: array index out of range");
+ // increment the write position to end of written data
+ pos += srclen;
+}
+
+template <typename T, typename Q>
+inline void WriteVLRDataNoInc_str(IndexVLRData& dest, char * const src, T const srclen, Q pos)
+{
+ // error if writing past array end
+ if (static_cast<size_t>(pos) + static_cast<size_t>(srclen) > dest.size())
+ throw std::out_of_range("liblas::detail::WriteVLRDataNoInc_str: array index out of range");
+ // copy srclen bytes to destination
+ memcpy(&dest[pos], src, srclen);
+}
+
}} // namespace liblas::detail
#endif // LIBLAS_DETAIL_INDEXOUTPUT_HPP_INCLUDED
diff -r 5de82dbc68a8 -r 3ef3932dd20a include/liblas/lasfilter.hpp
--- a/include/liblas/lasfilter.hpp Tue Aug 17 22:17:47 2010 +0100
+++ b/include/liblas/lasfilter.hpp Wed Aug 18 15:15:24 2010 +0100
@@ -128,7 +128,7 @@
{
public:
- ThinFilter(uint32_t thin);
+ ThinFilter(boost::uint32_t thin);
bool filter(const liblas::Point& point);
@@ -137,8 +137,8 @@
ThinFilter(ThinFilter const& other);
ThinFilter& operator=(ThinFilter const& rhs);
- uint32_t thin_amount;
- uint32_t thin_count;
+ boost::uint32_t thin_amount;
+ boost::uint32_t thin_count;
};
diff -r 5de82dbc68a8 -r 3ef3932dd20a include/liblas/lasindex.hpp
--- a/include/liblas/lasindex.hpp Tue Aug 17 22:17:47 2010 +0100
+++ b/include/liblas/lasindex.hpp Wed Aug 18 15:15:24 2010 +0100
@@ -42,9 +42,10 @@
#ifndef LIBLAS_LASINDEX_HPP_INCLUDED
#define LIBLAS_LASINDEX_HPP_INCLUDED
-#include <boost/cstdint.hpp>
+
#include <liblas/lasreader.hpp>
#include <liblas/lasheader.hpp>
+#include <liblas/lasbounds.hpp>
#include <liblas/lasvariablerecord.hpp>
#include <liblas/detail/index/indexcell.hpp>
@@ -73,10 +74,10 @@
{
public:
Index();
- Index(liblas::Reader *reader, std::ostream *ofs = 0, const char *tmpfilenme = 0, const char *outfilenme = 0, const char *indexauthor = 0,
+ Index(liblas::Reader *reader, std::ostream *ofs = 0, const char *tmpfilenme = 0, const char *indexauthor = 0,
const char *indexcomment = 0, const char *indexdate = 0,
double zbinht = 0.0, uint32_t maxmem = LIBLAS_INDEX_MAXMEMDEFAULT, int debugoutputlevel = 0, FILE *debugger = 0);
- Index(std::istream *ifs, std::ostream *ofs = 0, const char *tmpfilenme = 0, const char *outfilenme = 0, const char *indexauthor = 0,
+ Index(std::istream *ifs, std::ostream *ofs = 0, const char *tmpfilenme = 0, const char *indexauthor = 0,
const char *indexcomment = 0, const char *indexdate = 0,
double zbinht = 0.0, uint32_t maxmem = LIBLAS_INDEX_MAXMEMDEFAULT, int debugoutputlevel = 0, FILE *debugger = 0);
Index(IndexData const& ParamSrc);
@@ -91,8 +92,11 @@
private:
Reader *m_reader;
- Header m_header;
- bool m_indexBuilt, m_tempFileStarted, m_readerCreated, m_readOnly, m_forceNewIndex;
+ Reader *m_idxreader;
+ Header m_pointheader;
+ Header m_idxheader;
+ Bounds<double> m_bounds;
+ bool m_indexBuilt, m_tempFileStarted, m_readerCreated, m_readOnly, m_writestandaloneindex, m_forceNewIndex;
int m_debugOutputLevel;
uint32_t m_pointRecordsCount, m_maxMemoryUsage, m_cellsX, m_cellsY, m_cellsZ, m_totalCells,
m_tempFileWrittenBytes, m_DataVLR_ID;
@@ -100,11 +104,10 @@
m_LowZCellCompletelyIn, m_HighZCellCompletelyIn;
int32_t m_LowXBorderCell, m_HighXBorderCell, m_LowYBorderCell, m_HighYBorderCell,
m_LowZBorderCell, m_HighZBorderCell;
- double m_minX, m_maxX, m_minY, m_maxY, m_minZ, m_maxZ, m_scaleX, m_scaleY, m_scaleZ,
- m_offsetX, m_offsetY, m_offsetZ, m_rangeX, m_rangeY, m_rangeZ, m_cellSizeZ, m_cellSizeX, m_cellSizeY;
- double m_filterMinXCell, m_filterMaxXCell, m_filterMinYCell, m_filterMaxYCell, m_filterMinZCell, m_filterMaxZCell;
+ double m_rangeX, m_rangeY, m_rangeZ, m_cellSizeZ, m_cellSizeX, m_cellSizeY;
+ double m_filterMinXCell, m_filterMaxXCell, m_filterMinYCell, m_filterMaxYCell, m_filterMinZCell, m_filterMaxZCell,
+ m_LowXBorderPartCell, m_HighXBorderPartCell, m_LowYBorderPartCell, m_HighYBorderPartCell;
std::string m_tempFileName;
- std::string m_outFileName;
std::string m_indexAuthor;
std::string m_indexComment;
std::string m_indexDate;
@@ -120,6 +123,11 @@
bool LoadIndexVLR(VariableRecord const& vlr);
void SetCellFilterBounds(IndexData const& ParamSrc);
bool FilterOneVLR(VariableRecord const& vlr, uint32_t& i, IndexData const& ParamSrc);
+ bool VLRInteresting(int32_t MinCellX, int32_t MinCellY, int32_t MaxCellX, int32_t MaxCellY,
+ IndexData const& ParamSrc);
+ bool CellInteresting(int32_t x, int32_t y, IndexData const& ParamSrc);
+ bool SubCellInteresting(int32_t SubCellID, int32_t XCellID, int32_t YCellID, IndexData const& ParamSrc);
+ bool ZCellInteresting(int32_t ZCellID, IndexData const& ParamSrc);
bool FilterOnePoint(int32_t x, int32_t y, int32_t z, int32_t PointID, int32_t LastPointID, bool &LastPtRead,
IndexData const& ParamSrc);
bool IdentifyCell(Point const& CurPt, uint32_t& CurCellX, uint32_t& CurCellY) const;
@@ -132,8 +140,6 @@
void CloseTempFile(void);
bool SaveIndexInLASFile(void);
bool SaveIndexInStandAloneFile(void);
- FILE *OpenOutputFile(void);
- void CloseOutputFile(void);
bool FileError(const char *Reporter);
bool OutputFileError(const char *Reporter) const;
bool DebugOutputError(const char *Reporter) const;
@@ -141,6 +147,7 @@
bool PointBoundsError(const char *Reporter) const;
bool MemoryError(const char *Reporter) const;
bool InitError(const char *Reporter) const;
+ bool InputBoundsError(const char *Reporter) const;
// debugging
bool OutputCellStats(IndexCellDataBlock& CellBlock) const;
@@ -150,12 +157,13 @@
bool IndexFailed(void) const {return (! m_indexBuilt);};
bool IndexReady(void) const {return (m_indexBuilt);};
const std::vector<uint32_t>& Filter(IndexData const& ParamSrc);
- double GetMinX(void) const {return m_minX;};
- double GetMaxX(void) const {return m_maxX;};
- double GetMinY(void) const {return m_minY;};
- double GetMaxY(void) const {return m_maxY;};
- double GetMinZ(void) const {return m_minZ;};
- double GetMaxZ(void) const {return m_maxZ;};
+ double GetMinX(void) const {return m_bounds.min(0);};
+ double GetMaxX(void) const {return m_bounds.max(0);};
+ double GetMinY(void) const {return m_bounds.min(1);};
+ double GetMaxY(void) const {return m_bounds.max(1);};
+ double GetMinZ(void) const {return m_bounds.min(2);};
+ double GetMaxZ(void) const {return m_bounds.max(2);};
+ Bounds<double> const& GetBounds(void) const {return m_bounds;};
uint32_t GetPointRecordsCount(void) const {return m_pointRecordsCount;};
uint32_t GetCellsX(void) const {return m_cellsX;};
uint32_t GetCellsY(void) const {return m_cellsY;};
@@ -164,13 +172,15 @@
double GetCellSizeZ(void) const {return m_cellSizeZ;};
FILE *GetDebugger(void) const {return m_debugger;};
bool GetReadOnly(void) const {return m_readOnly;};
+ bool GetStandaloneIndex(void) const {return m_writestandaloneindex;};
bool GetForceNewIndex(void) const {return m_forceNewIndex;};
uint32_t GetMaxMemoryUsage(void) const {return m_maxMemoryUsage;};
- Header *GetHeader(void) {return &m_header;};
+ Header *GetPointHeader(void) {return &m_pointheader;};
+ Header *GetIndexHeader(void) {return &m_idxheader;};
Reader *GetReader(void) const {return m_reader;};
+ Reader *GetIndexReader(void) const {return m_idxreader;};
int GetDebugOutputLevel(void) const {return m_debugOutputLevel;};
const char *GetTempFileName(void) const {return m_tempFileName.c_str();};
- const char *GetOutFileName(void) const {return m_outFileName.c_str();};
const char *GetIndexAuthorStr(void) const;
const char *GetIndexCommentStr(void) const;
const char *GetIndexDateStr(void) const;
@@ -178,15 +188,15 @@
void SetIndexAuthorStr(const char *ias) {m_indexAuthor = ias;};
void SetIndexCommentStr(const char *ics) {m_indexComment = ics;};
void SetIndexDateStr(const char *ids) {m_indexDate = ids;};
- void SetMinX(double minX) {m_minX = minX;};
- void SetMaxX(double maxX) {m_maxX = maxX;};
- void SetMinY(double minY) {m_minY = minY;};
- void SetMaxY(double maxY) {m_maxY = maxY;};
- void SetMinZ(double minZ) {m_minZ = minZ;};
- void SetMaxZ(double maxZ) {m_maxZ = maxZ;};
- void CalcRangeX(void) {m_rangeX = m_maxX - m_minX;};
- void CalcRangeY(void) {m_rangeY = m_maxY - m_minY;};
- void CalcRangeZ(void) {m_rangeZ = m_maxZ - m_minZ;};
+ void SetMinX(double minX) {m_bounds.min(0, minX);};
+ void SetMaxX(double maxX) {m_bounds.max(0, maxX);};
+ void SetMinY(double minY) {m_bounds.min(1, minY);};
+ void SetMaxY(double maxY) {m_bounds.max(1, maxY);};
+ void SetMinZ(double minZ) {m_bounds.min(2, minZ);};
+ void SetMaxZ(double maxZ) {m_bounds.max(2, maxZ);};
+ void CalcRangeX(void) {m_rangeX = m_bounds.max(0) - m_bounds.min(0);};
+ void CalcRangeY(void) {m_rangeY = m_bounds.max(1) - m_bounds.min(1);};
+ void CalcRangeZ(void) {m_rangeZ = m_bounds.max(2) - m_bounds.min(2);};
void SetPointRecordsCount(uint32_t prc) {m_pointRecordsCount = prc;};
void SetCellsX(uint32_t cellsX) {m_cellsX = cellsX;};
void SetCellsY(uint32_t cellsY) {m_cellsY = cellsY;};
@@ -200,10 +210,12 @@
public:
IndexData(void);
IndexData(Index const& index);
- bool SetInitialValues(std::istream *ifs = 0, Reader *reader = 0, std::ostream *ofs = 0, const char *tmpfilenme = 0, const char *outfilenme = 0, const char *indexauthor = 0,
+ bool SetInitialValues(std::istream *ifs = 0, Reader *reader = 0, std::ostream *ofs = 0, Reader *idxreader = 0, const char *tmpfilenme = 0, const char *indexauthor = 0,
const char *indexcomment = 0, const char *indexdate = 0, double zbinht = 0.0,
- uint32_t maxmem = LIBLAS_INDEX_MAXMEMDEFAULT, int debugoutputlevel = 0, bool readonly = 0, bool forcenewindex = 0, FILE *debugger = 0);
+ uint32_t maxmem = LIBLAS_INDEX_MAXMEMDEFAULT, int debugoutputlevel = 0, bool readonly = 0, bool writestandaloneindex = 0,
+ bool forcenewindex = 0, FILE *debugger = 0);
bool SetFilterValues(double LowFilterX, double HighFilterX, double LowFilterY, double HighFilterY, double LowFilterZ, double HighFilterZ);
+ bool SetFilterValues(Bounds<double> const& src);
// Blocked copying operations, declared but not defined.
/// Copy constructor.
@@ -213,41 +225,47 @@
private:
void SetValues(void);
+ bool CalcFilterEnablers(void);
protected:
Reader *m_reader;
+ Reader *m_idxreader;
More information about the Liblas-commits
mailing list