[Liblas-commits] hg-main-tree: not every app should claim to be pc2pc

liblas-commits at liblas.org liblas-commits at liblas.org
Fri Mar 18 12:03:21 EDT 2011


details:   http://hg.libpc.orghg-main-tree/rev/c9138549c786
changeset: 370:c9138549c786
user:      Kirk McKelvey <kirkoman at lizardtech.com>
date:      Fri Mar 18 10:59:49 2011 -0500
description:
not every app should claim to be pc2pc
Subject: hg-main-tree: teach pcinfo to open .sid files

details:   http://hg.libpc.orghg-main-tree/rev/3d8d4009ee19
changeset: 371:3d8d4009ee19
user:      Kirk McKelvey <kirkoman at lizardtech.com>
date:      Fri Mar 18 11:00:22 2011 -0500
description:
teach pcinfo to open .sid files
Subject: hg-main-tree: get mrsid reader linking and reporting num points

details:   http://hg.libpc.orghg-main-tree/rev/fa468a10815f
changeset: 372:fa468a10815f
user:      Kirk McKelvey <kirkoman at lizardtech.com>
date:      Fri Mar 18 11:03:09 2011 -0500
description:
get mrsid reader linking and reporting num points

diffstat:

 apps/Application.cpp                   |   2 +-
 apps/pcinfo.cpp                        |  28 ++++++++++++++++++++++------
 include/libpc/drivers/mrsid/Reader.hpp |   2 ++
 src/drivers/mrsid/Reader.cpp           |  20 +++++++++++++++++---
 4 files changed, 42 insertions(+), 10 deletions(-)

diffs (129 lines):

diff -r d1d3936fca57 -r fa468a10815f apps/Application.cpp
--- a/apps/Application.cpp	Fri Mar 18 10:39:39 2011 -0500
+++ b/apps/Application.cpp	Fri Mar 18 11:03:09 2011 -0500
@@ -180,7 +180,7 @@
 void Application::outputVersion()
 {
     std::cout << "--------------------------------------------------------------------\n";
-    std::cout << "pc2pc (" << libpc::GetFullVersionString() << ")\n";
+    std::cout << m_appName << " (" << libpc::GetFullVersionString() << ")\n";
     std::cout << "--------------------------------------------------------------------\n";
     std::cout << std::endl;
 }
diff -r d1d3936fca57 -r fa468a10815f apps/pcinfo.cpp
--- a/apps/pcinfo.cpp	Fri Mar 18 10:39:39 2011 -0500
+++ b/apps/pcinfo.cpp	Fri Mar 18 11:03:09 2011 -0500
@@ -11,7 +11,8 @@
 
 
 #include <libpc/drivers/las/Reader.hpp>
-#include <libpc/drivers/liblas/reader.hpp>
+#include <libpc/drivers/liblas/Reader.hpp>
+#include <libpc/drivers/mrsid/Reader.hpp>
 
 #include <iostream>
 
@@ -79,20 +80,35 @@
     std::istream* ifs = Utils::openFile(m_inputFile);
 
     libpc::Stage* reader = NULL;
-    if (hasOption("native"))
+    size_t ext = m_inputFile.find_last_of('.');
+    if (ext != std::string::npos)
     {
-        reader = new libpc::drivers::las::LasReader(*ifs);
+        ext++;
+        if (!m_inputFile.substr(ext).compare("las") ||
+            !m_inputFile.substr(ext).compare("laz"))
+        {
+            if (hasOption("native"))
+                reader = new libpc::drivers::las::LasReader(*ifs);
+            else
+                reader = new libpc::drivers::liblas::LiblasReader(*ifs);
+        }
+        else if (!m_inputFile.substr(ext).compare("sid"))
+        {
+            reader = new libpc::drivers::mrsid::Reader(m_inputFile.c_str());
+        }
     }
     else
     {
-        reader = new libpc::drivers::liblas::LiblasReader(*ifs);
+        std::cerr << "Cannot determine file type of " << m_inputFile
+                  << "." << std::endl;
+        return 1;
     }
 
     boost::uint64_t numPoints = reader->getNumPoints();
 
     delete reader;
-
-    Utils::closeFile(ifs);
+    if (ifs)
+        Utils::closeFile(ifs);
 
     std::cout << numPoints << " points\n";
 
diff -r d1d3936fca57 -r fa468a10815f include/libpc/drivers/mrsid/Reader.hpp
--- a/include/libpc/drivers/mrsid/Reader.hpp	Fri Mar 18 10:39:39 2011 -0500
+++ b/include/libpc/drivers/mrsid/Reader.hpp	Fri Mar 18 11:03:09 2011 -0500
@@ -58,6 +58,8 @@
 
     const std::string& getName() const;
 
+    void seekToPoint(boost::uint64_t pointNum);
+    Iterator* createIterator(const Bounds<double>& bounds);
 protected:
     boost::uint32_t readBuffer(PointData&);
 
diff -r d1d3936fca57 -r fa468a10815f src/drivers/mrsid/Reader.cpp
--- a/src/drivers/mrsid/Reader.cpp	Fri Mar 18 10:39:39 2011 -0500
+++ b/src/drivers/mrsid/Reader.cpp	Fri Mar 18 11:03:09 2011 -0500
@@ -67,8 +67,12 @@
     Schema& schema = header->getSchema();
 
     header->setNumPoints(m_reader->getNumPoints());
-    Bounds<double> bounds(m_reader->getBounds().x.min, m_reader->getBounds().y.min, m_reader->getBounds().z.min,
-                          m_reader->getBounds().x.max, m_reader->getBounds().y.max, m_reader->getBounds().z.max);
+    Bounds<double> bounds(m_reader->getBounds().x.min,
+                          m_reader->getBounds().y.min,
+                          m_reader->getBounds().z.min,
+                          m_reader->getBounds().x.max,
+                          m_reader->getBounds().y.max,
+                          m_reader->getBounds().z.max);
 
     header->setBounds(bounds);
 
@@ -89,7 +93,7 @@
         return Dimension::Field_X;
     if (!strcmp(CHANNEL_NAME_Y, fieldname))
         return Dimension::Field_Y;
-    if (!strcmp(CHANNEL_NAME_Y, fieldname))
+    if (!strcmp(CHANNEL_NAME_Z, fieldname))
         return Dimension::Field_Z;
     if (!strcmp(CHANNEL_NAME_Intensity, fieldname))
         return Dimension::Field_Intensity;
@@ -125,6 +129,7 @@
     // Field_WaveformYt
     // Field_WaveformZt
     // ...
+    return Dimension::Field_X;
 }
 
 libpc::Dimension::DataType
@@ -169,6 +174,15 @@
     return 0;
 }
 
+void Reader::seekToPoint(boost::uint64_t)
+{
+    return;
+}
+
+libpc::Iterator *Reader::createIterator(const libpc::Bounds<double>&)
+{
+    return NULL;
+}
 
 }
 }


More information about the Liblas-commits mailing list