28 #include "../geometry/LinearRing.h"
29 #include "../geometry/MultiPoint.h"
30 #include "../geometry/MultiLineString.h"
31 #include "../geometry/Point.h"
32 #include "../geometry/CurvePolygon.h"
33 #include "../geometry/Envelope.h"
34 #include "../geometry/Enums.h"
35 #include "../raster/Raster.h"
36 #include "../raster/Grid.h"
37 #include "../raster/Band.h"
38 #include "../raster/BandProperty.h"
39 #include "../raster/Utils.h"
40 #include "../raster/SynchronizedRaster.h"
41 #include "../common/PlatformUtils.h"
42 #include "../common/progress/TaskProgress.h"
44 #include <boost/thread.hpp>
45 #include <boost/graph/graph_concepts.hpp>
46 #include <boost/scoped_ptr.hpp>
56 #define getPerpendicularDistance( pX, pY, lineAX, lineAY, lineBX, lineBY, aux1, aux2, perpDist ) \
57 aux1 = lineAX - lineBX; \
58 aux2 = lineAY - lineBY; \
61 perpDist = std::abs( pX - lineAX ); \
63 else if( aux2 == 0.0 ) \
65 perpDist = std::abs( pY - lineAY ); \
71 ( aux2 * pX ) - ( aux1 * pY ) + ( lineAX * lineBY ) - ( lineBX * lineAY ) \
74 std::sqrt( ( aux1 * aux1 ) + ( aux2 * aux2 ) ); \
82 : m_returnValuePtr( 0 ), m_abortValuePtr( 0 ), m_sync1Ptr( 0 ), m_sync2Ptr( 0 ),
83 m_raster1BlocksInfosPtr( 0 ), m_mutexPtr( 0 ), m_blockProcessedSignalMutexPtr( 0 ),
84 m_blockProcessedSignalPtr( 0 ), m_runningThreadsCounterPtr( 0 ),
85 m_blendMethod( te::rp::
Blender::InvalidBlendMethod ),
87 m_noDataValue( 0.0 ), m_forceRaster1NoDataValue( false ),
88 m_forceRaster2NoDataValue( false ),
89 m_maxRasterCachedBlocks( 0 ), m_useProgress( false )
171 const std::vector< unsigned int >& raster1Bands,
173 const std::vector< unsigned int >& raster2Bands,
177 const double& noDataValue,
178 const bool forceRaster1NoDataValue,
179 const bool forceRaster2NoDataValue,
180 const std::vector< double >& pixelOffsets1,
181 const std::vector< double >& pixelScales1,
182 const std::vector< double >& pixelOffsets2,
183 const std::vector< double >& pixelScales2,
187 const unsigned int threadsNumber,
188 const bool enableProgressInterface )
192 "Invalid raster 1" );
195 "Invalid raster 2" );
197 "Invalid raster bands vector" );
199 raster2Bands.size(),
"Invalid raster bands vector" );
201 raster1Bands.size(),
"Invalid pixel offsets" );
203 raster1Bands.size(),
"Invalid pixel scales" );
205 raster2Bands.size(),
"Invalid pixel offsets" );
207 raster2Bands.size(),
"Invalid pixel scales" );
210 "Invalid polygon 1" )
213 "Invalid polygon 2" )
215 "Invalid transformation" );
226 if( r1ValidDataDelimiterPtr )
230 if( r2ValidDataDelimiterPtr )
236 std::auto_ptr< te::gm::MultiPolygon > indexedDelimiter1Ptr(
239 if( r1ValidDataDelimiterPtr )
245 for( std::size_t geomIdx = 0 ; geomIdx < nGeoms ; ++geomIdx )
255 for( std::size_t ringIdx = 0 ; ringIdx < nRings ; ++ringIdx )
261 const std::size_t nPoints = inRingPtr->
getNPoints();
268 for( std::size_t pIdx = 0 ; pIdx < nPoints ; ++pIdx )
270 grid.
geoToGrid( inCoordsPtr[ pIdx ].x, inCoordsPtr[ pIdx ].y,
271 auxCoord.
x, auxCoord.
y );
272 outRingPtr->
setPoint( pIdx, auxCoord.
x, auxCoord.
y );
275 outPolPtr->
add( outRingPtr );
279 indexedDelimiter1Ptr->add( outPolPtr );
305 outPolPtr->
add( outRingPtr );
307 indexedDelimiter1Ptr->add( outPolPtr );
311 std::auto_ptr< te::gm::MultiPolygon > indexedDelimiter2Ptr(
314 if( r2ValidDataDelimiterPtr )
320 for( std::size_t geomIdx = 0 ; geomIdx < nGeoms ; ++geomIdx )
330 for( std::size_t ringIdx = 0 ; ringIdx < nRings ; ++ringIdx )
336 const std::size_t nPoints = inRingPtr->
getNPoints();
344 for( std::size_t pIdx = 0 ; pIdx < nPoints ; ++pIdx )
346 grid.
geoToGrid( inCoordsPtr[ pIdx ].x, inCoordsPtr[ pIdx ].y,
347 auxCoord.
x, auxCoord.
y );
348 geomTransformation.
inverseMap( auxCoord.
x, auxCoord.
y, auxCoord2.
x, auxCoord2.
y );
349 outRingPtr->
setPoint( pIdx, auxCoord2.
x, auxCoord2.
y );
352 outPolPtr->
add( outRingPtr );
355 indexedDelimiter2Ptr->add( outPolPtr );
368 auxCoord.
x, auxCoord.
y );
369 outRingPtr->
setPoint( 0, auxCoord.
x, auxCoord.
y );
370 outRingPtr->
setPoint( 4, auxCoord.
x, auxCoord.
y );
375 auxCoord.
x, auxCoord.
y );
376 outRingPtr->
setPoint( 1, auxCoord.
x, auxCoord.
y );
381 auxCoord.
x, auxCoord.
y );
382 outRingPtr->
setPoint( 2, auxCoord.
x, auxCoord.
y );
387 auxCoord.
x, auxCoord.
y );
388 outRingPtr->
setPoint( 3, auxCoord.
x, auxCoord.
y );
392 outPolPtr->
add( outRingPtr );
394 indexedDelimiter2Ptr->add( outPolPtr );
400 indexedDelimiter1Ptr.get() ) );
414 std::size_t ringIdx = 0;
415 std::auto_ptr< te::gm::Geometry > ringIntersectionPtr;
416 std::size_t nPols = 0;
417 std::size_t polIdx = 0;
419 nPols = indexedDelimiter2Ptr->getNumGeometries();
420 for( polIdx = 0 ; polIdx < nPols ; ++polIdx )
423 indexedDelimiter2Ptr->getGeometryN( polIdx ) );
426 for( ringIdx = 0 ; ringIdx < polPtr->
getNumRings() ;
429 ringIntersectionPtr.reset( indexedDelimiter1Ptr->intersection(
432 if( ringIntersectionPtr.get() != 0 )
440 nPols = indexedDelimiter1Ptr->getNumGeometries();
441 for( polIdx = 0 ; polIdx < nPols ; ++polIdx )
444 indexedDelimiter1Ptr->getGeometryN( polIdx ) );
447 for( ringIdx = 0 ; ringIdx < polPtr->
getNumRings() ;
450 ringIntersectionPtr.reset( indexedDelimiter2Ptr->intersection(
453 if( ringIntersectionPtr.get() != 0 )
486 switch( blendMethod )
538 if( forceRaster1NoDataValue )
540 std::vector< std::complex<double> > noDataValues1( raster1.
getNumberOfBands(),
541 std::complex<double>( noDataValue, 0.0 ) );
550 if( forceRaster2NoDataValue )
552 std::vector< std::complex<double> > noDataValues2( raster2.
getNumberOfBands(),
553 std::complex<double>( noDataValue, 0.0 ) );
570 for( std::vector< unsigned int >::size_type rasterBandsIdx = 0 ;
571 rasterBandsIdx < raster1Bands.size() ; ++rasterBandsIdx )
578 if( forceRaster1NoDataValue )
588 if( forceRaster2NoDataValue )
616 if( threadsNumber == 0 )
675 switch( blendMethod )
701 double*
const values )
749 double*
const values )
950 double*
const values )
1067 unsigned int firstOutputRasterCol = 0;
1068 unsigned int lastOutputRasterRow = 0;
1069 unsigned int lastOutputRasterCol = 0;
1070 unsigned int firstOutputRasterRow = 0;
1073 const double raster2LastRowIdx =
1075 const double raster2LastColIdx =
1077 double raster2LLColOverRaster1 = 0;
1078 double raster2LLRowOverRaster1 = 0;
1079 double raster2LRColOverRaster1 = 0;
1080 double raster2LRRowOverRaster1 = 0;
1081 double raster2URColOverRaster1 = 0;
1082 double raster2URRowOverRaster1 = 0;
1083 double raster2ULColOverRaster1 = 0;
1084 double raster2ULRowOverRaster1 = 0;
1089 raster2LLColOverRaster1,
1090 raster2LLRowOverRaster1);
1094 raster2LRColOverRaster1,
1095 raster2LRRowOverRaster1);
1099 raster2URColOverRaster1,
1100 raster2URRowOverRaster1);
1104 raster2ULColOverRaster1,
1105 raster2ULRowOverRaster1);
1107 firstOutputRasterCol = (
unsigned int)
1111 std::min( raster2LLColOverRaster1,
1112 std::min( raster2LRColOverRaster1,
1113 std::min( raster2URColOverRaster1,
1114 raster2ULColOverRaster1
1122 lastOutputRasterRow = (
unsigned int)
1126 std::max( raster2LLRowOverRaster1,
1127 std::max( raster2LRRowOverRaster1,
1128 std::max( raster2URRowOverRaster1,
1129 raster2ULRowOverRaster1
1137 lastOutputRasterCol = (
unsigned int)
1141 std::max( raster2LLColOverRaster1,
1142 std::max( raster2LRColOverRaster1,
1143 std::max( raster2URColOverRaster1,
1144 raster2ULColOverRaster1
1152 firstOutputRasterRow = (
unsigned int)
1156 std::min( raster2LLRowOverRaster1,
1157 std::min( raster2LRRowOverRaster1,
1158 std::min( raster2URRowOverRaster1,
1159 raster2ULRowOverRaster1
1167 assert( firstOutputRasterCol >= 0 );
1168 assert( firstOutputRasterCol <=
1170 assert( lastOutputRasterRow >= 0 );
1171 assert( lastOutputRasterRow <=
1173 assert( lastOutputRasterCol >= 0 );
1174 assert( lastOutputRasterCol <=
1176 assert( firstOutputRasterRow >= 0 );
1177 assert( firstOutputRasterRow <=
1183 std::vector< RasterBlockInfo > raster1BlocksInfos;
1184 bool allRaster1BandsWithSameBlocking =
true;
1190 for(
unsigned int raster1BandsIdx = 0 ; raster1BandsIdx <
1206 allRaster1BandsWithSameBlocking =
false;
1211 unsigned int firstBlockX = firstOutputRasterCol /
1213 unsigned int lastBlockX = lastOutputRasterCol /
1215 unsigned int firstBlockY = firstOutputRasterRow /
1217 unsigned int lastBlockY = lastOutputRasterRow /
1220 for(
unsigned int blkY = firstBlockY ; blkY <= lastBlockY ; ++blkY )
1222 for(
unsigned int blkX = firstBlockX ; blkX <= lastBlockX ; ++blkX )
1263 bool returnValue =
true;
1271 const double maxVMem2Use = 0.75 *
MIN( totalPhysMem, ( totalVMem - usedVMem ) );
1275 bool abortValue =
false;
1279 boost::mutex blockProcessedSignalMutex;
1280 boost::condition_variable blockProcessedSignal;
1281 unsigned int runningThreadsCounter = 0;
1305 std::vector< BlendIntoRaster1ThreadParams > allThreadsParams(
m_threadsNumber,
1312 runningThreadsCounter = 1;
1315 allThreadsParams[ 0 ].m_r1ValidDataDelimiterPtr.reset(
1320 allThreadsParams[ 0 ].m_r2ValidDataDelimiterPtr.reset(
1323 allThreadsParams[ 0 ].m_geomTransformationPtr.reset(
1325 allThreadsParams[ 0 ].m_maxRasterCachedBlocks = std::max( 1u,
1326 ((
unsigned int)maxVMem2Use)
1334 boost::thread_group threads;
1342 allThreadsParams[ threadIdx ].m_r1ValidDataDelimiterPtr.reset(
1347 allThreadsParams[ threadIdx ].m_r2ValidDataDelimiterPtr.reset(
1350 allThreadsParams[ threadIdx ].m_geomTransformationPtr.reset(
1353 allThreadsParams[ 0 ].m_maxRasterCachedBlocks = std::max( 1u,
1354 ((
unsigned int)maxVMem2Use)
1362 allThreadsParams[ threadIdx ].m_useProgress =
false;
1365 &( allThreadsParams[ threadIdx ] ) ) );
1370 std::auto_ptr< te::common::TaskProgress > progressPtr;
1374 progressPtr->setTotalSteps( raster1BlocksInfos.size() );
1375 progressPtr->setMessage(
"Blending" );
1377 while( (!abortValue) && (runningThreadsCounter > 0 ) )
1379 if( progressPtr->isActive() )
1381 boost::unique_lock<boost::mutex> lock( blockProcessedSignalMutex );
1382 blockProcessedSignal.timed_wait( lock,
1383 boost::posix_time::seconds( 1 ) );
1385 int processedBlocksNmb = 0;
1386 for(
unsigned int raster1BlocksInfosIdx = 0 ; raster1BlocksInfosIdx <
1387 raster1BlocksInfos.size() ; ++raster1BlocksInfosIdx )
1389 if( raster1BlocksInfos[ raster1BlocksInfosIdx ].m_wasProcessed )
1391 ++processedBlocksNmb;
1395 if( processedBlocksNmb != progressPtr->getCurrentStep() )
1397 progressPtr->pulse();
1429 const std::vector< unsigned int >& raster1Bands =
1431 const unsigned int raster1BandsSize = raster1Bands.size();
1433 std::vector< double > raster1BandsRangeMin( raster1BandsSize, 0 );
1434 std::vector< double > raster1BandsRangeMax( raster1BandsSize, 0 );
1437 for(
unsigned int raster1BandsIdx = 0 ; raster1BandsIdx <
1438 raster1BandsSize ; ++raster1BandsIdx )
1440 unsigned int bandIdx = raster1Bands[ raster1BandsIdx ];
1443 raster1BandsRangeMin[ raster1BandsIdx ],
1444 raster1BandsRangeMax[ raster1BandsIdx ]);
1487 std::auto_ptr< te::common::TaskProgress > progressPtr;
1492 progressPtr->setTotalSteps( raster1BlocksInfosSize );
1493 progressPtr->setMessage(
"Blending" );
1498 boost::scoped_array< double > blendedValuesHandler(
new double[ raster1BandsSize ] );
1499 double* blendedValuesHandlerPtr = blendedValuesHandler.get();
1503 for(
unsigned int raster1BlocksInfosIdx = 0 ; raster1BlocksInfosIdx <
1504 raster1BlocksInfosSize ; ++raster1BlocksInfosIdx )
1515 raster1BlocksInfosIdx );
1521 unsigned int raster1Row = 0;
1522 unsigned int raster1Col = 0;
1523 unsigned int raster1BandsIdx = 0;
1532 blendedValuesHandlerPtr );
1534 for( raster1BandsIdx = 0 ; raster1BandsIdx < raster1BandsSize ; ++raster1BandsIdx )
1536 double& blendedValue = blendedValuesHandlerPtr[ raster1BandsIdx ];
1538 if( blendedValue != noDataValue )
1540 blendedValue = std::max( blendedValue ,
1541 raster1BandsRangeMin[ raster1BandsIdx ] );
1542 blendedValue = std::min( blendedValue ,
1543 raster1BandsRangeMax[ raster1BandsIdx ] );
1545 raster1.
setValue( raster1Col, raster1Row, blendedValue,
1546 raster1Bands[ raster1BandsIdx ] );
1556 if( progressPtr->isActive() )
1558 progressPtr->pulse();
1574 boost::lock_guard<boost::mutex> blockProcessedSignalLockGuard(
1595 std::vector< std::pair< te::gm::Coord2D, te::gm::Coord2D > >& segments )
const
1597 if( dynamic_cast< te::gm::LineString const * >( geometryPtr ) )
1602 std::size_t nPoints = castGeomPtr->
size();
1605 for( std::size_t pIdx = 1 ; pIdx < nPoints ; ++pIdx )
1607 segments.push_back( std::pair< te::gm::Coord2D, te::gm::Coord2D >(
1608 coodsPtr[ pIdx - 1 ], coodsPtr[ pIdx ] ) );
1611 else if( dynamic_cast< te::gm::CurvePolygon const * >( geometryPtr ) )
1616 std::size_t numGeoms = castGeomPtr->
getNumRings();
1618 for( std::size_t gIdx = 0 ; gIdx < numGeoms ; ++gIdx )
1626 else if( dynamic_cast< te::gm::GeometryCollection const * >( geometryPtr ) )
1633 for( std::size_t gIdx = 0 ; gIdx < numGeoms ; ++gIdx )
1646 boost::ptr_vector< te::rst::TileIndexer >& tileIndexers )
const
1648 if( dynamic_cast< te::gm::Polygon const * >( geometryPtr ) )
1655 else if( dynamic_cast< te::gm::GeometryCollection const * >( geometryPtr ) )
1662 for( std::size_t gIdx = 0 ; gIdx < numGeoms ; ++gIdx )
double m_euclideanDistanceMethodImp_aux1
te::rst::Interpolator::Method m_interpMethod1
The interpolation method to use when reading raster 1 data.
std::vector< std::pair< te::gm::Coord2D, te::gm::Coord2D > > m_r2IntersectionSegmentsPoints
A sub-set of the intersection polygon wich is part of raster 2 valid data polygon ( raster 1 indexed ...
std::size_t getNumRings() const
It returns the number of rings in this CurvePolygon.
void initState()
Reset the instance to its initial default state.
std::size_t getNumGeometries() const
It returns the number of geometries in this GeometryCollection.
virtual void setValue(unsigned int c, unsigned int r, const double value, std::size_t b=0)
Sets the attribute value in a band of a cell.
void add(Curve *ring)
It adds the ring to the curve polygon.
void push_back(Curve *ring)
It adds the curve to the curve polygon.
MultiPolygon is a MultiSurface whose elements are Polygons.
Near neighborhood interpolation method.
static void blendIntoRaster1Thread(BlendIntoRaster1ThreadParams *paramsPtr)
Thread entry for the method blendIntoRaster1.
Polygon tile indexing class for optmized geometrical relational tests.
An adapter class to allow concurrent access to raster data by multiple threads.
unsigned long int m_maxRasterCachedBlocks
The maximum number of raster cache blocks.
TERASTEREXPORT void GetDataTypeRanges(const int &dataType, double &min, double &max)
Return the values range of a given data type.
bool * m_abortValuePtr
A pointer to the abort execution value.
std::vector< unsigned int > m_raster2Bands
Input raster 2 band indexes to use.
double m_euclideanDistanceMethodImp_Point2Col
std::vector< RasterBlockInfo > * m_raster1BlocksInfosPtr
blocks to process.
The parameters passed to blendIntoRaster1Thread method.
bool m_useProgress
If enabled each thread will use its own progress interface, if false only a signal will be emitted on...
boost::condition_variable * m_blockProcessedSignalPtr
Signal used to update the main process progress update.
Coord2D * getCoordinates() const
It returns a pointer to the internal array of coordinates.
double m_euclideanDistanceMethodImp_currDist
std::vector< double > m_pixelScales1
The values scale to be applied to raster 1 pixel values before the blended value calcule (one element...
Blended pixel value calculation for two overlaped rasters.
double m_sumMethodImp_Point2Col
std::auto_ptr< te::gm::MultiPolygon > m_r2ValidDataDelimiterPtr
A pointer to a geometry (raster 2 world/projected coords) delimiting the raster region with valid dat...
std::vector< double > m_pixelOffsets1
The values offset to be applied to raster 1 pixel values before the blended value calcule (one elemen...
std::vector< double > m_pixelScales2
The values scale to be applied to raster 2 pixel values before the blended value calcule (one element...
unsigned int getNumberOfColumns() const
Returns the raster number of columns.
int m_nblocksx
The number of blocks in x.
virtual const Band * getBand(std::size_t i) const =0
Returns the raster i-th band.
double m_sumMethodImp_Point2Line
std::complex< double > m_sumMethodImp_cValue2
te::rst::Raster const * m_raster2Ptr
Input raster 2.
double m_outputNoDataValue
The output raster no-data value.
It interpolates one pixel based on a selected algorithm. Methods currently available are Nearest Neig...
int m_nblocksy
The number of blocks in y.
Blended pixel value calculation for two overlaped rasters.
boost::mutex * m_mutexPtr
mutex pointer.
std::vector< double > m_raster2NoDataValues
Raster 2 no-data values (on value per band).
This class can be used to inform the progress of a task.
#define MIN(a, b)
Macro that returns min between two values.
std::auto_ptr< te::gm::Geometry > m_intersectionPtr
The Intersection geometry ( raster 1 indexed coods).
std::vector< unsigned int > m_raster2Bands
Input raster 2 band indexes to use (this vector has the same size as raster1Bands).
bool * m_returnValuePtr
A pointer to the threadreturn value.
void clear()
Clear all internal allocated resources.
unsigned int * m_runningThreadsCounterPtr
a pointer to the running threads counter.
An utility struct for representing 2D coordinates.
An access synchronizer to be used in SynchronizedRaster raster instances.
te::rst::RasterSynchronizer * m_sync2Ptr
Raster 1 syncronizer pointer.
int m_type
The data type of the elements in the band.
double m_noDataValue
Value to indicate elements where there is no data, default is std::numeric_limits::max().
std::size_t m_r1IntersectionSegmentsPointsSize
Size of m_r1IntersectionSegmentsPoints;.
std::complex< double > m_sumMethodImp_cValue1
InterpolationMethod
Allowed interpolation methods.
double m_euclideanDistanceMethodImp_dist2
std::complex< double > m_noBlendMethodImp_cValue
~BlendIntoRaster1ThreadParams()
double m_euclideanDistanceMethodImp_dist1
bool m_sumMethodImp_PointInsideIntersection
const te::rst::Band * getBand(std::size_t i) const
Returns the raster i-th band.
void geoToGrid(const double &x, const double &y, double &col, double &row) const
Get the grid point associated to a spatial location.
bool m_enableProgressInterface
Enable progress interface.
bool blendIntoRaster1()
Execute blending of the given input rasters and write the result into raster1.
BlendIntoRaster1ThreadParams & operator=(const BlendIntoRaster1ThreadParams &rhs)
void setBlendFunctionPonter(const BlendMethod blendMethod)
Set the value of m_blendFuncPtr following the given blend method.
#define TERP_TRUE_OR_RETURN_FALSE(value, message)
Checks if value is true. For false values a warning message will be logged and a return of context wi...
bool m_forceRaster1NoDataValue
Use noDataValue as the input raster 1 no-data value (The original rasters no-data values will be igno...
te::common::AccessPolicy getAccessPolicy() const
Returns the raster access policy.
std::auto_ptr< te::rst::Interpolator > m_interp2Ptr
Raster 2 interpolator instance pointer.
A LinearRing is a LineString that is both closed and simple.
TECOMMONEXPORT unsigned int GetPhysProcNumber()
Returns the number of physical processors.
double m_euclideanDistanceMethodImp_aux2
std::auto_ptr< te::gm::MultiPolygon > m_r1ValidDataDelimiterPtr
A pointer to a geometry (raster 1 world/projected coords) delimiting the raster region with valid dat...
std::vector< double > m_pixelOffsets1
The values offset to be applied to raster 1 pixel values before the blended value calcule (one elemen...
LineString is a curve with linear interpolation between points.
void setPoint(std::size_t i, const double &x, const double &y)
It sets the value of the specified point.
TECOMMONEXPORT unsigned long int GetUsedVirtualMemory()
Returns the amount of used virtual memory (bytes) for the current process (physical + swapped)...
An abstract class for raster data strucutures.
std::size_t m_r2IntersectionSegmentsPointsSize
Size of m_r2IntersectionSegmentsPoints;.
te::rst::Raster * m_raster1Ptr
Input raster 1.
unsigned int getNumberOfRows() const
Returns the raster number of rows.
#define TERP_LOG_AND_THROW(message)
Logs a error message and throws.
Pixels will be summed inside the raster overlapped area.
unsigned int m_sumMethodImp_IntersectionTileIndexersIdx
void euclideanDistanceMethodImp(const double &line1, const double &col1, double *const values)
Implementation for EuclideanDistanceMethod.
BandProperty * getProperty()
Returns the band property.
boost::ptr_vector< te::rst::TileIndexer > m_intersectionTileIndexers
The Intersection geometry tile indexers( raster 1 indexed coods), one indexer for each intersection p...
std::vector< double > m_pixelOffsets2
The values offset to be applied to raster 2 pixel values before the blended value calcule (one elemen...
int m_blkw
Block width (pixels).
virtual std::size_t getNumberOfBands() const =0
Returns the number of bands (dimension of cells attribute values) in the raster.
std::vector< double > m_raster1NoDataValues
Raster 1 no-data values (on value per band).
unsigned int m_rasterCols2ProcessBound
te::rst::RasterSynchronizer * m_sync1Ptr
Raster 1 syncronizer pointer.
void sumMethodImp(const double &line1, const double &col1, double *const values)
Implementation for SumMethod.
std::vector< double > m_pixelScales1
The values scale to be applied to raster 1 pixel values before the blended value calcule (one element...
bool m_forceRaster2NoDataValue
Use noDataValue as the input raster 2 no-data value (The original rasters no-data values will be igno...
std::size_t getNPoints() const
It returns the number of points (vertexes) in the linestring.
CurvePolygon is a planar surface defined by 1 exterior boundary and 0 or more interior boundaries...
void getBlendedValues(const double &line, const double &col, double *const values)
Blend a pixel value using the current parameters.
A raster band description.
double m_noBlendMethodImp_Point2Col
BlendFunctPtr m_blendFuncPtr
The current blend function.
BlendIntoRaster1ThreadParams()
Grid * getGrid()
It returns the raster grid.
std::vector< unsigned int > m_raster1Bands
Input raster 1 band indexes to use.
std::size_t m_euclideanDistanceMethodImp_vecIdx
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
bool initialize(te::rst::Raster &raster1, const std::vector< unsigned int > &raster1Bands, const te::rst::Raster &raster2, const std::vector< unsigned int > &raster2Bands, const BlendMethod &blendMethod, const te::rst::Interpolator::Method &interpMethod1, const te::rst::Interpolator::Method &interpMethod2, const double &noDataValue, const bool forceRaster1NoDataValue, const bool forceRaster2NoDataValue, const std::vector< double > &pixelOffsets1, const std::vector< double > &pixelScales1, const std::vector< double > &pixelOffsets2, const std::vector< double > &pixelScales2, te::gm::MultiPolygon const *const r1ValidDataDelimiterPtr, te::gm::MultiPolygon const *const r2ValidDataDelimiterPtr, const te::gm::GeometricTransformation &geomTransformation, const unsigned int threadsNumber, const bool enableProgressInterface)
Inititate the blender instance.
unsigned int m_blkTotalPixelsNumber
bool m_euclideanDistanceMethodImp_PointInsideIntersection
Geometry * getGeometryN(std::size_t i) const
It returns the n-th geometry in this GeometryCollection.
bool getSegments(te::gm::Geometry const *const geometryPtr, std::vector< std::pair< te::gm::Coord2D, te::gm::Coord2D > > &segments) const
Extract segments from the given geometry.
bool getTileIndexers(te::gm::Geometry const *const geometryPtr, boost::ptr_vector< te::rst::TileIndexer > &tileIndexers) const
Creater polygon tile indexers from the given geometry.
std::auto_ptr< te::gm::MultiPolygon > m_r1ValidDataDelimiterPtr
A pointer to a geometry (raster 1 world/projected coords) delimiting the raster region with valid dat...
unsigned int m_euclideanDistanceMethodImp_BandIdx
te::dt::AbstractData * clone() const
It clones the multi polygon.
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
bool m_forceRaster1NoDataValue
Use noDataValue as the input rasters no-data value (The original rasters no-data values will be ignor...
#define getPerpendicularDistance(pX, pY, lineAX, lineAY, lineBX, lineBY, aux1, aux2, perpDist)
void setX(const double &x)
It sets the Point x-coordinate value.
double m_noDataValue
The value returned where there is no pixel data bo blend.
unsigned int m_noBlendMethodImp_BandIdx
te::gm::Point m_sumMethodImp_auxPoint
te::gm::GeometricTransformation * m_geomTransformationPtr
A transformation mapping raster 1 pixels ( te::gm::GTParameters::TiePoint::first ) to raster 2 ( te::...
unsigned int m_rasterRows2ProcessBound
Euclidean distance method.
te::rst::Interpolator::Method m_interpMethod2
The interpolation method to use when reading raster 2 data.
std::auto_ptr< te::rst::Interpolator > m_interp1Ptr
Raster 1 interpolator instance pointer.
double m_noBlendMethodImp_Point2Line
boost::mutex * m_blockProcessedSignalMutexPtr
Mutex used to update the main process progress update.
bool m_forceRaster2NoDataValue
Use noDataValue as the input rasters no-data value (The original rasters no-data values will be ignor...
double m_noBlendMethodImp_Value
BlendMethod m_blendMethod
The blend method to apply.
unsigned int m_sumMethodImp_BandIdx
std::vector< double > m_pixelOffsets2
The values offset to be applied to raster 2 pixel values before the blended value calcule (one elemen...
TECOMMONEXPORT unsigned long int GetTotalPhysicalMemory()
Returns the amount of total physical memory (bytes).
std::auto_ptr< te::gm::MultiPolygon > m_r2ValidDataDelimiterPtr
A pointer to a geometry (raster 2 world/projected coords) delimiting the raster region with valid dat...
unsigned int m_threadsNumber
The number of threads to use (0:automatic , 1:disabled, any other integer dictates the number of thre...
void setY(const double &y)
It sets the Point y-coordinate value.
int m_blkh
Block height (pixels).
unsigned int m_firstRasterRow2Process
std::complex< double > m_euclideanDistanceMethodImp_cValue1
unsigned int m_euclideanDistanceMethodImp_IntersectionTileIndexersIdx
double m_euclideanDistanceMethodImp_Point2Line
#define TERP_DEBUG_TRUE_OR_THROW(value, message)
Checks if value is true and throws an exception if not.
It is a collection of other geometric objects.
A rectified grid is the spatial support for raster data.
BlendMethod m_blendMethod
The blend method to apply.
std::vector< unsigned int > m_raster1Bands
Input raster 1 band indexes to use.
void noBlendMethodImp(const double &line1, const double &col1, double *const values)
Implementation for NoBlendMethod.
std::auto_ptr< te::gm::GeometricTransformation > m_geomTransformationPtr
A transformation mapping raster 1 pixels ( te::gm::GTParameters::TiePoint::first ) to raster 2 pixels...
virtual int getBlockSize() const
It returns the number of bytes ocuppied by a data block.
te::gm::Point m_euclideanDistanceMethodImp_auxPoint
#define TERP_TRUE_OR_THROW(value, message)
Checks if value is true and throws an exception if not.
std::complex< double > m_euclideanDistanceMethodImp_cValue2
std::vector< double > m_pixelScales2
The values scale to be applied to raster 2 pixel values before the blended value calcule (one element...
Curve * getRingN(std::size_t i) const
It returns the n-th ring for this curve polygon as a curve.
te::rst::Interpolator::Method m_interpMethod2
The interpolation method to use when reading raster 2 data.
std::size_t size() const
It returns the number of points (vertexes) in the geometry.
std::vector< std::pair< te::gm::Coord2D, te::gm::Coord2D > > m_r1IntersectionSegmentsPoints
A sub-set of the intersection polygon wich is part of raster 1 valid data polygon ( raster 1 indexed ...
TECOMMONEXPORT unsigned long int GetTotalVirtualMemory()
Returns the amount of total virtual memory (bytes) that can be claimed by the current process (physic...
unsigned int m_firstRasterCol2Process