]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/chart.h
BUG macOs
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / chart.h
1 #ifndef wx_chart_h
2 #define wx_chart_h
3
4
5 //-----------------------------------------------------------------
6 #ifdef __GNUG__
7     #pragma interface "chart.h"
8 #endif
9
10 #ifdef __BORLANDC__
11         #pragma hdrstop
12 #endif
13
14 //---------------------------------------------------------------------
15 #include "wx/wxprec.h"
16 #ifndef WX_PRECOMP
17         #include "wx/wx.h"
18 #endif
19
20
21 //---------------------------------------------------------------------
22 #define MAX_DATASET   10
23 #define MAX_ITEM      50 
24 #define MARGE              5
25 #define MINOR_STEP    10
26 #define MAJOR_STEP     5
27 #define MAX_PER      200 
28 #define MINOR_PER     25
29 #define MAJOR_PER     50
30         
31 enum 
32 {
33   wxArea              = 0,
34   wxPerimeter         = 1,
35   wxDiameterArea      = 2, 
36   wxDiameterPerimeter = 3,
37   wxMinimumDiameter   = 4,
38   wxMaximumDiameter   = 5,
39   wxAverageDiameter   = 6,
40   wxStenosis          = 7
41 };
42
43
44 //-------------------------------------------------------------------
45 class wxDataSet: public wxObject
46 {
47  protected:
48    wxBrush  *m_dataStyle;
49    wxPen    *m_lineStyle;
50    wxString *m_text;
51    int       m_dataWidth;     // Scaled|Fixed
52    int       m_lineWidth;
53    int       m_pointMark;
54    int       m_displayValues; // def=NONE |IN | OUT 
55    bool      m_display;
56
57  public:
58    wxList *m_rowsList;
59  
60  public :
61    // Constructor & Destructor
62    wxDataSet(wxPen *lStype, wxBrush *dStyle,
63              int dWidth, int lWidth, int dGap, int pMark,
64              int disValues);
65    wxDataSet(wxPen *lStype, wxBrush *dStyle,
66              wxString *lText, bool lDisplay=false);
67    wxDataSet();
68    ~wxDataSet();
69  
70     // Set
71    void SetDataStyle(wxBrush* brush)  { m_dataStyle = brush;}
72    void SetDataWidth(int width)       { m_dataWidth = width;}
73    void SetLineStyle(wxPen* style)    { m_lineStyle = style;}
74    void SetPointMark(int mark)        { m_pointMark = mark; }
75    void SetText(wxString* string)     { m_text = string;    }
76    void Show(bool show)               { m_display=show;     }
77    
78    // Get
79    bool      GetShow()      { return m_display;   }
80    wxBrush*  GetDataStyle() { return m_dataStyle; }
81    int       GetDataWidth() { return m_dataWidth; }
82    wxPen*    GetLineStyle() { return m_lineStyle; }
83    int       GetPointMark() { return m_pointMark; }
84    wxString* GetText()      { return m_text;      }
85    
86 };
87 //---------------------------------------------------------------
88
89
90 class Table
91 {
92   public :
93     double x,y;
94         bool   empty;
95 };
96
97 //----------------------------------------------------------------------
98 class wxChart: public wxWindow
99 {
100 private:
101         
102     int         m_NumDataSet;
103         int         m_NumItem;
104         Table       m_table[MAX_DATASET][MAX_ITEM];
105     wxDataSet  *m_dataSetArray[MAX_DATASET]; 
106  
107     double  m_MinX, m_MaxX;
108     double  m_InfX, m_SupX, m_SupY;
109         
110         double  m_StepSizeX, m_StepSizeY, m_StepSizePer;
111     double  m_MaxValue; 
112     
113         int     m_ValueCol;      
114     bool    m_ShowPer;
115
116         int     m_MaxHauteur, m_MaxLargeur;
117     int     m_CenterX, m_CenterY;
118         int     m_EdgeTop, m_EdgeBottom, m_EdgeLeft, m_EdgeRight;
119     int     m_Top,m_Bottom, m_Left, m_Right;
120             
121     int     m_EdgeTopLegend, m_EdgeBottomLegend, m_EdgeLeftLegend, m_EdgeRightLegend;
122     int     m_TopLegend, m_BottomLegend, m_LeftLegend, m_RightLegend;
123         
124         double  m_MinorIncX, m_MajorIncX;
125     double  m_MinorIncY, m_MajorIncY;
126
127         void    DrawLine(wxDC &dc, int a);
128         void    DrawFond(wxDC& dc);
129     void    DrawAxe(wxDC& dc);
130     void    DrawAxePer(wxDC& dc);
131         void    DrawLegend(wxDC& dc, int nbr);
132         void    DrawGrille(wxDC& dc);
133         void    SetInitEdge();
134     void    SetChartBounds();
135         void    SetChartBoundsLegend();
136         void    SetCadreLegend(int nbr, int* bottom);
137     void    InitDataSet();
138     void    InitData();
139         double  MaxValue();
140         double  MinCol(double inf);
141     double  MaxCol(double sup);
142     void    SetInfX(double sup);
143         void    SetSupX(double sup);
144         void    SetSupY(double sup);
145     void    InitChart();
146     int     GetShow();
147
148 public:
149         // Constructor et Destructor
150         wxChart(wxFrame *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition,
151                 const wxSize& size = wxDefaultSize, long  style = wxDEFAULT_FRAME_STYLE,
152                 const wxString& name = wxPanelNameStr);
153     ~wxChart();
154         
155         void    OnPaint(wxPaintEvent& event);
156         void    OnLeftClick(wxDC &dc, double x, double y, int keys);
157         void    OnRightClick(wxDC &dc, double x, double y, int keys);
158         
159         void    Draw(wxDC& dc);
160         bool    IsEmpty(int a, int item);
161         double  GetDataX(int a, int item);
162         double  GetDataY(int a, int item);
163     void    SetData(int a, int item, double x, double y);
164     
165     void    SetMinX(double MinX);
166         void    SetMaxX(double MaxX);
167         void    SetMaxWidthHeight(int x,int y); 
168         void    SetCenterChart(int x, int y);
169         void    SetShowPer(bool per);
170         void    SetMaxValue(double max);
171         void    SetStepSizeX(double sizeX);
172     void    SetStepSizeY(double sizeY);
173     void    SetStepSizePer(double sizePer);
174     void    SetNumDataSet(int NumDataSet);
175         void    SetNumItem(int NumItem);
176         void    SetIncAxisX(double minor, double major);
177     void    SetIncAxisY(double minor, double major);
178     void    SetEdgeTop(int top);
179         void    SetEdgeBottom(int bottom);
180         void    SetEdgeLeft(int left);
181         void    SetEdgeRight(int right);
182     void    SetEdgeTopLegend(int top);
183         void    SetEdgeBottomLegend(int bottom);
184         void    SetEdgeLeftLegend(int left);
185         void    SetEdgeRightLegend(int right);
186         void    ShowDataSet(bool show,int dataset);
187         
188         double  GetMinX()          { return m_MinX;       }
189     double  GetMaxX()          { return m_MaxX;       }
190         int     GetMaxValue()      { return m_MaxValue;   }
191         double  GetStepSizeX()     { return m_StepSizeX;  }
192     double  GetStepSizeY()     { return m_StepSizeY;  }
193     double  GetStepSizePer()   { return m_StepSizePer;}
194     int     GetValueCol()      { return m_ValueCol;   }
195     int     GetNumDataSet()    { return m_NumDataSet; }
196         int     GetNumItem()       { return m_NumItem;    }
197         bool    GetShowPer()       { return m_ShowPer;    }
198         int     GetLargeur()       { return m_MaxLargeur; }
199     int     GetHauteur()       { return m_MaxHauteur; }
200         int     GetEdgeTop()       { return m_EdgeTop;    }
201     int     GetEdgeBottom()    { return m_EdgeBottom; }
202     int     GetEdgeLeft()      { return m_EdgeLeft;   }
203     int     GetEdgeRight()     { return m_EdgeRight;  }
204         int     GetEdgeTopLegend()    { return m_EdgeTopLegend;    }
205     int     GetEdgeBottomLegend() { return m_EdgeBottomLegend; }
206     int     GetEdgeLeftLegend()   { return m_EdgeLeftLegend;   }
207     int     GetEdgeRightLegend()  { return m_EdgeRightLegend;  }
208         bool    GetShowDataSet(int dataset);
209   
210    DECLARE_EVENT_TABLE()
211 };
212
213 #endif // wx_chart_h