[Liblas-commits] hg: turn off the xml test for now -- too fragile

liblas-commits at liblas.org liblas-commits at liblas.org
Fri Jul 1 10:40:42 EDT 2011


details:   http://hg.liblas.orghg/rev/12a2a1d1bdae
changeset: 3058:12a2a1d1bdae
user:      Howard Butler <hobu.inc at gmail.com>
date:      Fri Jul 01 08:40:47 2011 -0500
description:
turn off the xml test for now -- too fragile
Subject: hg: update to match correct output

details:   http://hg.liblas.orghg/rev/9f2852e270c8
changeset: 3059:9f2852e270c8
user:      Howard Butler <hobu.inc at gmail.com>
date:      Fri Jul 01 09:40:00 2011 -0500
description:
update to match correct output
Subject: hg: more header padding cleanup with a bunch of tests to keep this all going straight #239

details:   http://hg.liblas.orghg/rev/c3bc50b1db80
changeset: 3060:c3bc50b1db80
user:      Howard Butler <hobu.inc at gmail.com>
date:      Fri Jul 01 09:40:32 2011 -0500
description:
more header padding cleanup with a bunch of tests to keep this all going straight #239

diffstat:

 python/tests/Header.txt      |    7 +-
 python/tests/SRS-GDAL.txt    |    2 +-
 src/detail/writer/header.cpp |   33 ++-
 test/unit/zipwriter_test.cpp |  317 ++++++++++++++++++++++++++++++++++++++++++-
 4 files changed, 340 insertions(+), 19 deletions(-)

diffs (truncated from 430 to 300 lines):

diff -r c44c1a786abb -r c3bc50b1db80 python/tests/Header.txt
--- a/python/tests/Header.txt	Thu Jun 30 12:24:03 2011 -0500
+++ b/python/tests/Header.txt	Fri Jul 01 09:40:32 2011 -0500
@@ -118,6 +118,7 @@
   >>> h.dataformat_id = 0
   >>> h.data_record_length
   20
