RasterSummaryManager.h
Go to the documentation of this file.
1 /* Copyright (C) 2008 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/raster/RasterSummaryManager.h
22 
23  \brief A singleton for keeping raster summaries (most statistics).
24 */
25 
26 #ifndef __TERRALIB_RASTER_INTERNAL_RASTERSUMMARYMANAGER_H
27 #define __TERRALIB_RASTER_INTERNAL_RASTERSUMMARYMANAGER_H
28 
29 // TerraLib
30 #include "../common/Singleton.h"
31 #include "Config.h"
32 #include "Enums.h"
33 #include "RasterSummary.h"
34 
35 //STL
36 #include <map>
37 
38 namespace te
39 {
40  namespace rst
41  {
42 // Forward declaration
43  class Raster;
44 
45  /*!
46  \class RasterSummaryManager
47 
48  \brief A singleton for keeping raster summaries (most statistics).
49  It stores an internal map of raster conn info str and their
50  respective summaries.
51 
52  \ingroup rst
53 
54  \sa RasterSummary, BandSummary.
55  */
56  class TERASTEREXPORT RasterSummaryManager : public te::common::Singleton<RasterSummaryManager>
57  {
59 
60  public:
61 
62  /*!
63  \brief Adds a new entry in the summary manager.
64 
65  \param raster The raster to be added.
66  \param summary The raster summary of the respective raster.
67  The manager will take its ownership.
68 
69  \note If the raster was already added, the summary will be replaced.
70  */
71  void add(const Raster* raster, RasterSummary* summary);
72 
73  /*!
74  \brief It searches for a raster summary.
75 
76  \param raster The raster to be found.
77 
78  \return The calculated raster summary, or a null summary otherwise.
79  */
80  const RasterSummary* find(const Raster* raster) const;
81 
82  /*!
83  \brief Removes the summary from the specified raster.
84 
85  \param raster The raster to remove the summary.
86  */
87  void remove(const Raster* raster);
88 
89  /*!
90  \brief It searches for a raster summary. If not found it creates the summary and returns it.
91 
92  \param raster The raster to be found.
93  \param types The desired types of summary to be calculated (min, max, ...).
94  \param readall Force the reading the entire image (can be slow) for computing min and max values.
95 
96  \return The calculated raster summary.
97  */
98  const RasterSummary* get(const Raster* raster, const SummaryTypes st, bool readall = false);
99 
100  /*! \brief Destructor. */
102 
103  protected:
104 
105  /*! \brief Constructor. */
107 
108  private:
109 
110  std::map<std::string, RasterSummary*> m_rasterSummaries; //!< A map of rasters conn info and their respective summaries.
111  };
112 
113  } // end namespace rst
114 } // end namespace te
115 
116 #endif // __TERRALIB_RASTER_INTERNAL_RASTERSUMMARYMANAGER_H
117 
#define TERASTEREXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:62
std::map< std::string, RasterSummary * > m_rasterSummaries
A map of rasters conn info and their respective summaries.
Enumerations for the Raster module.
An abstract class for raster data strucutures.
Definition: Raster.h:71
SummaryTypes
Types for the BandSummary.
Definition: Enums.h:38
URI C++ Library.
RasterSummary is just a typedef of a boost::ptr_vector.
boost::ptr_vector< BandSummary > RasterSummary
RasterSummary is just a typedef of a boost::ptr_vector.
Definition: RasterSummary.h:44
A singleton for keeping raster summaries (most statistics). It stores an internal map of raster conn ...
Configuration flags for the Raster module of TerraLib.
Template support for singleton pattern.
Definition: Singleton.h:100