[Liblas-commits] r1010 - in trunk: include/liblas/detail src/detail

liblas-commits at liblas.org liblas-commits at liblas.org
Tue Feb 10 23:24:05 EST 2009


Author: hobu
Date: Tue Feb 10 23:24:05 2009
New Revision: 1010
URL: http://liblas.org/changeset/1010

Log:
we have to descale the points as we write them

Modified:
   trunk/include/liblas/detail/writer.hpp
   trunk/src/detail/writer.cpp
   trunk/src/detail/writer10.cpp
   trunk/src/detail/writer11.cpp
   trunk/src/detail/writer12.cpp

Modified: trunk/include/liblas/detail/writer.hpp
==============================================================================
--- trunk/include/liblas/detail/writer.hpp	(original)
+++ trunk/include/liblas/detail/writer.hpp	Tue Feb 10 23:24:05 2009
@@ -65,7 +65,7 @@
 
 protected:
     PointRecord m_record;
-    void FillPointRecord(PointRecord& record, const LASPoint& point);
+    void FillPointRecord(PointRecord& record, const LASPoint& point, const LASHeader& header);
 
 private:
 

Modified: trunk/src/detail/writer.cpp
==============================================================================
--- trunk/src/detail/writer.cpp	(original)
+++ trunk/src/detail/writer.cpp	Tue Feb 10 23:24:05 2009
@@ -60,11 +60,11 @@
 {
 }
 
-void Writer::FillPointRecord(PointRecord& record, const LASPoint& point) 
+void Writer::FillPointRecord(PointRecord& record, const LASPoint& point, const LASHeader& header) 
 {
-    record.x = point.GetX();
-    record.y = point.GetY();
-    record.z = point.GetZ();
+    record.x = static_cast<uint32_t>((point.GetX() - header.GetOffsetX()) / header.GetScaleX());
+    record.y = static_cast<uint32_t>((point.GetY() - header.GetOffsetY()) / header.GetScaleY());
+    record.z = static_cast<uint32_t>((point.GetZ() - header.GetOffsetZ()) / header.GetScaleZ());
     record.intensity = point.GetIntensity();
     record.flags = point.GetScanFlags();
     record.classification = point.GetClassification();

Modified: trunk/src/detail/writer10.cpp
==============================================================================
--- trunk/src/detail/writer10.cpp	(original)
+++ trunk/src/detail/writer10.cpp	Tue Feb 10 23:24:05 2009
@@ -233,7 +233,7 @@
     
     double t = 0;
     assert(LASHeader::ePointSize0 == sizeof(m_record));
-    Writer::FillPointRecord(m_record, point);
+    Writer::FillPointRecord(m_record, point, header);
     detail::write_n(m_ofs, m_record, sizeof(m_record));
 
     if (header.GetDataFormatId() == LASHeader::ePointFormat1) {

Modified: trunk/src/detail/writer11.cpp
==============================================================================
--- trunk/src/detail/writer11.cpp	(original)
+++ trunk/src/detail/writer11.cpp	Tue Feb 10 23:24:05 2009
@@ -234,7 +234,7 @@
     
     double t = 0;
     assert(LASHeader::ePointSize0 == sizeof(m_record));
-    Writer::FillPointRecord(m_record, point);
+    Writer::FillPointRecord(m_record, point, header);
     detail::write_n(m_ofs, m_record, sizeof(m_record));
 
     if (header.GetDataFormatId() == LASHeader::ePointFormat1) {

Modified: trunk/src/detail/writer12.cpp
==============================================================================
--- trunk/src/detail/writer12.cpp	(original)
+++ trunk/src/detail/writer12.cpp	Tue Feb 10 23:24:05 2009
@@ -239,7 +239,7 @@
     LASColor color;
     
     assert(LASHeader::ePointSize0 == sizeof(m_record));
-    Writer::FillPointRecord(m_record, point);
+    Writer::FillPointRecord(m_record, point, header);
     detail::write_n(m_ofs, m_record, sizeof(m_record));
 
     if (header.GetDataFormatId() == LASHeader::ePointFormat1) {


More information about the Liblas-commits mailing list