All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Categorize.cpp
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.cpp
22 
23  \brief The transformation of continuous values to distinct values (Categorize function).
24 */
25 
26 // TerraLib
27 #include "../common/STLUtils.h"
28 #include "Categorize.h"
29 #include "ParameterValue.h"
30 
32  : m_lookupValue(0),
33  m_value(0),
34  m_threshholdsBelongTo(NONE)
35 {
36 }
37 
39  : m_lookupValue(0),
40  m_value(0),
41  m_threshholdsBelongTo(NONE)
42 {
43  if(rhs.m_lookupValue)
44  {
46  }
47 
48  if(rhs.m_value)
49  {
50  m_value = rhs.m_value->clone();
51  }
52 
53  for(size_t t = 0; t < rhs.m_thresholds.size(); ++t)
54  {
55  m_thresholds.push_back(rhs.m_thresholds[t]->clone());
56  }
57 
58  for(size_t t = 0; t < rhs.m_thresholdValues.size(); ++t)
59  {
60  m_thresholdValues.push_back(rhs.m_thresholdValues[t]->clone());
61  }
62 
64 
66 }
67 
69 {
70  delete m_lookupValue;
71  delete m_value;
72  te::common::FreeContents(m_thresholds);
73  te::common::FreeContents(m_thresholdValues);
74 }
75 
77 {
78  return new Categorize(*this);
79 }
80 
82 {
83  delete m_lookupValue;
84  m_lookupValue = v;
85 
86 }
87 
89 {
90  delete m_value;
91  m_value = v;
92 }
93 
95 {
96  m_thresholds.push_back(v);
97 }
98 
100 {
101  m_thresholdValues.push_back(v);
102 }
103 
105 {
106  m_threshholdsBelongTo = t;
107 }
108 
109 const std::vector<te::se::ParameterValue*>& te::se::Categorize::getThresholds() const
110 {
111  return m_thresholds;
112 }
113 
114 const std::vector<te::se::ParameterValue*>& te::se::Categorize::getThresholdValues() const
115 {
116  return m_thresholdValues;
117 }
118 
The transformation of continuous values to distinct values (Categorize function). ...
Categorize()
It initializes a new Categorize.
Definition: Categorize.cpp:31
The transformation of continuous values to distinct values (Categorize function). ...
Definition: Categorize.h:90
const std::string & getFallbackValue() const
Definition: Function.cpp:42
virtual Categorize * clone() const
It returns a clone of this object.
Definition: Categorize.cpp:76
ThresholdsBelongToType
It controls the interval order.
Definition: Categorize.h:99
The ParameterValueType uses WFS-Filter expressions to give values for SE graphic parameters.
void setLookupValue(ParameterValue *v)
Definition: Categorize.cpp:81
The "ParameterValueType" uses WFS-Filter expressions to give values for SE graphic parameters...
~Categorize()
Destructor.
Definition: Categorize.cpp:68
const std::vector< ParameterValue * > & getThresholds() const
Definition: Categorize.cpp:109
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
ParameterValue * clone() const
It creates a new copy of this object.
ThresholdsBelongToType m_threshholdsBelongTo
(Optional)
Definition: Categorize.h:159
void setValue(ParameterValue *v)
Definition: Categorize.cpp:88
ParameterValue * m_lookupValue
Mandatory.
Definition: Categorize.h:155
std::string m_fallbackValue
The value of the fallbackValue attribute is used as a default value, if the SE implementation does no...
Definition: Function.h:88
void FreeContents(boost::unordered_map< K, V * > &m)
This function can be applied to a map of pointers. It will delete each pointer in the map...
Definition: BoostUtils.h:55
void setThresholdsBelongTo(ThresholdsBelongToType t)
Definition: Categorize.cpp:104
void addThreshold(ParameterValue *v)
Definition: Categorize.cpp:94
ParameterValue * m_value
Mandatory.
Definition: Categorize.h:156
void addValue(ParameterValue *v)
Definition: Categorize.cpp:99
const std::vector< ParameterValue * > & getThresholdValues() const
Definition: Categorize.cpp:114