[Liblas-commits] hg: start developing a constructor from VLRs
liblas-commits at liblas.org
liblas-commits at liblas.org
Wed Sep 1 23:26:58 EDT 2010
changeset b588f1f8db17 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=b588f1f8db17
summary: start developing a constructor from VLRs
diffstat:
include/liblas/lasschema.hpp | 8 ++++----
src/lasschema.cpp | 35 +++++++++++++++++++++++++++++++++++
2 files changed, 39 insertions(+), 4 deletions(-)
diffs (87 lines):
diff -r 36376dc3620d -r b588f1f8db17 include/liblas/lasschema.hpp
--- a/include/liblas/lasschema.hpp Wed Sep 01 21:13:08 2010 -0500
+++ b/include/liblas/lasschema.hpp Wed Sep 01 22:26:50 2010 -0500
@@ -44,6 +44,7 @@
#include <liblas/lasversion.hpp>
#include <liblas/external/property_tree/ptree.hpp>
+#include <liblas/lasvariablerecord.hpp>
// boost
#include <boost/cstdint.hpp>
#include <boost/any.hpp>
@@ -66,7 +67,7 @@
// Schema();
Schema(PointFormatName data_format_id);
- Schema(VariableRecord const& vlr);
+ Schema(std::vector<VariableRecord> const& vlrs);
Schema& operator=(Schema const& rhs);
Schema(Schema const& other);
@@ -82,12 +83,10 @@
PointFormatName GetDataFormatId() const { return m_data_format_id; }
- void SetDataFormatId(PointFormatName const& value);//{ m_data_format_id = value; }
+ void SetDataFormatId(PointFormatName const& value);
bool HasColor() const;
- // void Color(bool const& bColor);
bool HasTime() const;
- // void Time(bool const& bTime);
void AddDimension(boost::shared_ptr<DimensionI> dim);
boost::shared_ptr<DimensionI> GetDimension(std::string const& name) const;
@@ -110,6 +109,7 @@
void add_time();
void add_color();
void update_required_dimensions(PointFormatName data_format_id);
+ bool IsSchemaVLR(VariableRecord const& vlr);
};
diff -r 36376dc3620d -r b588f1f8db17 src/lasschema.cpp
--- a/src/lasschema.cpp Wed Sep 01 21:13:08 2010 -0500
+++ b/src/lasschema.cpp Wed Sep 01 22:26:50 2010 -0500
@@ -340,6 +340,41 @@
return *this;
}
+Schema::Schema(std::vector<VariableRecord> const& vlrs)
+{
+ bool have_schema = false;
+ std::vector<VariableRecord>::const_iterator it;
+ for (it = vlrs.begin(); it != vlrs.end(); ++it)
+ {
+ VariableRecord const& vlr = *it;
+ if (IsSchemaVLR(vlr))
+ {
+ have_schema = true;
+ break;
+ }
+ }
+ if (!have_schema)
+ {
+ throw std::runtime_error("No LASSchema VLR record found!");
+ }
+
+
+
+}
+
+bool Schema::IsSchemaVLR(VariableRecord const& vlr)
+{
+ std::string const uid("liblas");
+
+ // UID liblas and ID == 7 is Schema 1.0
+ if (uid == vlr.GetUserId(true).c_str() && 17 == vlr.GetRecordId())
+ {
+ return true;
+ }
+
+ return false;
+
+}
boost::uint32_t Schema::GetSize() const
{
More information about the Liblas-commits
mailing list