[Liblas-commits] hg: 2 new changesets

liblas-commits at liblas.org liblas-commits at liblas.org
Tue Jun 22 12:21:49 EDT 2010


changeset 5e3f0ed0d34d in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=5e3f0ed0d34d
summary: more precise #ifdefs

changeset 898f0d6119ad in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=898f0d6119ad
summary: use cmath, and change the name of our round function to not clash

diffstat:

 include/liblas/lasclassification.hpp |   6 +++++-
 src/detail/writer/point.cpp          |  10 ++++++----
 2 files changed, 11 insertions(+), 5 deletions(-)

diffs (48 lines):

diff -r 64089c9824d9 -r 898f0d6119ad include/liblas/lasclassification.hpp
--- a/include/liblas/lasclassification.hpp	Tue Jun 22 09:52:16 2010 -0500
+++ b/include/liblas/lasclassification.hpp	Tue Jun 22 11:21:34 2010 -0500
@@ -153,11 +153,15 @@
         // there is only std::bitset<_Bits>::bitset(_ULonglong) and 
         // std::bitset<_Bits>::bitset(int) here.  As an aside, I see no reason
         // to have a mask any larger than std::bitset<_Bits>::bitset(int)
-#ifdef WIN32 && if (_MSC_VER >= 1600)
+#ifdef WIN32 
+#if (_MSC_VER >= 1600)
         bitset_type const mask(static_cast<unsigned long long>(class_table_size) - 1);
 #else
         bitset_type const mask(static_cast<unsigned long>(class_table_size) - 1);
 #endif
+#else
+        bitset_type const mask(static_cast<unsigned long>(class_table_size) - 1);
+#endif
         bits &= mask;
 
         uint8_t const index = static_cast<uint8_t>(bits.to_ulong());
diff -r 64089c9824d9 -r 898f0d6119ad src/detail/writer/point.cpp
--- a/src/detail/writer/point.cpp	Tue Jun 22 09:52:16 2010 -0500
+++ b/src/detail/writer/point.cpp	Tue Jun 22 11:21:34 2010 -0500
@@ -48,8 +48,10 @@
 
 #include <sstream> 
 
+#include <cmath>
+
 // From http://stackoverflow.com/questions/485525/round-for-float-in-c
-double round(double r) {
+double sround(double r) {
     return (r > 0.0) ? floor(r + 0.5) : ceil(r - 0.5);
 }
 
@@ -236,9 +238,9 @@
     //         m_record.y = static_cast<int32_t>((p.GetY() - m_header.GetOffsetY()) / m_header.GetScaleY());
     //         m_record.z = static_cast<int32_t>((p.GetZ() - m_header.GetOffsetZ()) / m_header.GetScaleZ());
     //     }
-    m_record.x = static_cast<int32_t>(round(((p.GetX() - m_header.GetOffsetX()) / m_header.GetScaleX())));
-    m_record.y = static_cast<int32_t>(round(((p.GetY() - m_header.GetOffsetY()) / m_header.GetScaleY())));
-    m_record.z = static_cast<int32_t>(round(((p.GetZ() - m_header.GetOffsetZ()) / m_header.GetScaleZ())));
+    m_record.x = static_cast<int32_t>(sround(((p.GetX() - m_header.GetOffsetX()) / m_header.GetScaleX())));
+    m_record.y = static_cast<int32_t>(sround(((p.GetY() - m_header.GetOffsetY()) / m_header.GetScaleY())));
+    m_record.z = static_cast<int32_t>(sround(((p.GetZ() - m_header.GetOffsetZ()) / m_header.GetScaleZ())));
         
     Classification::bitset_type clsflags(p.GetClassification());
     m_record.classification = static_cast<uint8_t>(clsflags.to_ulong());


More information about the Liblas-commits mailing list