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
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
Definition: RGBAColor.h:58
This class represents the informations needed to build map charts.
Definition: Chart.h:52
te::color::RGBAColor m_contourColor
The chart contour color.
Definition: Chart.h:142
const te::color::RGBAColor & getContourColor() const
const std::vector< size_t > & getPropertiesPos() const
std::string m_summary
The summary used in case 1 to n.
Definition: Chart.h:149
bool m_avoidConflicts
A flag that indicates if conflicts must be avoided.
Definition: Chart.h:148
std::size_t getWidth() const
Chart(ChartType type, const std::vector< std::string > &properties, const std::vector< te::color::RGBAColor > &colors)
It constructs a new Chart instance.
void setColor(std::size_t i, const te::color::RGBAColor &color)
bool isVisible() const
It gets the chart visibility.
double getMaxValue() const
ChartType m_type
The chart type.
Definition: Chart.h:138
std::size_t m_barWidth
The bar width for char Bar type (in pixels).
Definition: Chart.h:145
Chart(ChartType type, const std::vector< std::string > &properties)
It constructs a new Chart instance.
bool m_isVisible
A flag that indicates if the chart is visible.
Definition: Chart.h:146
void setVisibility(bool visible)
It sets the chart visibility.
std::size_t getBarWidth() const
std::vector< te::color::RGBAColor > m_colors
The color used to each property.
Definition: Chart.h:141
void setAvoidConflicts(bool on)
bool getAvoidConflicts() const
~Chart()
Destructor.
ChartType getType() const
void setPropertiesPos(const std::vector< size_t > &propPos)
const std::vector< std::string > & getProperties() const
Chart * clone()
std::size_t getHeight() const
const te::color::RGBAColor & getColor(std::size_t i) const
void setBarWidth(std::size_t width)
std::size_t getContourWidth() const
void setContourColor(const te::color::RGBAColor &color)
std::string getSummary() const
It gets the grouping summary. It is used only in case 1 to n.
void setSummary(const std::string &summary)
It gets the grouping summary. It is used only in case 1 to n.
std::vector< size_t > m_propertiesPos
The properties position.
Definition: Chart.h:140
void setHeight(std::size_t height)
std::vector< std::string > m_properties
The property names that will be used to generate the chart.
Definition: Chart.h:139
std::size_t m_height
The chart height (in pixels).
Definition: Chart.h:144
double m_maxValue
The max value of the chart.
Definition: Chart.h:147
void setMaxValue(double value)
std::size_t m_contourWidth
The chart contour width (in pixels).
Definition: Chart.h:143
void setContourWidth(std::size_t width)
ChartType
The chart types.
Definition: Enums.h:165
TerraLib.
#define TEMAPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:60
Proxy configuration file for TerraView (see terraview_config.h).
Enumerations of XML module.