[Liblas-commits] hg: 2 new changesets

liblas-commits at liblas.org liblas-commits at liblas.org
Thu Sep 23 12:28:28 EDT 2010


changeset bac245829f67 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=bac245829f67
summary: updated to proper tests with vertcs unit

changeset 28eddbd39147 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=28eddbd39147
summary: stuff from howard

diffstat:

 include/liblas/detail/writer/point.hpp |   4 +++-
 python/tests/SRS-GDAL.txt              |   4 ++--
 src/detail/writer/point.cpp            |  14 +++++---------
 3 files changed, 10 insertions(+), 12 deletions(-)

diffs (91 lines):

diff -r 37f78228542a -r 28eddbd39147 include/liblas/detail/writer/point.hpp
--- a/include/liblas/detail/writer/point.hpp	Thu Sep 23 09:39:16 2010 -0500
+++ b/include/liblas/detail/writer/point.hpp	Thu Sep 23 12:27:49 2010 -0400
@@ -50,8 +50,10 @@
 #include <liblas/detail/fwd.hpp>
 // boost
 #include <boost/cstdint.hpp>
+
 // std
 #include <iosfwd>
+#include <vector>
 
 namespace liblas { namespace detail { namespace writer {
 
@@ -86,7 +88,7 @@
     
     Schema m_format;
     
-    boost::uint8_t* m_blanks; // TODO: shared_ptr --mlosko
+    std::vector<boost::uint8_t> m_blanks; 
 
     bool bTime;
     bool bColor;
diff -r 37f78228542a -r 28eddbd39147 python/tests/SRS-GDAL.txt
--- a/python/tests/SRS-GDAL.txt	Thu Sep 23 09:39:16 2010 -0500
+++ b/python/tests/SRS-GDAL.txt	Thu Sep 23 12:27:49 2010 -0400
@@ -123,7 +123,7 @@
 
   >>> f = file.File('../test/data/srs_vertcs.las',mode='r')
   >>> s = f.header.srs
-  >>> s.get_wkt_compoundok() == """COMPD_CS["unknown",PROJCS["WGS 84 / UTM zone 17N",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433],AUTHORITY["EPSG","4326"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",-81],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AUTHORITY["EPSG","32617"]],VERT_CS["NAVD88 height",VERT_DATUM["North American Vertical Datum 1988",2005,AUTHORITY["EPSG","5103"],EXTENSION["PROJ4_GRIDS","g2003conus.gtx,g2003alaska.gtx,g2003h01.gtx,g2003p01.gtx"]],AXIS["Up",UP],AUTHORITY["EPSG","5703"]]]"""
+  >>> s.get_wkt_compoundok() == """COMPD_CS["unknown",PROJCS["WGS 84 / UTM zone 17N",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433],AUTHORITY["EPSG","4326"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",-81],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AUTHORITY["EPSG","32617"]],VERT_CS["NAVD88 height",VERT_DATUM["North American Vertical Datum 1988",2005,AUTHORITY["EPSG","5103"],EXTENSION["PROJ4_GRIDS","g2003conus.gtx,g2003alaska.gtx,g2003h01.gtx,g2003p01.gtx"]],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["Up",UP],AUTHORITY["EPSG","5703"]]]"""
   True
 
   >>> s2 = srs.SRS()
@@ -131,4 +131,4 @@
   >>> s2.set_verticalcs( 5703, 'abc', 5103, 9001 )
   True
   >>> s2.get_wkt_compoundok()
-  'COMPD_CS["unknown",PROJCS["WGS 84 / UTM zone 17N",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433],AUTHORITY["EPSG","4326"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",-81],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AUTHORITY["EPSG","32617"]],VERT_CS["NAVD88 height",VERT_DATUM["North American Vertical Datum 1988",2005,AUTHORITY["EPSG","5103"],EXTENSION["PROJ4_GRIDS","g2003conus.gtx,g2003alaska.gtx,g2003h01.gtx,g2003p01.gtx"]],AXIS["Up",UP],AUTHORITY["EPSG","5703"]]]'
+  'COMPD_CS["unknown",PROJCS["WGS 84 / UTM zone 17N",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433],AUTHORITY["EPSG","4326"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",-81],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AUTHORITY["EPSG","32617"]],VERT_CS["NAVD88 height",VERT_DATUM["North American Vertical Datum 1988",2005,AUTHORITY["EPSG","5103"],EXTENSION["PROJ4_GRIDS","g2003conus.gtx,g2003alaska.gtx,g2003h01.gtx,g2003p01.gtx"]],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["Up",UP],AUTHORITY["EPSG","5703"]]]'
diff -r 37f78228542a -r 28eddbd39147 src/detail/writer/point.cpp
--- a/src/detail/writer/point.cpp	Thu Sep 23 09:39:16 2010 -0500
+++ b/src/detail/writer/point.cpp	Thu Sep 23 12:27:49 2010 -0400
@@ -61,7 +61,6 @@
     , m_header(header)
     , m_point(liblas::Point())
     , m_format(header.GetSchema())
-    , m_blanks(0)
     , bTime(header.GetSchema().HasTime())
     , bColor(header.GetSchema().HasColor())
 {
@@ -70,8 +69,7 @@
 
 Point::~Point()
 {
-    if (m_blanks != 0) 
-        delete[] m_blanks; 
+
 }
 
 void Point::setup()
@@ -89,10 +87,8 @@
             throw std::runtime_error("ByteSize of format was less than BaseByteSize, this cannot happen!");
         }
         
-        m_blanks = new uint8_t[size]; // FIXME: RAII for m_blanks!!! --mloskot
-        for (std::size_t i=0; i < size; ++i) {
-            m_blanks[i] = 0;
-        }
+        m_blanks.resize(size);
+        m_blanks.assign(size, 0);
     }
 }
 
@@ -162,13 +158,13 @@
         
         if (data.size() == 0) {
 
-            detail::write_n(GetStream(), *m_blanks, static_cast<std::streamsize>(size));
+            detail::write_n(GetStream(), m_blanks.front(), static_cast<std::streamsize>(size));
             
         } else if (data.size() < size){ 
             // size can be casted now that we have already checked if it is less than 0
             int16_t difference = static_cast<uint16_t>(size) - static_cast<uint16_t>(data.size());
             detail::write_n(GetStream(), data.front(), data.size());
-            detail::write_n(GetStream(), *m_blanks, static_cast<std::streamsize>(difference));
+            detail::write_n(GetStream(), m_blanks.front(), static_cast<std::streamsize>(difference));
 
         } else {
             detail::write_n(GetStream(), data.front(), static_cast<std::streamsize>(size));


More information about the Liblas-commits mailing list