[Liblas-commits] hg: all integer i/o functions now rewritten to use base data array

liblas-commits at liblas.org liblas-commits at liblas.org
Tue Oct 5 11:56:04 EDT 2010


changeset e1a089b478c3 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=e1a089b478c3
summary: all integer i/o functions now rewritten to use base data array

diffstat:

 include/liblas/laspoint.hpp |   54 +++++++-------
 src/laspoint.cpp            |  169 +++++++++++++++++++++++++++++++++++++------
 2 files changed, 171 insertions(+), 52 deletions(-)

diffs (278 lines):

diff -r aa3751c09b83 -r e1a089b478c3 include/liblas/laspoint.hpp
--- a/include/liblas/laspoint.hpp	Mon Oct 04 15:11:07 2010 -0500
+++ b/include/liblas/laspoint.hpp	Tue Oct 05 10:55:55 2010 -0500
@@ -171,7 +171,7 @@
     void SetFlightLineEdge(boost::uint16_t const& edge);
 
     //Classification& GetClassification();
-    Classification const& GetClassification() const;
+    Classification GetClassification() const;
     void SetClassification(Classification const& cls);
     void SetClassification(Classification::bitset_type const& flags);
     void SetClassification(boost::uint8_t const& flags);
@@ -192,7 +192,7 @@
     void SetPointSourceID(boost::uint16_t const& id);
 
     /// Fetch color value associated with this point (LAS 1.2)
-    Color const& GetColor() const;
+    Color GetColor() const;
 
     /// Set color value associated with this point (LAS 1.2)
     void SetColor(Color const& value);
@@ -309,25 +309,25 @@
 //     m_flags = flags;
 // }
 
-inline boost::int8_t Point::GetScanAngleRank() const
-{
-    return m_angle_rank;
-}
+// inline boost::int8_t Point::GetScanAngleRank() const
+// {
+//     return m_angle_rank;
+// }
 
-inline boost::uint8_t Point::GetUserData() const
-{
-    return m_user_data;
-}
+// inline boost::uint8_t Point::GetUserData() const
+// {
+//     return m_user_data;
+// }
 
-inline boost::uint16_t Point::GetPointSourceID() const
-{
-    return m_source_id;
-}
-
-inline void Point::SetPointSourceID(boost::uint16_t const& id)
-{
-    m_source_id = id;
-}
+// inline boost::uint16_t Point::GetPointSourceID() const
+// {
+//     return m_source_id;
+// }
+// 
+// inline void Point::SetPointSourceID(boost::uint16_t const& id)
+// {
+//     m_source_id = id;
+// }
 
 inline double Point::GetTime() const
 {
@@ -340,15 +340,15 @@
     m_gps_time = time;
 }
 
-inline Color const& Point::GetColor() const
-{
-    return m_color;
-}
+// > inline Color const& Point::GetColor() const
+// > {
+// >     return m_color;
+// > }
 
