[Liblas-commits] libpc: building with liblas' Bounds class now

liblas-commits at liblas.org liblas-commits at liblas.org
Fri Feb 11 00:46:24 EST 2011


details:   http://hg.liblas.orglibpc/rev/46b2d79f3ae6
changeset: 31:46b2d79f3ae6
user:      Michael P. Gerlek <mpg at flaxen.com>
date:      Thu Feb 10 21:46:18 2011 -0800
description:
building with liblas' Bounds class now

diffstat:

 apps/pc2pc.cpp                 |  12 +++++++--
 apps/pcinfo.cpp                |  10 +++++--
 include/libpc/Bounds.hpp       |  52 +++++++++++++++++++++---------------------
 include/libpc/Field.hpp        |   1 +
 include/libpc/MosaicFilter.hpp |   7 ++++-
 include/libpc/Range.hpp        |   6 ++--
 include/libpc/Utils.hpp        |   6 ++++-
 include/libpc/export.hpp       |   3 +-
 mpg-config.bat                 |   4 +-
 src/Field.cpp                  |   2 +
 src/Filter.cpp                 |   3 ++
 src/Header.cpp                 |   8 ++++--
 src/MosaicFilter.cpp           |   3 +-
 src/PointData.cpp              |   6 +++-
 src/PointLayout.cpp            |   2 +
 src/Reader.cpp                 |   3 ++
 src/Stage.cpp                  |   3 ++
 src/Writer.cpp                 |   2 +
 18 files changed, 87 insertions(+), 46 deletions(-)

diffs (truncated from 421 to 300 lines):

diff -r 605c80e02696 -r 46b2d79f3ae6 apps/pc2pc.cpp
--- a/apps/pc2pc.cpp	Thu Feb 10 20:53:09 2011 -0800
+++ b/apps/pc2pc.cpp	Thu Feb 10 21:46:18 2011 -0800
@@ -9,11 +9,17 @@
  * See LICENSE.txt in this source distribution for more information.
  **************************************************************************/
 
-#include <libpc/Bounds.hpp>
+#include <iostream>
+#include "libpc/Bounds.hpp"
+
+using namespace libpc;
+
+
+
 int main(int, char* [])
 {
-  Bounds bounds(1,2,3,4,5,6);
-  bounds.dump();
+  Bounds<double> bounds(1,2,3,4,5,6);
+  std::cout << bounds;
   return 0;
 }
 #if 0
diff -r 605c80e02696 -r 46b2d79f3ae6 apps/pcinfo.cpp
--- a/apps/pcinfo.cpp	Thu Feb 10 20:53:09 2011 -0800
+++ b/apps/pcinfo.cpp	Thu Feb 10 21:46:18 2011 -0800
@@ -9,12 +9,16 @@
  * See LICENSE.txt in this source distribution for more information.
  **************************************************************************/
 
-#include <libpc/Bounds.hpp>
+#include <iostream>
+#include "libpc/Bounds.hpp"
+
+using namespace libpc;
+
 
 int main(int, char* [])
 {
-  Bounds bounds(0,1,2,3,4,5);
-  bounds.dump();
+  Bounds<double> bounds(0,1,2,3,4,5);
+  std::cout << bounds;
   return 0;
 }
 #if 0
diff -r 605c80e02696 -r 46b2d79f3ae6 include/libpc/Bounds.hpp
--- a/include/libpc/Bounds.hpp	Thu Feb 10 20:53:09 2011 -0800
+++ b/include/libpc/Bounds.hpp	Thu Feb 10 21:46:18 2011 -0800
@@ -42,22 +42,21 @@
 
 #include "libpc/export.hpp"
 #include "libpc/Range.hpp"
