[Liblas-commits] hg-main-tree: default the header's scale to 1.0
for xyz
liblas-commits at liblas.org
liblas-commits at liblas.org
Tue Jul 12 10:29:40 EDT 2011
details: http://hg.libpc.orghg-main-tree/rev/839862208644
changeset: 851:839862208644
user: Howard Butler <hobu.inc at gmail.com>
date: Tue Jul 12 09:28:35 2011 -0500
description:
default the header's scale to 1.0 for xyz
Subject: hg-main-tree: apply scaling for test
details: http://hg.libpc.orghg-main-tree/rev/9e4d59b58c15
changeset: 852:9e4d59b58c15
user: Howard Butler <hobu.inc at gmail.com>
date: Tue Jul 12 09:28:52 2011 -0500
description:
apply scaling for test
Subject: hg-main-tree: set z scale to 1.0
details: http://hg.libpc.orghg-main-tree/rev/8d5120f5e1c7
changeset: 853:8d5120f5e1c7
user: Howard Butler <hobu.inc at gmail.com>
date: Tue Jul 12 09:29:08 2011 -0500
description:
set z scale to 1.0
Subject: hg-main-tree: add qfit2las utility (to be removed when we have VRT pipeline working
details: http://hg.libpc.orghg-main-tree/rev/650c22afc8ac
changeset: 854:650c22afc8ac
user: Howard Butler <hobu.inc at gmail.com>
date: Tue Jul 12 09:29:29 2011 -0500
description:
add qfit2las utility (to be removed when we have VRT pipeline working
diffstat:
apps/CMakeLists.txt | 8 ++-
apps/qfit2las.cpp | 116 +++++++++++++++++++++++++++++++++++++++++++
src/drivers/las/Header.cpp | 18 ++++--
src/drivers/qfit/Reader.cpp | 4 +-
test/unit/QFITReaderTest.cpp | 5 +-
5 files changed, 139 insertions(+), 12 deletions(-)
diffs (222 lines):
diff -r 638cd2e5253c -r 650c22afc8ac apps/CMakeLists.txt
--- a/apps/CMakeLists.txt Mon Jul 11 13:54:36 2011 -0700
+++ b/apps/CMakeLists.txt Tue Jul 12 09:29:29 2011 -0500
@@ -23,10 +23,11 @@
set(PC2PC pc2pc)
set(PCINFO pcinfo)
+set(QFIT2LAS qfit2las)
set(PDAL_UTILITIES
- ${PCINFO} ${PC2PC} ${PCVIEW})
+ ${PCINFO} ${PC2PC} ${PCVIEW} ${QFIT2LAS})
#------------------------------------------------------------------------------
@@ -60,6 +61,11 @@
target_link_libraries(${PC2PC} ${APPS_CPP_DEPENDENCIES} )
endif()
+if(QFIT2LAS)
+ add_executable(${QFIT2LAS} qfit2las.cpp Application.cpp Application.hpp)
+ target_link_libraries(${QFIT2LAS} ${APPS_CPP_DEPENDENCIES} )
+endif()
+
#------------------------------------------------------------------------------
# Targets installation
diff -r 638cd2e5253c -r 650c22afc8ac apps/qfit2las.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/apps/qfit2las.cpp Tue Jul 12 09:29:29 2011 -0500
@@ -0,0 +1,116 @@
+/***************************************************************************
+ *
+ * Project: libLAS -- C/C++ read/write library for LAS LIDAR data
+ * Purpose: LAS translation with optional configuration
+ * Author: Howard Butler, hobu.inc at gmail.com
+ ***************************************************************************
+ * Copyright (c) 2010, Howard Butler, hobu.inc at gmail.com
+ *
+ * See LICENSE.txt in this source distribution for more information.
+ **************************************************************************/
+
+
+#include <iostream>
+
+#include <pdal/exceptions.hpp>
+#include <pdal/drivers/las/Reader.hpp>
+
+#include <pdal/drivers/las/Writer.hpp>
+#include <pdal/drivers/qfit/Reader.hpp>
+
+#include "Application.hpp"
+
+using namespace pdal;
+namespace po = boost::program_options;
+
+
+class Application_pc2pc : public Application
+{
+public:
+ Application_pc2pc(int argc, char* argv[]);
+ int execute();
+
+private:
+ void addOptions();
+ bool validateOptions();
+
+ std::string m_inputFile;
+ std::string m_outputFile;
+
+};
+
+
+Application_pc2pc::Application_pc2pc(int argc, char* argv[])
+ : Application(argc, argv, "pc2pc")
+{
+}
+
+
+bool Application_pc2pc::validateOptions()
+{
+ if (!hasOption("input"))
+ {
+ usageError("--input/-i required");
+ return false;
+ }
+
+ if (!hasOption("output"))
+ {
+ usageError("--output/-o required");
+ return false;
+ }
+
+ return true;
+}
+
+
+void Application_pc2pc::addOptions()
+{
+ po::options_description* file_options = new po::options_description("file options");
+
+ file_options->add_options()
+ ("input,i", po::value<std::string>(&m_inputFile), "input file name")
+ ("output,o", po::value<std::string>(&m_outputFile), "output file name")
+ ;
+
+ addOptionSet(file_options);
+}
+
+int Application_pc2pc::execute()
+{
+ if (!Utils::fileExists(m_inputFile))
+ {
+ runtimeError("file not found: " + m_inputFile);
+ return 1;
+ }
+
+ std::ostream* ofs = Utils::createFile(m_outputFile);
+ pdal::Options options;
+
+ pdal::Option<std::string> filename("input", m_inputFile, "Input filename for reader to use" );
+ options.add(filename);
+ pdal::drivers::qfit::Reader reader(options);
+
+ const boost::uint64_t numPoints = reader.getNumPoints();
+
+ pdal::drivers::las::LasWriter writer(reader, *ofs);
+
+
+ // writer.setPointFormat( reader.getPointFormat() );
+
+ writer.write(numPoints);
+
+
+ Utils::closeFile(ofs);
+
+ return 0;
+}
+
+int main(int argc, char* argv[])
+{
+ Application_pc2pc app(argc, argv);
+ return app.run();
+}
+
+
+
diff -r 638cd2e5253c -r 650c22afc8ac src/drivers/las/Header.cpp
--- a/src/drivers/las/Header.cpp Mon Jul 11 13:54:36 2011 -0700
+++ b/src/drivers/las/Header.cpp Tue Jul 12 09:29:29 2011 -0500
@@ -51,11 +51,11 @@
// BUG: should be std::string
char const* const LasHeader::FileSignature = "LASF";
-char const* const LasHeader::SystemIdentifier = "libLAS";
-char const* const LasHeader::SoftwareIdentifier = "libLAS 1.6.0";
+char const* const LasHeader::SystemIdentifier = "PDAL";
+char const* const LasHeader::SoftwareIdentifier = "PDAL 0.1.0";
LasHeader::LasHeader()
- : m_scales(0.01,0.01,0.01)
+ : m_scales(1.0,1.0,1.0)
{
// BUG: set default here -- m_schema(LasSchema::ePointFormat3)
initialize();
@@ -307,10 +307,14 @@
void LasHeader::SetScale(double x, double y, double z)
{
- double const minscale = 0.01;
- m_scales[0] = Utils::compare_distance(0.0, x) ? minscale : x;
- m_scales[1] = Utils::compare_distance(0.0, y) ? minscale : y;
- m_scales[2] = Utils::compare_distance(0.0, z) ? minscale : z;
+ // double const minscale = 0.01;
+ // m_scales[0] = Utils::compare_distance(0.0, x) ? minscale : x;
+ // m_scales[1] = Utils::compare_distance(0.0, y) ? minscale : y;
+ // m_scales[2] = Utils::compare_distance(0.0, z) ? minscale : z;
+
+ m_scales[0] = x;
+ m_scales[1] = y;
+ m_scales[2] = z;
}
double LasHeader::GetOffsetX() const
diff -r 638cd2e5253c -r 650c22afc8ac src/drivers/qfit/Reader.cpp
--- a/src/drivers/qfit/Reader.cpp Mon Jul 11 13:54:36 2011 -0700
+++ b/src/drivers/qfit/Reader.cpp Tue Jul 12 09:29:29 2011 -0500
@@ -339,9 +339,9 @@
text.str("");
Dimension z(Dimension::Field_Z, Dimension::Int32);
- text << "z coordinate as a long integer. You must use the scale and "
- << "offset information of the header to determine the double value.";
+ text << "Elevation (millimeters)";
z.setDescription(text.str());
+ z.setNumericScale(1.0);
schema.addDimension(z);
text.str("");
diff -r 638cd2e5253c -r 650c22afc8ac test/unit/QFITReaderTest.cpp
--- a/test/unit/QFITReaderTest.cpp Mon Jul 11 13:54:36 2011 -0700
+++ b/test/unit/QFITReaderTest.cpp Tue Jul 12 09:29:29 2011 -0500
@@ -71,7 +71,8 @@
double x0 = schema.getDimension(offsetX).applyScaling<boost::int32_t>(x);
double y0 = schema.getDimension(offsetY).applyScaling<boost::int32_t>(y);
- double z0 = static_cast<double>(z);
+ double z0 = schema.getDimension(offsetZ).applyScaling<boost::int32_t>(z);
+ // double z0 = static_cast<double>(z);
//
// std::cout.setf(std::ios_base::fixed, std::ios_base::floatfield);
@@ -79,7 +80,7 @@
// std::cout << "expected x: " << xref << " y: " << yref << " z: " << zref << " t: " << tref << std::endl;
//
// std::cout << "actual x: " << x0 << " y: " << y0 << " z: " << z0 << " t: " << t << std::endl;
-
+ //
Compare(x0, xref);
Compare(y0, yref);
Compare(z0, zref);
More information about the Liblas-commits
mailing list