All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Grouping.cpp
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 Grouping.cpp
22 
23  \brief This class contains the parameters needed for grouping the values of a Property.
24 */
25 
26 // TerraLib
27 #include "../common/STLUtils.h"
28 #include "../datatype/Enums.h"
29 #include "Grouping.h"
30 #include "GroupingItem.h"
31 
32 
33 te::map::Grouping::Grouping(const std::string& propertyName, te::map::GroupingType type, size_t precision)
34  : m_propertyName(propertyName),
35  m_type(type),
36  m_precision(precision),
37  m_isVisible(true)
38 {
40 }
41 
43  : m_propertyName(rhs.m_propertyName),
44  m_type((te::map::GroupingType)rhs.m_propertyType),
45  m_precision(rhs.m_precision),
46  m_isVisible(true)
47 {
50 
51  std::vector<te::map::GroupingItem*> items;
52  for(std::size_t i = 0; i < rhs.m_items.size(); ++i)
53  {
55  items.push_back(item);
56  }
57 
58  setGroupingItems(items);
59 }
60 
62 {
63  te::common::FreeContents(m_items);
64 }
65 
67 {
68  return m_propertyName;
69 }
70 
71 
72 void te::map::Grouping::setPropertyName(const std::string& name)
73 {
74  m_propertyName = name;
75 }
76 
78 {
79  return m_propertyType;
80 }
81 
83 {
84  m_propertyType = type;
85 }
86 
87 
89 {
90  return m_type;
91 }
92 
94 {
95  m_type = type;
96 }
97 
98 const size_t te::map::Grouping::getPrecision() const
99 {
100  return m_precision;
101 }
102 
103 void te::map::Grouping::setPrecision(size_t precision)
104 {
105  m_precision = precision;
106 }
107 
109 {
110  return m_numSlices;
111 }
112 
113 void te::map::Grouping::setNumSlices(size_t numSlices)
114 {
115  m_numSlices = numSlices;
116 }
117 
119 {
120  return m_stdDeviation;
121 }
122 
123 void te::map::Grouping::setStdDeviation(double stdDeviation)
124 {
125  m_stdDeviation = stdDeviation;
126 }
127 
128 const std::vector<te::map::GroupingItem*>& te::map::Grouping::getGroupingItems() const
129 {
130  return m_items;
131 }
132 
133 void te::map::Grouping::setGroupingItems(std::vector<te::map::GroupingItem*>& items)
134 {
135  m_items = items;
136 
137  m_numSlices = m_items.size();
138 }
139 
141 {
142  return m_isVisible;
143 }
144 
146 {
147  m_isVisible = visible;
148 }
void setPrecision(size_t precision)
It sets the precision to be used for the property values.
Definition: Grouping.cpp:103
const double getStdDeviation() const
It gets the standard deviation used in the Standard Deviation grouping.
Definition: Grouping.cpp:118
int getPropertyType() const
It gets the property type whose values will be grouped.
Definition: Grouping.cpp:77
~Grouping()
Destructor.
Definition: Grouping.cpp:61
void setGroupingItems(std::vector< te::map::GroupingItem * > &items)
It sets the vector of grouping items.
Definition: Grouping.cpp:133
const size_t getPrecision() const
It gets the precision used for the property values.
Definition: Grouping.cpp:98
std::string getPropertyName() const
It gets the property name whose values will be grouped.
Definition: Grouping.cpp:66
void setStdDeviation(double stdDeviation)
It sets the standard deviation for the Standard Deviation grouping.
Definition: Grouping.cpp:123
This class contains the parameters needed for grouping the values of a Property.
Definition: Grouping.h:59
void setPropertyName(const std::string &name)
It sets the property name whose values will be grouped.
Definition: Grouping.cpp:72
void setNumSlices(size_t numSlices)
It sets the number of slices for the EqualSteps and Quantil groupings.
Definition: Grouping.cpp:113
A GroupingItem contains information about a grouping item associated to a layer.
Definition: GroupingItem.h:48
void setPropertyType(const int &type)
It sets the property type whose values will be grouped.
Definition: Grouping.cpp:82
void setVisibility(bool visible)
It sets the grouping visibility.
Definition: Grouping.cpp:145
int m_propertyType
The property type whose values will be used to make the grouping.
Definition: Grouping.h:189
double m_stdDeviation
The standard deviation used in the Standard Deviation grouping.
Definition: Grouping.h:193
bool isVisible() const
It gets the grouping visibility.
Definition: Grouping.cpp:140
std::vector< te::map::GroupingItem * > m_items
The vector of grouping items.
Definition: Grouping.h:195
const std::vector< te::map::GroupingItem * > & getGroupingItems() const
It gets the vector of grouping items.
Definition: Grouping.cpp:128
GroupingType
The grouping type associated to the layer.
Definition: Enums.h:150
Grouping(const std::string &propertyName, GroupingType type, size_t precision=6)
It constructs a new Grouping instance.
Definition: Grouping.cpp:33
const GroupingType getType() const
It gets the grouping type.
Definition: Grouping.cpp:88
size_t m_numSlices
The number of slices used in the Equal Steps and Quantil groupings.
Definition: Grouping.h:192
This class contains the parameters needed for grouping the values of a Property.
const size_t getNumSlices() const
It gets the number of slices used in the Equal Steps and Quantil groupings.
Definition: Grouping.cpp:108
void setType(GroupingType type)
It sets the grouping type.
Definition: Grouping.cpp:93
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