Skip to content

Commit

Permalink
Isolate override/default SRS members to Reader.
Browse files Browse the repository at this point in the history
  • Loading branch information
connormanning committed Oct 5, 2018
1 parent 04c8a79 commit 722f9c3
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 10 deletions.
15 changes: 15 additions & 0 deletions pdal/Reader.cpp
Expand Up @@ -54,6 +54,7 @@ void Reader::readerAddArgs(ProgramArgs& args)
m_defaultSrs);
}


void Reader::readerInitialize(PointTableRef)
{
if (!m_overrideSrs.empty() && !m_defaultSrs.empty())
Expand All @@ -65,4 +66,18 @@ void Reader::readerInitialize(PointTableRef)
setSpatialReference(m_defaultSrs);
}


void Reader::setSpatialReference(MetadataNode& m, const SpatialReference& srs)
{
if (getSpatialReference().empty() || m_overrideSrs.empty())
{
Stage::setSpatialReference(m, srs);
}
else
{
log()->get(LogLevel::Debug) <<
"Ignoring setSpatialReference attempt: an override was set";
}
}

} // namespace pdal
7 changes: 7 additions & 0 deletions pdal/Reader.hpp
Expand Up @@ -64,6 +64,13 @@ class PDAL_DLL Reader : public virtual Stage
Arg *m_filenameArg;
Arg *m_countArg;

SpatialReference m_overrideSrs;
SpatialReference m_defaultSrs;

using Stage::setSpatialReference;
virtual void setSpatialReference(MetadataNode& m,
const SpatialReference& srs);

private:
virtual PointViewSet run(PointViewPtr view)
{
Expand Down
7 changes: 0 additions & 7 deletions pdal/Stage.cpp
Expand Up @@ -330,13 +330,6 @@ void Stage::setSpatialReference(const SpatialReference& spatialRef)
void Stage::setSpatialReference(MetadataNode& m,
const SpatialReference& spatialRef)
{
if (!m_spatialReference.empty() && !m_overrideSrs.empty())
{
log()->get(LogLevel::Debug) <<
"Ignoring setSpatialReference attempt: an override was set";
return;
}

m_spatialReference = spatialRef;

auto pred = [](MetadataNode m)
Expand Down
4 changes: 1 addition & 3 deletions pdal/Stage.hpp
Expand Up @@ -328,10 +328,8 @@ class PDAL_DLL Stage
Options m_options; ///< Stage's options.
MetadataNode m_metadata; ///< Stage's metadata.
int m_progressFd; ///< Descriptor for progress info.
SpatialReference m_overrideSrs;
SpatialReference m_defaultSrs;

void setSpatialReference(MetadataNode& m, SpatialReference const&);
virtual void setSpatialReference(MetadataNode& m, SpatialReference const&);
void throwError(const std::string& s) const;
/**
Return the point count of all point views at the start of execution.
Expand Down

0 comments on commit 722f9c3

Please sign in to comment.