28 #include "../geometry/LinearRing.h"
29 #include "../geometry/MultiPoint.h"
30 #include "../geometry/MultiLineString.h"
31 #include "../geometry/Point.h"
32 #include "../geometry/Envelope.h"
33 #include "../geometry/Enums.h"
34 #include "../raster/Raster.h"
35 #include "../raster/Grid.h"
36 #include "../raster/Band.h"
37 #include "../raster/BandProperty.h"
38 #include "../raster/Utils.h"
39 #include "../raster/SynchronizedRaster.h"
40 #include "../common/PlatformUtils.h"
41 #include "../common/progress/TaskProgress.h"
43 #include <boost/thread.hpp>
44 #include <boost/graph/graph_concepts.hpp>
45 #include <boost/scoped_ptr.hpp>
55 #define getPerpendicularDistance( pX, pY, lineAX, lineAY, lineBX, lineBY, aux1, aux2, perpDist ) \
56 aux1 = lineAX - lineBX; \
57 aux2 = lineAY - lineBY; \
60 perpDist = std::abs( pX - lineAX ); \
62 else if( aux2 == 0.0 ) \
64 perpDist = std::abs( pY - lineAY ); \
70 ( aux2 * pX ) - ( aux1 * pY ) + ( lineAX * lineBY ) - ( lineBX * lineAY ) \
73 std::sqrt( ( aux1 * aux1 ) + ( aux2 * aux2 ) ); \
81 : m_returnValuePtr( 0 ), m_abortValuePtr( 0 ), m_sync1Ptr( 0 ), m_sync2Ptr( 0 ),
82 m_raster1BlocksInfosPtr( 0 ), m_mutexPtr( 0 ), m_blockProcessedSignalMutexPtr( 0 ),
83 m_blockProcessedSignalPtr( 0 ), m_runningThreadsCounterPtr( 0 ),
84 m_blendMethod( te::rp::
Blender::InvalidBlendMethod ),
85 m_interpMethod1( te::rst::Interpolator::NearestNeighbor ),
86 m_interpMethod2( te::rst::Interpolator::NearestNeighbor ),
87 m_noDataValue( 0.0 ), m_forceInputNoDataValue( false ),
88 m_maxRasterCachedBlocks( 0 ), m_useProgress( false )
170 const std::vector< unsigned int >& raster1Bands,
172 const std::vector< unsigned int >& raster2Bands,
176 const double& noDataValue,
177 const bool forceInputNoDataValue,
178 const std::vector< double >& pixelOffsets1,
179 const std::vector< double >& pixelScales1,
180 const std::vector< double >& pixelOffsets2,
181 const std::vector< double >& pixelScales2,
185 const unsigned int threadsNumber,
186 const bool enableProgressInterface )
190 "Invalid raster 1" );
193 "Invalid raster 2" );
195 "Invalid raster bands vector" );
197 raster2Bands.size(),
"Invalid raster bands vector" );
199 raster1Bands.size(),
"Invalid pixel offsets" );
201 raster1Bands.size(),
"Invalid pixel scales" );
203 raster2Bands.size(),
"Invalid pixel offsets" );
205 raster2Bands.size(),
"Invalid pixel scales" );
208 "Invalid polygon 1" )
211 "Invalid polygon 2" )
213 "Invalid transformation" );
224 if( r1ValidDataDelimiterPtr )
228 if( r2ValidDataDelimiterPtr )
234 std::auto_ptr< te::gm::MultiPolygon > indexedDelimiter1Ptr(
237 if( r1ValidDataDelimiterPtr )
243 for( std::size_t geomIdx = 0 ; geomIdx < nGeoms ; ++geomIdx )
253 for( std::size_t ringIdx = 0 ; ringIdx < nRings ; ++ringIdx )
259 const std::size_t nPoints = inRingPtr->
getNPoints();
266 for( std::size_t pIdx = 0 ; pIdx < nPoints ; ++pIdx )
268 grid.
geoToGrid( inCoordsPtr[ pIdx ].x, inCoordsPtr[ pIdx ].y,
269 auxCoord.
x, auxCoord.
y );
270 outRingPtr->
setPoint( pIdx, auxCoord.
x, auxCoord.
y );
273 outPolPtr->
add( outRingPtr );
277 indexedDelimiter1Ptr->add( outPolPtr );
303 outPolPtr->
add( outRingPtr );
305 indexedDelimiter1Ptr->add( outPolPtr );
309 std::auto_ptr< te::gm::MultiPolygon > indexedDelimiter2Ptr(
312 if( r2ValidDataDelimiterPtr )
318 for( std::size_t geomIdx = 0 ; geomIdx < nGeoms ; ++geomIdx )
328 for( std::size_t ringIdx = 0 ; ringIdx < nRings ; ++ringIdx )
334 const std::size_t nPoints = inRingPtr->
getNPoints();
342 for( std::size_t pIdx = 0 ; pIdx < nPoints ; ++pIdx )
344 grid.
geoToGrid( inCoordsPtr[ pIdx ].x, inCoordsPtr[ pIdx ].y,
345 auxCoord.
x, auxCoord.
y );
346 geomTransformation.
inverseMap( auxCoord.
x, auxCoord.
y, auxCoord2.
x, auxCoord2.
y );
347 outRingPtr->
setPoint( pIdx, auxCoord2.
x, auxCoord2.
y );
350 outPolPtr->
add( outRingPtr );
353 indexedDelimiter2Ptr->add( outPolPtr );
366 auxCoord.
x, auxCoord.
y );
367 outRingPtr->
setPoint( 0, auxCoord.
x, auxCoord.
y );
368 outRingPtr->
setPoint( 4, auxCoord.
x, auxCoord.
y );
373 auxCoord.
x, auxCoord.
y );
374 outRingPtr->
setPoint( 1, auxCoord.
x, auxCoord.
y );
379 auxCoord.
x, auxCoord.
y );
380 outRingPtr->
setPoint( 2, auxCoord.
x, auxCoord.
y );
385 auxCoord.
x, auxCoord.
y );
386 outRingPtr->
setPoint( 3, auxCoord.
x, auxCoord.
y );
390 outPolPtr->
add( outRingPtr );
392 indexedDelimiter2Ptr->add( outPolPtr );
398 std::auto_ptr< te::gm::Geometry > geomIntersectionPtr(
399 indexedDelimiter2Ptr->intersection( indexedDelimiter1Ptr.get() ) );
401 if( geomIntersectionPtr.get() )
405 std::auto_ptr< te::gm::MultiPolygon > multiPolIntersectionPtr(
407 multiPolIntersectionPtr->add( geomIntersectionPtr.release() );
422 std::size_t ringIdx = 0;
423 std::auto_ptr< te::gm::Geometry > ringIntersectionPtr;
424 std::size_t nPols = indexedDelimiter2Ptr->getNumGeometries();
426 for( std::size_t polIdx = 0 ; polIdx < nPols ; ++polIdx )
429 indexedDelimiter2Ptr->getGeometryN( polIdx ) );
432 for( ringIdx = 0 ; ringIdx < polPtr->
getNumRings() ;
435 ringIntersectionPtr.reset( indexedDelimiter1Ptr->intersection(
438 if( ringIntersectionPtr.get() != 0 )
443 ringIntersectionPtr.get() );
444 assert( ringIntersectionNPtr );
448 for( std::size_t gIdx = 0 ; gIdx < numGeoms ; ++gIdx )
452 assert( segIndexedNPtr );
454 std::size_t nPoints = segIndexedNPtr->
size();
457 for( std::size_t pIdx = 1 ; pIdx < nPoints ; ++pIdx )
460 coodsPtr[ pIdx - 1 ], coodsPtr[ pIdx ] ) );
467 ringIntersectionPtr.get() );
468 assert( segIndexedNPtr );
470 std::size_t nPoints = segIndexedNPtr->
size();
473 for( std::size_t pIdx = 1 ; pIdx < nPoints ; ++pIdx )
476 coodsPtr[ pIdx - 1 ], coodsPtr[ pIdx ] ) );
483 nPols = indexedDelimiter1Ptr->getNumGeometries();
485 for( std::size_t polIdx = 0 ; polIdx < nPols ; ++polIdx )
488 indexedDelimiter1Ptr->getGeometryN( polIdx ) );
491 for( ringIdx = 0 ; ringIdx < polPtr->
getNumRings() ;
494 ringIntersectionPtr.reset( indexedDelimiter2Ptr->intersection(
497 if( ringIntersectionPtr.get() != 0 )
502 ringIntersectionPtr.get() );
503 assert( ringIntersectionNPtr );
507 for( std::size_t gIdx = 0 ; gIdx < numGeoms ; ++gIdx )
511 assert( segIndexedNPtr );
513 std::size_t nPoints = segIndexedNPtr->
size();
516 for( std::size_t pIdx = 1 ; pIdx < nPoints ; ++pIdx )
519 coodsPtr[ pIdx - 1 ], coodsPtr[ pIdx ] ) );
526 ringIntersectionPtr.get() );
527 assert( segIndexedNPtr );
529 std::size_t nPoints = segIndexedNPtr->
size();
532 for( std::size_t pIdx = 1 ; pIdx < nPoints ; ++pIdx )
535 coodsPtr[ pIdx - 1 ], coodsPtr[ pIdx ] ) );
567 switch( blendMethod )
613 for( std::vector< unsigned int >::size_type rasterBandsIdx = 0 ;
614 rasterBandsIdx < raster1Bands.size() ; ++rasterBandsIdx )
622 if( forceInputNoDataValue )
653 if( threadsNumber == 0 )
712 switch( blendMethod )
733 double*
const values )
777 double*
const values )
949 unsigned int firstOutputRasterCol = 0;
950 unsigned int lastOutputRasterRow = 0;
951 unsigned int lastOutputRasterCol = 0;
952 unsigned int firstOutputRasterRow = 0;
955 const double raster2LastRowIdx =
957 const double raster2LastColIdx =
959 double raster2LLColOverRaster1 = 0;
960 double raster2LLRowOverRaster1 = 0;
961 double raster2LRColOverRaster1 = 0;
962 double raster2LRRowOverRaster1 = 0;
963 double raster2URColOverRaster1 = 0;
964 double raster2URRowOverRaster1 = 0;
965 double raster2ULColOverRaster1 = 0;
966 double raster2ULRowOverRaster1 = 0;
971 raster2LLColOverRaster1,
972 raster2LLRowOverRaster1);
976 raster2LRColOverRaster1,
977 raster2LRRowOverRaster1);
981 raster2URColOverRaster1,
982 raster2URRowOverRaster1);
986 raster2ULColOverRaster1,
987 raster2ULRowOverRaster1);
989 firstOutputRasterCol = (
unsigned int)
993 std::min( raster2LLColOverRaster1,
994 std::min( raster2LRColOverRaster1,
995 std::min( raster2URColOverRaster1,
996 raster2ULColOverRaster1
1004 lastOutputRasterRow = (
unsigned int)
1008 std::max( raster2LLRowOverRaster1,
1009 std::max( raster2LRRowOverRaster1,
1010 std::max( raster2URRowOverRaster1,
1011 raster2ULRowOverRaster1
1019 lastOutputRasterCol = (
unsigned int)
1023 std::max( raster2LLColOverRaster1,
1024 std::max( raster2LRColOverRaster1,
1025 std::max( raster2URColOverRaster1,
1026 raster2ULColOverRaster1
1034 firstOutputRasterRow = (
unsigned int)
1038 std::min( raster2LLRowOverRaster1,
1039 std::min( raster2LRRowOverRaster1,
1040 std::min( raster2URRowOverRaster1,
1041 raster2ULRowOverRaster1
1049 assert( firstOutputRasterCol >= 0 );
1050 assert( firstOutputRasterCol <=
1052 assert( lastOutputRasterRow >= 0 );
1053 assert( lastOutputRasterRow <=
1055 assert( lastOutputRasterCol >= 0 );
1056 assert( lastOutputRasterCol <=
1058 assert( firstOutputRasterRow >= 0 );
1059 assert( firstOutputRasterRow <=
1065 std::vector< RasterBlockInfo > raster1BlocksInfos;
1066 bool allRaster1BandsWithSameBlocking =
true;
1072 for(
unsigned int raster1BandsIdx = 0 ; raster1BandsIdx <
1088 allRaster1BandsWithSameBlocking =
false;
1093 unsigned int firstBlockX = firstOutputRasterCol /
1095 unsigned int lastBlockX = lastOutputRasterCol /
1097 unsigned int firstBlockY = firstOutputRasterRow /
1099 unsigned int lastBlockY = lastOutputRasterRow /
1102 for(
unsigned int blkY = firstBlockY ; blkY <= lastBlockY ; ++blkY )
1104 for(
unsigned int blkX = firstBlockX ; blkX <= lastBlockX ; ++blkX )
1145 bool returnValue =
true;
1153 const double maxVMem2Use = 0.75 *
MIN( totalPhysMem, ( totalVMem - usedVMem ) );
1157 bool abortValue =
false;
1161 boost::mutex blockProcessedSignalMutex;
1162 boost::condition_variable blockProcessedSignal;
1163 unsigned int runningThreadsCounter = 0;
1187 std::vector< BlendIntoRaster1ThreadParams > allThreadsParams(
m_threadsNumber,
1194 runningThreadsCounter = 1;
1197 allThreadsParams[ 0 ].m_r1ValidDataDelimiterPtr.reset(
1202 allThreadsParams[ 0 ].m_r2ValidDataDelimiterPtr.reset(
1205 allThreadsParams[ 0 ].m_geomTransformationPtr.reset(
1207 allThreadsParams[ 0 ].m_maxRasterCachedBlocks = ((
unsigned int)maxVMem2Use)
1215 boost::thread_group threads;
1223 allThreadsParams[ threadIdx ].m_r1ValidDataDelimiterPtr.reset(
1228 allThreadsParams[ threadIdx ].m_r2ValidDataDelimiterPtr.reset(
1231 allThreadsParams[ threadIdx ].m_geomTransformationPtr.reset(
1234 allThreadsParams[ 0 ].m_maxRasterCachedBlocks =
1235 ((
unsigned int)maxVMem2Use)
1243 allThreadsParams[ threadIdx ].m_useProgress =
false;
1246 &( allThreadsParams[ threadIdx ] ) ) );
1251 std::auto_ptr< te::common::TaskProgress > progressPtr;
1255 progressPtr->setTotalSteps( raster1BlocksInfos.size() );
1256 progressPtr->setMessage(
"Blending" );
1258 while( (!abortValue) && (runningThreadsCounter > 0 ) )
1260 if( progressPtr->isActive() )
1262 boost::unique_lock<boost::mutex> lock( blockProcessedSignalMutex );
1263 blockProcessedSignal.timed_wait( lock,
1264 boost::posix_time::seconds( 1 ) );
1266 int processedBlocksNmb = 0;
1267 for(
unsigned int raster1BlocksInfosIdx = 0 ; raster1BlocksInfosIdx <
1268 raster1BlocksInfos.size() ; ++raster1BlocksInfosIdx )
1270 if( raster1BlocksInfos[ raster1BlocksInfosIdx ].m_wasProcessed )
1272 ++processedBlocksNmb;
1276 if( processedBlocksNmb != progressPtr->getCurrentStep() )
1278 progressPtr->pulse();
1309 const std::vector< unsigned int >& raster1Bands =
1311 const unsigned int raster1BandsSize = raster1Bands.size();
1313 std::vector< double > raster1BandsRangeMin( raster1BandsSize, 0 );
1314 std::vector< double > raster1BandsRangeMax( raster1BandsSize, 0 );
1317 for(
unsigned int raster1BandsIdx = 0 ; raster1BandsIdx <
1318 raster1BandsSize ; ++raster1BandsIdx )
1320 unsigned int bandIdx = raster1Bands[ raster1BandsIdx ];
1323 raster1BandsRangeMin[ raster1BandsIdx ],
1324 raster1BandsRangeMax[ raster1BandsIdx ]);
1366 std::auto_ptr< te::common::TaskProgress > progressPtr;
1371 progressPtr->setTotalSteps( raster1BlocksInfosSize );
1372 progressPtr->setMessage(
"Blending" );
1377 boost::scoped_array< double > blendedValuesHandler(
new double[ raster1BandsSize ] );
1381 boost::scoped_array< double > blendedBandsBlockHandler;
1382 unsigned int blendedBandsBlockPixelsNumber = 0;
1384 for(
unsigned int raster1BlocksInfosIdx = 0 ; raster1BlocksInfosIdx <
1385 raster1BlocksInfosSize ; ++raster1BlocksInfosIdx )
1396 raster1BlocksInfosIdx );
1405 raster1BandsSize ] );
1411 unsigned int raster1Row = 0;
1412 unsigned int raster1Col = 0;
1413 unsigned int raster1BandsIdx = 0;
1414 double* blendedBandsBlockHandlerPointer = blendedBandsBlockHandler.get();
1423 blendedBandsBlockHandlerPointer );
1425 blendedBandsBlockHandlerPointer = blendedBandsBlockHandlerPointer + raster1BandsSize;
1429 blendedBandsBlockHandlerPointer = blendedBandsBlockHandler.get();
1431 for( raster1BandsIdx = 0 ; raster1BandsIdx < raster1BandsSize ; ++raster1BandsIdx )
1433 blendedBandsBlockHandlerPointer = blendedBandsBlockHandler.get() + raster1BandsIdx;
1441 double& blendedValue = *( blendedBandsBlockHandlerPointer );
1443 if( blendedValue != noDataValue )
1445 blendedValue = std::max( blendedValue ,
1446 raster1BandsRangeMin[ raster1BandsIdx ] );
1447 blendedValue = std::min( blendedValue ,
1448 raster1BandsRangeMax[ raster1BandsIdx ] );
1450 raster1.
setValue( raster1Col, raster1Row, blendedValue,
1451 raster1Bands[ raster1BandsIdx ] );
1454 blendedBandsBlockHandlerPointer = blendedBandsBlockHandlerPointer + raster1BandsSize;
1463 if( progressPtr->isActive() )
1465 progressPtr->pulse();
1481 boost::lock_guard<boost::mutex> blockProcessedSignalLockGuard(
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.
MultiPolygon is a MultiSurface whose elements are Polygons.
static void blendIntoRaster1Thread(BlendIntoRaster1ThreadParams *paramsPtr)
Thread entry for the method blendIntoRaster1.
An adapter class to allow concurrent access to raster data by multiple threads.
std::auto_ptr< te::gm::MultiPolygon > m_intersectionPtr
The Intersection geometry ( raster 1 indexed coods).
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_forceInputNoDataValue
Use noDataValue as the input rasters no-data value (The original rasters no-data values will be ignor...
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.
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.
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 1 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.
te::rst::Interpolator::Method m_interpMethod1
The interpolation method to use when reading raster 1 data.
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.
void getValue(const double &c, const double &r, std::complex< double > &v, const std::size_t &b)
Get the interpolated value at specific band.
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;.
double m_euclideanDistanceMethodImp_dist2
std::complex< double > m_noBlendMethodImp_cValue
~BlendIntoRaster1ThreadParams()
double m_euclideanDistanceMethodImp_dist1
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.
bool m_forceInputNoDataValue
Use noDataValue as the input rasters no-data value (The original rasters no-data values will be ignor...
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...
te::common::AccessPolicy getAccessPolicy() const
Returns the raster access policy.
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.
void euclideanDistanceMethodImp(const double &line1, const double &col1, double *const values)
Implementation for EuclideanDistanceMethod.
BandProperty * getProperty()
Returns the band property.
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
unsigned int m_rasterCols2ProcessBound
te::rst::RasterSynchronizer * m_sync1Ptr
Raster 1 syncronizer pointer.
std::vector< double > m_pixelScales1
The values scale to be applied to raster 1 pixel values before the blended value calcule (one element...
std::size_t getNPoints() const
It returns the number of points (vertexes) in the linestring.
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
unsigned int m_blkTotalPixelsNumber
Geometry * getGeometryN(std::size_t i) const
It returns the n-th geometry in this GeometryCollection.
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...
MultiLineString is a MultiCurve whose elements are LineStrings.
Method
Allowed interpolation methods.
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.
#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::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.
double m_noBlendMethodImp_Point2Line
boost::mutex * m_blockProcessedSignalMutexPtr
Mutex used to update the main process progress update.
double m_noBlendMethodImp_Value
BlendMethod m_blendMethod
The blend method to apply.
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
Near neighborhood interpolation method.
std::complex< double > m_euclideanDistanceMethodImp_cValue1
double m_euclideanDistanceMethodImp_Point2Line
#define TERP_DEBUG_TRUE_OR_THROW(value, message)
Checks if value is true and throws an exception if not.
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
te::rst::Interpolator * m_interp2
Raster 2 interpolator instance pointer.
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 forceInputNoDataValue, 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.
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...
te::rst::Interpolator * m_interp1
Raster 1 interpolator instance pointer.
unsigned int m_firstRasterCol2Process
virtual bool within(const Geometry *const rhs) const
It returns true if the geometry object is spatially within rhs geometry.