-inline void Point::SetColor(Color const& value)
-{
-    m_color = value;
-}
+// inline void Point::SetColor(Color const& value)
+// {
+//     m_color = value;
+// }
 
 inline double Point::operator[](std::size_t const& index) const
 {
diff -r aa3751c09b83 -r e1a089b478c3 src/laspoint.cpp
--- a/src/laspoint.cpp	Mon Oct 04 15:11:07 2010 -0500
+++ b/src/laspoint.cpp	Tue Oct 05 10:55:55 2010 -0500
@@ -177,35 +177,40 @@
 //     m_flags &= ~mask;
 //     m_flags |= mask & (static_cast<uint8_t>(edge) << 7);}
 
-void Point::SetScanAngleRank(int8_t const& rank)
-{
-    m_angle_rank = rank;
-}
+// void Point::SetScanAngleRank(int8_t const& rank)
+// {
+//     m_angle_rank = rank;
+// }
+// boost::int8_t Point::GetScanAngleRank() const
+// {
+//     return m_angle_rank;
+// }
 
-void Point::SetUserData(uint8_t const& data)
-{
-    m_user_data = data;
-}
 
-Classification const& Point::GetClassification() const
-{
-    return m_class;
-}
+// void Point::SetUserData(uint8_t const& data)
+// {
+//     m_user_data = data;
+// }
 
-void Point::SetClassification(Classification const& cls)
-{
-    m_class = cls;
-}
+// Classification const& Point::GetClassification() const
+// {
+//     return m_class;
+// }
+// 
+// void Point::SetClassification(Classification const& cls)
+// {
+//     m_class = cls;
+// }
 
-void Point::SetClassification(Classification::bitset_type const& flags)
-{
-    m_class = Classification(flags);
-}
-
-void Point::SetClassification(boost::uint8_t const& flags)
-{
-    m_class = Classification(flags);
-}
+// void Point::SetClassification(Classification::bitset_type const& flags)
+// {
+//     m_class = Classification(flags);
+// }
+// 
+// void Point::SetClassification(boost::uint8_t const& flags)
+// {
+//     m_class = Classification(flags);
+// }
 
 bool Point::equal(Point const& other) const
 {
@@ -718,6 +723,120 @@
     return s[0];
 }
 
+void Point::SetScanAngleRank(int8_t const& rank)
+{
+
+    std::vector<boost::uint8_t>::size_type pos = GetDimensionPosition("Scan Angle Rank");
+    
+    m_format_data[pos] = rank;
+
+}
+boost::int8_t Point::GetScanAngleRank() const
+{
+    
+    std::vector<boost::uint8_t>::size_type pos = GetDimensionPosition("Scan Angle Rank");
+    
+    return m_format_data[pos];
+}
+
+boost::uint8_t Point::GetUserData() const
+{
+    return m_format_data[GetDimensionPosition("User Data")];
+}
+
+void Point::SetUserData(boost::uint8_t const& flags)
+{
+    m_format_data[GetDimensionPosition("User Data")] = flags;
+}
+
+Classification Point::GetClassification() const
+{
+    boost::uint8_t kls = m_format_data[GetDimensionPosition("Classification")];    
+    return Classification(kls);
+}
+
+void Point::SetClassification(Classification const& cls)
+{
+    m_format_data[GetDimensionPosition("Classification")] = cls.GetClass();
+}
+
+void Point::SetClassification(Classification::bitset_type const& flags)
+{
+    m_format_data[GetDimensionPosition("Classification")] = Classification(flags).GetClass();
+}
+
+void Point::SetClassification(boost::uint8_t const& flags)
+{
+    m_format_data[GetDimensionPosition("Classification")] = Classification(flags).GetClass();
+}
+
+boost::uint16_t Point::GetPointSourceID() const
+{
+    boost::uint16_t output;
+    output = liblas::detail::bitsToInt<boost::uint16_t>(output, 
+                                                        m_format_data, 
+                                                        GetDimensionPosition("Point Source ID"));
+
+    return output;
+}
+
+
+void Point::SetPointSourceID(boost::uint16_t const& id)
+{
+    liblas::detail::intToBits<boost::uint16_t>(id, 
+                                               m_format_data, 
+                                               GetDimensionPosition("Point Source ID"));
+}
+
+Color Point::GetColor() const
+{
+    boost::uint16_t red(0);
+    boost::uint16_t green(0);
+    boost::uint16_t blue(0);
+
+    red = liblas::detail::bitsToInt<boost::uint16_t>(red, 
+                                                     m_format_data, 
+                                                     GetDimensionPosition("Red"));
+    green = liblas::detail::bitsToInt<boost::uint16_t>(green, 
+                                                     m_format_data, 
+                                                     GetDimensionPosition("Green"));
+    blue = liblas::detail::bitsToInt<boost::uint16_t>(blue, 
+                                                     m_format_data, 
+                                                     GetDimensionPosition("Blue"));
+
+  return Color(red, green, blue);
+}
+
+void Point::SetColor(Color const& value)
+{
+    liblas::detail::intToBits<boost::uint16_t>(value.GetRed(), 
+                                               m_format_data, 
+                                               GetDimensionPosition("Red"));
+    liblas::detail::intToBits<boost::uint16_t>(value.GetGreen(), 
+                                               m_format_data, 
+                                               GetDimensionPosition("Green"));
+    liblas::detail::intToBits<boost::uint16_t>(value.GetBlue(), 
+                                               m_format_data, 
+                                               GetDimensionPosition("Blue"));
+}
+
+// void Point::SetTime(double const& t)
+// {
+//     liblas::detail::intToBits<double>(t, 
+//                                                         m_format_data, 
+//                                                         GetDimensionPosition("Time"));
+// }
+// 
+// double Point::GetTime() const
+// {
+//     double output;
+//     liblas::detail::bitsToInt<double>(output, 
+//                                                m_format_data, 
+//                                                GetDimensionPosition("Time"));
+// 
+//     return output;
+// }
+
 boost::any Point::GetValue(DimensionPtr d) const
 {
 


More information about the Liblas-commits mailing list