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 )
89 const std::vector< std::string >& rTypes,
90 const std::vector< std::map< std::string, std::string > >& rInfos )
91 : m_currentOffset( 0 ), m_rTypes( rTypes ), m_rInfos( rInfos )
94 "Invalid rasters info" )
99 : m_currentOffset( 0 )
167 return (
unsigned int)
m_rTypes.size();
178 const std::string& directoryName,
179 const bool recursive,
180 const std::string& rType,
181 const bool sortFileNames,
182 const std::vector< std::string >& fileExtensions )
185 const std::vector< std::string >::size_type fileExtensionsSize =
186 fileExtensions.size();
187 std::vector< std::string >::size_type fileExtensionsIdx = 0;
189 boost::filesystem::path directoryPath( directoryName );
190 if( boost::filesystem::is_directory( directoryName ) )
194 boost::filesystem::recursive_directory_iterator dirIt( directoryPath );
195 const boost::filesystem::recursive_directory_iterator dirItE;
196 std::string auxString;
198 while( dirIt != dirItE )
200 if( boost::filesystem::is_regular_file( *dirIt ) )
202 if( fileExtensionsSize )
204 for( fileExtensionsIdx = 0 ; fileExtensionsIdx < fileExtensionsSize ;
205 ++fileExtensionsIdx )
207 if( dirIt->path().extension().generic_string()
208 == fileExtensions[ fileExtensionsIdx ] )
210 m_filesNames.push_back( dirIt->path().generic_string() );
216 m_filesNames.push_back( dirIt->path().generic_string() );
225 boost::filesystem::directory_iterator dirIt( directoryPath );
226 const boost::filesystem::directory_iterator dirItE;
228 while( dirIt != dirItE )
230 if( boost::filesystem::is_regular_file( *dirIt ) )
232 if( fileExtensionsSize )
234 for( fileExtensionsIdx = 0 ; fileExtensionsIdx < fileExtensionsSize ;
235 ++fileExtensionsIdx )
237 if( dirIt->path().extension().generic_string()
238 == fileExtensions[ fileExtensionsIdx ] )
240 m_filesNames.push_back( dirIt->path().generic_string() );
246 m_filesNames.push_back( dirIt->path().generic_string() );
263 : m_currentOffset( 0 )
293 std::map< std::string, std::string > mInfo;
318 std::map< std::string, std::string > mInfo;
~FeederConstRasterDirectory()
std::vector< std::string > m_rTypes
std::vector< std::string > m_filesNames
bool moveNext()
Advances to the next sequence obeject.
std::auto_ptr< te::rst::Raster > m_currentRasterPtr
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...
std::vector< std::string >::size_type m_currentOffset
unsigned int getCurrentOffset() const
Return the index of the current object.
std::vector< std::map< std::string, std::string > > m_rInfos
FeederConstRasterVector()
std::vector< std::string >::size_type m_currentOffset
te::rst::Raster const * getCurrentObj() const
Return the current sequence object.
std::vector< const te::rst::Raster * > m_rasters
unsigned int getCurrentOffset() const
Return the index of the current object.
unsigned int getObjsCount() const
Return the total number of feeder objects.
FeederConstRasterDirectory()
bool moveNext()
Advances to the next sequence obeject.
unsigned int getObjsCount() const
Return the total number of feeder objects.
~FeederConstRasterVector()
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.
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.
#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
te::rst::Raster const * getCurrentObj() const
Return the current sequence object.
bool moveNext()
Advances to the next sequence obeject.
An abstract class for raster data strucutures.
te::rst::Raster const * getCurrentObj() const
Return the current sequence object.
unsigned int getCurrentOffset() const
Return the index of the current object.
std::vector< const te::rst::Raster * >::size_type m_currentOffset