Skip to content

Commit

Permalink
fixed description field of Dimension
Browse files Browse the repository at this point in the history
  • Loading branch information
mpgerlek committed Sep 19, 2011
1 parent 13fb859 commit 34b28e0
Show file tree
Hide file tree
Showing 7 changed files with 314 additions and 187 deletions.
38 changes: 24 additions & 14 deletions include/pdal/Dimension.hpp
Expand Up @@ -44,7 +44,7 @@

#include <pdal/pdal.hpp>
#include <pdal/Utils.hpp>
#include <pdal/external/boost/uuid/uuid.hpp>

#include <boost/property_tree/ptree.hpp>


Expand All @@ -60,10 +60,11 @@ namespace pdal
class PDAL_DLL Dimension
{
public:
//typedef pdal::external::boost::uuids::uuid Id;

enum Id
{
//
// common field types: 0..999
//
Id_X_i32 = 0,
Id_Y_i32,
Id_Z_i32,
Expand All @@ -80,7 +81,10 @@ class PDAL_DLL Dimension

Id_Time_u64,

Id_Las_Intensity = 100,
//
// LAS: 1000..1999
//
Id_Las_Intensity = 1000,
Id_Las_ReturnNumber,
Id_Las_NumberOfReturns,
Id_Las_ScanDirectionFlag,
Expand All @@ -97,8 +101,10 @@ class PDAL_DLL Dimension
Id_Las_WaveformZt,
Id_Las_Time,

// terrasolid
Id_TerraSolid_Alpha = 200,
//
// terrasolid: 2000..2999
//
Id_TerraSolid_Alpha = 2000,
Id_TerraSolid_Classification,
Id_TerraSolid_PointSourceId_u8,
Id_TerraSolid_PointSourceId_u16,
Expand All @@ -109,12 +115,16 @@ class PDAL_DLL Dimension
Id_TerraSolid_Intensity,
Id_TerraSolid_Time,

// chipper stuff
Id_Chipper_1 = 300,
//
// chipper stuff: 3000..3999
//
Id_Chipper_1 = 3000,
Id_Chipper_2,

// qfit
Id_Qfit_StartPulse = 400,
//
// qfit: 4000..4999
//
Id_Qfit_StartPulse = 4000,
Id_Qfit_ReflectedPulse,
Id_Qfit_ScanAngleRank,
Id_Qfit_Pitch,
Expand All @@ -128,9 +138,9 @@ class PDAL_DLL Dimension
Id_Qfit_PDOP,
Id_Qfit_PulseWidth,

Id_Qfit_User1 = 10000,
// user fields are 100,000..199,999

Id_Undefined = 100000
Id_Undefined = 200000
};

enum DataType
Expand All @@ -157,8 +167,8 @@ class PDAL_DLL Dimension
};

/// \name Constructors
Dimension(const Id& id); // will use table to lookup datatype, description, etc
Dimension(const Id& id, DataType datatype, std::string name); // for dimensions not in the master table
Dimension(Id id); // will use table to lookup datatype, description, etc
Dimension(Id id, DataType datatype, std::string name, std::string description=std::string("")); // for dimensions not in the master table
Dimension(Dimension const& other);

