28 #include "../geometry/LinearRing.h" 29 #include "../geometry/CircularString.h" 30 #include "../geometry/MultiPoint.h" 31 #include "../geometry/MultiLineString.h" 32 #include "../geometry/Point.h" 33 #include "../geometry/Coord2D.h" 34 #include "../geometry/CurvePolygon.h" 35 #include "../geometry/Envelope.h" 36 #include "../geometry/Enums.h" 37 #include "../raster/Raster.h" 38 #include "../raster/Grid.h" 39 #include "../raster/Band.h" 40 #include "../raster/BandProperty.h" 41 #include "../raster/Utils.h" 42 #include "../raster/SynchronizedRaster.h" 43 #include "../common/PlatformUtils.h" 44 #include "../common/MathUtils.h" 45 #include "../common/progress/TaskProgress.h" 47 #include <boost/thread.hpp> 48 #include <boost/graph/graph_concepts.hpp> 49 #include <boost/scoped_ptr.hpp> 59 #define getPerpendicularDistance( pX, pY, lineAX, lineAY, lineBX, lineBY, aux1, aux2, perpDist ) \ 60 aux1 = lineAX - lineBX; \ 61 aux2 = lineAY - lineBY; \ 64 perpDist = std::abs( pX - lineAX ); \ 66 else if( aux2 == 0.0 ) \ 68 perpDist = std::abs( pY - lineAY ); \ 74 ( aux2 * pX ) - ( aux1 * pY ) + ( lineAX * lineBY ) - ( lineBX * lineAY ) \ 77 std::sqrt( ( aux1 * aux1 ) + ( aux2 * aux2 ) ); \ 85 : m_returnValuePtr( nullptr ), m_abortValuePtr( nullptr ), m_sync1Ptr( nullptr ), m_sync2Ptr( nullptr ),
86 m_raster1BlocksInfosPtr( nullptr ), m_mutexPtr( nullptr ), m_blockProcessedSignalMutexPtr( nullptr ),
87 m_blockProcessedSignalPtr( nullptr ), m_runningThreadsCounterPtr( nullptr ),
88 m_blendMethod(
te::rp::
Blender::InvalidBlendMethod ),
90 m_noDataValue( 0.0 ), m_forceRaster1NoDataValue( false ),
91 m_forceRaster2NoDataValue( false ),
92 m_maxRasterCachedBlocks( 0 ), m_useProgress( false )
179 const std::vector< unsigned int >& raster1Bands,
181 const std::vector< unsigned int >& raster2Bands,
185 const double& noDataValue,
186 const bool forceRaster1NoDataValue,
187 const bool forceRaster2NoDataValue,
188 const std::vector< double >& pixelOffsets1,
189 const std::vector< double >& pixelScales1,
190 const std::vector< double >& pixelOffsets2,
191 const std::vector< double >& pixelScales2,
195 const unsigned int threadsNumber,
196 const bool enableProgressInterface )
200 "Invalid raster 1" );
203 "Invalid raster 2" );
205 "Invalid raster bands vector" );
207 raster2Bands.size(),
"Invalid raster bands vector" );
209 raster1Bands.size(),
"Invalid pixel offsets" );
211 raster1Bands.size(),
"Invalid pixel scales" );
213 raster2Bands.size(),
"Invalid pixel offsets" );
215 raster2Bands.size(),
"Invalid pixel scales" );
218 "Invalid geometry 1" )
220 r1ValidDataDelimiterPtr->
isValid() : true ),
221 "Invalid geometry 1" )
224 "Invalid geometry 2" )
226 r2ValidDataDelimiterPtr->
isValid() : true ),
227 "Invalid geometry 2" )
229 "Invalid transformation" );
240 if( r1ValidDataDelimiterPtr )
244 if( r2ValidDataDelimiterPtr )
250 std::unique_ptr< te::gm::MultiPolygon > indexedDelimiter1Ptr(
253 if( r1ValidDataDelimiterPtr )
259 for( std::size_t geomIdx = 0 ; geomIdx < nGeoms ; ++geomIdx )
269 for( std::size_t ringIdx = 0 ; ringIdx < nRings ; ++ringIdx )
275 const std::size_t nPoints = inRingPtr->
getNPoints();
282 for( std::size_t pIdx = 0 ; pIdx < nPoints ; ++pIdx )
284 grid.
geoToGrid( inCoordsPtr[ pIdx ].x, inCoordsPtr[ pIdx ].y,
285 auxCoord.
x, auxCoord.
y );
286 outRingPtr->
setPoint( pIdx, auxCoord.
x, auxCoord.
y );
289 outPolPtr->
add( outRingPtr );
293 indexedDelimiter1Ptr->add( outPolPtr );
319 outPolPtr->
add( outRingPtr );
321 indexedDelimiter1Ptr->add( outPolPtr );
325 "Invalid indexed geometry 1" );
328 std::unique_ptr< te::gm::MultiPolygon > indexedDelimiter2Ptr(
331 if( r2ValidDataDelimiterPtr )
337 for( std::size_t geomIdx = 0 ; geomIdx < nGeoms ; ++geomIdx )
347 for( std::size_t ringIdx = 0 ; ringIdx < nRings ; ++ringIdx )
353 const std::size_t nPoints = inRingPtr->
getNPoints();
361 for( std::size_t pIdx = 0 ; pIdx < nPoints ; ++pIdx )
363 grid.
geoToGrid( inCoordsPtr[ pIdx ].x, inCoordsPtr[ pIdx ].y,
364 auxCoord.
x, auxCoord.
y );
365 geomTransformation.
inverseMap( auxCoord.
x, auxCoord.
y, auxCoord2.
x, auxCoord2.
y );
366 outRingPtr->
setPoint( pIdx, auxCoord2.
x, auxCoord2.
y );
369 outPolPtr->
add( outRingPtr );
372 indexedDelimiter2Ptr->add( outPolPtr );
385 auxCoord.
x, auxCoord.
y );
386 outRingPtr->
setPoint( 0, auxCoord.
x, auxCoord.
y );
387 outRingPtr->
setPoint( 4, auxCoord.
x, auxCoord.
y );
392 auxCoord.
x, auxCoord.
y );
393 outRingPtr->
setPoint( 1, auxCoord.
x, auxCoord.
y );
398 auxCoord.
x, auxCoord.
y );
399 outRingPtr->
setPoint( 2, auxCoord.
x, auxCoord.
y );
404 auxCoord.
x, auxCoord.
y );
405 outRingPtr->
setPoint( 3, auxCoord.
x, auxCoord.
y );
409 outPolPtr->
add( outRingPtr );
411 indexedDelimiter2Ptr->add( outPolPtr );
415 "Invalid indexed geometry 1" );
422 indexedDelimiter1Ptr.get() ) );
424 catch(
const std::exception& e )
427 std::string( e.what() ) );
442 std::size_t ringIdx = 0;
443 std::unique_ptr< te::gm::Geometry > ringIntersectionPtr;
444 std::size_t nPols = 0;
445 std::size_t polIdx = 0;
447 nPols = indexedDelimiter2Ptr->getNumGeometries();
448 for( polIdx = 0 ; polIdx < nPols ; ++polIdx )
451 indexedDelimiter2Ptr->getGeometryN( polIdx ) );
455 for( ringIdx = 0 ; ringIdx < polPtr->
getNumRings() ;
458 ringIntersectionPtr.reset( indexedDelimiter1Ptr->intersection(
461 if( ringIntersectionPtr.get() != nullptr )
469 nPols = indexedDelimiter1Ptr->getNumGeometries();
470 for( polIdx = 0 ; polIdx < nPols ; ++polIdx )
473 indexedDelimiter1Ptr->getGeometryN( polIdx ) );
477 for( ringIdx = 0 ; ringIdx < polPtr->
getNumRings() ;
480 ringIntersectionPtr.reset( indexedDelimiter2Ptr->intersection(
483 if( ringIntersectionPtr.get() != nullptr )
516 switch( blendMethod )
596 if( forceRaster1NoDataValue )
598 std::vector< std::complex<double> > noDataValues1( raster1.
getNumberOfBands(),
599 std::complex<double>( noDataValue, 0.0 ) );
608 if( forceRaster2NoDataValue )
610 std::vector< std::complex<double> > noDataValues2( raster2.
getNumberOfBands(),
611 std::complex<double>( noDataValue, 0.0 ) );
628 for( std::vector< unsigned int >::size_type rasterBandsIdx = 0 ;
629 rasterBandsIdx < raster1Bands.size() ; ++rasterBandsIdx )
636 if( forceRaster1NoDataValue )
646 if( forceRaster2NoDataValue )
674 if( threadsNumber == 0 )
733 switch( blendMethod )
769 double*
const values )
817 double*
const values )
1018 double*
const values )
1128 double*
const values )
1240 double*
const values )
1358 unsigned int firstOutputRasterCol = 0;
1359 unsigned int lastOutputRasterRow = 0;
1360 unsigned int lastOutputRasterCol = 0;
1361 unsigned int firstOutputRasterRow = 0;
1364 const double raster2LastRowIdx =
1366 const double raster2LastColIdx =
1368 double raster2LLColOverRaster1 = 0;
1369 double raster2LLRowOverRaster1 = 0;
1370 double raster2LRColOverRaster1 = 0;
1371 double raster2LRRowOverRaster1 = 0;
1372 double raster2URColOverRaster1 = 0;
1373 double raster2URRowOverRaster1 = 0;
1374 double raster2ULColOverRaster1 = 0;
1375 double raster2ULRowOverRaster1 = 0;
1380 raster2LLColOverRaster1,
1381 raster2LLRowOverRaster1);
1385 raster2LRColOverRaster1,
1386 raster2LRRowOverRaster1);
1390 raster2URColOverRaster1,
1391 raster2URRowOverRaster1);
1395 raster2ULColOverRaster1,
1396 raster2ULRowOverRaster1);
1398 firstOutputRasterCol = (
unsigned int)
1401 te::common::Round< double, long int >(
1402 std::min( raster2LLColOverRaster1,
1403 std::min( raster2LRColOverRaster1,
1404 std::min( raster2URColOverRaster1,
1405 raster2ULColOverRaster1
1413 lastOutputRasterRow = (
unsigned int)
1416 te::common::Round< double, long int >(
1417 std::max( raster2LLRowOverRaster1,
1418 std::max( raster2LRRowOverRaster1,
1419 std::max( raster2URRowOverRaster1,
1420 raster2ULRowOverRaster1
1428 lastOutputRasterCol = (
unsigned int)
1431 te::common::Round< double, long int >(
1432 std::max( raster2LLColOverRaster1,
1433 std::max( raster2LRColOverRaster1,
1434 std::max( raster2URColOverRaster1,
1435 raster2ULColOverRaster1
1443 firstOutputRasterRow = (
unsigned int)
1446 te::common::Round< double, long int >(
1447 std::min( raster2LLRowOverRaster1,
1448 std::min( raster2LRRowOverRaster1,
1449 std::min( raster2URRowOverRaster1,
1450 raster2ULRowOverRaster1
1458 assert( firstOutputRasterCol >= 0 );
1459 assert( firstOutputRasterCol <=
1461 assert( lastOutputRasterRow >= 0 );
1462 assert( lastOutputRasterRow <=
1464 assert( lastOutputRasterCol >= 0 );
1465 assert( lastOutputRasterCol <=
1467 assert( firstOutputRasterRow >= 0 );
1468 assert( firstOutputRasterRow <=
1474 std::vector< RasterBlockInfo > raster1BlocksInfos;
1475 bool allRaster1BandsWithSameBlocking =
true;
1481 for(
unsigned int raster1BandsIdx = 0 ; raster1BandsIdx <
1497 allRaster1BandsWithSameBlocking =
false;
1502 unsigned int firstBlockX = firstOutputRasterCol /
1504 unsigned int lastBlockX = lastOutputRasterCol /
1506 unsigned int firstBlockY = firstOutputRasterRow /
1508 unsigned int lastBlockY = lastOutputRasterRow /
1511 for(
unsigned int blkY = firstBlockY ; blkY <= lastBlockY ; ++blkY )
1513 for(
unsigned int blkX = firstBlockX ; blkX <= lastBlockX ; ++blkX )
1554 bool returnValue =
true;
1562 const double maxVMem2Use = 0.75 *
MIN( totalPhysMem, ( totalVMem - usedVMem ) );
1566 bool abortValue =
false;
1570 boost::mutex blockProcessedSignalMutex;
1571 boost::condition_variable blockProcessedSignal;
1572 unsigned int runningThreadsCounter = 0;
1596 std::vector< BlendIntoRaster1ThreadParams > allThreadsParams(
m_threadsNumber,
1603 runningThreadsCounter = 1;
1606 allThreadsParams[ 0 ].m_r1ValidDataDelimiterPtr.reset(
1611 allThreadsParams[ 0 ].m_r2ValidDataDelimiterPtr.reset(
1614 allThreadsParams[ 0 ].m_geomTransformationPtr.reset(
1616 allThreadsParams[ 0 ].m_maxRasterCachedBlocks = std::max( 1u,
1617 ((
unsigned int)maxVMem2Use)
1625 boost::thread_group threads;
1633 allThreadsParams[ threadIdx ].m_r1ValidDataDelimiterPtr.reset(
1638 allThreadsParams[ threadIdx ].m_r2ValidDataDelimiterPtr.reset(
1641 allThreadsParams[ threadIdx ].m_geomTransformationPtr.reset(
1644 allThreadsParams[ 0 ].m_maxRasterCachedBlocks = std::max( 1u,
1645 ((
unsigned int)maxVMem2Use)
1653 allThreadsParams[ threadIdx ].m_useProgress =
false;
1656 &( allThreadsParams[ threadIdx ] ) ) );
1661 std::unique_ptr< te::common::TaskProgress > progressPtr;
1665 progressPtr->setTotalSteps(static_cast<int>(raster1BlocksInfos.size()));
1666 progressPtr->setMessage(
"Blending" );
1668 while( (!abortValue) && (runningThreadsCounter > 0 ) )
1670 if( progressPtr->isActive() )
1672 boost::unique_lock<boost::mutex> lock( blockProcessedSignalMutex );
1673 blockProcessedSignal.timed_wait( lock,
1674 boost::posix_time::seconds( 1 ) );
1676 int processedBlocksNmb = 0;
1677 for(
unsigned int raster1BlocksInfosIdx = 0 ; raster1BlocksInfosIdx <
1678 raster1BlocksInfos.size() ; ++raster1BlocksInfosIdx )
1680 if( raster1BlocksInfos[ raster1BlocksInfosIdx ].m_wasProcessed )
1682 ++processedBlocksNmb;
1686 if( processedBlocksNmb != progressPtr->getCurrentStep() )
1688 progressPtr->pulse();
1720 const std::vector< unsigned int >& raster1Bands =
1722 const unsigned int raster1BandsSize =
static_cast<unsigned int>(raster1Bands.size());
1724 std::vector< double > raster1BandsRangeMin( raster1BandsSize, 0 );
1725 std::vector< double > raster1BandsRangeMax( raster1BandsSize, 0 );
1728 for(
unsigned int raster1BandsIdx = 0 ; raster1BandsIdx <
1729 raster1BandsSize ; ++raster1BandsIdx )
1731 unsigned int bandIdx = raster1Bands[ raster1BandsIdx ];
1734 raster1BandsRangeMin[ raster1BandsIdx ],
1735 raster1BandsRangeMax[ raster1BandsIdx ]);
1742 const unsigned int raster1BlocksInfosSize =
static_cast<unsigned int>(paramsPtr->
m_raster1BlocksInfosPtr->size());
1778 std::unique_ptr< te::common::TaskProgress > progressPtr;
1783 progressPtr->setTotalSteps( raster1BlocksInfosSize );
1784 progressPtr->setMessage(
"Blending" );
1789 boost::scoped_array< double > blendedValuesHandler(
new double[ raster1BandsSize ] );
1790 double* blendedValuesHandlerPtr = blendedValuesHandler.get();
1794 for(
unsigned int raster1BlocksInfosIdx = 0 ; raster1BlocksInfosIdx <
1795 raster1BlocksInfosSize ; ++raster1BlocksInfosIdx )
1806 raster1BlocksInfosIdx );
1812 unsigned int raster1Row = 0;
1813 unsigned int raster1Col = 0;
1814 unsigned int raster1BandsIdx = 0;
1823 blendedValuesHandlerPtr );
1825 for( raster1BandsIdx = 0 ; raster1BandsIdx < raster1BandsSize ; ++raster1BandsIdx )
1827 double& blendedValue = blendedValuesHandlerPtr[ raster1BandsIdx ];
1829 if( blendedValue != noDataValue )
1831 blendedValue = std::max( blendedValue ,
1832 raster1BandsRangeMin[ raster1BandsIdx ] );
1833 blendedValue = std::min( blendedValue ,
1834 raster1BandsRangeMax[ raster1BandsIdx ] );
1836 raster1.setValue( raster1Col, raster1Row, blendedValue,
1837 raster1Bands[ raster1BandsIdx ] );
1847 if( progressPtr->isActive() )
1849 progressPtr->pulse();
1865 boost::lock_guard<boost::mutex> blockProcessedSignalLockGuard(
1886 std::vector< std::pair< te::gm::Coord2D, te::gm::Coord2D > >& segments )
const 1888 if( dynamic_cast< te::gm::LineString const * >( geometryPtr ) )
1893 std::size_t nPoints = castGeomPtr->
size();
1896 for( std::size_t pIdx = 1 ; pIdx < nPoints ; ++pIdx )
1898 segments.push_back( std::pair< te::gm::Coord2D, te::gm::Coord2D >(
1899 coodsPtr[ pIdx - 1 ], coodsPtr[ pIdx ] ) );
1902 else if( dynamic_cast< te::gm::CircularString const * >( geometryPtr ) )
1907 std::size_t nPoints = castGeomPtr->
size();
1908 const std::vector< te::gm::Coord2D >& coods = castGeomPtr->
getCoordinates();
1910 for( std::size_t pIdx = 1 ; pIdx < nPoints ; ++pIdx )
1912 segments.push_back( std::pair< te::gm::Coord2D, te::gm::Coord2D >(
1913 coods[ pIdx - 1 ], coods[ pIdx ] ) );
1916 else if( dynamic_cast< te::gm::CurvePolygon const * >( geometryPtr ) )
1921 std::size_t numGeoms = castGeomPtr->
getNumRings();
1923 for( std::size_t gIdx = 0 ; gIdx < numGeoms ; ++gIdx )
1928 else if( dynamic_cast< te::gm::GeometryCollection const * >( geometryPtr ) )
1935 for( std::size_t gIdx = 0 ; gIdx < numGeoms ; ++gIdx )
1943 boost::ptr_vector< te::rst::TileIndexer >& tileIndexers )
const 1945 if( dynamic_cast< te::gm::Polygon const * >( geometryPtr ) )
1952 else if( dynamic_cast< te::gm::GeometryCollection const * >( geometryPtr ) )
1959 for( std::size_t gIdx = 0 ; gIdx < numGeoms ; ++gIdx )
std::unique_ptr< te::gm::GeometricTransformation > m_geomTransformationPtr
A transformation mapping raster 1 pixels ( te::gm::GTParameters::TiePoint::first ) to raster 2 pixels...
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.
std::size_t size() const
It returns the number of points (vertexes) in the geometry.
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.
te::gm::Point m_maxMethodImp_auxPoint
Near neighborhood interpolation method.
static void blendIntoRaster1Thread(BlendIntoRaster1ThreadParams *paramsPtr)
Thread entry for the method blendIntoRaster1.
Polygon tile indexing class for optmized geometrical relational tests.
Keep the maximum value of two overlapping pixels.
An adapter class to allow concurrent access to raster data by multiple threads.
TECOMMONEXPORT unsigned long long int GetTotalVirtualMemory()
Returns the amount of total virtual memory (bytes) that can be claimed by the current process (physic...
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
void minMethodImp(const double &line1, const double &col1, double *const values)
Implementation for MinMethod.
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::vector< double > m_pixelOffsets1
The values offset to be applied to raster 1 pixel values before the blended value calcule (one elemen...
unsigned int m_minMethodImp_IntersectionTileIndexersIdx
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.
std::unique_ptr< te::gm::MultiPolygon > m_r2ValidDataDelimiterPtr
A pointer to a geometry (raster 2 world/projected coords) delimiting the raster region with valid dat...
int m_nblocksx
The number of blocks in x.
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.
te::gm::Point m_minMethodImp_auxPoint
It interpolates one pixel based on a selected algorithm. Methods currently available are Nearest Neig...
int m_nblocksy
The number of blocks in y.
std::complex< double > m_minMethodImp_cValue2
std::unique_ptr< te::gm::MultiPolygon > m_r1ValidDataDelimiterPtr
A pointer to a geometry (raster 1 world/projected coords) delimiting the raster region with valid dat...
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.
unsigned int m_maxMethodImp_BandIdx
#define MIN(a, b)
Macro that returns min between two values.
double m_minMethodImp_Point2Line
std::complex< double > m_maxMethodImp_cValue2
std::unique_ptr< te::rst::Interpolator > m_interp1Ptr
Raster 1 interpolator instance pointer.
unsigned int m_maxMethodImp_IntersectionTileIndexersIdx
std::unique_ptr< te::rst::Interpolator > m_interp2Ptr
Raster 2 interpolator instance pointer.
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.
double m_noDataValue
Value to indicate elements where there is no data, default is std::numeric_limits<double>::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
void geoToGrid(const double &x, const double &y, double &col, double &row) const
Get the grid point associated to a spatial location.
double m_maxMethodImp_Point2Line
bool m_enableProgressInterface
Enable progress interface.
bool blendIntoRaster1()
Execute blending of the given input rasters and write the result into raster1.
std::complex< double > m_maxMethodImp_cValue1
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.
A LinearRing is a LineString that is both closed and simple.
unsigned int m_minMethodImp_BandIdx
TECOMMONEXPORT unsigned int GetPhysProcNumber()
Returns the number of physical processors.
double m_euclideanDistanceMethodImp_aux2
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.
virtual bool isValid() const _NOEXCEPT_OP(false)
It tells if the geometry is well formed.
bool m_maxMethodImp_PointInsideIntersection
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.
virtual std::size_t getNumberOfBands() const =0
Returns the number of bands (dimension of cells attribute values) in the raster.
#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
Keep the minimum value of two overlapping pixels.
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).
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.
void maxMethodImp(const double &line1, const double &col1, double *const values)
Implementation for MaxMethod.
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
void 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.
BlendFunctPtr m_blendFuncPtr
The current blend function.
virtual const Band * getBand(std::size_t i) const =0
Returns the raster i-th band.
BlendIntoRaster1ThreadParams()
Grid * getGrid()
It returns the raster grid.
std::unique_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< unsigned int > m_raster1Bands
Input raster 1 band indexes to use.
std::size_t m_euclideanDistanceMethodImp_vecIdx
const std::vector< Coord2D > & getCoordinates() const
It returns a pointer to the internal array of coordinates.
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.
std::complex< double > m_minMethodImp_cValue1
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 getTileIndexers(te::gm::Geometry const *const geometryPtr, boost::ptr_vector< te::rst::TileIndexer > &tileIndexers) const
Creater polygon tile indexers from the given geometry (only if it is a polygon or a collection of pol...
TECOMMONEXPORT unsigned long long int GetTotalPhysicalMemory()
Returns the amount of total physical memory (bytes).
unsigned int m_euclideanDistanceMethodImp_BandIdx
#define TERP_LOG_AND_RETURN_FALSE(message)
Logs a warning message will and return false.
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.
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...
double m_maxMethodImp_Point2Col
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.
TECOMMONEXPORT unsigned long long int GetUsedVirtualMemory()
Returns the amount of used virtual memory (bytes) for the current process (physical + swapped)...
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.
std::unique_ptr< te::gm::Geometry > m_intersectionPtr
The Intersection geometry ( raster 1 indexed coods).
void noBlendMethodImp(const double &line1, const double &col1, double *const values)
Implementation for NoBlendMethod.
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.
bool m_minMethodImp_PointInsideIntersection
std::complex< double > m_euclideanDistanceMethodImp_cValue2
CircularString is a curve with circular interpolation between points.
std::unique_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_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.
double m_minMethodImp_Point2Col
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 ...
unsigned int m_firstRasterCol2Process