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 # ------------------------------------------------------------------------ */
27 #ifndef __pPlotterLayer_h__
28 #define __pPlotterLayer_h__
29 // ----------------------------------------------------------------------------
30 // WX headers inclusion.
31 // For compilers that support precompilation, includes <wx/wx.h>.
32 // ----------------------------------------------------------------------------
34 #include <wx/wxprec.h>
43 //----------------------------------------------------------------------------
45 //----------------------------------------------------------------------------
47 #include "pFunctionPoint.h"
54 //using namespace std;
55 //----------------------------------------------------------------------------
57 //----------------------------------------------------------------------------
58 class creaMaracasVisu_EXPORT pPlotterLayer: public mpLayer
63 @param flags Label alignment, pass one of #mpALIGN_NE, #mpALIGN_NW, #mpALIGN_SW, #mpALIGN_SE.
65 pPlotterLayer(wxString name = wxEmptyString, int flags = mpALIGN_NE);
67 it define the first point of the polygon for be drawing
68 returs true if the first and second point of the polygon are setted
70 bool initializePolygon(wxPoint* points,double x1, double y1,double x2, double y2);
72 Draw the line from (x1,y1) to (x2,y2) only passing by the
73 positive points in the line
75 void draw(wxDC & dc,mpWindow & w,double x1,double y1,double x2,double y2, int orgy);
78 * Draw the function with th spline points
81 void drawSplineCurve(wxDC & dc,mpWindow & w, int orgy);
84 * Draw the line between the last point of the function
85 * and the position of the mouse
87 void drawLineToMousePoint(wxDC & dc,mpWindow & w, int orgy);
89 * Draw le lines between the points of the function
91 void drawFunction(wxDC & dc,mpWindow & w, int orgy);
93 * Draw the points of the function
95 void drawPoints(wxDC & dc,mpWindow & w, int orgy );
98 Get the value of the traslation
101 virtual int getXTraslation()
106 Get the type of the curve
110 virtual int getmType()
115 * get the maxShowed of the function in x and y
117 virtual void getMaxShowed(int & maxX, int &maxY)
121 * get the minShowed of the function in x and y
123 virtual void getMinShowed(int & minX, int &minY)
128 Gets the x-offset of the zoom
131 virtual int getOffsetPixelsXv(){return -1;}
135 Gets the Y-offset of the zoom
138 virtual int getOffsetPixelsYv(){ return -1;}
142 returns the xSpline to plotter
144 virtual std::vector<double> getXSpline()
146 std::vector<double> v;
150 returns the ySpline to plotter
152 virtual std::vector<double> getYSpline()
154 std::vector<double> v;
159 Get the type of the curve
163 virtual int vGetType()
168 Get _offsetX and _offsetY
171 virtual void getOffsets(int &offsetX,int &offSetY )
175 * Get the factor zoom
177 virtual void getFactorZoom(float & fz){}
179 * if the function that is drawing is the actual
181 virtual void getIfActual(bool &actual){}
185 * get the max of the function in x and y
187 virtual void getMax(int & maxX, int &maxY){}
190 * Get screens of the function
192 virtual void getScreens(int & scrX, int & scrY){}
197 virtual void setScreens(int scrX,int scrY){}
200 * Let us know the scale of the function
202 virtual void getScales(double & scaleX,double & scaleY){}
205 *Rewind the value of node
207 virtual void Rewind(){}
209 /** Get locus value for next N.
210 Override this function in your implementation.
211 @param x Returns X value
212 @param y Returns Y value
214 virtual bool GetNextXY(double & x, double & y){return false;}
216 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
217 #if wxMAJOR_VERSION <= 2
219 Get Point list of the funcion
222 virtual void GetPoints(wxList &points){}
225 Get Point list of the funcion
228 virtual wxList* GetPointsPtr(){ }
232 /** Layer plot handler.
233 This implementation will plot the locus in the visible area and
234 put a label according to the aligment specified.
236 virtual void Plot(wxDC & dc, mpWindow & w);
238 Let us Know if the user want to see the points of the function
239 of other color than the color of the lines
241 virtual void ifShowPoints(bool & show){}
244 * Let us Know if the user has finished the drawing
245 * that starts before.
247 virtual void getDrawing(bool &draw){}
249 * Gets the point of the mouse where the user is
251 virtual void getMousePoint(int &x,int &y){}
253 * this method gets the direction of the drawing
255 virtual void getDirection(bool &dir){}
257 * Get the number of points of the function
259 virtual void getSize(int &size){};
262 int m_flags; //!< Holds label alignment
264 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
265 #if wxMAJOR_VERSION <= 2
267 * Points of the function thats is drawing
271 // use GetPointsPtr()
275 * the scale in x, with wich it must draw
279 * the scale in y, with wich it must draw
294 DECLARE_CLASS (pPlotterLayer)