Skip to content

Commit

Permalink
Add method to EPT's FixedPointLayout to allow it to contain non-doubl…
Browse files Browse the repository at this point in the history
…e XYZs to match a remote buffer layout.
  • Loading branch information
connormanning committed Feb 11, 2020
1 parent eb3735d commit 1ca20b6
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
2 changes: 1 addition & 1 deletion io/EptReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ void EptReader::addDimensions(PointLayoutPtr layout)
Dimension::interpretationName(coercedType) << std::endl;

layout->registerOrAssignDim(name, coercedType);
m_remoteLayout->registerOrAssignDim(name, remoteType);
m_remoteLayout->registerOrAssignFixedDim(name, remoteType);
}

m_remoteLayout->finalize();
Expand Down
20 changes: 20 additions & 0 deletions io/private/EptSupport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,5 +168,25 @@ void Pool::work()
}
}

void FixedPointLayout::registerFixedDim(const Dimension::Id id,
const Dimension::Type type)
{
Dimension::Detail dd = m_detail[Utils::toNative(id)];
dd.setType(type);
update(dd, Dimension::name(id));
}

Dimension::Id FixedPointLayout::registerOrAssignFixedDim(const std::string name,
const Dimension::Type type)
{
Dimension::Id id = Dimension::id(name);
if (id != Dimension::Id::Unknown)
{
registerFixedDim(id, type);
return id;
}
return assignDim(name, type);
}

} // namespace pdal

10 changes: 9 additions & 1 deletion io/private/EptSupport.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,15 @@ class FixedPointLayout : public PointLayout
// The default PointLayout class may reorder dimension entries for packing
// efficiency. However if a PointLayout is intended to be mapped to data
// coming from a remote source, then the dimensions must retain their order.
// FixedPointLayout retains the order of dimensions as they are registered.
// FixedPointLayout retains the order of dimensions as they are registered,
// as well as adding a custom assignment function that makes sure XYZ are
// registered as their appropriate remote type rather than always as
// doubles.
public:
void registerFixedDim(Dimension::Id id, Dimension::Type type);
Dimension::Id registerOrAssignFixedDim(std::string name,
Dimension::Type type);

protected:
PDAL_DLL virtual bool update(
pdal::Dimension::Detail dimDetail,
Expand Down

0 comments on commit 1ca20b6

Please sign in to comment.