Dimension& operator=(Dimension const& rhs);
Expand Down
430 changes: 265 additions & 165 deletions src/Dimension.cpp

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions test/data/apps/pcinfo_schema.txt
Expand Up @@ -3,7 +3,7 @@
{
"name": "X",
"datatype": "Int32",
"description": "x coordinate as a long integer. You must use the scale and offset information of the header to determine the double value.",
"description": "x coordinate as a long integer. You must use the scale and offset information of the header to determine the double value.",
"bytesize": "4",
"endianness": "little",
"scale": "0.01"
Expand All @@ -12,7 +12,7 @@
{
"name": "Y",
"datatype": "Int32",
"description": "y coordinate as a long integer. You must use the scale and offset information of the header to determine the double value.",
"description": "y coordinate as a long integer. You must use the scale and offset information of the header to determine the double value.",
"bytesize": "4",
"endianness": "little",
"scale": "0.01"
Expand All @@ -21,7 +21,7 @@
{
"name": "Z",
"datatype": "Int32",
"description": "z coordinate as a long integer. You must use the scale and offset information of the header to determine the double value.",
"description": "z coordinate as a long integer. You must use the scale and offset information of the header to determine the double value.",
"bytesize": "4",
"endianness": "little",
"scale": "0.01"
Expand Down Expand Up @@ -57,7 +57,7 @@
{
"name": "ScanDirectionFlag",
"datatype": "Uint8",
"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": "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).",
"bytesize": "1",
"endianness": "little",
"scale": "0"
Expand Down
5 changes: 4 additions & 1 deletion test/unit/DimensionLayoutTest.cpp
Expand Up @@ -77,7 +77,10 @@ BOOST_AUTO_TEST_CASE(DimensionLayoutTest_ptree)
std::string out1 = ss1.str();

static std::string xml_header = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
std::string ref = xml_header + "<dimension><name>X</name><datatype>Int32</datatype><description/><bytesize>4</bytesize><endianness>little</endianness><scale>0</scale></dimension><byteoffset>0</byteoffset><position>0</position><isValid>false</isValid>";
std::string ref = xml_header +
"<dimension><name>X</name><datatype>Int32</datatype>"
"<description>x coordinate as a long integer. You must use the scale and offset information of the header to determine the double value.</description>"
"<bytesize>4</bytesize><endianness>little</endianness><scale>0</scale></dimension><byteoffset>0</byteoffset><position>0</position><isValid>false</isValid>";

boost::algorithm::erase_all(out1, "\n");
boost::algorithm::erase_all(ref, "\n");
Expand Down
5 changes: 4 additions & 1 deletion test/unit/DimensionTest.cpp
Expand Up @@ -85,7 +85,10 @@ BOOST_AUTO_TEST_CASE(DimensionTest_ptree)
std::string out1 = ss1.str();

std::string xml_header = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
std::string ref = xml_header + "<name>X</name><datatype>Int32</datatype><description/><bytesize>4</bytesize><endianness>little</endianness><scale>0</scale>";
std::string ref = xml_header +
"<name>X</name><datatype>Int32</datatype>"
"<description>x coordinate as a long integer. You must use the scale and offset information of the header to determine the double value.</description>"
"<bytesize>4</bytesize><endianness>little</endianness><scale>0</scale>";

boost::algorithm::erase_all(out1, "\n");
boost::algorithm::erase_all(ref, "\n");
Expand Down
9 changes: 8 additions & 1 deletion test/unit/SchemaLayoutTest.cpp
Expand Up @@ -117,7 +117,14 @@ BOOST_AUTO_TEST_CASE(SchemaLayoutTest_ptree)
std::string out1 = ss1.str();

static std::string xml_header = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
std::string ref = xml_header + "<dimensionlayout><dimension><name>X</name><datatype>Int32</datatype><description/><bytesize>4</bytesize><endianness>little</endianness><scale>0</scale></dimension><byteoffset>0</byteoffset><position>0</position><isValid>false</isValid></dimensionlayout><dimensionlayout><dimension><name>Y</name><datatype>Int32</datatype><description/><bytesize>4</bytesize><endianness>little</endianness><scale>0</scale></dimension><byteoffset>4</byteoffset><position>1</position><isValid>false</isValid></dimensionlayout>";
std::string ref = xml_header + "<dimensionlayout>"
"<dimension><name>X</name><datatype>Int32</datatype>"
"<description>x coordinate as a long integer. You must use the scale and offset information of the header to determine the double value.</description>"
"<bytesize>4</bytesize><endianness>little</endianness><scale>0</scale></dimension><byteoffset>0</byteoffset><position>0</position>"
"<isValid>false</isValid></dimensionlayout>"
"<dimensionlayout><dimension><name>Y</name><datatype>Int32</datatype>"
"<description>y coordinate as a long integer. You must use the scale and offset information of the header to determine the double value.</description>"
"<bytesize>4</bytesize><endianness>little</endianness><scale>0</scale></dimension><byteoffset>4</byteoffset><position>1</position><isValid>false</isValid></dimensionlayout>";

boost::algorithm::erase_all(out1, "\n");
boost::algorithm::erase_all(ref, "\n");
Expand Down
6 changes: 5 additions & 1 deletion test/unit/SchemaTest.cpp
Expand Up @@ -95,7 +95,11 @@ BOOST_AUTO_TEST_CASE(SchemaTest_ptree)

boost::algorithm::erase_all(out1, "\n");
static std::string xml_header = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
std::string ref = xml_header + "<dimension><name>X</name><datatype>Int32</datatype><description/><bytesize>4</bytesize><endianness>little</endianness><scale>0</scale></dimension><dimension><name>Y</name><datatype>Int32</datatype><description/><bytesize>4</bytesize><endianness>little</endianness><scale>0</scale></dimension>";
std::string ref = xml_header + "<dimension><name>X</name><datatype>Int32</datatype>"
"<description>x coordinate as a long integer. You must use the scale and offset information of the header to determine the double value.</description>"
"<bytesize>4</bytesize><endianness>little</endianness><scale>0</scale></dimension><dimension><name>Y</name><datatype>Int32</datatype>"
"<description>y coordinate as a long integer. You must use the scale and offset information of the header to determine the double value.</description>"
"<bytesize>4</bytesize><endianness>little</endianness><scale>0</scale></dimension>";

boost::algorithm::erase_all(ref, "\n");
BOOST_CHECK_EQUAL(ref, out1);
Expand Down

0 comments on commit 34b28e0

Please sign in to comment.