All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator 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 {
44  te::common::FreeContents(m_items);
45 }
46 
48 {
49  return m_propertyName;
50 }
51 
52 
53 void te::map::Grouping::setPropertyName(const std::string& name)
54 {
55  m_propertyName = name;
56 }
57 
59 {
60  return m_propertyType;
61 }
62 
64 {
65  m_propertyType = type;
66 }
67 
68 
70 {
71  return m_type;
72 }
73 
75 {
76  m_type = type;
77 }
78 
79 const size_t te::map::Grouping::getPrecision() const
80 {
81  return m_precision;
82 }
83 
84 void te::map::Grouping::setPrecision(size_t precision)
85 {
86  m_precision = precision;
87 }
88 
89 const size_t te::map::Grouping::getNumSlices() const
90 {
91  return m_numSlices;
92 }
93 
94 void te::map::Grouping::setNumSlices(size_t numSlices)
95 {
96  m_numSlices = numSlices;
97 }
98 
100 {
101  return m_stdDeviation;
102 }
103 
104 void te::map::Grouping::setStdDeviation(double stdDeviation)
105 {
106  m_stdDeviation = stdDeviation;
107 }
108 
109 const std::vector<te::map::GroupingItem*>& te::map::Grouping::getGroupingItems() const
110 {
111  return m_items;
112 }
113 
114 void te::map::Grouping::setGroupingItems(std::vector<te::map::GroupingItem*>& items)
115 {
116  m_items = items;
117 }
118 
120 {
121  return m_isVisible;
122 }
123 
125 {
126  m_isVisible = visible;
127 }
GroupingType
The grouping type associated to the layer.
Definition: Enums.h:150
const double getStdDeviation() const
It gets the standard deviation used in the Standard Deviation grouping.
Definition: Grouping.cpp:99
void setPrecision(size_t precision)
It sets the precision to be used for the property values.
Definition: Grouping.cpp:84
void setType(GroupingType type)
It sets the grouping type.
Definition: Grouping.cpp:74
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 setGroupingItems(std::vector< te::map::GroupingItem * > &items)
It sets the vector of grouping items.
Definition: Grouping.cpp:114
int getPropertyType() const
It gets the property type whose values will be grouped.
Definition: Grouping.cpp:58
void setNumSlices(size_t numSlices)
It sets the number of slices for the EqualSteps and Quantil groupings.
Definition: Grouping.cpp:94
bool isVisible() const
It gets the grouping visibility.
Definition: Grouping.cpp:119
void setVisibility(bool visible)
It sets the grouping visibility.
Definition: Grouping.cpp:124
Grouping(const std::string &propertyName, GroupingType type, size_t precision=6)
It constructs a new Grouping instance.
Definition: Grouping.cpp:33
const size_t getNumSlices() const
It gets the number of slices used in the Equal Steps and Quantil groupings.
Definition: Grouping.cpp:89
std::string getPropertyName() const
It gets the property name whose values will be grouped.
Definition: Grouping.cpp:47
void setPropertyName(const std::string &name)
It sets the property name whose values will be grouped.
Definition: Grouping.cpp:53
const size_t getPrecision() const
It gets the precision used for the property values.
Definition: Grouping.cpp:79
void setStdDeviation(double stdDeviation)
It sets the standard deviation for the Standard Deviation grouping.
Definition: Grouping.cpp:104
~Grouping()
Destructor.
Definition: Grouping.cpp:42
This class contains the parameters needed for grouping the values of a Property.
int m_propertyType
The property type whose values will be used to make the grouping.
Definition: Grouping.h:186
void setPropertyType(const int &type)
It sets the property type whose values will be grouped.
Definition: Grouping.cpp:63
const std::vector< te::map::GroupingItem * > & getGroupingItems() const
It gets the vector of grouping items.
Definition: Grouping.cpp:109
const GroupingType getType() const
It gets the grouping type.
Definition: Grouping.cpp:69