27 #include "../raster/RasterFactory.h" 
   28 #include "../raster/Grid.h" 
   29 #include "../geometry/LinearRing.h" 
   30 #include "../common/Exception.h" 
   32 #include <boost/filesystem.hpp> 
   41       const std::vector< const te::rst::Raster* > rasters )
 
   42     : m_currentOffset( 0 ), m_rasters( rasters )
 
   47     : m_currentOffset( 0 )
 
  105       const std::vector< std::string >& rTypes,
 
  106       const std::vector< std::map< std::string, std::string > >& rInfos )
 
  107     : m_currentOffset( 0 ), m_rTypes( rTypes ), m_rInfos( rInfos )
 
  110         "Invalid rasters info" )
 
  115     : m_currentOffset( 0 )
 
  212       return (
unsigned int) 
m_rTypes.size();
 
  223       const std::string& directoryName,
 
  224       const bool recursive,
 
  225       const std::string& rType,
 
  226       const bool sortFileNames,
 
  227       const std::vector< std::string >& fileExtensions )
 
  230         sortFileNames, fileExtensions, 0, 
false ), 
"Feeder initialization error" );
 
  234       const std::string& directoryName,
 
  235       const bool recursive,
 
  236       const std::string& rType,
 
  237       const bool sortFileNames,
 
  238       const std::vector< std::string >& fileExtensions,
 
  240       const bool ignoreInvalidRasterFiles )
 
  243         sortFileNames, fileExtensions, restrictionGeomPtr, ignoreInvalidRasterFiles ), 
 
  244         "Feeder initialization error" );
 
  248     : m_selectedRasterIndexesOffset( 0 )
 
  264         static std::string emptyStr;
 
  278       std::map< std::string, std::string > mInfo;
 
  285           nextSelectedRasterIndexesOffset ] ];
 
  308         ++nextSelectedRasterIndexesOffset;
 
  332         std::map< std::string, std::string > mInfo;
 
  365       std::map< std::string, std::string > mInfo;
 
  366       std::size_t nextSelectedRasterIndexesOffset = 0;
 
  371           nextSelectedRasterIndexesOffset ] ];        
 
  394         ++nextSelectedRasterIndexesOffset;
 
  412        std::auto_ptr< te::dt::AbstractData > cloneResult( restrictionGeom.
clone() );
 
  414          "Invalid geometry" );
 
  426          std::map< std::string, std::string > mInfo;
 
  427          std::auto_ptr< te::rst::Raster > rasterPtr;
 
  430          for( 
unsigned int allRasterFileNamesIdx = 0 ; allRasterFileNamesIdx <
 
  455             if( rasterPtr.get() )
 
  457               rasterExtPtr = rasterPtr->getGrid()->getExtent();
 
  461                 rasterExtPtr->
m_ury );
 
  463                 rasterExtPtr->
m_ury );
 
  465                 rasterExtPtr->
m_lly );
 
  467                 rasterExtPtr->
m_lly );
 
  469                 rasterExtPtr->
m_ury );
 
  470               auxLinearRingPtr->
setSRID( rasterPtr->getSRID() );
 
  473               auxPolygon.
push_back( auxLinearRingPtr );
 
  475               auxPolygon.
setSRID( rasterPtr->getSRID() );
 
  486        for( 
unsigned int allRastersBoundingBoxesIdx = 0 ; allRastersBoundingBoxesIdx <
 
  490            allRastersBoundingBoxesIdx ].getSRID() )
 
  493              allRastersBoundingBoxesIdx ].getSRID() );
 
  497            allRastersBoundingBoxesIdx ] ) ) )
 
  509       const std::string& directoryName,
 
  510       const bool recursive,
 
  511       const std::string& rType,
 
  512       const bool sortFileNames,
 
  513       const std::vector< std::string >& fileExtensions,
 
  515       const bool ignoreInvalidRasterFiles )
 
  525         const std::vector< std::string >::size_type fileExtensionsSize = 
 
  526           fileExtensions.size();
 
  527         std::vector< std::string >::size_type fileExtensionsIdx = 0;
 
  529         boost::filesystem::path directoryPath( directoryName );
 
  530         if( boost::filesystem::is_directory( directoryName ) )
 
  534             boost::filesystem::recursive_directory_iterator dirIt( directoryPath );
 
  535             const boost::filesystem::recursive_directory_iterator dirItE;
 
  536             std::string auxString;
 
  538             while( dirIt != dirItE )
 
  540               if( boost::filesystem::is_regular_file( *dirIt ) )
 
  542                 if( fileExtensionsSize )
 
  544                   for( fileExtensionsIdx = 0 ; fileExtensionsIdx < fileExtensionsSize ;
 
  545                     ++fileExtensionsIdx )
 
  547                     if( dirIt->path().extension().generic_string()
 
  548                         == fileExtensions[ fileExtensionsIdx ] )
 
  565             boost::filesystem::directory_iterator dirIt( directoryPath );
 
  566             const boost::filesystem::directory_iterator dirItE;
 
  568             while( dirIt != dirItE )
 
  570               if( boost::filesystem::is_regular_file( *dirIt ) )
 
  572                 if( fileExtensionsSize )
 
  574                   for( fileExtensionsIdx = 0 ; fileExtensionsIdx < fileExtensionsSize ;
 
  575                     ++fileExtensionsIdx )
 
  577                     if( dirIt->path().extension().generic_string()
 
  578                         == fileExtensions[ fileExtensionsIdx ] )
 
  603         for( std::vector< std::string >::size_type allRasterFileNamesIdx = 0 ;
 
  605           ++allRasterFileNamesIdx )
 
  615       if( restrictionGeomPtr )
 
