]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotterLayer.h
ca89d1b30435ecf5f3095b7df39eb96c96b20aa7
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / pPlotter / pPlotterLayer.h
1
2 #ifndef __pPlotterLayer_h__
3 #define __pPlotterLayer_h__
4 // ----------------------------------------------------------------------------
5 // WX headers inclusion.
6 // For compilers that support precompilation, includes <wx/wx.h>.
7 // ----------------------------------------------------------------------------
8
9 #include <wx/wxprec.h>
10 #ifdef __BORLANDC__
11 #pragma hdrstop
12 #endif
13 #ifndef WX_PRECOMP
14 #include <wx/wx.h>
15 #endif
16
17
18 //----------------------------------------------------------------------------
19 // Includes
20 //----------------------------------------------------------------------------
21 #include "mathplot.h"
22 #include "pFunctionPoint.h"
23 #include <vector>
24
25 #define MAX_POINTS 50
26 #define MOVE 5
27
28
29 //using namespace std;
30 //----------------------------------------------------------------------------
31 // Class definition
32 //----------------------------------------------------------------------------
33 class creaMaracasVisu_EXPORT pPlotterLayer: public mpLayer 
34 {
35
36 public:
37         /** @param name  Label
38         @param flags Label alignment, pass one of #mpALIGN_NE, #mpALIGN_NW, #mpALIGN_SW, #mpALIGN_SE.
39         */
40         pPlotterLayer(wxString name = wxEmptyString, int flags = mpALIGN_NE);
41         /*
42          it define the first point of the polygon for be drawing
43          returs true if the first and second point of the polygon are setted
44         */
45         bool initializePolygon(wxPoint* points,double x1, double y1,double x2, double y2);
46         /*
47         Draw the line from (x1,y1) to (x2,y2) only passing by the 
48         positive points in the line
49         */
50 void draw(wxDC & dc,mpWindow & w,double x1,double y1,double x2,double y2);
51         
52         /**
53         * Draw the function with th spline points
54         *
55         */
56         void drawSplineCurve(wxDC & dc,mpWindow & w);
57         
58         /**
59         * Draw the line between the last point of the function
60         * and the position of the mouse
61         */
62         void drawLineToMousePoint(wxDC & dc,mpWindow & w);
63         /**
64         * Draw le lines between the points of the function
65         */
66         void drawFunction(wxDC & dc,mpWindow & w);
67         /**
68         *  Draw the points of the function
69         */
70         void drawPoints(wxDC & dc,mpWindow & w);
71         
72         /**
73          Get the value of the traslation
74         in the x-axis
75         */
76         virtual int getXTraslation()
77         {
78                 return -1;
79         }
80         /**
81          Get the type of the curve
82          1=normal function
83          2=Histogram
84         */
85         virtual int getmType()
86         {
87                 return -1;
88         }
89         /**
90         * get the maxShowed of the function in x and y
91         */
92         virtual void getMaxShowed(int & maxX, int &maxY)
93         {
94         }
95         /**
96         * get the minShowed of the function in x and y
97         */
98         virtual void getMinShowed(int & minX, int &minY)
99         {
100         }
101         
102         /**
103         Gets the x-offset of the zoom
104         in pixels
105         */
106         virtual int getOffsetPixelsXv(){return -1;}     
107         
108         
109         /**
110         Gets the Y-offset of the zoom
111         in pixels
112         */
113         virtual int getOffsetPixelsYv(){ return -1;}
114
115         
116         /*
117          returns the xSpline to plotter
118         */
119         virtual std::vector<double> getXSpline()
120         { 
121                 std::vector<double> v;
122                 return v;
123         }
124         /*
125          returns the ySpline to plotter
126         */
127         virtual std::vector<double> getYSpline()
128         { 
129                 std::vector<double> v;
130                 return v;
131         }
132
133         /**
134          Get the type of the curve
135          1=piecewise functio
136          2= smooth
137         */
138         virtual int vGetType()
139         { return -1;}
140
141
142         /**
143          Get _offsetX and _offsetY
144         */
145
146         virtual void getOffsets(int &offsetX,int &offSetY )
147         {}
148
149         /*
150         * Get the factor zoom
151         */
152         virtual void getFactorZoom(float & fz){}
153         /**
154         * if the function that is drawing is the actual
155         */
156         virtual void getIfActual(bool &actual){}
157         
158         
159         /**
160         * get the max of the function in x and y
161         */
162         virtual void getMax(int & maxX, int &maxY){}
163
164         /**
165         * Get screens of the function
166         */
167         virtual void  getScreens(int & scrX, int & scrY){}
168
169         /**
170         * Set screens value
171         */
172         virtual void setScreens(int scrX,int scrY){}
173
174         /**
175         * Let us know the scale of the function
176         */
177         virtual void getScales(double & scaleX,double & scaleY){}
178
179         /**
180         *Rewind the value of node
181         */
182         virtual void Rewind(){}
183
184         /** Get locus value for next N.
185         Override this function in your implementation.
186         @param x Returns X value
187         @param y Returns Y value
188         */
189         virtual bool GetNextXY(double & x, double & y){return false;}
190
191         /**
192         Get Point list of the funcion
193         @param return points
194         */
195         virtual void GetPoints(wxList &points){}
196
197         /** Layer plot handler.
198         This implementation will plot the locus in the visible area and
199         put a label according to the aligment specified.
200         */
201         virtual void Plot(wxDC & dc, mpWindow & w);
202         /**
203         Let us Know if the user want to see the points of the function
204         of other color than the color of the lines
205         */
206         virtual void ifShowPoints(bool & show){}
207
208         /**
209         * Let us Know if the user has finished the drawing
210         * that starts before.
211         */
212         virtual void getDrawing(bool &draw){}
213         /*
214         * Gets the point of the mouse where the user is
215         */
216         virtual void getMousePoint(int &x,int &y){}
217         /**
218         * this method gets the direction of the drawing
219         */
220         virtual void getDirection(bool &dir){}
221         /**
222         * Get the number of points of the function
223         */
224         virtual void getSize(int &size){};
225
226 protected:
227         int m_flags; //!< Holds label alignment
228         /*
229         * Points of the function thats is drawing
230         */
231         wxList points;
232         /*
233         * the scale in x, with wich it must draw
234         */
235         double scaleX;
236         /*
237         * the scale in y, with wich it must draw
238         */
239         double scaleY;
240
241         /**
242         * offset X
243         */
244         int offsetX;
245         
246         /**
247         * offset Y
248         */
249         int offsetY;
250         
251
252         DECLARE_CLASS (pPlotterLayer)
253 };
254
255 #endif
256
257