[Liblas-commits] hg: 2 new changesets

liblas-commits at liblas.org liblas-commits at liblas.org
Sat Oct 24 23:04:12 EDT 2009


changeset 30ad41bdedb5 in /home/www/liblas.org/hg
details: http://hg.liblas.org/main/hg?cmd=changeset;node=30ad41bdedb5
summary: support non- bulk loaded indexes.  damn I rreally wish I could migrate this crap to the sidx C API

changeset e9158c0af165 in /home/www/liblas.org/hg
details: http://hg.liblas.org/main/hg?cmd=changeset;node=e9158c0af165
summary: merge

diffstat:

 CMakeLists.txt                 |  30 ++++++++++++++++++++++--------
 COPYING                        |   1 +
 CTestConfig.cmake              |  20 ++++++++++++++++++++
 ChangeLog                      |   3 +++
 apps/lasindex.cpp              |  48 ++++++++++++++++++++++++++++++++++++++++++------
 include/liblas/index/index.hpp |   1 +
 src/index/index.cpp            |  30 +++++++++++++++++++++++++++++-
 7 files changed, 118 insertions(+), 15 deletions(-)

diffs (241 lines):

diff -r 5e54e79a89a7 -r e9158c0af165 CMakeLists.txt
--- a/CMakeLists.txt	Fri Oct 23 21:29:54 2009 -0500
+++ b/CMakeLists.txt	Sat Oct 24 22:01:06 2009 -0500
@@ -25,6 +25,11 @@
 SET(WITH_UTILITIES TRUE CACHE BOOL "Choose if libLAS utilities should be built")
 SET(WITH_TESTS FALSE CACHE BOOL "Choose if libLAS unit tests should be built")
 
+# Enable CTest and submissions to libLAS dashboard at CDash
+# http://my.cdash.org/index.php?project=libLAS
+SET(ENABLE_CTEST FALSE CACHE BOOL
+    "Enable CTest to support submissions of results to CDash at http://cdash.org")
+
 ###############################################################################
 # CMake settings
 CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0)
@@ -244,20 +249,29 @@
 ADD_SUBDIRECTORY(src)
 
 IF(WITH_UTILITIES)
-    MESSAGE(STATUS "Adding libLAS utilities to build - done")
+    MESSAGE(STATUS "Enable libLAS utilities to build - done")
     ADD_SUBDIRECTORY(apps)
 ENDIF()
 
 IF(WITH_TESTS)
-    # TODO:
-    # Waiting for Mercurial support at cdash.org --mloskot
-    # Dashboard has been prepared for experiments
-    # http://my.cdash.org/index.php?project=libLAS
-    #INCLUDE(CTest)
+    MESSAGE(STATUS "Enable libLAS unit tests to build - done")
+    ENABLE_TESTING()
 
-    MESSAGE(STATUS "Adding libLAS unit test suite to build - done")
-    ENABLE_TESTING()
+
+    IF(ENABLE_CTEST)
+        MESSAGE(STATUS "Enable CTest to support submissions of results to CDash at http://cdash.org")
+        CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0)
+        # Dashboard has been prepared for experiments
+        # http://my.cdash.org/index.php?project=libLAS
+        INCLUDE(CTest)
+        MESSAGE(STATUS "Enable CTest to support submissions of results to CDash at http://cdash.org - done")
+    ENDIF()
+
     ADD_SUBDIRECTORY(test)
+ELSE()
+    IF(ENABLE_CTEST)
+        MESSAGE(WARNING "CTest support requested but WITH_TESTS option not specified to build of libLAS unit tests")
+    ENDIF()
 ENDIF()
 
 # EOF
diff -r 5e54e79a89a7 -r e9158c0af165 COPYING
--- a/COPYING	Fri Oct 23 21:29:54 2009 -0500
+++ b/COPYING	Sat Oct 24 22:01:06 2009 -0500
@@ -0,0 +1,1 @@
+empty file
diff -r 5e54e79a89a7 -r e9158c0af165 CTestConfig.cmake
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/CTestConfig.cmake	Sat Oct 24 22:01:06 2009 -0500
@@ -0,0 +1,20 @@
+###############################################################################
+#
+# CTest configuration for libLAS project
+#
+# libLAS CDash: http://my.cdash.org/index.php?project=libLAS
+#
+###############################################################################
+## This file should be placed in the root directory of your project.
+## Then modify the CMakeLists.txt file in the root directory of your
+## project to incorporate the testing dashboard.
+## # The following are required to uses Dart and the Cdash dashboard
+##   ENABLE_TESTING()
+##   INCLUDE(CTest)
+set(CTEST_PROJECT_NAME "libLAS")
+set(CTEST_NIGHTLY_START_TIME "01:30:00 BST")
+
+set(CTEST_DROP_METHOD "http")
+set(CTEST_DROP_SITE "my.cdash.org")
+set(CTEST_DROP_LOCATION "/submit.php?project=libLAS")
+set(CTEST_DROP_SITE_CDASH TRUE)
diff -r 5e54e79a89a7 -r e9158c0af165 ChangeLog
--- a/ChangeLog	Fri Oct 23 21:29:54 2009 -0500
+++ b/ChangeLog	Sat Oct 24 22:01:06 2009 -0500
@@ -1,3 +1,6 @@
+FIXME: The log is way behind the reality. Are we going to maintain it? --mloskot
+
+
 2009-03-25 16:58  hobu
 
 	* trunk/nmake.opt: tweak some comments
