[Liblas-commits] hg: 4 new changesets

liblas-commits at liblas.org liblas-commits at liblas.org
Thu Aug 26 13:55:04 EDT 2010


changeset 28ee8d89af6c in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=28ee8d89af6c
summary: docs for mloskot

changeset 776c383730fa in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=776c383730fa
summary: use uint32_t for liblas::Color constructor, but carry around as a uint16_t.  Verify upon construction

changeset b99a74476154 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=b99a74476154
summary: cast to uint64_t to fit with default bitset constructors

changeset 177b0ad3f290 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=177b0ad3f290
summary: unfix my _MSC_VER_FULL fix that was broken for msvc10

diffstat:

 include/liblas/lascolor.hpp                                  |   2 +-
 include/liblas/property_tree/detail/ptree_implementation.hpp |   4 +-
 src/lasclassification.cpp                                    |   4 +-
 src/lascolor.cpp                                             |  14 ++++++++++-
 src/lasfilter.cpp                                            |   3 ++
 5 files changed, 20 insertions(+), 7 deletions(-)

diffs (102 lines):

diff -r cd2f287ea5cd -r 177b0ad3f290 include/liblas/lascolor.hpp
--- a/include/liblas/lascolor.hpp	Thu Aug 26 12:32:19 2010 -0500
+++ b/include/liblas/lascolor.hpp	Thu Aug 26 12:54:49 2010 -0500
@@ -63,7 +63,7 @@
     /// User-defined constructor.
     /// Initializes object with given RGB values.
     /// \exception std::invalid_argument if color component value is out of range of unsigned 8-bit integer.
-    Color(value_type red, value_type green, value_type blue);
+    Color(boost::uint32_t red, boost::uint32_t green, boost::uint32_t blue);
 
     /// User-defined constructor.
     /// Initializes colour components based on values of 3-element array.
diff -r cd2f287ea5cd -r 177b0ad3f290 include/liblas/property_tree/detail/ptree_implementation.hpp
--- a/include/liblas/property_tree/detail/ptree_implementation.hpp	Thu Aug 26 12:32:19 2010 -0500
+++ b/include/liblas/property_tree/detail/ptree_implementation.hpp	Thu Aug 26 12:54:49 2010 -0500
@@ -15,8 +15,8 @@
 #include <boost/iterator/reverse_iterator.hpp>
 #include <memory>
 
-#if defined(_MSC_VER) && \
-    (_MSC_VER >= 160000000 && _MSC_VER < 170000000)
+#if defined(BOOST_MSVC) && \
+    (_MSC_FULL_VER >= 160000000 && _MSC_FULL_VER < 170000000)
 #define BOOST_PROPERTY_TREE_PAIR_BUG
 #endif
 
diff -r cd2f287ea5cd -r 177b0ad3f290 src/lasclassification.cpp
--- a/src/lasclassification.cpp	Thu Aug 26 12:32:19 2010 -0500
+++ b/src/lasclassification.cpp	Thu Aug 26 12:54:49 2010 -0500
@@ -129,11 +129,11 @@
     return static_cast<uint8_t>(index);
 }
 
-void Classification::SetClass(uint32_t index)
+void Classification::SetClass(boost::uint32_t index)
 {
     check_class_index(index);
 
-    bitset_type binval(index);
+    bitset_type binval(static_cast<boost::uint64_t>(index));
     binval <<= 0;
 
     // Store value in bits 0,1,2,3,4
diff -r cd2f287ea5cd -r 177b0ad3f290 src/lascolor.cpp
--- a/src/lascolor.cpp	Thu Aug 26 12:32:19 2010 -0500
+++ b/src/lascolor.cpp	Thu Aug 26 12:54:49 2010 -0500
@@ -44,6 +44,7 @@
 #include <boost/cstdint.hpp>
 // std
 #include <stdexcept>
+#include <limits>
 
 namespace liblas {
 
@@ -52,8 +53,13 @@
     m_color.assign(0);
 }
 
-Color::Color(value_type red, value_type green, value_type blue)
+Color::Color(boost::uint32_t red, boost::uint32_t green, boost::uint32_t blue)
 {
+    if (red > std::numeric_limits<uint16_t>::max() || 
+        green > std::numeric_limits<uint16_t>::max() || 
+        blue > std::numeric_limits<uint16_t>::max())
+        throw_invalid_color_component();
+
     m_color[0] = red;
     m_color[1] = green;
     m_color[2] = blue;
@@ -61,6 +67,10 @@
 
 Color::Color(boost::array<value_type, 3> const& color)
 {
+    if (color[0] > std::numeric_limits<uint16_t>::max() || 
+        color[1] > std::numeric_limits<uint16_t>::max() || 
+        color[2] > std::numeric_limits<uint16_t>::max())
+        throw_invalid_color_component();
     m_color = color;
 }
 
@@ -85,7 +95,7 @@
 
 void Color::throw_invalid_color_component() const
 {
-    throw std::invalid_argument("color component value too large");
+    throw std::invalid_argument("Color component value too large.  Each must be less than 65536");
 }
 
 } // namespace liblas
diff -r cd2f287ea5cd -r 177b0ad3f290 src/lasfilter.cpp
--- a/src/lasfilter.cpp	Thu Aug 26 12:32:19 2010 -0500
+++ b/src/lasfilter.cpp	Thu Aug 26 12:54:49 2010 -0500
@@ -152,6 +152,9 @@
 bool ThinFilter::filter(const liblas::Point& p)
 {
     // FIXME: why p is not used? --mloskot
+    // Because this filter is really just a counter.  
+    // It throws out all points that aren't 
+    // thin_count % thin_amount == 0. --hobu
     boost::ignore_unused_variable_warning(p);
 
     // If thin_amount == thin_count, we throw this one out.


More information about the Liblas-commits mailing list