27 #include "../Config.h" 36 #define BOOST_TEST_NO_MAIN 37 #include <boost/test/unit_test.hpp> 38 #include <boost/shared_ptr.hpp> 42 #define ASSERTMAXDIST( pt1, pt2, maxDist ) \ 44 const double diffx = pt1.x - pt2.x; \ 45 const double diffy = pt1.y - pt2.y; \ 46 const double error = std::sqrt( ( diffx * diffx ) + ( diffy * diffy ) ); \ 47 BOOST_CHECK( error <= maxDist ); \ 50 #define ASSERTMAXDIFF( value1, value2, maxDiff ) \ 52 BOOST_CHECK( ( std::abs( value1 - value2 ) <= maxDiff ) ); \ 59 std::map<std::string, std::string> auxRasterInfo;
61 auxRasterInfo[
"URI"] = TERRALIB_DATA_DIR
"/geotiff/cbers_rgb342_crop1.tif";
64 BOOST_CHECK( inputRasterPtrPointer.get() );
68 *inputRasterPtrPointer->getGrid(), detailedExtent ),
69 "Indexed extent creation error" );
73 *inputRasterPtrPointer->getGrid(), indexedDetailedExtent ),
74 "Indexed extent creation error" );
87 tiePoint1.first.x = 0;
88 tiePoint1.first.y = 0;
89 inputRasterPtrPointer->getGrid()->gridToGeo( tiePoint1.first.x, tiePoint1.first.y,
90 tiePoint1.second.x, tiePoint1.second.y );
94 tiePoint2.first.x = (double)( inputRasterPtrPointer->getNumberOfColumns() - 1.0 );
95 tiePoint2.first.y = 0;
96 inputRasterPtrPointer->getGrid()->gridToGeo( tiePoint2.first.x, tiePoint2.first.y,
97 tiePoint2.second.x, tiePoint2.second.y );
101 tiePoint3.first.x = (double)( inputRasterPtrPointer->getNumberOfColumns() - 1.0 );
102 tiePoint3.first.y = (double)( inputRasterPtrPointer->getNumberOfRows() - 1.0 );
103 inputRasterPtrPointer->getGrid()->gridToGeo( tiePoint3.first.x, tiePoint3.first.y,
104 tiePoint3.second.x, tiePoint3.second.y );
105 algoInputParams.
m_tiePoints.push_back( tiePoint3 );
108 tiePoint4.first.x = 0;
109 tiePoint4.first.y = (double)( inputRasterPtrPointer->getNumberOfRows() - 1.0 );
110 inputRasterPtrPointer->getGrid()->gridToGeo( tiePoint4.first.x, tiePoint4.first.y,
111 tiePoint4.second.x, tiePoint4.second.y );
112 algoInputParams.
m_tiePoints.push_back( tiePoint4 );
114 algoInputParams.
m_outputSRID = inputRasterPtrPointer->getSRID();
127 algoOutputParams.
m_rInfo[
"URI"] =
128 "terralib_unittest_rp_Register_Test001.tif";
129 algoOutputParams.
m_rType =
"GDAL";
135 BOOST_CHECK( algorithmInstance.
initialize( algoInputParams ) );
136 BOOST_CHECK( algorithmInstance.
execute( algoOutputParams ) );
143 ASSERTMAXDIST( inputRasterPtrPointer->getGrid()->getExtent()->getLowerLeft(),
146 ASSERTMAXDIST( inputRasterPtrPointer->getGrid()->getExtent()->getUpperRight(),
151 BOOST_AUTO_TEST_SUITE_END()
Near neighborhood interpolation method.
#define ASSERTMAXDIFF(value1, value2, maxDiff)
bool execute(AlgorithmOutputParameters &outputParams)
Executes the algorithm using the supplied parameters.
std::pair< Coord2D, Coord2D > TiePoint
Tie point type definition.
A LinearRing is a LineString that is both closed and simple.
bool initialize(const AlgorithmInputParameters &inputParams)
Initialize the algorithm instance making it ready for execution.
std::map< std::string, std::string > m_rInfo
The necessary information to create the output rasters (as described in te::raster::RasterFactory).
This file contains include headers for the TerraLib Raster Processing module.
bool GetDetailedExtent(const te::rst::Grid &grid, te::gm::LinearRing &detailedExtent)
Create a datailed extent from the given grid.
Performs raster data registering into a SRS using a set of tie points.
bool GetIndexedDetailedExtent(const te::rst::Grid &grid, te::gm::LinearRing &indexedDetailedExtent)
Create a indexed (lines,columns) datailed extent from the given grid.
BOOST_AUTO_TEST_CASE(encoding_test_utf8_latin1)
Register output parameters.
std::string m_rType
Output raster data source type (as described in te::raster::RasterFactory ).
This file contains include headers for the Vector Geometry model of TerraLib.
BOOST_AUTO_TEST_SUITE(register_tests) BOOST_AUTO_TEST_CASE(register_test)
std::unique_ptr< te::rst::Raster > m_outputRasterPtr
The generated output registered raster.
static Raster * open(const std::map< std::string, std::string > &rinfo, te::common::AccessPolicy p=te::common::RAccess)
It opens a raster with the given parameters and default raster driver.
#define ASSERTMAXDIST(pt1, pt2, maxDist)