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