Skip to content

Commit

Permalink
rename pdal::filters::ReprojectionFilter -> pdal::filters::Reprojection
Browse files Browse the repository at this point in the history
  • Loading branch information
hobu committed Nov 14, 2011
1 parent a48ae54 commit 2e8b685
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 38 deletions.
2 changes: 1 addition & 1 deletion apps/pc2pc.cpp
Expand Up @@ -48,7 +48,7 @@

#include <pdal/filters/Cache.hpp>
#include <pdal/filters/Chipper.hpp>
#include <pdal/filters/ReprojectionFilter.hpp>
#include <pdal/filters/Reprojection.hpp>
#include <pdal/filters/Scaling.hpp>

#include <boost/property_tree/xml_parser.hpp>
Expand Down
Expand Up @@ -37,6 +37,7 @@

#include <pdal/pdal.hpp>
#include <pdal/Filter.hpp>
#include <pdal/FilterIterator.hpp>

#include <boost/shared_ptr.hpp>

Expand All @@ -54,15 +55,15 @@ namespace pdal { namespace filters {

class ReprojectionFilterSequentialIterator;

class PDAL_DLL ReprojectionFilter : public Filter
class PDAL_DLL Reprojection : public Filter
{
public:
SET_STAGE_NAME("filters.reprojection", "Reprojection Filter")

ReprojectionFilter(Stage& prevStage, const Options&);
ReprojectionFilter(Stage& prevStage,
Reprojection(Stage& prevStage, const Options&);
Reprojection(Stage& prevStage,
const SpatialReference& outSRS);
ReprojectionFilter(Stage& prevStage,
Reprojection(Stage& prevStage,
const SpatialReference& inSRS,
const SpatialReference& outSRS);

Expand Down Expand Up @@ -97,11 +98,30 @@ class PDAL_DLL ReprojectionFilter : public Filter
TransformPtr m_transform_ptr;
boost::shared_ptr<pdal::gdal::Debug> m_gdal_debug;

ReprojectionFilter& operator=(const ReprojectionFilter&); // not implemented
ReprojectionFilter(const ReprojectionFilter&); // not implemented
Reprojection& operator=(const Reprojection&); // not implemented
Reprojection(const Reprojection&); // not implemented
};


namespace iterators { namespace sequential {


class Reprojection : public pdal::FilterSequentialIterator
{
public:
Reprojection(const pdal::filters::Reprojection& filter);

private:
boost::uint64_t skipImpl(boost::uint64_t);
boost::uint32_t readBufferImpl(PointBuffer&);
bool atEndImpl() const;

const pdal::filters::Reprojection& m_reprojectionFilter;
};


} } // iterators::sequential

} } // namespaces

#endif
6 changes: 2 additions & 4 deletions src/CMakeLists.txt
Expand Up @@ -324,8 +324,7 @@ set(PDAL_FILTERS_HPP
${PDAL_FILTERS_HEADERS}/MosaicFilter.hpp
${PDAL_FILTERS_HEADERS}/MosaicFilterIterator.hpp
${PDAL_FILTERS_HEADERS}/PointBufferCache.hpp
${PDAL_FILTERS_HEADERS}/ReprojectionFilter.hpp
${PDAL_FILTERS_HEADERS}/ReprojectionFilterIterator.hpp
${PDAL_FILTERS_HEADERS}/Reprojection.hpp
${PDAL_FILTERS_HEADERS}/Scaling.hpp
${PDAL_FILTERS_HEADERS}/StatsFilter.hpp
${PDAL_FILTERS_HEADERS}/StatsFilterIterator.hpp
Expand All @@ -343,8 +342,7 @@ set (PDAL_FILTERS_CPP
${PDAL_FILTERS_SRC}/MosaicFilter.cpp
${PDAL_FILTERS_SRC}/MosaicFilterIterator.cpp
${PDAL_FILTERS_SRC}/PointBufferCache.cpp
${PDAL_FILTERS_SRC}/ReprojectionFilter.cpp
${PDAL_FILTERS_SRC}/ReprojectionFilterIterator.cpp
${PDAL_FILTERS_SRC}/Reprojection.cpp
${PDAL_FILTERS_SRC}/Scaling.cpp
${PDAL_FILTERS_SRC}/StatsFilter.cpp
${PDAL_FILTERS_SRC}/StatsFilterIterator.cpp
Expand Down
6 changes: 3 additions & 3 deletions src/StageFactory.cpp
Expand Up @@ -67,7 +67,7 @@
#include <pdal/filters/Color.hpp>
#include <pdal/filters/Crop.hpp>
#include <pdal/filters/Decimation.hpp>
#include <pdal/filters/ReprojectionFilter.hpp>
#include <pdal/filters/Reprojection.hpp>
#include <pdal/filters/InPlaceReprojection.hpp>
#include <pdal/filters/Scaling.hpp>
#include <pdal/filters/StatsFilter.hpp>
Expand Down Expand Up @@ -135,7 +135,7 @@ namespace pdal
MAKE_FILTER_CREATOR(Decimation, pdal::filters::Decimation)
MAKE_FILTER_CREATOR(Descaling, pdal::filters::Descaling)
MAKE_FILTER_CREATOR(InPlaceReprojection, pdal::filters::InPlaceReprojection)
MAKE_FILTER_CREATOR(ReprojectionFilter, pdal::filters::ReprojectionFilter)
MAKE_FILTER_CREATOR(Reprojection, pdal::filters::Reprojection)
MAKE_FILTER_CREATOR(Scaling, pdal::filters::Scaling)
MAKE_FILTER_CREATOR(StatsFilter, pdal::filters::StatsFilter)

Expand Down Expand Up @@ -311,7 +311,7 @@ void StageFactory::registerKnownFilters()
REGISTER_FILTER(Crop, pdal::filters::Crop);
REGISTER_FILTER(Decimation, pdal::filters::Decimation);
REGISTER_FILTER(Descaling, pdal::filters::Descaling);
REGISTER_FILTER(ReprojectionFilter, pdal::filters::ReprojectionFilter);
REGISTER_FILTER(Reprojection, pdal::filters::Reprojection);
REGISTER_FILTER(InPlaceReprojection, pdal::filters::InPlaceReprojection);
REGISTER_FILTER(Scaling, pdal::filters::Scaling);
REGISTER_FILTER(StatsFilter, pdal::filters::StatsFilter);
Expand Down
68 changes: 52 additions & 16 deletions src/filters/ReprojectionFilter.cpp → src/filters/Reprojection.cpp
Expand Up @@ -32,14 +32,14 @@
* OF SUCH DAMAGE.
****************************************************************************/

#include <pdal/filters/ReprojectionFilter.hpp>
#include <pdal/filters/Reprojection.hpp>

#include <boost/concept_check.hpp> // ignore_unused_variable_warning

#include <pdal/Dimension.hpp>
#include <pdal/Schema.hpp>
#include <pdal/PointBuffer.hpp>
#include <pdal/filters/ReprojectionFilterIterator.hpp>


#ifdef PDAL_HAVE_GDAL
#include <gdal.h>
Expand Down Expand Up @@ -82,7 +82,7 @@ namespace pdal { namespace filters {



ReprojectionFilter::ReprojectionFilter(Stage& prevStage, const Options& options)
Reprojection::Reprojection(Stage& prevStage, const Options& options)
: pdal::Filter(prevStage, options)
, m_outSRS(options.getValueOrThrow<pdal::SpatialReference>("out_srs"))
, m_inferInputSRS(false)
Expand All @@ -101,8 +101,8 @@ ReprojectionFilter::ReprojectionFilter(Stage& prevStage, const Options& options)
}


ReprojectionFilter::ReprojectionFilter(Stage& prevStage,
const SpatialReference& outSRS)
Reprojection::Reprojection(Stage& prevStage,
const SpatialReference& outSRS)
: Filter(prevStage, Options::none())
, m_outSRS(outSRS)
, m_inferInputSRS(true)
Expand All @@ -111,9 +111,9 @@ ReprojectionFilter::ReprojectionFilter(Stage& prevStage,
}


ReprojectionFilter::ReprojectionFilter(Stage& prevStage,
const SpatialReference& inSRS,
const SpatialReference& outSRS)
Reprojection::Reprojection(Stage& prevStage,
const SpatialReference& inSRS,
const SpatialReference& outSRS)
: Filter(prevStage, Options::none())
, m_inSRS(inSRS)
, m_outSRS(outSRS)
Expand All @@ -123,7 +123,7 @@ ReprojectionFilter::ReprojectionFilter(Stage& prevStage,
}


void ReprojectionFilter::initialize()
void Reprojection::initialize()
{
Filter::initialize();

Expand Down Expand Up @@ -181,14 +181,14 @@ void ReprojectionFilter::initialize()
}


const Options ReprojectionFilter::getDefaultOptions() const
const Options Reprojection::getDefaultOptions() const
{
Options options;
return options;
}


void ReprojectionFilter::updateBounds()
void Reprojection::updateBounds()
{
const Bounds<double>& oldBounds = getBounds();

Expand Down Expand Up @@ -217,7 +217,7 @@ void ReprojectionFilter::updateBounds()
}


void ReprojectionFilter::checkImpedance()
void Reprojection::checkImpedance()
{
const Schema& schema = this->getSchema();

Expand All @@ -232,7 +232,7 @@ void ReprojectionFilter::checkImpedance()
}


void ReprojectionFilter::transform(double& x, double& y, double& z) const
void Reprojection::transform(double& x, double& y, double& z) const
{

#ifdef PDAL_HAVE_GDAL
Expand All @@ -255,7 +255,7 @@ void ReprojectionFilter::transform(double& x, double& y, double& z) const
}


void ReprojectionFilter::processBuffer(PointBuffer& data) const
void Reprojection::processBuffer(PointBuffer& data) const
{
const boost::uint32_t numPoints = data.getNumPoints();

Expand Down Expand Up @@ -284,9 +284,45 @@ void ReprojectionFilter::processBuffer(PointBuffer& data) const
}


pdal::StageSequentialIterator* ReprojectionFilter::createSequentialIterator() const
pdal::StageSequentialIterator* Reprojection::createSequentialIterator() const
{
return new pdal::filters::iterators::sequential::Reprojection(*this);
}


namespace iterators { namespace sequential {


Reprojection::Reprojection(const pdal::filters::Reprojection& filter)
: pdal::FilterSequentialIterator(filter)
, m_reprojectionFilter(filter)
{
return;
}


boost::uint32_t Reprojection::readBufferImpl(PointBuffer& data)
{
return new ReprojectionFilterSequentialIterator(*this);
const boost::uint32_t numRead = getPrevIterator().read(data);

m_reprojectionFilter.processBuffer(data);

return numRead;
}


boost::uint64_t Reprojection::skipImpl(boost::uint64_t count)
{
getPrevIterator().skip(count);
return count;
}


bool Reprojection::atEndImpl() const
{
return getPrevIterator().atEnd();
}

} } // namespaces

} } // namespaces
14 changes: 7 additions & 7 deletions test/unit/ReprojectionFilterTest.cpp
Expand Up @@ -36,15 +36,15 @@

#include <pdal/SpatialReference.hpp>
#include <pdal/drivers/las/Reader.hpp>
#include <pdal/filters/ReprojectionFilter.hpp>
#include <pdal/filters/Reprojection.hpp>
#include <pdal/filters/Scaling.hpp>
#include <pdal/StageIterator.hpp>
#include <pdal/Schema.hpp>
#include <pdal/PointBuffer.hpp>

#include "Support.hpp"

BOOST_AUTO_TEST_SUITE(ReprojectionFilterTest)
BOOST_AUTO_TEST_SUITE(ReprojectionTest)


#ifdef PDAL_SRS_ENABLED
Expand Down Expand Up @@ -72,7 +72,7 @@ static void getPoint(const pdal::PointBuffer& data, double& x, double& y, double


// Test reprojecting UTM 15 to DD with a filter
BOOST_AUTO_TEST_CASE(ReprojectionFilterTest_test_1)
BOOST_AUTO_TEST_CASE(ReprojectionTest_test_1)
{
const char* epsg4326_wkt = "GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0],UNIT[\"degree\",0.0174532925199433],AUTHORITY[\"EPSG\",\"4326\"]]";
const char* utm15_wkt = "PROJCS[\"NAD83 / UTM zone 15N\",GEOGCS[\"NAD83\",DATUM[\"North_American_Datum_1983\",SPHEROID[\"GRS 1980\",6378137,298.2572221010002,AUTHORITY[\"EPSG\",\"7019\"]],AUTHORITY[\"EPSG\",\"6269\"]],PRIMEM[\"Greenwich\",0],UNIT[\"degree\",0.0174532925199433],AUTHORITY[\"EPSG\",\"4269\"]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin\",0],PARAMETER[\"central_meridian\",-93],PARAMETER[\"scale_factor\",0.9996],PARAMETER[\"false_easting\",500000],PARAMETER[\"false_northing\",0],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AUTHORITY[\"EPSG\",\"26915\"]]";
Expand Down Expand Up @@ -135,7 +135,7 @@ BOOST_AUTO_TEST_CASE(ReprojectionFilterTest_test_1)
pdal::drivers::las::Reader reader(Support::datapath("utm15.las"));

pdal::filters::Scaling scalingFilter(reader);
pdal::filters::ReprojectionFilter reprojectionFilter(scalingFilter, out_ref);
pdal::filters::Reprojection reprojectionFilter(scalingFilter, out_ref);
pdal::filters::Descaling descalingFilter(reprojectionFilter);

descalingFilter.initialize();
Expand Down Expand Up @@ -172,7 +172,7 @@ BOOST_AUTO_TEST_CASE(ReprojectionFilterTest_test_1)
pdal::Options opts(opt2);

pdal::filters::Scaling scalingFilter(reader);
pdal::filters::ReprojectionFilter reprojectionFilter(scalingFilter, opts);
pdal::filters::Reprojection reprojectionFilter(scalingFilter, opts);
pdal::filters::Descaling descalingFilter(reprojectionFilter);

descalingFilter.initialize();
Expand Down Expand Up @@ -208,7 +208,7 @@ BOOST_AUTO_TEST_CASE(ReprojectionFilterTest_test_1)
// convert to doubles, use internal scale factor
pdal::filters::Scaling scalingFilter(reader);

pdal::filters::ReprojectionFilter reprojectionFilter(scalingFilter, out_ref);
pdal::filters::Reprojection reprojectionFilter(scalingFilter, out_ref);

// convert to ints, using custom scale factor
pdal::filters::Descaling descalingFilter(reprojectionFilter, 0.000001, 0.0, 0.000001, 0.0, 0.01, 0.0);
Expand Down Expand Up @@ -248,7 +248,7 @@ BOOST_AUTO_TEST_CASE(test_impedence_mismatch)
bool ok = false;
try
{
pdal::filters::ReprojectionFilter filter(reader, out_ref);
pdal::filters::Reprojection filter(reader, out_ref);
filter.initialize();
ok = false;
}
Expand Down
1 change: 0 additions & 1 deletion test/unit/ScalingFilterTest.cpp
Expand Up @@ -36,7 +36,6 @@

#include <pdal/SpatialReference.hpp>
#include <pdal/drivers/las/Reader.hpp>
#include <pdal/filters/ReprojectionFilter.hpp>
#include <pdal/filters/Scaling.hpp>
#include <pdal/StageIterator.hpp>
#include <pdal/Schema.hpp>
Expand Down

0 comments on commit 2e8b685

Please sign in to comment.