All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
FeedersRaster.h
Go to the documentation of this file.
1 /* Copyright (C) 2001-2009 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file terralib/rp/FeedersRaster.h
22  \brief Raster objects feeders.
23  */
24 
25 #ifndef __TERRALIB_RP_INTERNAL_FEEDERSRASTER_H
26 #define __TERRALIB_RP_INTERNAL_FEEDERSRASTER_H
27 
28 #include "Config.h"
29 #include "AbstractFeeder.h"
30 #include "../raster/Raster.h"
31 
32 #include <string>
33 #include <vector>
34 #include <map>
35 #include <memory>
36 
37 namespace te
38 {
39  namespace rp
40  {
41  /*!
42  \class FeederConstRaster
43  \brief Feeder from a input rasters.
44  */
45  class TERPEXPORT FeederConstRaster : public AbstractFeeder< const te::rst::Raster >
46  {
47  public :
48 
49  virtual ~FeederConstRaster() {};
50 
51  //overloads
52  virtual te::rst::Raster const* getCurrentObj() const = 0;
53  virtual bool moveNext() = 0;
54  virtual bool moveTo( const unsigned int index ) = 0;
55  virtual void reset() = 0;
56  virtual unsigned int getObjsCount() const = 0;
57  virtual unsigned int getCurrentOffset() const = 0;
58 
59  protected :
60 
62  };
63 
64  /*!
65  \class FeederConstRasterVector
66  \brief A feeder from a input rasters vector;
67  */
69  {
70  public :
71 
72  /*!
73  \brief Constructor from a vector of input rasters pointers;
74  \param rasters Input vector of rasters pointers.
75  \note The given rasters must always be avaliable.
76  \note The feeder WILL NOT ACQUIRE the pointers.
77  */
78  FeederConstRasterVector( const std::vector< const te::rst::Raster* > rasters );
79 
81 
82  //overloads
83  te::rst::Raster const* getCurrentObj() const;
84  bool moveNext();
85  bool moveTo( const unsigned int index );
86  void reset();
87  unsigned int getObjsCount() const;
88  unsigned int getCurrentOffset() const;
89 
90  protected :
91 
92  std::vector< const te::rst::Raster* >::size_type m_currentOffset;
93  std::vector< const te::rst::Raster* > m_rasters;
94 
96  };
97 
98  /*!
99  \class FeederConstRasterFileNames
100  \brief A feeder from a vector of input rasters infos.
101  */
103  {
104  public :
105 
106  /*!
107  \brief Constructor from a vector of input rasters infos;
108  \param rTypes The name of the specific drivers to instantiate each raster.
109  \param rInfos The necessary information to instantiate each raster.
110  \note The given rasters must always be avaliable.
111  */
112  FeederConstRasterInfo( const std::vector< std::string >& rTypes,
113  const std::vector< std::map< std::string, std::string > >& rInfos );
114 
116 
117  //overloads
118  te::rst::Raster const* getCurrentObj() const;
119  bool moveNext();
120  bool moveTo( const unsigned int index );
121  void reset();
122  unsigned int getObjsCount() const;
123  unsigned int getCurrentOffset() const;
124 
125  protected :
126 
127  std::vector< std::string >::size_type m_currentOffset;
128  std::vector< std::string > m_rTypes;
129  std::vector< std::map< std::string, std::string > > m_rInfos;
130  std::auto_ptr< te::rst::Raster > m_currentRasterPtr;
131 
133  };
134 
135 
136  /*!
137  \class FeederConstRasterDirectory
138  \brief A feeder from an input directory name.
139  */
141  {
142  public :
143 
144  /*!
145  \brief Constructor from an input directory name.
146  \param directoryName The directory full path name.
147  \param recursive true if a recursive search must be performed.
148  \param rType The name of the specific driver to instantiate each raster.
149  \param sortFileNames If true, the file names will be sorted.
150  \param fileExtensions The file extensions filter (example: ".tif"), or an empty vector if all extensions must be accepted.
151  */
152  FeederConstRasterDirectory( const std::string& directoryName,
153  const bool recursive,
154  const std::string& rType,
155  const bool sortFileNames,
156  const std::vector< std::string >& fileExtensions );
157 
159 
160  //overloads
161  te::rst::Raster const* getCurrentObj() const;
162  bool moveNext();
163  bool moveTo( const unsigned int index );
164  void reset();
165  unsigned int getObjsCount() const;
166  unsigned int getCurrentOffset() const;
167 
168  protected :
169 
170  std::string m_rType;
171  std::vector< std::string >::size_type m_currentOffset;
172  std::vector< std::string > m_filesNames;
173  std::auto_ptr< te::rst::Raster > m_currentRasterPtr;
174 
176  };
177  } // end namespace rp
178 } // end namespace te
179 
180 #endif // __TERRALIB_RP_INTERNAL_FEEDERSRASTER_H
181 
Abstract objects feeder.
A feeder from a input rasters vector;.
Definition: FeedersRaster.h:68
Abstract objects feeder.
std::vector< const te::rst::Raster * >::size_type m_currentOffset
Definition: FeedersRaster.h:92
std::vector< const te::rst::Raster * > m_rasters
Definition: FeedersRaster.h:93
std::vector< std::string >::size_type m_currentOffset
An abstract class for raster data strucutures.
Definition: Raster.h:71
#define TERPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:111
std::auto_ptr< te::rst::Raster > m_currentRasterPtr
std::vector< std::string > m_filesNames
Configuration flags for the Raster Processing module of TerraLib.
Feeder from a input rasters.
Definition: FeedersRaster.h:45
A feeder from an input directory name.
std::vector< std::map< std::string, std::string > > m_rInfos
std::vector< std::string >::size_type m_currentOffset
std::auto_ptr< te::rst::Raster > m_currentRasterPtr
std::vector< std::string > m_rTypes