[Liblas-commits] hg: 3 new changesets
liblas-commits at liblas.org
liblas-commits at liblas.org
Tue Aug 31 22:19:35 EDT 2010
changeset b8b7ada4ea23 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=b8b7ada4ea23
summary: make failures more descriptive
changeset 0153fadb9214 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=0153fadb9214
summary: switch off schema in C API for now, this is broken and will be fixed
changeset 0a9071b292e9 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=0a9071b292e9
summary: initial rewrite of liblas::Schema
diffstat:
include/liblas/lasheader.hpp | 15 +-
include/liblas/lasschema.hpp | 193 +++++++++---
src/detail/reader/header.cpp | 8 +-
src/las_c_api.cpp | 320 ++++++++++----------
src/lasheader.cpp | 148 ++++----
src/lasschema.cpp | 671 +++++++++++++++++++++++++++++++++++-------
test/unit/common.cpp | 50 +-
7 files changed, 974 insertions(+), 431 deletions(-)
diffs (truncated from 1734 to 300 lines):
diff -r 3a3b6dc77e12 -r 0a9071b292e9 include/liblas/lasheader.hpp
--- a/include/liblas/lasheader.hpp Sat Aug 28 22:26:29 2010 -0500
+++ b/include/liblas/lasheader.hpp Tue Aug 31 21:19:25 2010 -0500
@@ -45,7 +45,6 @@
#include <liblas/guid.hpp>
#include <liblas/lasbounds.hpp>
-#include <liblas/lasheader.hpp>
#include <liblas/lasschema.hpp>
#include <liblas/lasspatialreference.hpp>
#include <liblas/lasvariablerecord.hpp>
@@ -237,10 +236,10 @@
/// \todo To be documented
boost::uint16_t GetDataRecordLength() const;
- /// Set the length of the point format. Evidently, there are
- /// LAS files in the wild that contain point formats of sizes that
- /// are different than the prescribed set specified in the specification.
- void SetDataRecordLength(boost::uint16_t v);
+ // /// Set the length of the point format. Evidently, there are
+ // /// LAS files in the wild that contain point formats of sizes that
+ // /// are different than the prescribed set specified in the specification.
+ // void SetDataRecordLength(boost::uint16_t v);
/// Get total number of point records stored in the LAS file.
boost::uint32_t GetPointRecordsCount() const;
@@ -372,7 +371,7 @@
//
void Init();
void ClearGeoKeyVLRs();
- void UpdateSchema();
+ // void UpdateSchema();
//
// Private data members
@@ -393,8 +392,8 @@
boost::uint16_t m_headerSize;
boost::uint32_t m_dataOffset;
boost::uint32_t m_recordsCount;
- boost::uint8_t m_dataFormatId;
- boost::uint16_t m_dataRecordLen;
+ // PointFormatName m_dataFormatId;
+ // boost::uint16_t m_dataRecordLen;
boost::uint32_t m_pointRecordsCount;
RecordsByReturnArray m_pointRecordsByReturn;
PointScales m_scales;
diff -r 3a3b6dc77e12 -r 0a9071b292e9 include/liblas/lasschema.hpp
--- a/include/liblas/lasschema.hpp Sat Aug 28 22:26:29 2010 -0500
+++ b/include/liblas/lasschema.hpp Tue Aug 31 21:19:25 2010 -0500
@@ -42,102 +42,191 @@
#ifndef LIBLAS_SCHEMA_HPP_INCLUDED
#define LIBLAS_SCHEMA_HPP_INCLUDED
+#include <liblas/lasversion.hpp>
+
// boost
#include <boost/cstdint.hpp>
#include <boost/any.hpp>
+#include <boost/shared_ptr.hpp>
+
// std
#include <iosfwd>
#include <limits>
#include <string>
+#include <vector>
namespace liblas {
+// class Schema
+// {
+// public:
+//
+// Schema(boost::uint8_t major, boost::uint8_t minor, boost::uint16_t size);
+// Schema(boost::uint8_t major, boost::uint8_t minor, boost::uint16_t size, bool bColor, bool bTime);
+//
+// Schema& operator=(Schema const& rhs);
+// Schema(Schema const& other);
+//
+// ~Schema() {};
+//
+// /// Fetch byte size
+// boost::uint16_t GetByteSize() const;
+//
+// /// Set the total byte size of the point record
+// void SetByteSize(boost::uint16_t const& value);
+//
+// /// Get the base size (only accounting for Time, Color, etc )
+// /// This is equivalent to the point format's base byte size
+// boost::uint16_t GetBaseByteSize() const;
+//
+// boost::uint8_t GetVersionMajor() const;
+// void SetVersionMajor(boost::uint8_t const& value);
+//
+// boost::uint8_t GetVersionMinor() const;
+// void SetVersionMinor(boost::uint8_t const& value);
+//
+// bool HasColor() const;
+// void Color(bool const& bColor); // updatesize(); }
+// bool HasTime() const;
+// void Time(bool const& bTime); // {m_hasTime = bTime; updatesize(); }
+//
+// protected:
+//
+// boost::uint16_t m_size;
+// boost::uint8_t m_versionminor;
+// boost::uint8_t m_versionmajor;
+//
+// bool m_hasColor;
+// bool m_hasTime;
+//
+// boost::uint16_t m_base_size;
+//
+// private:
+// void updatesize();
+// void updatesize(boost::uint16_t new_size);
+// boost::uint16_t calculate_base_size();
+// };
+
+class DimensionI;
+typedef boost::shared_ptr<DimensionI> DimensionPtr;
+
class Schema
{
public:
-
- Schema(boost::uint8_t major, boost::uint8_t minor, boost::uint16_t size);
- Schema(boost::uint8_t major, boost::uint8_t minor, boost::uint16_t size, bool bColor, bool bTime);
-
+
+ // Schema();
+ Schema(PointFormatName data_format_id);
Schema& operator=(Schema const& rhs);
Schema(Schema const& other);
+
~Schema() {};
/// Fetch byte size
- boost::uint16_t GetByteSize() const;
+ boost::uint32_t GetByteSize() const;
- /// Set value of the red image channel
- void SetByteSize(boost::uint16_t const& value);
+ boost::uint32_t GetSize() const;
/// Get the base size (only accounting for Time, Color, etc )
- boost::uint16_t GetBaseByteSize() const;
+ boost::uint32_t GetBaseByteSize() const;
+
+
+ PointFormatName GetDataFormatId() const { return m_data_format_id; }
+ void SetDataFormatId(PointFormatName const& value);//{ m_data_format_id = value; }
- boost::uint8_t GetVersionMajor() const;
- void SetVersionMajor(boost::uint8_t const& value);
+ bool HasColor() const;
+ // void Color(bool const& bColor);
+ bool HasTime() const;
+ // void Time(bool const& bTime);
- boost::uint8_t GetVersionMinor() const;
- void SetVersionMinor(boost::uint8_t const& value);
-
- bool HasColor() const;
- void Color(bool const& bColor); // updatesize(); }
- bool HasTime() const;
- void Time(bool const& bTime); // {m_hasTime = bTime; updatesize(); }
+ void AddDimension(boost::shared_ptr<DimensionI> dim);
+ boost::shared_ptr<DimensionI> GetDimension(std::string const& name) const;
+ void RemoveDimension(DimensionPtr dim);
+
+ std::vector<std::string> GetDimensionNames() const;
protected:
boost::uint16_t m_size;
- boost::uint8_t m_versionminor;
- boost::uint8_t m_versionmajor;
-
- bool m_hasColor;
- bool m_hasTime;
-
- boost::uint16_t m_base_size;
+ PointFormatName m_data_format_id;
private:
- void updatesize();
- void updatesize(boost::uint16_t new_size);
- boost::uint16_t calculate_base_size();
+
+
+
+ std::vector<DimensionPtr> m_dimensions;
+
+
+ void add_record0_dimensions();
+ void add_time();
+ void add_color();
+ void update_required_dimensions(PointFormatName data_format_id);
};
-class Dimension
+
+class DimensionI
{
public:
- Dimension(std::string const& name, uint32_t size_in_bits) : m_name(name), m_bitsize(size_in_bits) {};
+ DimensionI(std::string const& name, boost::uint32_t size_in_bits) :
+ m_name(name),
+ m_bitsize(size_in_bits)
+ {};
+ virtual ~DimensionI() {};
+
std::string const& GetName() { return m_name; }
/// bits, logical size of point record
- virtual std::size_t GetSize() const = 0;
+ std::size_t GetSize() const
+ {
+ return m_bitsize;
+ }
/// bytes, physical/serialisation size of record
- virtual std::size_t GetByteSize() const = 0;
+ std::size_t GetByteSize() const
+ {
+ return m_bitsize / 8;
+ }
- virtual bool IsRequired() const = 0;
+ /// Is this dimension required by PointFormatName
+ bool IsRequired() const { return m_required; }
+ void IsRequired(bool v) { m_required = v; }
+
+ bool IsActive() const { return m_active; }
+ void IsActive(bool v) { m_active = v; }
+
+ std::string GetDescription() const { return m_description; }
+ void SetDescription(std::string const& v) { m_description = v; }
+
+
- virtual void IsRequired(bool bRequired) = 0;
private:
std::string m_name;
boost::uint32_t m_bitsize;
+ bool m_required;
+ bool m_active;
+ std::string m_description;
};
template <typename T>
-class NumericDimension : public Dimension
+class NumericDimension : public DimensionI
{
public:
- NumericDimension(T type, std::string const& name ) : Dimension(name),
+ NumericDimension(std::string const& name,
+ T type,
+ boost::uint32_t size_in_bits ) :
+ DimensionI(name, size_in_bits),
+ m_min(std::numeric_limits<T>::min()),
m_max(std::numeric_limits<T>::max()),
- m_min(std::numeric_limits<T>::min()),
m_type(type)
{
};
NumericDimension& operator=(NumericDimension const& rhs);
- NumericDimension(Dimension const& other);
+ NumericDimension(DimensionI const& other);
~NumericDimension() {};
@@ -148,17 +237,7 @@
T const& GetMax() { return m_max; }
void SetMin(T const& min) { m_min = min; }
- /// bits, logical size of point record
- std::size_t GetSize() const
- {
- return sizeof(m_type) * 8;
- }
-
- /// bytes, physical/serialisation size of record
- std::size_t GetByteSize() const
- {
- return sizeof(m_type);
- }
+
private:
@@ -168,7 +247,25 @@
More information about the Liblas-commits
mailing list