All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator 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 void reset() = 0;
55  virtual unsigned int getObjsCount() const = 0;
56  virtual unsigned int getCurrentOffset() const = 0;
57 
58  protected :
59 
61  };
62 
63  /*!
64  \class FeederConstRasterVector
65  \brief A feeder from a input rasters vector;
66  */
68  {
69  public :
70 
71  /*!
72  \brief Constructor from a vector of input rasters pointers;
73  \param rasters Input vector of rasters pointers.
74  \note The given rasters must always be avaliable.
75  \note The feeder WILL NOT ACQUIRE the pointers.
76  */
77  FeederConstRasterVector( const std::vector< const te::rst::Raster* > rasters );
78 
80 
81  //overloads
82  te::rst::Raster const* getCurrentObj() const;
83  bool moveNext();
84  void reset();
85  unsigned int getObjsCount() const;
86  unsigned int getCurrentOffset() const;
87 
88  protected :
89 
90  std::vector< const te::rst::Raster* >::size_type m_currentOffset;
91  std::vector< const te::rst::Raster* > m_rasters;
92 
94  };
95 
96  /*!
97  \class FeederConstRasterFileNames
98  \brief A feeder from a vector of input rasters infos.
99  */
101  {
102  public :
103 
104  /*!
105  \brief Constructor from a vector of input rasters infos;
106  \param rTypes The name of the specific drivers to instantiate each raster.
107  \param rInfos The necessary information to instantiate each raster.
108  \note The given rasters must always be avaliable.
109  */
110  FeederConstRasterInfo( const std::vector< std::string >& rTypes,
111  const std::vector< std::map< std::string, std::string > >& rInfos );
112 
114 
115  //overloads
116  te::rst::Raster const* getCurrentObj() const;
117  bool moveNext();
118  void reset();
119  unsigned int getObjsCount() const;
120  unsigned int getCurrentOffset() const;
121 
122  protected :
123 
124  std::vector< std::string >::size_type m_currentOffset;
125  std::vector< std::string > m_rTypes;
126  std::vector< std::map< std::string, std::string > > m_rInfos;
127  std::auto_ptr< te::rst::Raster > m_currentRasterPtr;
128 
130  };
131 
132 
133  /*!
134  \class FeederConstRasterDirectory
135  \brief A feeder from an input directory name.
136  */
138  {
139  public :
140 
141  /*!
142  \brief Constructor from an input directory name.
143  \param directoryName The directory full path name.
144  \param recursive true if a recursive search must be performed.
145  \param rType The name of the specific driver to instantiate each raster.
146  \param sortFileNames If true, the file names will be sorted.
147  \param fileExtensions The file extensions filter (example: ".tif"), or an empty vector if all extensions must be accepted.
148  */
149  FeederConstRasterDirectory( const std::string& directoryName,
150  const bool recursive,
151  const std::string& rType,
152  const bool sortFileNames,
153  const std::vector< std::string >& fileExtensions );
154 
156 
157  //overloads
158  te::rst::Raster const* getCurrentObj() const;
159  bool moveNext();
160  void reset();
161  unsigned int getObjsCount() const;
162  unsigned int getCurrentOffset() const;
163 
164  protected :
165 
166  std::string m_rType;
167  std::vector< std::string >::size_type m_currentOffset;
168  std::vector< std::string > m_filesNames;
169  std::auto_ptr< te::rst::Raster > m_currentRasterPtr;
170 
172  };
173  } // end namespace rp
174 } // end namespace te
175 
176 #endif // __TERRALIB_RP_INTERNAL_FEEDERSRASTER_H
177 
std::vector< std::string > m_rTypes
std::vector< std::string > m_filesNames
std::auto_ptr< te::rst::Raster > m_currentRasterPtr
std::vector< std::string >::size_type m_currentOffset
std::vector< std::map< std::string, std::string > > m_rInfos
Abstract objects feeder.
std::vector< std::string >::size_type m_currentOffset
std::vector< const te::rst::Raster * > m_rasters
Definition: FeedersRaster.h:91
A feeder from a input rasters vector;.
Definition: FeedersRaster.h:67
A feeder from an input directory name.
Configuration flags for the Raster Processing module of TerraLib.
Abstract objects feeder.
std::auto_ptr< te::rst::Raster > m_currentRasterPtr
Feeder from a input rasters.
Definition: FeedersRaster.h:45
An abstract class for raster data strucutures.
Definition: Raster.h:70
std::vector< const te::rst::Raster * >::size_type m_currentOffset
Definition: FeedersRaster.h:90
#define TERPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:91