A feeder from an input directory name. More...
#include <FeedersRaster.h>
Public Member Functions | |
void | applyGeometryRestriction (const te::gm::Geometry &restrictionGeom) |
Apply a new geometry intersect restriction selecting only those rasters intersecting the given geometry. More... | |
FeederConstRasterDirectory (const std::string &directoryName, const bool recursive, const std::string &rType, const bool sortFileNames, const std::vector< std::string > &fileExtensions) | |
Constructor from an input directory name. More... | |
FeederConstRasterDirectory (const std::string &directoryName, const bool recursive, const std::string &rType, const bool sortFileNames, const std::vector< std::string > &fileExtensions, te::gm::Geometry const *const restrictionGeomPtr, const bool ignoreInvalidRasterFiles) | |
Constructor from an input directory name with a restriction geometry. More... | |
te::rst::Raster const * | getCurrentObj () const |
Return the current sequence object. More... | |
unsigned int | getCurrentOffset () const |
Return the index of the current object. More... | |
const std::string & | getCurrentRasterFileName () |
Returns the current raster file name. More... | |
unsigned int | getObjsCount () const |
Return the total number of feeder objects. More... | |
bool | moveNext () |
Advances to the next sequence obeject. More... | |
bool | moveTo (const unsigned int index) |
Jump to the given object index. More... | |
void | reset () |
Reset the feeder to the first position (subsequent accesses will start from the first sequence obejct). More... | |
~FeederConstRasterDirectory () | |
Protected Member Functions | |
FeederConstRasterDirectory () | |
bool | initialize (const std::string &directoryName, const bool recursive, const std::string &rType, const bool sortFileNames, const std::vector< std::string > &fileExtensions, te::gm::Geometry const *const restrictionGeomPtr, const bool ignoreInvalidRasterFiles) |
Initialize this instance. More... | |
Protected Attributes | |
std::vector< std::string > | m_allRasterFileNames |
std::vector< te::gm::Polygon > | m_allRastersBoundingBoxes |
std::auto_ptr< te::rst::Raster > | m_currentRasterPtr |
bool | m_ignoreInvalidRasterFiles |
If true, invalid raster files will be ignored. More... | |
std::auto_ptr< te::gm::Geometry > | m_restrictionGeomPtr |
std::string | m_rType |
std::vector< unsigned int > ::size_type | m_selectedRasterIndexesOffset |
std::vector< unsigned int > | m_selectedRastersIndexes |
A feeder from an input directory name.
Definition at line 141 of file FeedersRaster.h.
te::rp::FeederConstRasterDirectory::FeederConstRasterDirectory | ( | const std::string & | directoryName, |
const bool | recursive, | ||
const std::string & | rType, | ||
const bool | sortFileNames, | ||
const std::vector< std::string > & | fileExtensions | ||
) |
Constructor from an input directory name.
directoryName | The directory full path name. |
recursive | true if a recursive search must be performed. |
rType | The name of the specific driver to instantiate each raster. |
sortFileNames | If true, the file names will be sorted. |
fileExtensions | The file extensions filter (example: ".tif"), or an empty vector if all extensions must be accepted. |
Definition at line 222 of file FeedersRaster.cpp.
References initialize(), and TERP_TRUE_OR_THROW.
te::rp::FeederConstRasterDirectory::FeederConstRasterDirectory | ( | const std::string & | directoryName, |
const bool | recursive, | ||
const std::string & | rType, | ||
const bool | sortFileNames, | ||
const std::vector< std::string > & | fileExtensions, | ||
te::gm::Geometry const *const | restrictionGeomPtr, | ||
const bool | ignoreInvalidRasterFiles | ||
) |
Constructor from an input directory name with a restriction geometry.
directoryName | The directory full path name. |
recursive | true if a recursive search must be performed. |
rType | The name of the specific driver to instantiate each raster. |
sortFileNames | If true, the file names will be sorted. |
fileExtensions | The file extensions filter (example: ".tif"), or an empty vector if all extensions must be accepted. |
restrictionGeomPtr | A pointer to a restriction geometry (only rasters intercepting this geomtry will be considered) or a null pointer if there is no restriction. |
ignoreInvalidRasterFiles | If true, invalid raster files will be ignored. |
Definition at line 233 of file FeedersRaster.cpp.
References initialize(), and TERP_TRUE_OR_THROW.
te::rp::FeederConstRasterDirectory::~FeederConstRasterDirectory | ( | ) |
Definition at line 252 of file FeedersRaster.cpp.
|
protected |
Definition at line 247 of file FeedersRaster.cpp.
void te::rp::FeederConstRasterDirectory::applyGeometryRestriction | ( | const te::gm::Geometry & | restrictionGeom | ) |
Apply a new geometry intersect restriction selecting only those rasters intersecting the given geometry.
restrictionGeom | The new restrigion geometry. |
Definition at line 410 of file FeedersRaster.cpp.
References te::gm::CurvePolygon::clear(), te::dt::AbstractData::clone(), te::gm::LineStringType, m_allRasterFileNames, m_allRastersBoundingBoxes, m_ignoreInvalidRasterFiles, te::gm::Envelope::m_llx, te::gm::Envelope::m_lly, m_restrictionGeomPtr, m_rType, m_selectedRasterIndexesOffset, m_selectedRastersIndexes, te::gm::Envelope::m_urx, te::gm::Envelope::m_ury, te::rst::RasterFactory::open(), te::gm::PolygonType, te::gm::CurvePolygon::push_back(), te::common::RAccess, reset(), te::gm::LineString::setPoint(), te::gm::LineString::setSRID(), te::gm::CurvePolygon::setSRID(), TERP_LOG_AND_THROW, TERP_LOGWARN, TERP_TRUE_OR_THROW, and te::common::Exception::what().
Referenced by initialize().
|
virtual |
Return the current sequence object.
Implements te::rp::FeederConstRaster.
Definition at line 269 of file FeedersRaster.cpp.
References m_currentRasterPtr.
|
virtual |
Return the index of the current object.
Implements te::rp::FeederConstRaster.
Definition at line 405 of file FeedersRaster.cpp.
References m_selectedRasterIndexesOffset.
const std::string & te::rp::FeederConstRasterDirectory::getCurrentRasterFileName | ( | ) |
Returns the current raster file name.
Definition at line 256 of file FeedersRaster.cpp.
References m_allRasterFileNames, m_selectedRasterIndexesOffset, and m_selectedRastersIndexes.
|
virtual |
Return the total number of feeder objects.
Implements te::rp::FeederConstRaster.
Definition at line 400 of file FeedersRaster.cpp.
References m_selectedRastersIndexes.
|
protected |
Initialize this instance.
directoryName | The directory full path name. |
recursive | true if a recursive search must be performed. |
rType | The name of the specific driver to instantiate each raster. |
sortFileNames | If true, the file names will be sorted. |
fileExtensions | The file extensions filter (example: ".tif"), or an empty vector if all extensions must be accepted. |
restrictionGeomPtr | A pointer to a restriction geometry (only rasters intercepting this geomtry will be considered) or a null pointer if there is no restriction. |
ignoreInvalidRasterFiles | If true, invalid raster files will be ignored. |
Definition at line 508 of file FeedersRaster.cpp.
References applyGeometryRestriction(), m_allRasterFileNames, m_ignoreInvalidRasterFiles, m_rType, m_selectedRasterIndexesOffset, m_selectedRastersIndexes, and reset().
Referenced by FeederConstRasterDirectory().
|
virtual |
Advances to the next sequence obeject.
Implements te::rp::FeederConstRaster.
Definition at line 274 of file FeedersRaster.cpp.
References m_allRasterFileNames, m_currentRasterPtr, m_ignoreInvalidRasterFiles, m_rType, m_selectedRasterIndexesOffset, m_selectedRastersIndexes, te::rst::RasterFactory::open(), te::common::RAccess, TERP_LOG_AND_RETURN_FALSE, and te::common::Exception::what().
|
virtual |
Jump to the given object index.
Implements te::rp::FeederConstRaster.
Definition at line 323 of file FeedersRaster.cpp.
References m_allRasterFileNames, m_currentRasterPtr, m_rType, m_selectedRasterIndexesOffset, m_selectedRastersIndexes, te::rst::RasterFactory::open(), te::common::RAccess, TERP_LOGWARN, and te::common::Exception::what().
|
virtual |
Reset the feeder to the first position (subsequent accesses will start from the first sequence obejct).
Implements te::rp::FeederConstRaster.
Definition at line 361 of file FeedersRaster.cpp.
References m_allRasterFileNames, m_currentRasterPtr, m_ignoreInvalidRasterFiles, m_rType, m_selectedRasterIndexesOffset, m_selectedRastersIndexes, te::rst::RasterFactory::open(), te::common::RAccess, TERP_LOGWARN, and te::common::Exception::what().
Referenced by applyGeometryRestriction(), and initialize().
|
protected |
Definition at line 205 of file FeedersRaster.h.
Referenced by applyGeometryRestriction(), getCurrentRasterFileName(), initialize(), moveNext(), moveTo(), and reset().
|
protected |
Definition at line 206 of file FeedersRaster.h.
Referenced by applyGeometryRestriction().
|
protected |
Definition at line 207 of file FeedersRaster.h.
Referenced by getCurrentObj(), moveNext(), moveTo(), and reset().
|
protected |
If true, invalid raster files will be ignored.
Definition at line 201 of file FeedersRaster.h.
Referenced by applyGeometryRestriction(), initialize(), moveNext(), and reset().
|
protected |
Definition at line 208 of file FeedersRaster.h.
Referenced by applyGeometryRestriction().
|
protected |
Definition at line 202 of file FeedersRaster.h.
Referenced by applyGeometryRestriction(), initialize(), moveNext(), moveTo(), and reset().
|
protected |
Definition at line 204 of file FeedersRaster.h.
Referenced by applyGeometryRestriction(), getCurrentOffset(), getCurrentRasterFileName(), initialize(), moveNext(), moveTo(), and reset().
|
protected |
Definition at line 203 of file FeedersRaster.h.
Referenced by applyGeometryRestriction(), getCurrentRasterFileName(), getObjsCount(), initialize(), moveNext(), moveTo(), and reset().