Grouping.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 Grouping.h
22 
23  \brief This class contains the parameters needed for grouping the values of a Property.
24 */
25 
26 #ifndef __TERRALIB_MAPTOOLS_INTERNAL_GROUPING_H
27 #define __TERRALIB_MAPTOOLS_INTERNAL_GROUPING_H
28 
29 // TerraLib
30 #include "Config.h"
31 #include "Enums.h"
32 
33 // STL
34 #include <cstdlib>
35 #include <string>
36 #include <vector>
37 
38 namespace te
39 {
40 // Forward declarations
41  namespace dt
42  {
43  class Property;
44  }
45 
46  namespace map
47  {
48  class GroupingItem;
49 
50  /*!
51  \class Grouping
52 
53  \brief This class contains the parameters needed for grouping the values of a Property.
54 
55  \ingroup map
56 
57  \sa GroupingItem, Layer
58  */
60  {
61  public:
62 
63  /*!
64  \brief It constructs a new Grouping instance.
65 
66  \param propertyName The property name whose values will be used to make the grouping.
67  \param type The grouping type.
68  \param precision The precision to be set to the property values.
69  */
70  Grouping(const std::string& propertyName, GroupingType type, size_t precision = 6);
71 
72  /*! \brief Destructor. */
73  ~Grouping();
74 
75  /*! \brief Copy constructor. */
76  Grouping(const Grouping& rhs);
77 
78  /*!
79  \brief It gets the property name whose values will be grouped.
80 
81  \return The property name.
82  */
83  std::string getPropertyName() const;
84 
85  /*!
86  \brief It sets the property name whose values will be grouped.
87 
88  \param name The property name.
89  */
90  void setPropertyName(const std::string& name);
91 
92  /*!
93  \brief It gets the property type whose values will be grouped.
94 
95  \return The property type.
96  */
97  int getPropertyType() const;
98 
99  /*!
100  \brief It sets the property type whose values will be grouped.
101 
102  \param type The property type.
103  */
104  void setPropertyType(const int& type);
105 
106  /*!
107  \brief It gets the grouping type.
108 
109  \return The grouping type.
110  */
111  const GroupingType getType() const;
112 
113  /*!
114  \brief It sets the grouping type.
115 
116  \param type The grouping type.
117  */
118  void setType(GroupingType type);
119 
120  /*!
121  \brief It gets the precision used for the property values.
122 
123  \output The precision used for the property values.
124  */
125  const size_t getPrecision() const;
126 
127  /*!
128  \brief It sets the precision to be used for the property values.
129 
130  \param precision The precision value.
131  */
132  void setPrecision(size_t precision);
133 
134  /*!
135  \brief It gets the number of slices used in the Equal Steps and Quantil groupings.
136 
137  \output The number of slices.
138  */
139  const size_t getNumSlices() const;
140 
141  /*!
142  \brief It sets the number of slices for the EqualSteps and Quantil groupings.
143 
144  \param numSlices The number of slices.
145  */
146  void setNumSlices(size_t numSlices);
147 
148  /*!
149  \brief It gets the standard deviation used in the Standard Deviation grouping.
150 
151  \output The standard deviation.
152  */
153  const double getStdDeviation() const;
154 
155  /*!
156  \brief It sets the standard deviation for the Standard Deviation grouping.
157 
158  \param stdDeviation The standard deviation.
159  */
160  void setStdDeviation(double stdDeviation);
161 
162  /*!
163  \brief It gets the vector of grouping items.
164 
165  \return The vector of grouping items.
166  */
167  const std::vector<te::map::GroupingItem*>& getGroupingItems() const;
168 
169  /*!
170  \brief It sets the vector of grouping items.
171 
172  \param The vector of grouping items.
173  */
174  void setGroupingItems(std::vector<te::map::GroupingItem*>& items);
175 
176  /*! \brief It gets the grouping visibility. */
177  bool isVisible() const;
178 
179  /*!
180  \brief It sets the grouping visibility.
181 
182  \param visible The visibility value.
183  */
184  void setVisibility(bool visible);
185 
186  /*! \brief It gets the grouping summary. It is used only in case 1 to n.
187  */
188  std::string getSummary() const;
189 
190  /*!
191  \brief It gets the grouping summary. It is used only in case 1 to n.
192 
193  \param summary The summary mode. It can be: "MIN", "MAX", "SUM", "AVERAGE", "MEDIAN", "STDDEV" or "VARIANCE"
194  */
195  void setSummary(const std::string& summary);
196 
197  private:
198 
199  std::string m_propertyName; //!< The property name whose values will be used to make the grouping.
200  int m_propertyType; //!< The property type whose values will be used to make the grouping.
201  GroupingType m_type; //!< The grouping type.
202  size_t m_precision; //!< The precision of the values.
203  size_t m_numSlices; //!< The number of slices used in the Equal Steps and Quantil groupings.
204  double m_stdDeviation; //!< The standard deviation used in the Standard Deviation grouping.
205  bool m_isVisible; //!< A flag that indicates if the grouping is visible.
206  std::vector<te::map::GroupingItem*> m_items; //!< The vector of grouping items.
207  std::string m_summary; //!< The summary used in case 1 to n.
208  };
209 
210  } // end namespace map
211 } // end namespace te
212 
213 #endif // __TERRALIB_MAPTOOLS_INTERNAL_GROUPING_H
214 
std::string m_propertyName
The property name whose values will be used to make the grouping.
Definition: Grouping.h:199
size_t m_precision
The precision of the values.
Definition: Grouping.h:202
This class contains the parameters needed for grouping the values of a Property.
Definition: Grouping.h:59
URI C++ Library.
std::string m_summary
The summary used in case 1 to n.
Definition: Grouping.h:207
#define TEMAPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:60
int m_propertyType
The property type whose values will be used to make the grouping.
Definition: Grouping.h:200
bool m_isVisible
A flag that indicates if the grouping is visible.
Definition: Grouping.h:205
double m_stdDeviation
The standard deviation used in the Standard Deviation grouping.
Definition: Grouping.h:204
std::vector< te::map::GroupingItem * > m_items
The vector of grouping items.
Definition: Grouping.h:206
GroupingType
The grouping type associated to the layer.
Definition: Enums.h:151
size_t m_numSlices
The number of slices used in the Equal Steps and Quantil groupings.
Definition: Grouping.h:203
GroupingType m_type
The grouping type.
Definition: Grouping.h:201