-  
-  >>> h.xml
-  '<?xml version="1.0" encoding="utf-8"?>\n<filesignature>LASF</filesignature><projectdid>00000000-0000-0000-0000-000000000000</projectdid><systemid>Python</systemid><softwareid>hobuhobuhobuhobuhobuhobuhobuhob</softwareid><version>1.2</version><filesourceid>0</filesourceid><reserved>0</reserved><srs><proj4/><prettywkt/><wkt/><compoundwkt/><prettycompoundwkt/><gtiff>Geotiff_Information:\n   Version: 1\n   Key_Revision: 1.0\n   Tagged_Information:\n      End_Of_Tags.\n   Keyed_Information:\n      End_Of_Keys.\n   End_Of_Geotiff.\n</gtiff></srs><date>78/2008</date><size>227</size><dataoffset>742</dataoffset><header_padding>0</header_padding><count>42</count><dataformatid>0</dataformatid><datarecordlength>20</datarecordlength><compressed>false</compressed><compression_info>LASzip Version 2.0r0 c2 50000: POINT10 2</compression_info><returns><return><id>0</id><count>1341235</count></return><return><id>1</id><count>3412341222</count></return><return><id>2</id><count>0</count></retu
 rn><return><id>3</id><count>0</count></return><return><id>4</id><count>4321</count></return></returns><scale><x>0.5</x><y>0.5</y><z>0.001</z></scale><offset><x>32</x><y>32</y><z>256</z></offset><minimum><x>33452344.2333</x><y>523442.344</y><z>-90.99299999999999</z></minimum><maximum><x>33452344.2333</x><y>523442.344</y><z>-90.99299999999999</z></maximum><schema><LASSchema><dimensions><dimension><name>X</name><description>x coordinate as a long integer.  You must use the scale and offset information of the header to determine the double value.</description><position>0</position><active>1</active><size>32</size><integer>1</integer><signed>1</signed><required>1</required><byteoffset>0</byteoffset><bitoffset>0</bitoffset><bytesize>4</bytesize></dimension><dimension><name>Y</name><description>y coordinate as a long integer.  You must use the scale and offset information of the header to determine the double value.</description><position>1</position><active>1</active><size>32</siz
 e><integer>1</integer><signed>1</signed><required>1</required><byteoffset>4</byteoffset><bitoffset>0</bitoffset><bytesize>4</bytesize></dimension><dimension><name>Z</name><description>z coordinate as a long integer.  You must use the scale and offset information of the header to determine the double value.</description><position>2</position><active>1</active><size>32</size><integer>1</integer><signed>1</signed><required>1</required><byteoffset>8</byteoffset><bitoffset>0</bitoffset><bytesize>4</bytesize></dimension><dimension><name>Intensity</name><description>The intensity value is the integer representation of the pulse return magnitude. This value is optional and system specific. However, it should always be included if available.</description><position>3</position><active>1</active><size>16</size><integer>1</integer><signed>0</signed><required>1</required><byteoffset>12</byteoffset><bitoffset>0</bitoffset><bytesize>2</bytesize></dimension><dimension><name>Return Number</n
 ame><description>Return Number: The Return Number is the pulse return number for a given output pulse. A given output laser pulse can have many returns, and they must be marked in sequence of return. The first return will have a Return Number of one, the second a Return Number of two, and so on up to five returns.</description><position>4</position><active>1</active><size>3</size><integer>1</integer><signed>0</signed><required>1</required><byteoffset>14</byteoffset><bitoffset>3</bitoffset><bytesize>1</bytesize></dimension><dimension><name>Number of Returns</name><description>Number of Returns (for this emitted pulse): The Number of Returns is the total number of returns for a given pulse. For example, a laser data point may be return two (Return Number) within a total number of five returns.</description><position>5</position><active>1</active><size>3</size><integer>1</integer><signed>0</signed><required>1</required><byteoffset>14</byteoffset><bitoffset>6</bitoffset><bytesiz
 e>1</bytesize></dimension><dimension><name>Scan Direction</name><description>The Scan Direction Flag denotes the direction at which the scanner mirror was traveling at the time of the output pulse. A bit value of 1 is a positive scan direction, and a bit value of 0 is a negative scan direction (where positive scan direction is a scan moving from the left side of the in-track direction to the right side and negative the opposite). </description><position>6</position><active>1</active><size>1</size><integer>1</integer><signed>0</signed><required>1</required><byteoffset>14</byteoffset><bitoffset>7</bitoffset><bytesize>1</bytesize></dimension><dimension><name>Flightline Edge</name><description>The Edge of Flight Line data bit has a value of 1 only when the point is at the end of a scan. It is the last point on a given scan line before it changes direction.</description><position>7</position><active>1</active><size>1</size><integer>1</integer><signed>0</signed><required>1</requir
 ed><byteoffset>14</byteoffset><bitoffset>8</bitoffset><bytesize>1</bytesize></dimension><dimension><name>Classification</name><description>Classification in LAS 1.0 was essentially user defined and optional. LAS 1.1 defines a standard set of ASPRS classifications. In addition, the field is now mandatory. If a point has never been classified, this byte must be set to zero. There are no user defined classes since both point format 0 and point format 1 supply 8 bits per point for user defined operations. Note that the format for classification is a bit encoded field with the lower five bits used for class and the three high bits used for flags.</description><position>8</position><active>1</active><size>8</size><integer>0</integer><signed>0</signed><required>1</required><byteoffset>15</byteoffset><bitoffset>0</bitoffset><bytesize>1</bytesize></dimension><dimension><name>Scan Angle Rank</name><description>The Scan Angle Rank is a signed one-byte number with a valid range from -90
  to +90. The Scan Angle Rank is the angle (rounded to the nearest integer in the absolute value sense) at which the laser point was output from the laser system including the roll of the aircraft. The scan angle is within 1 degree of accuracy from +90 to -90 degrees. The scan angle is an angle based on 0 degrees being nadir, and -90 degrees to the left side of the aircraft in the direction of flight.</description><position>9</position><active>1</active><size>8</size><integer>1</integer><signed>1</signed><required>1</required><byteoffset>16</byteoffset><bitoffset>0</bitoffset><bytesize>1</bytesize></dimension><dimension><name>User Data</name><description>This field may be used at the user&apos;s discretion</description><position>10</position><active>1</active><size>8</size><integer>0</integer><signed>0</signed><required>1</required><byteoffset>17</byteoffset><bitoffset>0</bitoffset><bytesize>1</bytesize></dimension><dimension><name>Point Source ID</name><description>This valu
 e indicates the file from which this point originated. Valid values for this field are 1 to 65,535 inclusive with zero being used for a special case discussed below. The numerical value corresponds to the File Source ID from which this point originated. Zero is reserved as a convenience to system implementers. A Point Source ID of zero implies that this point originated in this file. This implies that processing software should set the Point Source ID equal to the File Source ID of the file containing this point at some time during processing. </description><position>11</position><active>1</active><size>16</size><integer>1</integer><signed>0</signed><required>1</required><byteoffset>18</byteoffset><bitoffset>0</bitoffset><bytesize>2</bytesize></dimension></dimensions><version>1.0</version><liblas>1.7.0b1</liblas><formatid>0</formatid></LASSchema></schema>'