diff -r 5e54e79a89a7 -r e9158c0af165 apps/lasindex.cpp
--- a/apps/lasindex.cpp	Fri Oct 23 21:29:54 2009 -0500
+++ b/apps/lasindex.cpp	Sat Oct 24 22:01:06 2009 -0500
@@ -49,12 +49,28 @@
 
 using namespace liblas;
 
+void LoadIndex (LASIndex* index, LASReader* reader, long dimension) 
+{
+
+    bool read = reader->ReadNextPoint();
+    liblas::int64_t id = 0;
+    if (read) {
+        const LASPoint& p = reader->GetPoint();
+        index->insert(const_cast<LASPoint&>(p), id);
+    }
+    while (reader->ReadNextPoint()) {
+        id += 1;
+        const LASPoint& p = reader->GetPoint();
+        index->insert(const_cast<LASPoint&>(p), id);
+    }
+}
 int main(int argc, char* argv[])
 {
     std::string input;
     
     long dimension = 3;
     long capacity = 10000;
+    bool bBulkLoad = true;
     
     for (int i = 1; i < argc; i++)
     {
@@ -82,6 +98,7 @@
             i++;
             dimension = atoi(argv[i]);
         }
+        
         else if (   std::strcmp(argv[i],"--capacity") == 0  ||
                     std::strcmp(argv[i],"-cap") == 0     ||
                     std::strcmp(argv[i],"-c") == 0       
@@ -90,6 +107,14 @@
             i++;
             capacity = atoi(argv[i]);
         }
+        else if (   std::strcmp(argv[i],"--individual") == 0  ||
+                    std::strcmp(argv[i],"--non-bulk") == 0     ||
+                    std::strcmp(argv[i],"-g") == 0       
+                )
+        {
+
+            bBulkLoad = false;
+        }
         else if (input.empty())
         {
             input = std::string(argv[i]);
@@ -112,18 +137,29 @@
     LASReader* reader = new LASReader(*istrm);
     std::cout << "Indexing " << input<< " "<<std::endl;
 
-    LASIndexDataStream* idxstrm = new LASIndexDataStream(reader, dimension);
-    
+    LASIndexDataStream* idxstrm = 0;
     
     LASIndex* idx = new LASIndex(input);
     idx->SetType(LASIndex::eExternalIndex);
     idx->SetLeafCapacity(capacity);
     idx->SetFillFactor(0.8);
     idx->SetDimension(dimension);
-    idx->Initialize(*idxstrm);
 
-    delete idx;
-    delete idxstrm;
-    delete reader;
+    if (bBulkLoad) {
+        idxstrm = new LASIndexDataStream(reader, dimension);
+        idx->Initialize(*idxstrm);
+    } else {
+        idx->Initialize();
+        LoadIndex(idx, reader, dimension);
+    }
+
+    if (idx)
+        delete idx;
+    
+    if (idxstrm)
+        delete idxstrm;
+    if (reader)
+        delete reader;
+    
     delete istrm;
 }
diff -r 5e54e79a89a7 -r e9158c0af165 include/liblas/index/index.hpp
--- a/include/liblas/index/index.hpp	Fri Oct 23 21:29:54 2009 -0500
+++ b/include/liblas/index/index.hpp	Sat Oct 24 22:01:06 2009 -0500
@@ -185,6 +185,7 @@
     SpatialIndex::IStorageManager* CreateStorage(std::string& filename);
     SpatialIndex::StorageManager::IBuffer* CreateIndexBuffer(SpatialIndex::IStorageManager& storage);
     SpatialIndex::ISpatialIndex* CreateIndex(LASIndexDataStream& strm);
+    SpatialIndex::ISpatialIndex* CreateIndex();
     SpatialIndex::ISpatialIndex* LoadIndex();
     bool ExternalIndexExists(std::string& filename);
 };
diff -r 5e54e79a89a7 -r e9158c0af165 src/index/index.cpp
--- a/src/index/index.cpp	Fri Oct 23 21:29:54 2009 -0500
+++ b/src/index/index.cpp	Sat Oct 24 22:01:06 2009 -0500
@@ -128,7 +128,8 @@
     }
     else
     {
-        throw std::runtime_error("can't create index with only a filename, must have LASDatastream");
+        m_rtree = CreateIndex();
+        // throw std::runtime_error("can't create index with only a filename, must have LASDatastream");
     }
     
     m_Initialized = true;
@@ -190,6 +191,33 @@
     }    
 }
 
+SpatialIndex::ISpatialIndex* LASIndex::CreateIndex() 
+{
+    using namespace SpatialIndex;
+    
+    ISpatialIndex* index = 0;
+    
+    try{
+        index = RTree::createNewRTree( 
+                                                      *m_buffer,
+                                                      m_idxFillFactor,
+                                                      m_idxCapacity,
+                                                      m_idxLeafCap,
+                                                      m_idxDimension,
+                                                      SpatialIndex::RTree::RV_RSTAR,
+                                                      m_idxId);
+        bool ret = index->isIndexValid();
+        if (ret == false) 
+            throw std::runtime_error(   "Spatial index error: index is not "
+                                        "valid after CreateIndex");
+
+        return index;
+    } catch (Tools::Exception& e) {
+        std::ostringstream os;
+        os << "Spatial Index Error: " << e.what();
+        throw std::runtime_error(os.str());
+    }    
+}
 SpatialIndex::ISpatialIndex* LASIndex::LoadIndex() 
 {
     using namespace SpatialIndex;


More information about the Liblas-commits mailing list