]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/include/wxChart.h
Support #1768 CREATIS Licence insertion
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / include / wxChart.h
1 /*# ---------------------------------------------------------------------
2 #
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
4 #                        pour la Sant�)
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
8 #
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.
15 #
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
20 #  liability.
21 #
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 # ------------------------------------------------------------------------ */
25
26 /*=========================================================================
27
28   Program:   wxMaracas
29   Module:    $RCSfile: wxChart.h,v $
30   Language:  C++
31   Date:      $Date: 2012/11/15 14:15:18 $
32   Version:   $Revision: 1.2 $
33
34   Copyright: (c) 2002, 2003
35   License:
36   
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.
40
41 =========================================================================*/
42
43 #ifndef __WX__MARACAS__CHART__HXX__
44 #define __WX__MARACAS__CHART__HXX__
45
46 #include <wx/wx.h>
47
48 //---------------------------------------------------------------------
49 #define MAX_DATASET   10
50 #define MAX_ITEM      50 
51 #define MARGE              5
52 #define MINOR_STEP    10
53 #define MAJOR_STEP     5
54 #define MAX_PER      200 
55 #define MINOR_PER     25
56 #define MAJOR_PER     50
57         
58 enum 
59 {
60   wxArea              = 0,
61   wxPerimeter         = 1,
62   wxDiameterArea      = 2, 
63   wxDiameterPerimeter = 3,
64   wxMinimumDiameter   = 4,
65   wxMaximumDiameter   = 5,
66   wxAverageDiameter   = 6,
67   wxStenosis          = 7
68 };
69
70
71 //-------------------------------------------------------------------
72 class wxDataSet: public wxObject
73 {
74  protected:
75    wxBrush  *m_dataStyle;
76    wxPen    *m_lineStyle;
77    wxString *m_text;
78    int       m_dataWidth;     // Scaled|Fixed
79    int       m_lineWidth;
80    int       m_pointMark;
81    int       m_displayValues; // def=NONE |IN | OUT 
82    bool      m_display;
83
84  public:
85    wxList *m_rowsList;
86  
87  public :
88    // Constructor & Destructor
89    wxDataSet(wxPen *lStype, wxBrush *dStyle,
90              int dWidth, int lWidth, int dGap, int pMark,
91              int disValues);
92    wxDataSet(wxPen *lStype, wxBrush *dStyle,
93              wxString *lText, bool lDisplay=false);
94    wxDataSet();
95    ~wxDataSet();
96  
97     // Set
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;  }
104    
105    // Get
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;       }
112    
113 };
114 //---------------------------------------------------------------
115
116
117 class Table
118 {
119   public :
120     double x,y;
121         bool   empty;
122 };
123
124 //----------------------------------------------------------------------
125 class wxChart: public wxPanel
126 {
127 private:
128         
129     int         m_NumDataSet;
130         int         m_NumItem;
131         Table       m_table[MAX_DATASET][MAX_ITEM];
132     wxDataSet  *m_dataSetArray[MAX_DATASET]; 
133  
134     double      m_MinX, m_MaxX;
135     double      m_InfX, m_SupX, m_SupY;
136         
137         double      m_StepSizeX, m_StepSizeY, m_StepSizePer;
138     double      m_MaxValue; 
139     
140         double      m_MinorIncX, m_MajorIncX;
141     double      m_MinorIncY, m_MajorIncY;
142
143     bool        m_ShowPer;
144
145         int         m_ValueCol;  
146
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;
151             
152     int         m_EdgeTopLegend, m_EdgeBottomLegend, m_EdgeLeftLegend, m_EdgeRightLegend;
153     int         m_TopLegend, m_BottomLegend, m_LeftLegend, m_RightLegend;
154         
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);
161         void        SetInitEdge();
162     void        SetChartBounds();
163         void        SetChartBoundsLegend();
164         void        SetCadreLegend(int nbr, int* bottom);
165     void        InitDataSet();
166     void        InitData();
167         double      MaxValue();
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);
173     void        InitChart();
174     int         GetShow();
175
176 public:
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);
181     ~wxChart();
182         
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);
186         
187         void    Draw(wxDC& dc);
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);
192     
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);
215         
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;  }
237         
238    DECLARE_EVENT_TABLE()
239 };
240
241
242
243 #endif 
244