\ No newline at end of file
+
+## too fragile
+##  >>> h.xml
+##  '<?xml version="1.0" encoding="utf-8"?>\n<filesignature>LASF</filesignature><projectdid>00000000-0000-0000-0000-000000000000</projectdid><systemid>Python</systemid><softwareid>hobuhobuhobuhobuhobuhobuhobuhob</softwareid><version>1.2</version><filesourceid>0</filesourceid><reserved>0</reserved><srs><proj4/><prettywkt/><wkt/><compoundwkt/><prettycompoundwkt/><gtiff>Geotiff_Information:\n   Version: 1\n   Key_Revision: 1.0\n   Tagged_Information:\n      End_Of_Tags.\n   Keyed_Information:\n      End_Of_Keys.\n   End_Of_Geotiff.\n</gtiff></srs><date>78/2008</date><size>227</size><dataoffset>742</dataoffset><header_padding>0</header_padding><count>42</count><dataformatid>0</dataformatid><datarecordlength>20</datarecordlength><compressed>false</compressed><compression_info>LASzip Version 2.0r0 c2 50000: POINT10 2</compression_info><returns><return><id>0</id><count>1341235</count></return><return><id>1</id><count>3412341222</count></return><return><id>2</id><count>0</count></re
 turn><return><id>3</id><count>0</count></return><return><id>4</id><count>4321</count></return></returns><scale><x>0.5</x><y>0.5</y><z>0.001</z></scale><offset><x>32</x><y>32</y><z>256</z></offset><minimum><x>33452344.2333</x><y>523442.344</y><z>-90.99299999999999</z></minimum><maximum><x>33452344.2333</x><y>523442.344</y><z>-90.99299999999999</z></maximum><schema><LASSchema><dimensions><dimension><name>X</name><description>x coordinate as a long integer.  You must use the scale and offset information of the header to determine the double value.</description><position>0</position><active>1</active><size>32</size><integer>1</integer><signed>1</signed><required>1</required><byteoffset>0</byteoffset><bitoffset>0</bitoffset><bytesize>4</bytesize></dimension><dimension><name>Y</name><description>y coordinate as a long integer.  You must use the scale and offset information of the header to determine the double value.</description><position>1</position><active>1</active><size>32</s
 ize><integer>1</integer><signed>1</signed><required>1</required><byteoffset>4</byteoffset><bitoffset>0</bitoffset><bytesize>4</bytesize></dimension><dimension><name>Z</name><description>z coordinate as a long integer.  You must use the scale and offset information of the header to determine the double value.</description><position>2</position><active>1</active><size>32</size><integer>1</integer><signed>1</signed><required>1</required><byteoffset>8</byteoffset><bitoffset>0</bitoffset><bytesize>4</bytesize></dimension><dimension><name>Intensity</name><description>The intensity value is the integer representation of the pulse return magnitude. This value is optional and system specific. However, it should always be included if available.</description><position>3</position><active>1</active><size>16</size><integer>1</integer><signed>0</signed><required>1</required><byteoffset>12</byteoffset><bitoffset>0</bitoffset><bytesize>2</bytesize></dimension><dimension><name>Return Number<
 /name><description>Return Number: The Return Number is the pulse return number for a given output pulse. A given output laser pulse can have many returns, and they must be marked in sequence of return. The first return will have a Return Number of one, the second a Return Number of two, and so on up to five returns.</description><position>4</position><active>1</active><size>3</size><integer>1</integer><signed>0</signed><required>1</required><byteoffset>14</byteoffset><bitoffset>3</bitoffset><bytesize>1</bytesize></dimension><dimension><name>Number of Returns</name><description>Number of Returns (for this emitted pulse): The Number of Returns is the total number of returns for a given pulse. For example, a laser data point may be return two (Return Number) within a total number of five returns.</description><position>5</position><active>1</active><size>3</size><integer>1</integer><signed>0</signed><required>1</required><byteoffset>14</byteoffset><bitoffset>6</bitoffset><bytes
 ize>1</bytesize></dimension><dimension><name>Scan Direction</name><description>The Scan Direction Flag denotes the direction at which the scanner mirror was traveling at the time of the output pulse. A bit value of 1 is a positive scan direction, and a bit value of 0 is a negative scan direction (where positive scan direction is a scan moving from the left side of the in-track direction to the right side and negative the opposite). </description><position>6</position><active>1</active><size>1</size><integer>1</integer><signed>0</signed><required>1</required><byteoffset>14</byteoffset><bitoffset>7</bitoffset><bytesize>1</bytesize></dimension><dimension><name>Flightline Edge</name><description>The Edge of Flight Line data bit has a value of 1 only when the point is at the end of a scan. It is the last point on a given scan line before it changes direction.</description><position>7</position><active>1</active><size>1</size><integer>1</integer><signed>0</signed><required>1</requ
 ired><byteoffset>14</byteoffset><bitoffset>8</bitoffset><bytesize>1</bytesize></dimension><dimension><name>Classification</name><description>Classification in LAS 1.0 was essentially user defined and optional. LAS 1.1 defines a standard set of ASPRS classifications. In addition, the field is now mandatory. If a point has never been classified, this byte must be set to zero. There are no user defined classes since both point format 0 and point format 1 supply 8 bits per point for user defined operations. Note that the format for classification is a bit encoded field with the lower five bits used for class and the three high bits used for flags.</description><position>8</position><active>1</active><size>8</size><integer>0</integer><signed>0</signed><required>1</required><byteoffset>15</byteoffset><bitoffset>0</bitoffset><bytesize>1</bytesize></dimension><dimension><name>Scan Angle Rank</name><description>The Scan Angle Rank is a signed one-byte number with a valid range from -
 90 to +90. The Scan Angle Rank is the angle (rounded to the nearest integer in the absolute value sense) at which the laser point was output from the laser system including the roll of the aircraft. The scan angle is within 1 degree of accuracy from +90 to -90 degrees. The scan angle is an angle based on 0 degrees being nadir, and -90 degrees to the left side of the aircraft in the direction of flight.</description><position>9</position><active>1</active><size>8</size><integer>1</integer><signed>1</signed><required>1</required><byteoffset>16</byteoffset><bitoffset>0</bitoffset><bytesize>1</bytesize></dimension><dimension><name>User Data</name><description>This field may be used at the user&apos;s discretion</description><position>10</position><active>1</active><size>8</size><integer>0</integer><signed>0</signed><required>1</required><byteoffset>17</byteoffset><bitoffset>0</bitoffset><bytesize>1</bytesize></dimension><dimension><name>Point Source ID</name><description>This va
 lue indicates the file from which this point originated. Valid values for this field are 1 to 65,535 inclusive with zero being used for a special case discussed below. The numerical value corresponds to the File Source ID from which this point originated. Zero is reserved as a convenience to system implementers. A Point Source ID of zero implies that this point originated in this file. This implies that processing software should set the Point Source ID equal to the File Source ID of the file containing this point at some time during processing. </description><position>11</position><active>1</active><size>16</size><integer>1</integer><signed>0</signed><required>1</required><byteoffset>18</byteoffset><bitoffset>0</bitoffset><bytesize>2</bytesize></dimension></dimensions><version>1.0</version><liblas>1.7.0b1</liblas><formatid>0</formatid></LASSchema></schema>'
