27 #include "../raster/RasterFactory.h"
29 #include <boost/filesystem.hpp>
38 const std::vector< const te::rst::Raster* > rasters )
39 : m_currentOffset( 0 ), m_rasters( rasters )
44 : m_currentOffset( 0 )
102 const std::vector< std::string >& rTypes,
103 const std::vector< std::map< std::string, std::string > >& rInfos )
104 : m_currentOffset( 0 ), m_rTypes( rTypes ), m_rInfos( rInfos )
107 "Invalid rasters info" )
112 : m_currentOffset( 0 )
209 return (
unsigned int)
m_rTypes.size();
220 const std::string& directoryName,
221 const bool recursive,
222 const std::string& rType,
223 const bool sortFileNames,
224 const std::vector< std::string >& fileExtensions )
227 const std::vector< std::string >::size_type fileExtensionsSize =
228 fileExtensions.size();
229 std::vector< std::string >::size_type fileExtensionsIdx = 0;
231 boost::filesystem::path directoryPath( directoryName );
232 if( boost::filesystem::is_directory( directoryName ) )
236 boost::filesystem::recursive_directory_iterator dirIt( directoryPath );
237 const boost::filesystem::recursive_directory_iterator dirItE;
238 std::string auxString;
240 while( dirIt != dirItE )
242 if( boost::filesystem::is_regular_file( *dirIt ) )
244 if( fileExtensionsSize )
246 for( fileExtensionsIdx = 0 ; fileExtensionsIdx < fileExtensionsSize ;
247 ++fileExtensionsIdx )
249 if( dirIt->path().extension().generic_string()
250 == fileExtensions[ fileExtensionsIdx ] )
252 m_filesNames.push_back( dirIt->path().generic_string() );
258 m_filesNames.push_back( dirIt->path().generic_string() );
267 boost::filesystem::directory_iterator dirIt( directoryPath );
268 const boost::filesystem::directory_iterator dirItE;
270 while( dirIt != dirItE )
272 if( boost::filesystem::is_regular_file( *dirIt ) )
274 if( fileExtensionsSize )
276 for( fileExtensionsIdx = 0 ; fileExtensionsIdx < fileExtensionsSize ;
277 ++fileExtensionsIdx )
279 if( dirIt->path().extension().generic_string()
280 == fileExtensions[ fileExtensionsIdx ] )
282 m_filesNames.push_back( dirIt->path().generic_string() );
288 m_filesNames.push_back( dirIt->path().generic_string() );
305 : m_currentOffset( 0 )
335 std::map< std::string, std::string > mInfo;
364 std::map< std::string, std::string > mInfo;
388 std::map< std::string, std::string > mInfo;
bool moveTo(const unsigned int index)
Jump to the given object index.
FeederConstRasterDirectory()
te::rst::Raster const * getCurrentObj() const
Return the current sequence object.
bool moveNext()
Advances to the next sequence obeject.
bool moveTo(const unsigned int index)
Jump to the given object index.
unsigned int getCurrentOffset() const
Return the index of the current object.
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...
unsigned int getObjsCount() const
Return the total number of feeder objects.
unsigned int getObjsCount() const
Return the total number of feeder objects.
std::vector< const te::rst::Raster * >::size_type m_currentOffset
std::vector< const te::rst::Raster * > m_rasters
te::rst::Raster const * getCurrentObj() const
Return the current sequence object.
~FeederConstRasterVector()
std::vector< std::string >::size_type m_currentOffset
An abstract class for raster data strucutures.
std::auto_ptr< te::rst::Raster > m_currentRasterPtr
std::vector< std::string > m_filesNames
te::rst::Raster const * getCurrentObj() const
Return the current sequence object.
unsigned int getObjsCount() const
Return the total number of feeder objects.
bool moveTo(const unsigned int index)
Jump to the given object index.
bool moveNext()
Advances to the next sequence obeject.
FeederConstRasterVector()
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
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
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