+#include "libpc/Utils.hpp"
 
 namespace libpc
 {
 
 template <typename T>
-class Bounds
+class LIBPC_DLL Bounds
 {
 public:
+  typedef T value_type;
+  typedef typename std::vector< Range<T> >::size_type size_type;
+  typedef typename std::vector< Range<T> > RangeVec;
 
-	typedef T value_type;
-    typedef typename std::vector< Range<T> >::size_type size_type;
-    
-    typedef typename std::vector< Range<T> > RangeVec;
 private:
-
-    RangeVec ranges;
+  RangeVec ranges;
     
 public:
 
@@ -288,13 +287,14 @@
 /// Does this Bounds contain other?
 bool contains(Bounds const& other) const
 {
-    for (size_type i = 0; i < dimension(); i++) {
-        if ( ranges[i].contains(other.ranges[i]) )
-            return true;
-        else // As soon as it is not contains, we're false
-            return false;
-    }
-    return true;
+  // BUG: this loop only executes once, what is intended semantics?
+  for (size_type i = 0; i < dimension(); i++) {
+    if ( ranges[i].contains(other.ranges[i]) )
+      return true;
+    else // As soon as it is not contains, we're false
+      return false;
+  }
+  return true;
 }
 
 /////// Does this Bounds this point other?
@@ -415,8 +415,8 @@
         if ((min)(d) > (max)(d) )
         {
             // Check that we're not infinity either way
-            if ( (compare_distance((min)(d), (std::numeric_limits<T>::max)()) ||
-                  compare_distance((max)(d), -(std::numeric_limits<T>::max)()) ))
+            if ( (Utils::compare_distance((min)(d), (std::numeric_limits<T>::max)()) ||
+                  Utils::compare_distance((max)(d), -(std::numeric_limits<T>::max)()) ))
             {
                 std::ostringstream msg; 
                 msg << "liblas::Bounds::verify: Minimum point at dimension " << d
@@ -426,8 +426,8 @@
         }
     }
 }
-
-friend std::ostream& operator<<(std::ostream& ostr, const Bounds<T>& bounds);
+
+//friend std::ostream& operator<<(std::ostream& ostr, const Bounds<T>& bounds);
 
 ////Bounds<T> project(liblas::SpatialReference const& in_ref, liblas::SpatialReference const& out_ref)
 ////{
@@ -445,14 +445,14 @@
 };
 
 template<class T>
-std::ostream& operator<<(std::ostream& ostr, const Bounds<T>& bounds)
-{
-  for (std::size_type d = 0; d < dimension(); ++d)
-  {
-      const Range<T>& r = bounds.ranges[d];
-    ostr << "(" <<  r.minimum << "," << r.maximum << ")";
-  }
-  return ostr;
+std::ostream& operator<<(std::ostream& ostr, const Bounds<T>& bounds)
+{
+  for (size_t d = 0; d < bounds.dimension(); ++d)
+  {
+      const Range<T>& r = bounds.dims()[d];
+    ostr << "(" <<  r.minimum << "," << r.maximum << ")";
+  }
+  return ostr;
 }
 
 } // namespace libpc
diff -r 605c80e02696 -r 46b2d79f3ae6 include/libpc/Field.hpp
--- a/include/libpc/Field.hpp	Thu Feb 10 20:53:09 2011 -0800
+++ b/include/libpc/Field.hpp	Thu Feb 10 21:46:18 2011 -0800
@@ -37,6 +37,7 @@
 
 #include <vector>
 #include <string>
