Pyrogenesis  trunk
CChart.h
Go to the documentation of this file.
1 /* Copyright (C) 2016 Wildfire Games.
2  * This file is part of 0 A.D.
3  *
4  * 0 A.D. is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * 0 A.D. is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef INCLUDED_CCHART
19 #define INCLUDED_CCHART
20 
21 #include "GUI.h"
22 #include "graphics/Color.h"
23 #include "maths/Vector2D.h"
24 #include <vector>
25 
26 
27 struct CChartData
28 {
30  std::vector<CVector2D> m_Points;
31 };
32 
33 /**
34  * Chart for a data visualization as lines or points
35  *
36  * @see IGUIObject
37  */
38 class CChart : public IGUIObject
39 {
41 
42 public:
43  CChart();
44  virtual ~CChart();
45 
46 protected:
47  /**
48  * @see IGUIObject#HandleMessage()
49  */
50  virtual void HandleMessage(SGUIMessage& Message);
51 
52  /**
53  * Draws the Chart
54  */
55  virtual void Draw();
56 
57  virtual CRect GetChartRect() const;
58 
59  void UpdateSeries();
60 
61  std::vector<CChartData> m_Series;
62 
63 private:
64  /**
65  * Helper function
66  */
67  void DrawLine(const CShaderProgramPtr& shader, const CColor& color, const std::vector<float>& vertices) const;
68 };
69 
70 #endif // INCLUDED_CCHART
Definition: Shapes.h:36
std::vector< CVector2D > m_Points
Definition: CChart.h:30
Base settings, all objects possess these settings in their m_BaseSettings Instructions can be found i...
Definition: IGUIObject.h:117
std::vector< CChartData > m_Series
Definition: CChart.h:61
Chart for a data visualization as lines or points.
Definition: CChart.h:38
void Draw(DrawCalls &Calls, float Z)
Definition: GUIRenderer.cpp:345
Definition: CChart.h:27
Message send to IGUIObject::HandleMessage() in order to give life to Objects manually with a derived ...
Definition: GUIbase.h:91
#define GUI_OBJECT(obj)
Definition: GUIbase.h:48
std::shared_ptr< CShaderProgram > CShaderProgramPtr
Definition: ShaderProgramPtr.h:25
Rectangle class used for screen rectangles.
Definition: Shapes.h:73
CColor m_Color
Definition: CChart.h:29