Categorize.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/se/Categorize.h
22 
23  \brief The transformation of continuous values to distinct values (Categorize function).
24 */
25 
26 #ifndef __TERRALIB_SE_INTERNAL_CATEGORIZE_H
27 #define __TERRALIB_SE_INTERNAL_CATEGORIZE_H
28 
29 // TerraLib
30 #include "Function.h"
31 
32 // STL
33 #include <vector>
34 
35 namespace te
36 {
37  namespace se
38  {
39 // Forward declaration
40  class ParameterValue;
41 
42  /*!
43  \class Categorize
44 
45  \brief The transformation of continuous values to distinct values (Categorize function).
46 
47  The Symbology encoding specification defines
48  three pre-defined functions for transforming raw data:
49  <ul>
50  <li><b>Categorization:</b> The transformation of continuous
51  values to distinct values. This is
52  for example needed to generate choropleth
53  maps from continuous attributes. Another
54  example would be the stepwise selection of
55  different text heights or line widths in
56  dependence from such an attribute;</li>
57  <li><b>Interpolation:</b> Transformation of continuous values by a
58  function defined on a number of nodes. This
59  is used to adjust the value distribution of an
60  attribute to the desired distribution of a
61  continuous symbolization control variable
62  (like size, width, color, etc);</li>
63  <li><b>Recoding:</b> Transformation of discrete values to any
64  other values. This is needed when integers
65  have to be translated into text or, reversely,
66  text contents into other texts or numeric values
67  or colors.</li>
68  </ul>
69  <br>
70  The Thresholds have to be specified in ascending order
71  and (like the LookupValue) have to be of a uniform and
72  orderable type. The value of the function is determined
73  by looking up into which interval between two thresholds
74  the LookupValue falls. The first interval ranges from
75  -Infinity to the first given threshold and the last one
76  accordingly from the last threshold to +Infinity.
77  In case the Categorize (or Interpolate) function is used
78  inside a RasterSymbolizer as a ColorMap, the LookupValue
79  is set to the fixed value "Rasterdata".
80  The Values can be of any type, dependent on which symbolization
81  context the function is employed. Color values (like #00ffff)
82  or numeric values are typical.
83  Whether the Threshold values themselves belong to the preceding
84  or the succeeding interval can be controlled by the attribute
85  thresholdsBelongTo= with the possible values "preceding" and
86  "succeeding" the latter being the default.
87 
88  \sa Function, ParameterValue
89  */
91  {
92  public:
93 
94  /*!
95  \enum ThresholdsBelongToType
96 
97  \brief It controls the interval order.
98  */
100  {
101  NONE, /*!< */
102  SUCCEEDING, /*!< */
103  PRECEDING /*!< */
104  };
105 
106  /** @name Initializer Methods
107  * Methods related to instantiation and destruction.
108  */
109  //@{
110 
111  /*! \brief It initializes a new Categorize. */
112  Categorize();
113 
114  /*!
115  \brief Copy constructor.
116 
117  \param rhs The other Categorize.
118  */
119  Categorize(const Categorize& rhs);
120 
121  /*! \brief Destructor. */
122  ~Categorize();
123 
124  /*!
125  \brief It returns a clone of this object.
126 
127  \return A clone of this object.
128  */
129  virtual Categorize* clone() const;
130 
131  //@}
132 
133  void setLookupValue(ParameterValue* v);
134 
135  ParameterValue* getLookupValue() const { return m_lookupValue; }
136 
137  void setValue(ParameterValue* v);
138 
139  ParameterValue* getValue() const { return m_value; }
140 
141  void addThreshold(ParameterValue* v);
142 
143  void addValue(ParameterValue* v);
144 
145  void setThresholdsBelongTo(ThresholdsBelongToType t);
146 
147  const ThresholdsBelongToType& getThresholdsBelongTo() const { return m_threshholdsBelongTo; }
148 
149  const std::vector<ParameterValue*>& getThresholds() const;
150 
151  const std::vector<ParameterValue*>& getThresholdValues() const;
152 
153  private:
154 
155  ParameterValue* m_lookupValue; //!< Mandatory.
156  ParameterValue* m_value; //!< Mandatory.
157  std::vector<ParameterValue*> m_thresholds; //!< A vector of threshold. (Optional)
158  std::vector<ParameterValue*> m_thresholdValues; //!< A vector of threshold values. (Optional)
160  };
161 
162  } // end namespace se
163 } // end namespace te
164 
165 #endif // __TERRALIB_SE_INTERNAL_CATEGORIZE_H
The transformation of continuous values to distinct values (Categorize function). ...
Definition: Categorize.h:90
Symbology Encoding functions.
Definition: Function.h:65
ThresholdsBelongToType
It controls the interval order.
Definition: Categorize.h:99
const ThresholdsBelongToType & getThresholdsBelongTo() const
Definition: Categorize.h:147
The "ParameterValueType" uses WFS-Filter expressions to give values for SE graphic parameters...
URI C++ Library.
ParameterValue * getLookupValue() const
Definition: Categorize.h:135
std::vector< ParameterValue * > m_thresholdValues
A vector of threshold values. (Optional)
Definition: Categorize.h:158
std::vector< ParameterValue * > m_thresholds
A vector of threshold. (Optional)
Definition: Categorize.h:157
#define TESEEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:187
ParameterValue * getValue() const
Definition: Categorize.h:139
ThresholdsBelongToType m_threshholdsBelongTo
(Optional)
Definition: Categorize.h:159
Symbology Encoding functions.
ParameterValue * m_lookupValue
Mandatory.
Definition: Categorize.h:155
ParameterValue * m_value
Mandatory.
Definition: Categorize.h:156