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 # ------------------------------------------------------------------------ */
30 //-----------------------------------------------------------------
32 #pragma interface "chart.h"
39 //---------------------------------------------------------------------
40 #include "wx/wxprec.h"
46 //---------------------------------------------------------------------
47 #define MAX_DATASET 10
61 wxDiameterPerimeter = 3,
62 wxMinimumDiameter = 4,
63 wxMaximumDiameter = 5,
64 wxAverageDiameter = 6,
69 //-------------------------------------------------------------------
70 class wxDataSet: public wxObject
76 int m_dataWidth; // Scaled|Fixed
79 int m_displayValues; // def=NONE |IN | OUT
86 // Constructor & Destructor
87 wxDataSet(wxPen *lStype, wxBrush *dStyle,
88 int dWidth, int lWidth, int dGap, int pMark,
90 wxDataSet(wxPen *lStype, wxBrush *dStyle,
91 wxString *lText, bool lDisplay=false);
96 void SetDataStyle(wxBrush* brush) { m_dataStyle = brush;}
97 void SetDataWidth(int width) { m_dataWidth = width;}
98 void SetLineStyle(wxPen* style) { m_lineStyle = style;}
99 void SetPointMark(int mark) { m_pointMark = mark; }
100 void SetText(wxString* string) { m_text = string; }
101 void Show(bool show) { m_display=show; }
104 bool GetShow() { return m_display; }
105 wxBrush* GetDataStyle() { return m_dataStyle; }
106 int GetDataWidth() { return m_dataWidth; }
107 wxPen* GetLineStyle() { return m_lineStyle; }
108 int GetPointMark() { return m_pointMark; }
109 wxString* GetText() { return m_text; }
112 //---------------------------------------------------------------
122 //----------------------------------------------------------------------
123 class wxChart: public wxWindow
129 Table m_table[MAX_DATASET][MAX_ITEM];
130 wxDataSet *m_dataSetArray[MAX_DATASET];
132 double m_MinX, m_MaxX;
133 double m_InfX, m_SupX, m_SupY;
135 double m_StepSizeX, m_StepSizeY, m_StepSizePer;
141 int m_MaxHauteur, m_MaxLargeur;
142 int m_CenterX, m_CenterY;
143 int m_EdgeTop, m_EdgeBottom, m_EdgeLeft, m_EdgeRight;
144 int m_Top,m_Bottom, m_Left, m_Right;
146 int m_EdgeTopLegend, m_EdgeBottomLegend, m_EdgeLeftLegend, m_EdgeRightLegend;
147 int m_TopLegend, m_BottomLegend, m_LeftLegend, m_RightLegend;
149 double m_MinorIncX, m_MajorIncX;
150 double m_MinorIncY, m_MajorIncY;
152 void DrawLine(wxDC &dc, int a);
153 void DrawFond(wxDC& dc);
154 void DrawAxe(wxDC& dc);
155 void DrawAxePer(wxDC& dc);
156 void DrawLegend(wxDC& dc, int nbr);
157 void DrawGrille(wxDC& dc);
159 void SetChartBounds();
160 void SetChartBoundsLegend();
161 void SetCadreLegend(int nbr, int* bottom);
165 double MinCol(double inf);
166 double MaxCol(double sup);
167 void SetInfX(double sup);
168 void SetSupX(double sup);
169 void SetSupY(double sup);
174 // Constructor et Destructor
175 wxChart(wxFrame *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition,
176 const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE,
177 const wxString& name = wxPanelNameStr);
180 void OnPaint(wxPaintEvent& event);
181 void OnLeftClick(wxDC &dc, double x, double y, int keys);
182 void OnRightClick(wxDC &dc, double x, double y, int keys);
185 bool IsEmpty(int a, int item);
186 double GetDataX(int a, int item);
187 double GetDataY(int a, int item);
188 void SetData(int a, int item, double x, double y);
190 void SetMinX(double MinX);
191 void SetMaxX(double MaxX);
192 void SetMaxWidthHeight(int x,int y);
193 void SetCenterChart(int x, int y);
194 void SetShowPer(bool per);
195 void SetMaxValue(double max);
196 void SetStepSizeX(double sizeX);
197 void SetStepSizeY(double sizeY);
198 void SetStepSizePer(double sizePer);
199 void SetNumDataSet(int NumDataSet);
200 void SetNumItem(int NumItem);
201 void SetIncAxisX(double minor, double major);
202 void SetIncAxisY(double minor, double major);
203 void SetEdgeTop(int top);
204 void SetEdgeBottom(int bottom);
205 void SetEdgeLeft(int left);
206 void SetEdgeRight(int right);
207 void SetEdgeTopLegend(int top);
208 void SetEdgeBottomLegend(int bottom);
209 void SetEdgeLeftLegend(int left);
210 void SetEdgeRightLegend(int right);
211 void ShowDataSet(bool show,int dataset);
213 double GetMinX() { return m_MinX; }
214 double GetMaxX() { return m_MaxX; }
215 int GetMaxValue() { return m_MaxValue; }
216 double GetStepSizeX() { return m_StepSizeX; }
217 double GetStepSizeY() { return m_StepSizeY; }
218 double GetStepSizePer() { return m_StepSizePer;}
219 int GetValueCol() { return m_ValueCol; }
220 int GetNumDataSet() { return m_NumDataSet; }
221 int GetNumItem() { return m_NumItem; }
222 bool GetShowPer() { return m_ShowPer; }
223 int GetLargeur() { return m_MaxLargeur; }
224 int GetHauteur() { return m_MaxHauteur; }
225 int GetEdgeTop() { return m_EdgeTop; }
226 int GetEdgeBottom() { return m_EdgeBottom; }
227 int GetEdgeLeft() { return m_EdgeLeft; }
228 int GetEdgeRight() { return m_EdgeRight; }
229 int GetEdgeTopLegend() { return m_EdgeTopLegend; }
230 int GetEdgeBottomLegend() { return m_EdgeBottomLegend; }
231 int GetEdgeLeftLegend() { return m_EdgeLeftLegend; }
232 int GetEdgeRightLegend() { return m_EdgeRightLegend; }
233 bool GetShowDataSet(int dataset);
235 DECLARE_EVENT_TABLE()