\ No newline at end of file
diff -r c44c1a786abb -r c3bc50b1db80 python/tests/SRS-GDAL.txt
--- a/python/tests/SRS-GDAL.txt	Thu Jun 30 12:24:03 2011 -0500
+++ b/python/tests/SRS-GDAL.txt	Fri Jul 01 09:40:32 2011 -0500
@@ -112,7 +112,7 @@
   >>> del f_project
   >>> f3 = file.File('junk_srs_project.las')
   >>> f3.header.data_offset
-  1140L
+  789L
 
   >>> s_utm = srs.SRS()
   >>> s_utm.wkt = utm_wkt
diff -r c44c1a786abb -r c3bc50b1db80 src/detail/writer/header.cpp
--- a/src/detail/writer/header.cpp	Thu Jun 30 12:24:03 2011 -0500
+++ b/src/detail/writer/header.cpp	Fri Jul 01 09:40:32 2011 -0500
@@ -170,7 +170,15 @@
         if (existing_padding < 0) 
         {
             int32_t d = abs(existing_padding);
-            m_header.SetHeaderPadding(d);
+            
+            // overflowed here
+            boost::int32_t new_padding = d - m_header.GetVLRBlockSize();
+            if (m_header.GetVLRBlockSize() > d)
+            {
+                m_header.SetHeaderPadding(0);
+            } else {
+                m_header.SetHeaderPadding(d - m_header.GetVLRBlockSize());
+            }
         } else {
             // cast is safe, we've already checked for < 0
             if (static_cast<uint32_t>(existing_padding) >= m_header.GetHeaderPadding())
@@ -305,12 +313,6 @@
     detail::write_n(m_ofs, m_header.GetMaxZ(), sizeof(double));
     detail::write_n(m_ofs, m_header.GetMinZ(), sizeof(double));
 
-    // If WriteVLR returns a value, it is because the header's 
-    // offset is not large enough to contain the VLRs.  The value 
-    // it returns is the number of bytes we must increase the header
-    // by in order for it to contain the VLRs.  We do not touch VLRs if we 
-    // are in append mode.
-
     if (!bAppendMode) 
     {
         WriteVLRs();
@@ -348,11 +350,18 @@
     int32_t diff = m_header.GetDataOffset() - GetRequiredHeaderSize();
     
     if (diff < 0) {
-        std::ostringstream oss;
-        oss << "Header is not large enough to contain VLRs.  Data offset is ";
-        oss << m_header.GetDataOffset() << " while the required total size ";
-        oss << "for the VLRs is " << GetRequiredHeaderSize();
-        throw std::runtime_error(oss.str());
+
+        m_header.SetDataOffset(GetRequiredHeaderSize());
+        // Seek to the location of the data offset in the header and write a new one.
+        m_ofs.seekp(96, std::ios::beg);
+        detail::write_n(m_ofs, m_header.GetDataOffset(), sizeof(m_header.GetDataOffset()));
+        m_ofs.seekp(m_header.GetHeaderSize(), std::ios::beg);
+        
+        // std::ostringstream oss;
+        // oss << "Header is not large enough to contain VLRs.  Data offset is ";
+        // oss << m_header.GetDataOffset() << " while the required total size ";
+        // oss << "for the VLRs is " << GetRequiredHeaderSize();
+        // throw std::runtime_error(oss.str());
     }
 
     for (uint32_t i = 0; i < m_header.GetRecordsCount(); ++i)
diff -r c44c1a786abb -r c3bc50b1db80 test/unit/zipwriter_test.cpp
--- a/test/unit/zipwriter_test.cpp	Thu Jun 30 12:24:03 2011 -0500
+++ b/test/unit/zipwriter_test.cpp	Fri Jul 01 09:40:32 2011 -0500
@@ -21,20 +21,123 @@
     struct zipwriter_data
     {
         std::string file_laz;
+        std::string header_10;
+        std::string header_10_vlr;
+        std::string header_12;
+        std::string header_12_vlr;
+        std::string header_10_compressed;
+        std::string header_10_compressed_vlr;
+        std::string header_12_compressed;
+        std::string header_12_compressed_vlr;
+        std::string header_12_padded;
+        std::string header_12_too_small_pad;
 
         zipwriter_data() :
-            file_laz(g_test_data_path + "//tmp.laz")
+            file_laz(g_test_data_path + "//tmp.laz"),
+            header_10(g_test_data_path + "//header-1.0-test.las"),
+            header_10_vlr(g_test_data_path + "//header-1.0-vlr-test.las"),
+            header_12(g_test_data_path + "//header-1.2-test.las"),
+            header_12_vlr(g_test_data_path + "//header-1.2-vlr-test.las"),
+            header_10_compressed(g_test_data_path + "//header-1.0-compressed-test.laz"),
+            header_10_compressed_vlr(g_test_data_path + "//header-1.0-compressed-test.laz"),
+            header_12_compressed(g_test_data_path + "//header-1.2-compressed-test.laz"),
+            header_12_compressed_vlr(g_test_data_path + "//header-1.2-compressed-test.laz"),
+            header_12_padded(g_test_data_path + "//header-1.2-padded.laz"),
+            header_12_too_small_pad(g_test_data_path + "//header-1.2-too-small-pad.laz")
         {}
 
         ~zipwriter_data()
         {
-            // remove temporary file after each test case
-            int const ret = std::remove(file_laz.c_str());
+            cleanup(file_laz);
+            cleanup(header_10);
+            cleanup(header_10_vlr);
+            cleanup(header_12);
+            cleanup(header_12_vlr);
+            cleanup(header_10_compressed);
+            cleanup(header_10_compressed_vlr);
+            cleanup(header_12_compressed);
+            cleanup(header_12_compressed_vlr);
+            cleanup(header_12_padded);
+            cleanup(header_12_too_small_pad);
+
+        }
+        
+        void cleanup(std::string const& input)
+        {
+            const int ret = std::remove(input.c_str());
             if (0 != ret)
             {
                 ; // ignore, file may not exist
             }
         }
+        
+        void setup(  std::string const& input, 
+                liblas::Header const& header)
+        {
+
+            std::ofstream ofs;
+            ofs.open(input.c_str(), std::ios::out | std::ios::binary);
+
+            liblas::Writer writer(ofs, header);
+
+            liblas::Point point;
+
+            // Write 1st point
+            point.SetCoordinates(10, 20, 30);
+            point.SetIntensity(5);
+            point.SetReturnNumber(1);
+            point.SetNumberOfReturns(1);
+            point.SetScanDirection(1);
+            point.SetFlightLineEdge(1);
+            point.SetClassification(7);
+            point.SetScanAngleRank(90);
+            point.SetUserData(0);
+            point.SetPointSourceID(1);
+
+            writer.WritePoint(point);
+
+            // write 2nd point
+            point.SetCoordinates(40, 50, 60);
+            point.SetPointSourceID(2);
+            writer.WritePoint(point);
+
+            // write 3rd point
+            point.SetCoordinates(70, 80, 90);
+            point.SetPointSourceID(3);
+            writer.WritePoint(point);
+            
+        }
+        
+        liblas::Header FetchHeader(std::string input)
+        {
+            std::ifstream ifs;
+            ifs.open(input.c_str(), std::ios::in | std::ios::binary);
+            ensure(ifs.is_open());
+
+            liblas::ReaderFactory factory;
+            liblas::Reader reader = factory.CreateWithStream(ifs);
+            return reader.GetHeader();
+        }
+        
+        liblas::VariableRecord ConstructVLR()
+        {
+            liblas::VariableRecord r;
+            
+            std::vector<boost::uint8_t> vdata;
+            vdata.resize(256);
+            for(int i=0; i < 256; i++)
+            {
+                vdata[i] = i;
+            }
+            r.SetReserved(0xAABB);
+            r.SetUserId("HOBU");
+            r.SetRecordId(1234);
+            r.SetDescription("some lovely text");
+            r.SetData(vdata);
+
+            r.SetRecordLength((boost::uint16_t)vdata.size());
+            return r;
+        }
     };
 
     typedef test_group<zipwriter_data> tg;
@@ -193,6 +296,214 @@
             return;
         }
     }
