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 
75  ChartType getType() const;
76 
77  const std::vector<std::string>& getProperties() const;
78 
79  const std::vector<size_t>& getPropertiesPos() const;
80 
81  void setPropertiesPos(const std::vector<size_t>& propPos);
82 
83  const te::color::RGBAColor& getColor(std::size_t i) const;
84 
85  void setColor(std::size_t i, const te::color::RGBAColor& color);
86 
87  const te::color::RGBAColor& getContourColor() const;
88 
89  void setContourColor(const te::color::RGBAColor& color);
90 
91  std::size_t getContourWidth() const;
92 
93  void setContourWidth(std::size_t width);
94 
95  std::size_t getHeight() const;
96 
97  void setHeight(std::size_t height);
98 
99  std::size_t getWidth() const;
100 
101  std::size_t getBarWidth() const;
102 
103  void setBarWidth(std::size_t width);
104 
105  void setMaxValue(double value);
106 
107  double getMaxValue() const;
108 
109  /*! \brief It gets the chart visibility. */
110  bool isVisible() const;
111 
112  /*!
113  \brief It sets the chart visibility.
114 
115  \param visible The visibility value.
116  */
117  void setVisibility(bool visible);
118 
119  void setAvoidConflicts(bool on);
120 
121  bool getAvoidConflicts() const;
122 
123  /*! \brief It gets the grouping summary. It is used only in case 1 to n.
124  */
125  std::string getSummary() const;
126 
127  /*!
128  \brief It gets the grouping summary. It is used only in case 1 to n.
129 
130  \param summary The summary mode. It can be: "MIN", "MAX", "SUM", "AVERAGE", "MEDIAN", "STDDEV" or "VARIANCE"
131  */
132  void setSummary(const std::string& summary);
133 
134  private:
135 
136  ChartType m_type; //!< The chart type.
137  std::vector<std::string> m_properties; //!< The property names that will be used to generate the chart.
138  std::vector<size_t> m_propertiesPos; //!< The properties position.
139  std::vector<te::color::RGBAColor> m_colors; //!< The color used to each property.
140  te::color::RGBAColor m_contourColor; //!< The chart contour color.
141  std::size_t m_contourWidth; //!< The chart contour width (in pixels).
142  std::size_t m_height; //!< The chart height (in pixels).
143  std::size_t m_barWidth; //!< The bar width for char Bar type (in pixels).
144  bool m_isVisible; //!< A flag that indicates if the chart is visible.
145  double m_maxValue; //!< The max value of the chart.
146  bool m_avoidConflicts; //!< A flag that indicates if conflicts must be avoided.
147  std::string m_summary; //!< The summary used in case 1 to n.
148  };
149 
150  } // end namespace map
151 } // end namespace te
152 
153 #endif // __TERRALIB_MAPTOOLS_INTERNAL_CHART_H
ChartType
The chart types.
Definition: Enums.h:164
std::size_t m_height
The chart height (in pixels).
Definition: Chart.h:142
double m_maxValue
The max value of the chart.
Definition: Chart.h:145
std::vector< te::color::RGBAColor > m_colors
The color used to each property.
Definition: Chart.h:139
std::size_t m_barWidth
The bar width for char Bar type (in pixels).
Definition: Chart.h:143
std::vector< std::string > m_properties
The property names that will be used to generate the chart.
Definition: Chart.h:137
This class represents the informations needed to build map charts.
Definition: Chart.h:51
ChartType m_type
The chart type.
Definition: Chart.h:136
te::color::RGBAColor m_contourColor
The chart contour color.
Definition: Chart.h:140
URI C++ Library.
#define TEMAPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:60
std::string m_summary
The summary used in case 1 to n.
Definition: Chart.h:147
bool m_isVisible
A flag that indicates if the chart is visible.
Definition: Chart.h:144
std::vector< size_t > m_propertiesPos
The properties position.
Definition: Chart.h:138
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
Definition: RGBAColor.h:57
std::size_t m_contourWidth
The chart contour width (in pixels).
Definition: Chart.h:141
bool m_avoidConflicts
A flag that indicates if conflicts must be avoided.
Definition: Chart.h:146