+#include "libpc/export.hpp"
 
 namespace libpc
 {
diff -r 605c80e02696 -r 46b2d79f3ae6 include/libpc/MosaicFilter.hpp
--- a/include/libpc/MosaicFilter.hpp	Thu Feb 10 20:53:09 2011 -0800
+++ b/include/libpc/MosaicFilter.hpp	Thu Feb 10 21:46:18 2011 -0800
@@ -39,8 +39,11 @@
 #include "libpc/Bounds.hpp"
 
 
+namespace libpc
+{
+
 // removes any points outside of the given range
-class MosaicFilter : public Filter
+class LIBPC_DLL MosaicFilter : public Filter
 {
 public:
   MosaicFilter(Stage& prevStage, Stage& prevStage2);
@@ -54,4 +57,6 @@
   MosaicFilter(const MosaicFilter&); // not implemented
 };
 
+}; // namespace libpc
+
 #endif
diff -r 605c80e02696 -r 46b2d79f3ae6 include/libpc/Range.hpp
--- a/include/libpc/Range.hpp	Thu Feb 10 20:53:09 2011 -0800
+++ b/include/libpc/Range.hpp	Thu Feb 10 21:46:18 2011 -0800
@@ -40,13 +40,13 @@
 {
 
 template <typename T>
-class Range
+class LIBPC_DLL Range
 {
 public:
     T minimum;
     T maximum;
 
-	typedef T value_type;
+  typedef T value_type;
 
     Range(T mmin=(std::numeric_limits<T>::max)(), T mmax=(std::numeric_limits<T>::min)())
         : minimum(mmin), maximum(mmax) {}
@@ -106,7 +106,7 @@
     
     bool empty(void) const 
     {
-  return Utils::compare_distance(minimum, (std::numeric_limits<T>::max)()) && compare_distance(maximum, (std::numeric_limits<T>::min)());
+      return Utils::compare_distance(minimum, (std::numeric_limits<T>::max)()) && Utils::compare_distance(maximum, (std::numeric_limits<T>::min)());
     }
     
     void shift(T v) 
diff -r 605c80e02696 -r 46b2d79f3ae6 include/libpc/Utils.hpp
--- a/include/libpc/Utils.hpp	Thu Feb 10 20:53:09 2011 -0800
+++ b/include/libpc/Utils.hpp	Thu Feb 10 21:46:18 2011 -0800
@@ -37,9 +37,12 @@
 
 #include <cassert>
 #include <limits>
+#include "libpc/export.hpp"
 
+namespace libpc
+{
 
-class Utils
+class LIBPC_DLL Utils
 {
 public:
   static double random(double min, double max)
@@ -70,5 +73,6 @@
 
 };
 
+}; // namespace libpc
 
 #endif
diff -r 605c80e02696 -r 46b2d79f3ae6 include/libpc/export.hpp
--- a/include/libpc/export.hpp	Thu Feb 10 20:53:09 2011 -0800
+++ b/include/libpc/export.hpp	Thu Feb 10 21:46:18 2011 -0800
@@ -54,7 +54,8 @@
 #endif
 
 #ifdef _MSC_VER
-//#pragma warning(disable:4251 4275)
+#pragma warning(disable:4251)// [templated class] needs to have dll-interface...
+//#pragma warning(disable:4275)
 #endif // _MSC_VER
 
 #endif // LIBPC_HPP_INCLUDED
diff -r 605c80e02696 -r 46b2d79f3ae6 mpg-config.bat
--- a/mpg-config.bat	Thu Feb 10 20:53:09 2011 -0800
+++ b/mpg-config.bat	Thu Feb 10 21:46:18 2011 -0800
@@ -1,8 +1,8 @@
 @echo off
 
 set G="Visual Studio 10 Win64"
-set LIBPC=c:\dev\libpc
-set LASZIP=c:\dev\laszip
+set LIBPC=d:\dev\libpc
+set LASZIP=d:\dev\laszip
 set OSGEO4W=C:\OSGeo4W
 set OSGEO4W_GDAL=C:\OSGeo4W\apps\gdal-17
 set BOOST="C:\Utils\boost_1_45_0"
diff -r 605c80e02696 -r 46b2d79f3ae6 src/Field.cpp
--- a/src/Field.cpp	Thu Feb 10 20:53:09 2011 -0800
+++ b/src/Field.cpp	Thu Feb 10 21:46:18 2011 -0800
@@ -41,6 +41,8 @@
 using std::cout;
 using std::endl;
 
+using namespace libpc;
+
 
 Field::Field() : 
   m_item(Field::InvalidItem),
diff -r 605c80e02696 -r 46b2d79f3ae6 src/Filter.cpp
--- a/src/Filter.cpp	Thu Feb 10 20:53:09 2011 -0800
+++ b/src/Filter.cpp	Thu Feb 10 21:46:18 2011 -0800
@@ -34,6 +34,9 @@
 
 #include "libpc/Filter.hpp"
 
+using namespace libpc;
+
+
 Filter::Filter(Stage& prevStage) :
   m_prevStage(prevStage)
 {
diff -r 605c80e02696 -r 46b2d79f3ae6 src/Header.cpp
--- a/src/Header.cpp	Thu Feb 10 20:53:09 2011 -0800
+++ b/src/Header.cpp	Thu Feb 10 21:46:18 2011 -0800
@@ -39,6 +39,8 @@
 using std::cout;
 using std::endl;
 
+using namespace libpc;
+
 
 Header::Header() :
   m_numPoints(0)
@@ -68,13 +70,13 @@
 }
  
 


More information about the Liblas-commits mailing list