[Liblas-commits] hg-main-tree: add an endianness element for dimension

liblas-commits at liblas.org liblas-commits at liblas.org
Wed May 25 12:49:55 EDT 2011


details:   http://hg.libpc.orghg-main-tree/rev/f870bdbf9480
changeset: 732:f870bdbf9480
user:      Howard Butler <hobu.inc at gmail.com>
date:      Wed May 25 11:47:15 2011 -0500
description:
add an endianness element for dimension
Subject: hg-main-tree: turn off writing the task xml for now

details:   http://hg.libpc.orghg-main-tree/rev/da7552e94155
changeset: 733:da7552e94155
user:      Howard Butler <hobu.inc at gmail.com>
date:      Wed May 25 11:48:59 2011 -0500
description:
turn off writing the task xml for now
Subject: hg-main-tree: pointSourceID is uint16_t, not int16_t

details:   http://hg.libpc.orghg-main-tree/rev/0c5ac8e28753
changeset: 734:0c5ac8e28753
user:      Howard Butler <hobu.inc at gmail.com>
date:      Wed May 25 11:49:15 2011 -0500
description:
pointSourceID is uint16_t, not int16_t
Subject: hg-main-tree: add a Get8DimensionFixedSchema method for our fixed-format schema that we currently write to Oracle

details:   http://hg.libpc.orghg-main-tree/rev/e909219b4c5f
changeset: 735:e909219b4c5f
user:      Howard Butler <hobu.inc at gmail.com>
date:      Wed May 25 11:49:46 2011 -0500
description:
add a Get8DimensionFixedSchema method for our fixed-format schema that we currently write to Oracle

diffstat:

 apps/pc2pc.cpp                       |    6 +-
 include/libpc/drivers/oci/Common.hpp |    2 +-
 src/drivers/oci/Writer.cpp           |  190 +++++++++++++++++++++++++++++++++++
 test/data/schemas/LAS.xsd            |   21 +++-
 4 files changed, 214 insertions(+), 5 deletions(-)

diffs (273 lines):

diff -r 7089c623ac1b -r e909219b4c5f apps/pc2pc.cpp
--- a/apps/pc2pc.cpp	Wed May 25 10:28:58 2011 -0500
+++ b/apps/pc2pc.cpp	Wed May 25 11:49:46 2011 -0500
@@ -156,8 +156,8 @@
 
         writer.write(numPoints);
         boost::property_tree::ptree output_tree;
-        output_tree.put_child(writer.getName(), options.GetPTree());
-        boost::property_tree::write_xml(m_xml, output_tree);
+        // output_tree.put_child(writer.getName(), options.GetPTree());
+        // boost::property_tree::write_xml(m_xml, output_tree);
                     
 #else
         throw configuration_error("libPC not compiled with Oracle support");
@@ -204,7 +204,7 @@
         
         output_tree.put_child(reader.getName(), options.GetPTree());
         // output_tree.put_child(writer.getName(), )
-        boost::property_tree::write_xml(m_xml, output_tree);
+        // boost::property_tree::write_xml(m_xml, output_tree);
             
     #else
             throw configuration_error("libPC not compiled with Oracle support");
diff -r 7089c623ac1b -r e909219b4c5f include/libpc/drivers/oci/Common.hpp
--- a/include/libpc/drivers/oci/Common.hpp	Wed May 25 10:28:58 2011 -0500
+++ b/include/libpc/drivers/oci/Common.hpp	Wed May 25 11:49:46 2011 -0500
@@ -105,7 +105,7 @@
     boost::int8_t edgeOfFlightLine;
     boost::int8_t scanAngleRank;
     boost::int8_t userData;
-    boost::int16_t pointSourceId;
+    boost::uint16_t pointSourceId;
     boost::uint16_t red;
     boost::uint16_t green;
     boost::uint16_t blue;
