Skip to content

Commit

Permalink
put orientation on the pdal::Schema #209
Browse files Browse the repository at this point in the history
  • Loading branch information
hobu committed Nov 19, 2013
1 parent cd707ef commit 50979d7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
14 changes: 13 additions & 1 deletion include/pdal/Schema.hpp
Expand Up @@ -101,6 +101,13 @@ typedef boost::uint32_t size_type;

typedef std::map<Dimension const*, Dimension const*> DimensionMap;

enum Orientation
{
POINT_INTERLEAVED = 1,
DIMENSION_INTERLEAVED = 2,
UNKNOWN_INTERLEAVED = 256
};

}

/// A pdal::Schema is a composition of pdal::Dimension instances that form
Expand Down Expand Up @@ -216,6 +223,11 @@ class PDAL_DLL Schema
return m_index.get<schema::name>().size();
}

inline schema::Orientation getOrientation() const
{
return m_orientation;
}

/// @name Summary and serialization
/// @return a boost::property_tree representing the Schema
/*!
Expand Down Expand Up @@ -256,7 +268,7 @@ class PDAL_DLL Schema
private:

schema::size_type m_byteSize;

schema::Orientation m_orientation;
schema::Map m_index;

};
Expand Down
9 changes: 8 additions & 1 deletion src/Schema.cpp
Expand Up @@ -61,12 +61,14 @@ namespace pdal

Schema::Schema()
: m_byteSize(0)
, m_orientation(schema::POINT_INTERLEAVED)
{
return;
}

Schema::Schema(std::vector<Dimension> const& dimensions)
: m_byteSize(0)
, m_orientation(schema::POINT_INTERLEAVED)
{

for (std::vector<Dimension>::const_iterator i = dimensions.begin();
Expand All @@ -80,6 +82,8 @@ Schema::Schema(std::vector<Dimension> const& dimensions)
Schema::Schema(Schema const& other)
: m_byteSize(other.m_byteSize)
, m_index(other.m_index)
, m_orientation(other.m_orientation)

{

}
Expand All @@ -92,6 +96,7 @@ Schema& Schema::operator=(Schema const& rhs)
{
m_byteSize = rhs.m_byteSize;
m_index = rhs.m_index;
m_orientation = rhs.m_orientation;
}

return *this;
Expand All @@ -103,6 +108,8 @@ bool Schema::operator==(const Schema& other) const
if (m_byteSize != other.m_byteSize) return false;

if (m_index.size() != other.m_index.size()) return false;

if (m_orientation != other.m_orientation) return false;

schema::index_by_index const& idx = m_index.get<schema::index>();
schema::index_by_index const& idx2 = other.m_index.get<schema::index>();
Expand Down Expand Up @@ -242,7 +249,7 @@ const Dimension* Schema::getDimensionPtr(string_ref nameIn, string_ref namespc,
std::string* errorMsg) const
{
// getDimensionPtr is implemented in terms of string_ref so that we
// can guarentee not to allocate memory unless we really need to.
// can guarantee not to allocate memory unless we really need to.
string_ref name = nameIn;
string_ref ns = namespc;
if (ns.empty())
Expand Down

0 comments on commit 50979d7

Please sign in to comment.