1 /*# ---------------------------------------------------------------------
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
9 # This software is governed by the CeCILL-B license under French law and
10 # abiding by the rules of distribution of free software. You can use,
11 # modify and/ or redistribute the software under the terms of the CeCILL-B
12 # license as circulated by CEA, CNRS and INRIA at the following URL
13 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
14 # or in the file LICENSE.txt.
16 # As a counterpart to the access to the source code and rights to copy,
17 # modify and redistribute granted by the license, users are provided only
18 # with a limited warranty and the software's author, the holder of the
19 # economic rights, and the successive licensors have only limited
22 # The fact that you are presently reading this means that you have had
23 # knowledge of the CeCILL-B license and that you accept its terms.
24 # ------------------------------------------------------------------------ */
26 /*=========================================================================
29 Module: $RCSfile: wxChart.h,v $
31 Date: $Date: 2012/11/15 14:15:18 $
32 Version: $Revision: 1.2 $
34 Copyright: (c) 2002, 2003
37 This software is distributed WITHOUT ANY WARRANTY; without even
38 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
39 PURPOSE. See the above copyright notice for more information.
41 =========================================================================*/
43 #ifndef __WX__MARACAS__CHART__HXX__
44 #define __WX__MARACAS__CHART__HXX__
48 //---------------------------------------------------------------------
49 #define MAX_DATASET 10
63 wxDiameterPerimeter = 3,
64 wxMinimumDiameter = 4,
65 wxMaximumDiameter = 5,
66 wxAverageDiameter = 6,
71 //-------------------------------------------------------------------
72 class wxDataSet: public wxObject
78 int m_dataWidth; // Scaled|Fixed
81 int m_displayValues; // def=NONE |IN | OUT
88 // Constructor & Destructor
89 wxDataSet(wxPen *lStype, wxBrush *dStyle,
90 int dWidth, int lWidth, int dGap, int pMark,
92 wxDataSet(wxPen *lStype, wxBrush *dStyle,
93 wxString *lText, bool lDisplay=false);
98 void SetDataStyle(wxBrush* brush) { m_dataStyle = brush; }
99 void SetDataWidth(int width) { m_dataWidth = width; }
100 void SetLineStyle(wxPen* style) { m_lineStyle = style; }
101 void SetPointMark(int mark) { m_pointMark = mark; }
102 void SetText(wxString* string) { m_text = string;}
103 void Show(bool show) { m_display = show; }
106 bool GetShow() { return m_display; }
107 wxBrush* GetDataStyle() { return m_dataStyle; }
108 int GetDataWidth() { return m_dataWidth; }
109 wxPen* GetLineStyle() { return m_lineStyle; }
110 int GetPointMark() { return m_pointMark; }
111 wxString* GetText() { return m_text; }
114 //---------------------------------------------------------------
124 //----------------------------------------------------------------------
125 class wxChart: public wxPanel
131 Table m_table[MAX_DATASET][MAX_ITEM];
132 wxDataSet *m_dataSetArray[MAX_DATASET];
134 double m_MinX, m_MaxX;
135 double m_InfX, m_SupX, m_SupY;
137 double m_StepSizeX, m_StepSizeY, m_StepSizePer;
140 double m_MinorIncX, m_MajorIncX;
141 double m_MinorIncY, m_MajorIncY;
147 int m_MaxHauteur, m_MaxLargeur;
148 int m_CenterX, m_CenterY;
149 int m_EdgeTop, m_EdgeBottom, m_EdgeLeft, m_EdgeRight;
150 int m_Top,m_Bottom, m_Left, m_Right;
152 int m_EdgeTopLegend, m_EdgeBottomLegend, m_EdgeLeftLegend, m_EdgeRightLegend;
153 int m_TopLegend, m_BottomLegend, m_LeftLegend, m_RightLegend;
155 void DrawLine(wxDC &dc, int a);
156 void DrawFond(wxDC& dc);
157 void DrawAxe(wxDC& dc);
158 void DrawAxePer(wxDC& dc);
159 void DrawLegend(wxDC& dc, int nbr);
160 void DrawGrille(wxDC& dc);
162 void SetChartBounds();
163 void SetChartBoundsLegend();
164 void SetCadreLegend(int nbr, int* bottom);
168 double MinCol(double inf);
169 double MaxCol(double sup);
170 void SetInfX(double sup);
171 void SetSupX(double sup);
172 void SetSupY(double sup);
177 // Constructor et Destructor
178 wxChart(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition,
179 const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE,
180 const wxString& name = wxPanelNameStr);
183 void OnPaint(wxPaintEvent& event);
184 void OnLeftClick(wxDC &dc, double x, double y, int keys);
185 void OnRightClick(wxDC &dc, double x, double y, int keys);
188 bool IsEmpty(int a, int item);
189 double GetDataX(int a, int item);
190 double GetDataY(int a, int item);
191 void SetData(int a, int item, double x, double y);
193 void SetMinX(double MinX);
194 void SetMaxX(double MaxX);
195 void SetMaxWidthHeight(int x,int y);
196 void SetCenterChart(int x, int y);
197 void SetShowPer(bool per);
198 void SetMaxValue(double max);
199 void SetStepSizeX(double sizeX);
200 void SetStepSizeY(double sizeY);
201 void SetStepSizePer(double sizePer);
202 void SetNumDataSet(int NumDataSet);
203 void SetNumItem(int NumItem);
204 void SetIncAxisX(double minor, double major);
205 void SetIncAxisY(double minor, double major);
206 void SetEdgeTop(int top);
207 void SetEdgeBottom(int bottom);
208 void SetEdgeLeft(int left);
209 void SetEdgeRight(int right);
210 void SetEdgeTopLegend(int top);
211 void SetEdgeBottomLegend(int bottom);
212 void SetEdgeLeftLegend(int left);
213 void SetEdgeRightLegend(int right);
214 void ShowDataSet(bool show,int dataset);
216 bool GetShowDataSet(int dataset);
217 double GetMinX() { return m_MinX; }
218 double GetMaxX() { return m_MaxX; }
219 int GetMaxValue() { return (int)m_MaxValue; }
220 double GetStepSizeX() { return m_StepSizeX; }
221 double GetStepSizeY() { return m_StepSizeY; }
222 double GetStepSizePer() { return m_StepSizePer; }
223 int GetValueCol() { return m_ValueCol; }
224 int GetNumDataSet() { return m_NumDataSet; }
225 int GetNumItem() { return m_NumItem; }
226 bool GetShowPer() { return m_ShowPer; }
227 int GetLargeur() { return m_MaxLargeur; }
228 int GetHauteur() { return m_MaxHauteur; }
229 int GetEdgeTop() { return m_EdgeTop; }
230 int GetEdgeBottom() { return m_EdgeBottom; }
231 int GetEdgeLeft() { return m_EdgeLeft; }
232 int GetEdgeRight() { return m_EdgeRight; }
233 int GetEdgeTopLegend() { return m_EdgeTopLegend; }
234 int GetEdgeBottomLegend() { return m_EdgeBottomLegend; }
235 int GetEdgeLeftLegend() { return m_EdgeLeftLegend; }
236 int GetEdgeRightLegend() { return m_EdgeRightLegend; }
238 DECLARE_EVENT_TABLE()