diff -r 7089c623ac1b -r e909219b4c5f src/drivers/oci/Writer.cpp
--- a/src/drivers/oci/Writer.cpp	Wed May 25 10:28:58 2011 -0500
+++ b/src/drivers/oci/Writer.cpp	Wed May 25 11:49:46 2011 -0500
@@ -45,6 +45,196 @@
 namespace libpc { namespace drivers { namespace oci {
 
 
+libpc::Schema Get8DimensionFixedSchema()
+{
+    std::ostringstream text;
+    libpc::Schema schema;
+    
+    Dimension x(Dimension::Field_X, Dimension::Double);
+    text << "x coordinate as a long integer.  You must use the scale and "
+         << "offset information of the header to determine the double value.";
+    x.setDescription(text.str());
+    x.setEndianness(libpc::Endian_Big);
+    schema.addDimension(x);
+    text.str("");
+
+    Dimension y(Dimension::Field_Y, Dimension::Double);
+    text << "y coordinate as a long integer.  You must use the scale and "
+         << "offset information of the header to determine the double value.";
+    y.setDescription(text.str());
+    y.setEndianness(libpc::Endian_Big);
+    schema.addDimension(y);
+    text.str("");
+
+    Dimension z(Dimension::Field_Z, Dimension::Double);
+    text << "z coordinate as a long integer.  You must use the scale and "
+         << "offset information of the header to determine the double value.";
+    z.setDescription(text.str());
+    z.setEndianness(libpc::Endian_Big);
+    schema.addDimension(z);
+    text.str("");
+
+    Dimension t(Dimension::Field_Time, Dimension::Double);
+    text << "The GPS Time is the double floating point time tag value at "
+        "which the point was acquired. It is GPS Week Time if the "
+        "Global Encoding low bit is clear and Adjusted Standard GPS "
+        "Time if the Global Encoding low bit is set (see Global Encoding "
+        "in the Public Header Block description).";
+    t.setDescription(text.str());
+    t.setEndianness(libpc::Endian_Big);
+    schema.addDimension(t);
+    text.str("");
+
+    Dimension classification(Dimension::Field_Classification, Dimension::Double);
+    text << "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.";
+    classification.setDescription(text.str());
+    classification.setEndianness(libpc::Endian_Big);
+    schema.addDimension(classification);
+    text.str("");
+    
+    Dimension intensity(Dimension::Field_Intensity, Dimension::Double);
+    text << "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.";
+    intensity.setDescription(text.str());
+    intensity.setEndianness(libpc::Endian_Big);
+    schema.addDimension(intensity);
+    text.str("");
+
+    Dimension return_no(Dimension::Field_ReturnNumber, Dimension::Uint8); // 3 bits only
+    text << "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.";
+    return_no.setDescription(text.str());
+    return_no.setEndianness(libpc::Endian_Big);
+    schema.addDimension(return_no);
+    text.str("");
+
+    Dimension no_returns(Dimension::Field_NumberOfReturns, Dimension::Uint8); // 3 bits only
+    text << "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.";
+    no_returns.setDescription(text.str());
+    no_returns.setEndianness(libpc::Endian_Big);
+    schema.addDimension(no_returns);
+    text.str("");
+
+    Dimension scan_dir(Dimension::Field_ScanDirectionFlag, Dimension::Uint8); // 1 bit only
+    text << "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). ";
+    scan_dir.setDescription(text.str());
+    scan_dir.setEndianness(libpc::Endian_Big);
+    schema.addDimension(scan_dir);
+    text.str("");
+
+    Dimension edge(Dimension::Field_EdgeOfFlightLine, Dimension::Uint8); // 1 bit only
+    text << "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.";
+    edge.setDescription(text.str());
+    edge.setEndianness(libpc::Endian_Big);
+    schema.addDimension(edge);
+    text.str("");
+
+
+
+    Dimension scan_angle(Dimension::Field_ScanAngleRank, Dimension::Int8);
+    text << "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.";
+    scan_angle.setDescription(text.str());
+    scan_angle.setEndianness(libpc::Endian_Big);
+    schema.addDimension(scan_angle);
+    text.str("");
+
+    Dimension user_data(Dimension::Field_UserData, Dimension::Uint8);
+    text << "This field may be used at the userís discretion";
+    user_data.setDescription(text.str());
+    user_data.setEndianness(libpc::Endian_Big);
+    schema.addDimension(user_data);
+    text.str("");
+
+    Dimension point_source_id(Dimension::Field_PointSourceId, Dimension::Uint16);
+    text << "This value 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. ";
+    point_source_id.setDescription(text.str());
+    point_source_id.setEndianness(libpc::Endian_Big);
+    schema.addDimension(point_source_id);
+    text.str("");
+
+
+
+    Dimension red(Dimension::Field_Red, Dimension::Uint16);
+    text << "The red image channel value associated with this point";
+    red.setDescription(text.str());
+    red.setEndianness(libpc::Endian_Big);
+    schema.addDimension(red);
+    text.str("");
+
+    Dimension green(Dimension::Field_Green, Dimension::Uint16);
+    text << "The green image channel value associated with this point";
+    green.setDescription(text.str());
+    green.setEndianness(libpc::Endian_Big);
+    schema.addDimension(green);
+    text.str("");
+
+    Dimension blue(Dimension::Field_Blue, Dimension::Uint16);
+    text << "The blue image channel value associated with this point";
+    blue.setDescription(text.str());
+    blue.setEndianness(libpc::Endian_Big);
+    schema.addDimension(blue);
+    text.str("");
+
+    Dimension alpha(Dimension::Field_Alpha, Dimension::Uint16);
+    text << "The alpha image channel value associated with this point";
+    alpha.setDescription(text.str());
+    alpha.setEndianness(libpc::Endian_Big);
+    schema.addDimension(alpha);
+    text.str("");
+
+    Dimension blk_id(Dimension::Field_User1, Dimension::Uint32);
+    text << "The block id for this point";
+    blk_id.setDescription(text.str());
+    blk_id.setEndianness(libpc::Endian_Big);
+    schema.addDimension(blk_id);
+    text.str("");
+
+    Dimension pt_id(Dimension::Field_User2, Dimension::Uint32);
+    text << "The point id for this point";
+    pt_id.setDescription(text.str());
+    pt_id.setEndianness(libpc::Endian_Big);
+    schema.addDimension(pt_id);
+    text.str("");
+        
+    return schema;
+}
 
 std::string ReadFile(std::string filename)
 {
diff -r 7089c623ac1b -r e909219b4c5f test/data/schemas/LAS.xsd
--- a/test/data/schemas/LAS.xsd	Wed May 25 10:28:58 2011 -0500
+++ b/test/data/schemas/LAS.xsd	Wed May 25 11:49:46 2011 -0500
@@ -32,6 +32,18 @@
         <xs:attribute name="units" type="pc:interpretationType"/>
         <xs:attribute name="value" type="xs:decimal"/>
     </xs:complexType>
+
+    <xs:simpleType name="endiannessType">
+        <xs:annotation>
+      <xs:documentation>
+            Used to describe the storage endianness of the data in the dimension.
+        </xs:documentation>
+    </xs:annotation>   
+        <xs:restriction base="xs:string">
+            <xs:enumeration value="big"/>
+            <xs:enumeration value="little"/>
+        </xs:restriction>
+    </xs:simpleType>
     
     <xs:complexType name="dimensionType">
         <xs:all>
@@ -108,7 +120,14 @@
                         The scale of this dimension.  Used to support scaled integer types
                     </xs:documentation>
                 </xs:annotation>   
-            </xs:element>        
+            </xs:element>
+            <xs:element minOccurs="0" name="endianness" type="pc:endiannessType">
+                <xs:annotation>
+                    <xs:documentation>
+                        Describes the storage endianness of the dimension.
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:element>          
         </xs:all>
     </xs:complexType>
     


More information about the Liblas-commits mailing list