+
+    // Test header integrity
+    template<>
+    template<>
+    void to::test<3>()
+    {
+
+        {
+            liblas::Header header;
+
+            header.SetVersionMinor(0);
+            header.SetHeaderPadding(0);
+            header.SetCompressed(false);
+
+            setup(header_10, header);
+        }
+
+        {
+            liblas::Header header = FetchHeader(header_10);
+            
+            ensure_equals("1.0 no-vlr iscompressed?", header.Compressed(), false);
+            
+            // compression is going to add the LASzip VLR
+            ensure_equals("1.0 no-vlr data offset", header.GetDataOffset(), (boost::uint32_t)229);
+            ensure_equals("1.0 no-vlr header padding", header.GetHeaderPadding(), (boost::uint32_t)2);
+
+        }
+
+        {
+            liblas::Header header;
+
+            header.SetVersionMinor(0);
+            header.SetHeaderPadding(0);
+            header.SetCompressed(false);
+            liblas::VariableRecord v = ConstructVLR();
+            header.AddVLR(v);
+
+            setup(header_10_vlr, header);
+        }
+
+        {
+            liblas::Header header = FetchHeader(header_10_vlr);
+            
+            ensure_equals("1.0 vlr iscompressed?", header.Compressed(), false);
+            
+            // compression is going to add the LASzip VLR
+            ensure_equals("1.0 vlr data offset", header.GetDataOffset(), (boost::uint32_t)539);
+            ensure_equals("1.0 vlr header padding", header.GetHeaderPadding(), (boost::uint32_t)2);
+
+        }
+
+        {
+            liblas::Header header;
+
+            header.SetVersionMinor(2);
+            header.SetHeaderPadding(0);
+            header.SetCompressed(false);
+
+            setup(header_12, header);
+        }
+
+        {
+            liblas::Header header = FetchHeader(header_12);
+            
+            ensure_equals("1.2 no-vlr iscompressed?", header.Compressed(), false);
+            
+            // compression is going to add the LASzip VLR
+            ensure_equals("1.2 no-vlr data offset", header.GetDataOffset(), (boost::uint32_t)227);
+            ensure_equals("1.2 no-vlr header padding", header.GetHeaderPadding(), (boost::uint32_t)0);
+
+        }
+
+        {
+            liblas::Header header;
+
+            header.SetVersionMinor(2);
+            header.SetHeaderPadding(0);
+            header.SetCompressed(false);
+            liblas::VariableRecord v = ConstructVLR();
+            header.AddVLR(v);
+


More information about the Liblas-commits mailing list