[Liblas-commits] r1246 - in trunk: apps include/liblas src
liblas-commits at liblas.org
liblas-commits at liblas.org
Wed Apr 22 21:50:27 EDT 2009
Author: hobu
Date: Wed Apr 22 21:50:27 2009
New Revision: 1246
URL: http://liblas.org/changeset/1246
Log:
#ifdef's around the spatial indexing stuff for now
Modified:
trunk/apps/Makefile.am
trunk/apps/lasindex.cpp
trunk/include/liblas/lasreader.hpp
trunk/src/Makefile.am
trunk/src/lasreader.cpp
Modified: trunk/apps/Makefile.am
==============================================================================
--- trunk/apps/Makefile.am (original)
+++ trunk/apps/Makefile.am Wed Apr 22 21:50:27 2009
@@ -21,7 +21,11 @@
lasindex_SOURCES = lasindex.cpp
-bin_PROGRAMS = lasinfo las2las lasmerge las2txt txt2las ts2las lasindex
+bin_PROGRAMS = lasinfo las2las lasmerge las2txt txt2las ts2las
+
+if SPATIALINDEX_IS_CONFIG
+bin_PROGRAMS += lasindex
+endif
bin_SCRIPTS = liblas-config
Modified: trunk/apps/lasindex.cpp
==============================================================================
--- trunk/apps/lasindex.cpp (original)
+++ trunk/apps/lasindex.cpp Wed Apr 22 21:50:27 2009
@@ -105,7 +105,7 @@
LASHeader header = reader->GetHeader();
std::cout << "number of points: " << header.GetPointRecordsCount() << std::endl;
- for (int i=0; i< 23; i++) {
+ for (int i=0; i< header.GetPointRecordsCount(); i++) {
bool read = reader->ReadPointAt(i);
LASPoint p = reader->GetPoint();
std::cout.precision(2);
Modified: trunk/include/liblas/lasreader.hpp
==============================================================================
--- trunk/include/liblas/lasreader.hpp (original)
+++ trunk/include/liblas/lasreader.hpp Wed Apr 22 21:50:27 2009
@@ -47,8 +47,12 @@
#include <liblas/laspoint.hpp>
#include <liblas/lasvariablerecord.hpp>
#include <liblas/lasspatialreference.hpp>
-#include <liblas/lasindex.hpp>
#include <liblas/detail/fwd.hpp>
+
+#ifdef USE_SPATIALINDEX
+#include <liblas/lasindex.hpp>
+#endif
+
// std
#include <iosfwd>
#include <string>
@@ -88,7 +92,9 @@
void Index(std::string& filename);
void Index();
+#ifdef USE_SPATIALINDEX
LASIndex* GetIndex();
+#endif
private:
@@ -104,7 +110,12 @@
std::vector<LASVariableRecord> m_vlrs;
bool m_doindex;
+
+#ifdef USE_SPATIALINDEX
LASIndex* m_index;
+#else
+ typedef void* LASIndex;
+#endif
};
} // namespace liblas
Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am (original)
+++ trunk/src/Makefile.am Wed Apr 22 21:50:27 2009
@@ -23,7 +23,6 @@
laserror.cpp \
laspoint.cpp \
lasheader.cpp \
- lasindex.cpp \
lasvariablerecord.cpp \
lasreader.cpp \
laswriter.cpp \
@@ -43,5 +42,8 @@
if GDAL_IS_CONFIG
liblas_la_SOURCES += gt_wkt_srs.cpp
endif
-
+
+if SPATIALINDEX_IS_CONFIG
+liblas_la_SOURCES += lasindex.cpp
+endif
liblas_la_LDFLAGS = -version-info 1:0:0
Modified: trunk/src/lasreader.cpp
==============================================================================
--- trunk/src/lasreader.cpp (original)
+++ trunk/src/lasreader.cpp Wed Apr 22 21:50:27 2009
@@ -58,7 +58,9 @@
m_pimpl(detail::ReaderFactory::Create(ifs)),
m_doindex(false)
{
+#ifdef USE_SPATIALINDEX
m_index = 0;
+#endif
Init();
}
@@ -66,7 +68,9 @@
{
// empty, but required so we can implement PIMPL using
// std::auto_ptr with incomplete type (Reader).
+#ifdef USE_SPATIALINDEX
if (m_index != 0) delete m_index;
+#endif
}
std::size_t LASReader::GetVersion() const
@@ -93,7 +97,10 @@
bool LASReader::ReadPointAt(std::size_t n)
{
bool ret = m_pimpl->ReadPointAt(n, m_point, m_header);
+
+#ifdef USE_SPATIALINDEX
if (m_doindex) m_index->insert(m_point, n);
+#endif
return ret;
}
@@ -152,20 +159,25 @@
void LASReader::Index()
{
m_doindex = true;
+#ifdef USE_SPATIALINDEX
m_index = new LASIndex();
+#endif
}
void LASReader::Index(std::string& filename)
{
m_doindex = true;
+#ifdef USE_SPATIALINDEX
m_index = new LASIndex(filename);
-
+#endif
}
+#ifdef USE_SPATIALINDEX
+
LASIndex* LASReader::GetIndex()
{
return m_index;
}
-
+#endif
} // namespace liblas
More information about the Liblas-commits
mailing list