[Liblas-commits] hg: add --fix-optech-scan-angle to multiply and/or
clip scan ang...
liblas-commits at liblas.org
liblas-commits at liblas.org
Sun Jan 23 22:26:59 EST 2011
details: http://hg.liblas.orghg/rev/9871e606bd68
changeset: 2813:9871e606bd68
user: Howard Butler <hobu.inc at gmail.com>
date: Sun Jan 23 21:26:52 2011 -0600
description:
add --fix-optech-scan-angle to multiply and/or clip scan angles from Optech sensors by 1.944445 to enable people to quickly fix a common output bug from Dashmap
diffstat:
apps/laskernel.cpp | 41 +++++++++++++++++++++++++++++++++++++++++
apps/laskernel.hpp | 15 +++++++++++++++
2 files changed, 56 insertions(+), 0 deletions(-)
diffs (88 lines):
diff -r c9123cb61570 -r 9871e606bd68 apps/laskernel.cpp
--- a/apps/laskernel.cpp Fri Jan 21 14:05:58 2011 -0600
+++ b/apps/laskernel.cpp Sun Jan 23 21:26:52 2011 -0600
@@ -1,6 +1,36 @@
#include "laskernel.hpp"
+bool OptechScanAngleFixer::transform(liblas::Point& p)
+{
+ boost::int8_t angle = p.GetScanAngleRank();
+ double a = static_cast<double>(angle);
+
+ double da = 1.944445 * a;
+
+ double rda = liblas::detail::sround(da);
+
+ boost::int32_t new_a = static_cast<boost::int32_t>(rda);
+
+ boost::int8_t output = 0;
+ if (new_a > (std::numeric_limits<boost::int8_t>::max)())
+ {
+ output = (std::numeric_limits<boost::int8_t>::max)();
+ }
+ else if (new_a < (std::numeric_limits<boost::int8_t>::min)())
+ {
+ output = (std::numeric_limits<boost::int8_t>::min)();
+ }
+ else
+ {
+ output = static_cast<boost::int8_t>(new_a);
+ }
+
+ p.SetScanAngleRank(output);
+ return true;
+
+}
+
std::istream* OpenInput(std::string const& filename, bool bEnd)
{
std::ios::openmode mode = std::ios::in | std::ios::binary;
@@ -375,6 +405,7 @@
("add-vlr", po::value<std::vector<std::string> >()->multitoken(), "Add VLRs with the given name and id combination. --add-vlr hobu 1234 \"Description of the VLR\" \"filename.ext\"")
("system-identifier", po::value<std::string>(), "Set the SystemID for the file. --system-identifier \"MODIFICATION\"")
("generating-software", po::value<std::string>(), "Set the SoftwareID for the file. --generating-software \"liblas.org\"")
+ ("fix-optech-scan-angle", po::value<bool>()->zero_tokens(), "Multiply the scan angle by 1.944445 to fix up scan angle generation output by some Optech scanners")
;
return transform_options;
@@ -1401,6 +1432,16 @@
liblas::TransformPtr trans_trans = liblas::TransformPtr(new liblas::TranslationTransform(translate));
transforms.push_back(trans_trans);
}
+
+ if (vm.count("fix-optech-scan-angle"))
+ {
+ if (verbose)
+ std::cout << "Fixing Scan Angles by multiplying by 1.944445" << std::endl;
+
+ liblas::TransformPtr transform = liblas::TransformPtr(new OptechScanAngleFixer());
+ transforms.push_back(transform);
+ }
+
return transforms;
}
diff -r c9123cb61570 -r 9871e606bd68 apps/laskernel.hpp
--- a/apps/laskernel.hpp Fri Jan 21 14:05:58 2011 -0600
+++ b/apps/laskernel.hpp Sun Jan 23 21:26:52 2011 -0600
@@ -105,4 +105,19 @@
LAS_DLL void RepairHeader(liblas::CoordinateSummary const& summary, liblas::Header& header);
LAS_DLL liblas::property_tree::ptree SummarizeReader(liblas::Reader& reader) ;
+
+class OptechScanAngleFixer: public liblas::TransformI
+{
+public:
+
+ OptechScanAngleFixer() {};
+ ~OptechScanAngleFixer() {};
+
+ bool transform(liblas::Point& point);
+
+private:
+ OptechScanAngleFixer(OptechScanAngleFixer const& other);
+ OptechScanAngleFixer& operator=(OptechScanAngleFixer const& rhs);
+};
+
#endif // LIBLAS_ITERATOR_HPP_INCLUDED
More information about the Liblas-commits
mailing list