Chart.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/maptools/Chart.h
22 
23  \brief This class represents the informations needed to build map charts.
24 */
25 
26 #ifndef __TERRALIB_MAPTOOLS_INTERNAL_CHART_H
27 #define __TERRALIB_MAPTOOLS_INTERNAL_CHART_H
28 
29 // TerraLib
30 #include "../color/RGBAColor.h"
31 #include "Config.h"
32 #include "Enums.h"
33 
34 // STL
35 #include <string>
36 #include <vector>
37 
38 namespace te
39 {
40  namespace map
41  {
42  /*!
43  \class Chart
44 
45  \brief This class represents the informations needed to build map charts.
46 
47  \ingroup map
48 
49  \sa AbstractLayer
50  */
52  {
53  public:
54 
55  /*!
56  \brief It constructs a new Chart instance.
57 
58  \param type The chart type.
59  \param properties The property names that will be used to generate the chart.
60  */
61  Chart(ChartType type, const std::vector<std::string>& properties);
62 
63  /*!
64  \brief It constructs a new Chart instance.
65 
66  \param type The chart type.
67  \param properties The property names that will be used to generate the chart.
68  \param colors The colors that will be used to represent each property.
69  */
70  Chart(ChartType type, const std::vector<std::string>& properties, const std::vector<te::color::RGBAColor>& colors);
71 
72  /*! \brief Destructor. */
73  ~Chart();
74 
76 
77  ChartType getType() const;
78 
79  const std::vector<std::string>& getProperties() const;
80 
81  const std::vector<size_t>& getPropertiesPos() const;
82 
83  void setPropertiesPos(const std::vector<size_t>& propPos);
84 
85  const te::color::RGBAColor& getColor(std::size_t i) const;
86 
87  void setColor(std::size_t i, const te::color::RGBAColor& color);
88 
90 
92 
93  std::size_t getContourWidth() const;
94 
95  void setContourWidth(std::size_t width);
96 
97  std::size_t getHeight() const;
98 
99  void setHeight(std::size_t height);
100 
101  std::size_t getWidth() const;
102 
103  std::size_t getBarWidth() const;
104 
105  void setBarWidth(std::size_t width);
106 
107  void setMaxValue(double value);
108 
109  double getMaxValue() const;
110 
111  /*! \brief It gets the chart visibility. */
112  bool isVisible() const;
113 
114  /*!
115  \brief It sets the chart visibility.
116 
117  \param visible The visibility value.
118  */
119  void setVisibility(bool visible);
120 
121  void setAvoidConflicts(bool on);
122 
123  bool getAvoidConflicts() const;
124 
125  /*! \brief It gets the grouping summary. It is used only in case 1 to n.
126  */
127  std::string getSummary() const;
128 
129  /*!
130  \brief It gets the grouping summary. It is used only in case 1 to n.
131 
132  \param summary The summary mode. It can be: "MIN", "MAX", "SUM", "AVERAGE", "MEDIAN", "STDDEV" or "VARIANCE"
133  */
134  void setSummary(const std::string& summary);
135 
136  private:
137 
138  ChartType m_type; //!< The chart type.
139  std::vector<std::string> m_properties; //!< The property names that will be used to generate the chart.
140  std::vector<size_t> m_propertiesPos; //!< The properties position.
141  std::vector<te::color::RGBAColor> m_colors; //!< The color used to each property.
142  te::color::RGBAColor m_contourColor; //!< The chart contour color.
143  std::size_t m_contourWidth; //!< The chart contour width (in pixels).
144  std::size_t m_height; //!< The chart height (in pixels).
145  std::size_t m_barWidth; //!< The bar width for char Bar type (in pixels).
146  bool m_isVisible; //!< A flag that indicates if the chart is visible.
147  double m_maxValue; //!< The max value of the chart.
148  bool m_avoidConflicts; //!< A flag that indicates if conflicts must be avoided.
149  std::string m_summary; //!< The summary used in case 1 to n.
150  };
151 
152  } // end namespace map
153 } // end namespace te
154 
155 #endif // __TERRALIB_MAPTOOLS_INTERNAL_CHART_H
te::map::Chart::setMaxValue
void setMaxValue(double value)
te
TerraLib.
Definition: AddressGeocodingOp.h:52
te::map::Chart::getContourWidth
std::size_t getContourWidth() const
te::map::Chart::setSummary
void setSummary(const std::string &summary)
It gets the grouping summary. It is used only in case 1 to n.
te::map::Chart::setAvoidConflicts
void setAvoidConflicts(bool on)
te::map::Chart::getWidth
std::size_t getWidth() const
te::map::Chart::~Chart
~Chart()
Destructor.
te::map::Chart::setPropertiesPos
void setPropertiesPos(const std::vector< size_t > &propPos)
te::map::Chart::getBarWidth
std::size_t getBarWidth() const
te::map::Chart::getMaxValue
double getMaxValue() const
te::map::Chart::getAvoidConflicts
bool getAvoidConflicts() const
te::map::Chart::setVisibility
void setVisibility(bool visible)
It sets the chart visibility.
te::map::Chart::getHeight
std::size_t getHeight() const
te::map::Chart::setColor
void setColor(std::size_t i, const te::color::RGBAColor &color)
te::map::Chart::setHeight
void setHeight(std::size_t height)
te::map::Chart::m_contourColor
te::color::RGBAColor m_contourColor
The chart contour color.
Definition: Chart.h:142
te::map::Chart::setContourWidth
void setContourWidth(std::size_t width)
te::map::Chart::setBarWidth
void setBarWidth(std::size_t width)
te::map::ChartType
ChartType
The chart types.
Definition: Enums.h:165
te::map::Chart::Chart
Chart(ChartType type, const std::vector< std::string > &properties)
It constructs a new Chart instance.
te::map::Chart::m_barWidth
std::size_t m_barWidth
The bar width for char Bar type (in pixels).
Definition: Chart.h:145
te::map::Chart::m_colors
std::vector< te::color::RGBAColor > m_colors
The color used to each property.
Definition: Chart.h:141
te::map::Chart::m_summary
std::string m_summary
The summary used in case 1 to n.
Definition: Chart.h:149
te::map::Chart::Chart
Chart(ChartType type, const std::vector< std::string > &properties, const std::vector< te::color::RGBAColor > &colors)
It constructs a new Chart instance.
Enums.h
Enumerations of XML module.
te::map::Chart::isVisible
bool isVisible() const
It gets the chart visibility.
te::map::Chart
This class represents the informations needed to build map charts.
Definition: Chart.h:52
te::map::Chart::getColor
const te::color::RGBAColor & getColor(std::size_t i) const
te::map::Chart::m_properties
std::vector< std::string > m_properties
The property names that will be used to generate the chart.
Definition: Chart.h:139
te::map::Chart::getProperties
const std::vector< std::string > & getProperties() const
te::map::Chart::getPropertiesPos
const std::vector< size_t > & getPropertiesPos() const
te::map::Chart::getContourColor
const te::color::RGBAColor & getContourColor() const
te::map::Chart::m_avoidConflicts
bool m_avoidConflicts
A flag that indicates if conflicts must be avoided.
Definition: Chart.h:148
te::color::RGBAColor
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
Definition: RGBAColor.h:58
TEMAPEXPORT
#define TEMAPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:60
te::map::Chart::clone
Chart * clone()
te::map::Chart::getSummary
std::string getSummary() const
It gets the grouping summary. It is used only in case 1 to n.
te::map::Chart::m_contourWidth
std::size_t m_contourWidth
The chart contour width (in pixels).
Definition: Chart.h:143
te::map::Chart::setContourColor
void setContourColor(const te::color::RGBAColor &color)
te::map::Chart::m_isVisible
bool m_isVisible
A flag that indicates if the chart is visible.
Definition: Chart.h:146
Config.h
Proxy configuration file for TerraView (see terraview_config.h).
te::map::Chart::m_height
std::size_t m_height
The chart height (in pixels).
Definition: Chart.h:144
te::map::Chart::m_maxValue
double m_maxValue
The max value of the chart.
Definition: Chart.h:147
te::map::Chart::m_propertiesPos
std::vector< size_t > m_propertiesPos
The properties position.
Definition: Chart.h:140
te::map::Chart::m_type
ChartType m_type
The chart type.
Definition: Chart.h:138
te::map::Chart::getType
ChartType getType() const