bool moveTo(const unsigned int index)
Jump to the given object index. 
 
FeederConstRasterDirectory()
 
void push_back(Curve *ring)
It adds the curve to the curve polygon. 
 
te::rst::Raster const * getCurrentObj() const 
Return the current sequence object. 
 
bool moveNext()
Advances to the next sequence obeject. 
 
std::vector< te::gm::Polygon > m_allRastersBoundingBoxes
 
bool moveTo(const unsigned int index)
Jump to the given object index. 
 
unsigned int getCurrentOffset() const 
Return the index of the current object. 
 
void setSRID(int srid)
It sets the Spatial Reference System ID of the geometry and all its parts if it is a GeometryCollecti...
 
unsigned int getCurrentOffset() const 
Return the index of the current object. 
 
~FeederConstRasterDirectory()
 
bool moveNext()
Advances to the next sequence obeject. 
 
void reset()
Reset the feeder to the first position (subsequent accesses will start from the first sequence obejct...
 
virtual const char * what() const 
It outputs the exception message. 
 
#define TERP_LOGWARN(message)
Logs a warning message. 
 
unsigned int getObjsCount() const 
Return the total number of feeder objects. 
 
unsigned int getObjsCount() const 
Return the total number of feeder objects. 
 
double m_urx
Upper right corner x-coordinate. 
 
std::auto_ptr< te::gm::Geometry > m_restrictionGeomPtr
 
std::vector< const te::rst::Raster * >::size_type m_currentOffset
 
std::vector< unsigned int >::size_type m_selectedRasterIndexesOffset
 
std::vector< const te::rst::Raster * > m_rasters
 
void applyGeometryRestriction(const te::gm::Geometry &restrictionGeom)
Apply a new geometry intersect restriction selecting only those rasters intersecting the given geomet...
 
te::rst::Raster const * getCurrentObj() const 
Return the current sequence object. 
 
~FeederConstRasterVector()
 
A LinearRing is a LineString that is both closed and simple. 
 
double m_llx
Lower left corner x-coordinate. 
 
void setPoint(std::size_t i, const double &x, const double &y)
It sets the value of the specified point. 
 
An Envelope defines a 2D rectangular region. 
 
An abstract class for raster data strucutures. 
 
#define TERP_LOG_AND_THROW(message)
Logs a error message and throws. 
 
std::auto_ptr< te::rst::Raster > m_currentRasterPtr
 
te::rst::Raster const * getCurrentObj() const 
Return the current sequence object. 
 
This class is designed to declare objects to be thrown as exceptions by TerraLib. ...
 
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards. 
 
double m_lly
Lower left corner y-coordinate. 
 
unsigned int getObjsCount() const 
Return the total number of feeder objects. 
 
bool moveTo(const unsigned int index)
Jump to the given object index. 
 
#define TERP_LOG_AND_RETURN_FALSE(message)
Logs a warning message will and return false. 
 
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings. 
 
bool moveNext()
Advances to the next sequence obeject. 
 
double m_ury
Upper right corner y-coordinate. 
 
FeederConstRasterVector()
 
void clear()
It deletes all the rings of the CurvePolygon and clear it. 
 
void setSRID(int srid)
It sets the Spatial Reference System ID of the linestring. 
 
void reset()
Reset the feeder to the first position (subsequent accesses will start from the first sequence obejct...
 
void reset()
Reset the feeder to the first position (subsequent accesses will start from the first sequence obejct...
 
unsigned int getCurrentOffset() const 
Return the index of the current object. 
 
std::vector< std::map< std::string, std::string > > m_rInfos
 
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. 
 
virtual AbstractData * clone() const =0
It returns a clone of this object. 
 
std::vector< unsigned int > m_selectedRastersIndexes
 
std::vector< std::string >::size_type m_currentOffset
 
#define TERP_TRUE_OR_THROW(value, message)
Checks if value is true and throws an exception if not. 
 
std::auto_ptr< te::rst::Raster > m_currentRasterPtr
 
bool m_ignoreInvalidRasterFiles
If true, invalid raster files will be ignored. 
 
const std::string & getCurrentRasterFileName()
Returns the current raster file name. 
 
static Raster * open(const std::map< std::string, std::string > &rinfo, te::common::AccessPolicy p=te::common::RAccess)
It opens a raster with the given parameters and default raster driver. 
 
std::vector< std::string > m_rTypes
 
std::vector< std::string > m_allRasterFileNames