]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotterLayer.cxx
#3472 TDx
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / pPlotter / pPlotterLayer.cxx
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 // Class definition include
28 //----------------------------------------------------------------------------
29 #include "pPlotterLayer.h"
30
31 // ----------------------------------------------------------------------------
32 // WX headers inclusion.
33 // For compilers that support precompilation, includes <wx/wx.h>.
34 // ----------------------------------------------------------------------------
35
36 #ifndef WX_PRECOMP
37 #include <wx/wx.h>
38 #endif
39
40 #include <vector>
41 #include <fstream>
42 #include <iostream>
43 //----------------------------------------------------------------------------
44 // Class implementation
45 //----------------------------------------------------------------------------
46
47 IMPLEMENT_ABSTRACT_CLASS(pPlotterLayer, mpLayer)
48 //----------------------------------------------------------------------------
49 // Methods
50 //----------------------------------------------------------------------------
51
52 /** 
53 *@param name  Label
54 *@param flags Label alignment, pass one of #mpALIGN_NE, #mpALIGN_NW, #mpALIGN_SW, #mpALIGN_SE.
55 */
56 pPlotterLayer:: pPlotterLayer(wxString name , int flags )
57 {
58         SetName(name);
59         m_flags = flags;
60 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
61 #if wxMAJOR_VERSION <= 2
62         points.DeleteContents(TRUE);
63 #else
64         // ...
65 #endif
66         offsetX = 0;
67         offsetY = 0;
68 }
69
70 /*
71 Draw the line from (x1,y1) to (x2,y2) only passing by the 
72 positive points in the line
73 */
74 void  pPlotterLayer::draw(wxDC & dc,mpWindow & w,double x1,double y1,double x2,double y2, int orgy)
75 {
76         
77         //intercepts
78         float m=((float)(y2-y1))/(x2-x1);
79         float x0=-y1/m+x1;
80         float y0=-m*x1+y1;      
81
82         double sizedc = dc.GetSize().GetHeight()-orgy;
83
84         //analyzing the curve
85
86                 if(x1<=0 && x2>=0)
87                 {
88                         if(y2>=0 && y1>=0)
89                                         dc.DrawLine(0,GetYTranslated(sizedc,y0), x2,GetYTranslated(sizedc,y2));
90
91                         else if(y2<=0 && y1>=0)
92                         {
93                                 if(y0>=0 && x0>=0)
94                                         dc.DrawLine(0,GetYTranslated(sizedc,y0),x0,GetYTranslated(sizedc,0) );
95                         }
96                         else if(y2>=0 && y1<=0)
97                         {
98                                 if(y0>=0) 
99                                 dc.DrawLine(0,GetYTranslated(sizedc,y0),x2,GetYTranslated(sizedc,y2) );
100                         }
101         
102                 }
103
104                 if(x1>=0 && x2>=0)
105                 {
106                         if(y1>=0 && y2>=0 )
107                                 dc.DrawLine(x1,GetYTranslated(sizedc,y1), x2,GetYTranslated(sizedc,y2));
108                         else if(y1>=0 && y2<=0)
109                                 dc.DrawLine(x1,GetYTranslated(sizedc,y1),x0,GetYTranslated(sizedc,0) );
110                         else if(y1<=0 && y2>=0) 
111                                         dc.DrawLine(x0,GetYTranslated(sizedc,0),x2,GetYTranslated(sizedc,y2));
112                 }
113                 
114                 
115 }
116         
117 /**
118 * Draw the function with th spline points
119 *
120 */
121 void pPlotterLayer::drawSplineCurve(wxDC & dc,mpWindow & w, int orgy)
122 {
123         std::vector<double> vx=getXSpline();
124         std::vector<double> vy=getYSpline();
125         wxPoint* ppoints;
126         
127         int /*counter=0,*/ minX,maxX,minY,maxY; // JPRx
128         /*
129         This is the offset of every point scale to the window
130         pixel
131         */
132         int offsetpx=getOffsetPixelsXv();
133         int offsetpy=getOffsetPixelsYv();
134         
135         // type of plotter
136         int type=getmType();
137  
138         wxPoint point;
139         /***********/
140         getMaxShowed(maxX,maxY);
141         getMinShowed(minX,minY);
142         /***********/
143
144         
145         if(type==2)
146         {
147          /*
148                 Fill the function if it represented an histogram
149           */
150                 ppoints=(wxPoint*)malloc(sizeof(int)*2*(vx.size()+2));
151                 //initialize points
152                 point.x=-5000;
153                 point.y=-5000;
154                 ppoints[0]=point;
155                 ppoints[1]=point;
156         }
157         
158         int size=vx.size();
159         int j=2;
160
161         for(int i=0;(i+1)< size;i++)
162         {
163                 
164                 
165                 double cxi=(vx.at(i)-minX-offsetX)*scaleX+offsetpx;
166                 double cyi=(vy.at(i)-minY-offsetY)*scaleY+offsetpy;
167                 
168                 double cxj=(vx.at(i+1)-minX-offsetX)*scaleX+offsetpx;
169                 double cyj=(vy.at(i+1)-minY-offsetY)*scaleY+offsetpy;
170                 
171                 
172                 if(type!=2)     
173                         draw(dc,w,cxi,cyi,cxj,cyj,orgy);
174                 else if(type==2)
175                 {
176                         if(!initializePolygon(ppoints,cxi,cyi,cxj,cyj) && ((cxi<=0 && cxj>=0)||(cxi>=0 && cxj>=0)))
177                         {
178                                         point.x=cxj;
179                                         point.y=cyj;
180                                         ppoints[j]=point;
181                                         j++;
182                 
183                         }
184                 }
185                 
186         }
187         if(type==2)
188         {
189                 //point.x=vx.at(size-1)* scaleX + offsetpx;
190                 point.x=ppoints[j-1].x;
191                 point.y=0;
192                 //ppoints[vx.size()]=point;
193                 ppoints[j]=point;
194                 /*
195                 Fill the function if it represented an histogram
196           */
197                 //ppoints=(wxPoint*)malloc(sizeof(int)*2*(vx.size()+1));
198                 //settings for fill
199                 //point.x=vx.at(0)*scaleX + offsetpx;
200                 point.x=ppoints[0].x;
201                 point.y=0;
202                 //ppoints[vx.size()+1]=point;
203                 ppoints[j+1]=point;
204
205                 dc.SetBrush(wxBrush( wxColour(239,238,242) ,wxSOLID  ));
206                 dc.SetPen(wxPen( wxColour(0,0,0) ,1,wxSOLID  ));
207                 //dc.DrawPolygon(vx.size()+2,ppoints,0,0);
208                 for(int i = 0; i <= j + 1; i++){
209                         int sizedc = dc.GetSize().GetHeight()-orgy;
210                         ppoints[i].y = GetYTranslated(sizedc, ppoints[i].y);
211                 }       
212                 dc.DrawPolygon(j+2,ppoints,0,0);
213         }
214         
215         
216 }
217
218 /*
219  it define the first point of the polygon for be drawing
220  returns true if the first and second point of the polygon are set
221 */
222 bool pPlotterLayer::initializePolygon(wxPoint* points,double x1, double y1,double x2, double y2)
223 {
224         bool setted=false;
225
226                 //intercepts
227         float m=((float)(y2-y1))/(x2-x1);
228         float x0=-y1/m+x1;
229         float y0=-m*x1+y1;      
230
231         if(points[0].x<=0&& points[1].x<=0 && points[0].y<=0&& points[1].y<=0)
232         {
233         
234                 //int offsetpx=getOffsetPixelsXv(); //JPRx      
235
236                 //analyzing the curve
237
238                         if(x1<=0 && x2>=0)
239                         {
240                                 if(y2>=0 && y1>=0)
241                                 {
242                                                 //dc.DrawLine(0,y0, x2,y2);
243                                                 points[0].x=0;
244                                                 points[0].y=y0;
245                                                 points[1].x=x2;
246                                                 points[1].y=y2;
247                                                 setted=true;                                    
248                                         
249                                 }
250                                 else if(y2<=0 && y1>=0)
251                                 {
252                                         if(y0>=0 && x0>=0)
253                                         {
254                                                 //dc.DrawLine(0,y0,x0,0 );
255                                                 points[0].x=0;
256                                                 points[0].y=y0;
257                                                 points[1].x=x0;
258                                                 points[1].y=0;
259                                                 setted=true;    
260
261                                         }
262                                                 
263                                 }
264                                 else if(y2>=0 && y1<=0)
265                                 {       
266                                         if(y0>=0) 
267                                         {       
268                                                 //dc.DrawLine(0,y0,x2,y2 );
269                                                 points[0].x=0;
270                                                 points[0].y=y0;
271                                                 points[1].x=x2;
272                                                 points[1].y=y2;
273                                                 setted=true;    
274                                         }
275                                 }
276                 
277                         }
278
279                         if(x1>=0 && x2>=0)
280                         {
281                                 if(y1>=0 && y2>=0 )
282                                 {
283                                         //dc.DrawLine(x1,y1, x2,y2);
284                                         points[0].x=x1;
285                                         points[0].y=y1;
286                                         points[1].x=x2;
287                                         points[1].y=y2;
288                                         setted=true;    
289                                 }
290                                 else if(y1>=0 && y2<=0)
291                                 {
292                                         //dc.DrawLine(x1,y1,x0,0 );
293                                         points[0].x=x1;
294                                         points[0].y=y1;
295                                         points[1].x=x0;
296                                         points[1].y=0;
297                                         setted=true;    
298                                 }
299                                 else if(y1<=0 && y2>=0) 
300                                 {       
301                                         //dc.DrawLine(x0,0,x2,y2);
302                                         points[0].x=x0;
303                                         points[0].y=0;
304                                         points[1].x=x2;
305                                         points[1].y=y2;
306                                         setted=true;    
307                                 }
308                         }
309                         else
310                         return setted;
311         }
312         else
313                 return setted;
314         return setted; 
315 }
316
317 /**
318 * Draw the lines between the points of the function
319 */
320 void pPlotterLayer::drawFunction(wxDC & dc,mpWindow & w, int orgy)
321 {
322         int scrwX,scrwY,offsetpx,offsetpy,maxX,minX,maxY,minY;
323         wxPoint* ppoints = NULL;
324
325         /*
326         This is the offset of every point scale to the window
327         pixel
328         */
329         offsetpx = getOffsetPixelsXv();
330         offsetpy = getOffsetPixelsYv(); 
331         Rewind();
332         dc.GetSize(&scrwX, &scrwY);
333         //Lines between the points
334         int sizedc = dc.GetSize().GetHeight()-orgy;
335 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
336 #if wxMAJOR_VERSION <= 2
337         GetPoints(points);
338 #else
339   //...
340 #endif
341         // type of plotter
342         int type=getmType();
343         /***********/
344         getMaxShowed(maxX,maxY);
345         getMinShowed(minX,minY);
346         /***********/
347
348         //traslation
349         //int xTraslation=getXTraslation(); //JPRx
350 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
351 #if wxMAJOR_VERSION <= 2
352         wxNode* node= points.GetFirst();
353 #else
354         wxNode* node= GetPointsPtr()->GetFirst();
355 #endif
356         // int i=1;//points.GetCount()+1; //JPRx
357         int j=2;
358         /*
359          Fill it if it is an histogram
360         */
361         wxPoint point;
362         // pFunctionPoint* pointk; //JPRx
363         if(type==2)
364         {
365                 /*
366                 Fill the function if it represented an histogram
367           */
368 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
369 #if wxMAJOR_VERSION <= 2
370                 ppoints         = (wxPoint*)malloc(sizeof(int)*2*(points.GetCount()+2));
371 #else
372                 ppoints         = (wxPoint*)malloc(sizeof(int)*2*(GetPointsPtr()->GetCount()+2));
373 #endif
374                 //initialize points
375                 point.x         = -5000;
376                 point.y         = GetYTranslated(sizedc,-5000);
377                 ppoints[0]      = point;
378                 ppoints[1]      = point;
379         }
380         
381         while (node!=NULL && node->GetNext()!=NULL)
382         { 
383                 pFunctionPoint* pointi=(pFunctionPoint*)node->GetData();
384                                 wxNode* nextNode=node->GetNext();
385                 pFunctionPoint* pointj=(pFunctionPoint*)nextNode->GetData();
386                                                 
387                 // we do the offset
388                 int pxi=(pointi->getRealX()-minX)-offsetX;
389                 int pyi=(pointi->getRealY()-minY)-offsetY;
390                 int pxj=(pointj->getRealX()-minX)-offsetX;
391                 int pyj=(pointj->getRealY()-minY)-offsetY;
392                 int cxi=pxi* scaleX + offsetpx; //+ xTraslation;
393                 int cxj=pxj* scaleX + offsetpx; //+ xTraslation;
394                 int cyi=pyi* scaleY+ offsetpy ;
395                 int cyj=pyj* scaleY+ offsetpy ;
396                 //dc.DrawLine(pxi* scaleX + offsetpx,pyi* scaleY+ offsetpy, pxj* scaleX + offsetpx,pyj* scaleY+ offsetpy );
397                 if(type!=2)
398                 {
399                         draw(dc,w,pxi* scaleX + offsetpx,pyi* scaleY+ offsetpy, pxj* scaleX + offsetpx,pyj* scaleY+ offsetpy,orgy );
400                         //dc.DrawLine(pxi* scaleX + offsetpx,pyi* scaleY+ offsetpy, pxj* scaleX + offsetpx,pyj* scaleY+ offsetpy );
401                 } else if(type==2) {
402                         if(!initializePolygon(ppoints,cxi,cyi,cxj,cyj) && ((cxi<=0 && cxj>=0)||(cxi>=0 && cxj>=0)))
403                         {
404                                         point.x=cxj;
405                                         point.y=GetYTranslated(sizedc,cyj);
406                                         ppoints[j]=point;
407                                         j++;
408                 
409                         } // if
410                 } // if type
411                 node=node->GetNext();
412         } 
413         if(type==2)
414         {
415                 //point.x=vx.at(size-1)* scaleX + offsetpx;
416                 point.x=ppoints[j-1].x;
417                 point.y=GetYTranslated(sizedc,0);
418                 //ppoints[vx.size()]=point;
419                 ppoints[j]=point;
420                 /*
421                 Fill the function if it represented an histogram
422           */
423                 //ppoints=(wxPoint*)malloc(sizeof(int)*2*(vx.size()+1));
424                 //settings for fill
425                 //point.x=vx.at(0)*scaleX + offsetpx;
426                 point.x=ppoints[0].x;
427                 point.y=GetYTranslated(sizedc,0);
428                 //ppoints[vx.size()+1]=point;
429                 ppoints[j+1]=point;
430
431                 dc.SetBrush(wxBrush( wxColour(239,238,242) ,wxSOLID  ));
432                 dc.SetPen(wxPen( wxColour(0,0,0) ,1,wxSOLID  ));
433                 //dc.DrawPolygon(vx.size()+2,ppoints,0,0);
434                 dc.DrawPolygon(j+2,ppoints,0,0);
435         } // if type
436 }
437
438 /**
439 *  Draw the points of the function
440 */
441 void pPlotterLayer::drawPoints(wxDC & dc,mpWindow & w, int orgy)
442 {
443         
444         Rewind();
445         double x, y;
446         int minX,maxX,minY,maxY;
447
448         double sizedc = dc.GetSize().GetHeight()-orgy;
449         
450         /*
451         This is the offset of every point scale to the window
452         pixel
453         */
454         int offsetpx=getOffsetPixelsXv();
455         int offsetpy=getOffsetPixelsYv();
456         //traslation
457 //      int xTraslation=getXTraslation();  //EED
458         /*wxPen mypen(*wxBLACK, 5, wxSOLID);
459         dc.SetPen(mypen);*/
460         /***********/
461         getMaxShowed(maxX,maxY);
462         getMinShowed(minX,minY);
463         /***********/
464         //we have to draw the points
465
466         while (GetNextXY(x, y))
467         {
468                 //GetNextXY(x, y);
469                 //set the points of the polygons
470                 wxPoint points[4];
471                 dc.SetBrush(wxBrush( wxColour(255,0,0),wxSOLID  ));
472                 //dc.SetPen(wxPen(wxColour(0,0,0),1,wxSOLID) );
473                 points[0].x=((x-minX-offsetX)*scaleX + offsetpx-MOVE);
474                 points[0].y=GetYTranslated(sizedc,((y-minY-offsetY)*scaleY+ offsetpy-MOVE));
475                 points[1].x=((x-minX-offsetX)*scaleX+ offsetpx+MOVE);
476                 points[1].y=GetYTranslated(sizedc,((y-minY-offsetY)*scaleY+ offsetpy-MOVE));
477                 points[2].x=((x-minX-offsetX)*scaleX+ offsetpx+MOVE);
478                 points[2].y=GetYTranslated(sizedc,((y-minY-offsetY)*scaleY+ offsetpy+MOVE));
479                 points[3].x=((x-minX-offsetX)*scaleX+ offsetpx-MOVE);
480                 points[3].y=GetYTranslated(sizedc,((y-minY-offsetY)*scaleY+ offsetpy+MOVE));
481                 if((x-minX-offsetX)*scaleX >=0 && (y-minY-offsetY/*w.getMinScrY()*/)*scaleY>=0)
482                 dc.DrawPolygon(4,points,0,0);
483         }
484 }
485
486 /**
487 * Draw the line between the last point of the function
488 * and the position of the mouse
489 */
490 void pPlotterLayer::drawLineToMousePoint(wxDC & dc,mpWindow & w, int orgy)
491 {
492         int x,y,sizeP,maxX,maxY,minX,minY;
493         bool direction;
494         
495         Rewind();
496         
497         getMousePoint(x,y);
498         getDirection(direction);
499         getSize(sizeP);
500         //Lines betwen the points
501
502 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
503 #if wxMAJOR_VERSION <= 2
504         GetPoints(points);
505         wxNode *node    = points.GetLast();
506         wxNode *node1   = points.GetFirst();
507 #else
508         wxNode *node    = GetPointsPtr()->GetLast();
509         wxNode *node1   = GetPointsPtr()->GetFirst();
510 #endif
511         
512         
513         /*
514         This is the offset of every point scale to the window
515         pixel
516         */
517         int offsetpx = getOffsetPixelsXv();
518         int offsetpy = getOffsetPixelsYv();
519         /***********/
520         getMaxShowed(maxX,maxY);
521         getMinShowed(minX,minY);
522         /***********/
523         //traslation
524 //      int xTraslation=getXTraslation(); //EED
525         
526         if(node)
527         {
528                 pFunctionPoint* lastPoint=(pFunctionPoint*)node->GetData();
529                 pFunctionPoint* firstPoint=(pFunctionPoint*)node1->GetData();
530
531                 //LeftDrawing
532                 if(lastPoint->getRealX()<x && direction && sizeP >=2)
533                         
534                         dc.DrawLine((lastPoint->getRealX()-minX-offsetX)*scaleX + offsetpx,(lastPoint->getRealY()-minY-offsetY)*scaleY+ offsetpy, (x-minX)*scaleX + offsetpx, (y-minY)*scaleY + offsetpy);
535                 
536                 //right drawing
537                 else if(firstPoint->getRealX()>x && !direction && sizeP >=2 )
538                         
539                         dc.DrawLine((firstPoint->getRealX()-minX-offsetX)*scaleX+ offsetpx,(firstPoint->getRealY()-minY-offsetY)*scaleY+ offsetpy,(x-minX)*scaleX+ offsetpx, (y-minY)*scaleY+ offsetpy);
540                 
541                 //just a point
542                 else if(sizeP==1 )
543                 {
544                         dc.DrawLine((lastPoint->getRealX()-minX-offsetX)*scaleX + offsetpx,(lastPoint->getRealY()-minY-offsetY)*scaleY+ offsetpy, (x-minX)*scaleX+ offsetpx, (y-minY)*scaleY+ offsetpy);
545                 }
546         }                       
547         
548         if( w.drawGuideLines() )  
549         {
550                 dc.SetPen(wxPen(  wxColour(255,0,0),1,wxDOT ));
551                 // Drawing the horizontal guide line    
552                 dc.DrawLine( 0, (y-minY)*scaleY + offsetpy, (x-minX)*scaleX + offsetpx, (y-minY)*scaleY + offsetpy);                                    
553                 // Drawing the vertical guide line      
554                 dc.DrawLine( (x-minX)*scaleX + offsetpx,0, (x-minX)*scaleX + offsetpx, (y-minY)*scaleY + offsetpy);     
555         }
556 }
557
558
559 /** 
560 Layer plot handler.
561 This implementation will plot the locus in the visible area and
562 put a label according to the aligment specified.
563 */
564 void pPlotterLayer::Plot(wxDC & dc, mpWindow & w)
565 {
566         bool show,drawing,actual;
567         int scrwX,scrwY,maxX,maxY,minX,minY,type;
568         float factorZoom;
569         
570         ifShowPoints(show);
571         getDrawing(drawing);
572         type=vGetType();
573         
574         dc.SetPen( m_pen);
575         
576         /*
577          * Managing the scale and zoom
578          */
579         
580         dc.GetSize(&scrwX, &scrwY);
581         
582         getIfActual(actual);
583         //getMax(maxX, maxY);
584         /***********/
585         getMaxShowed(maxX,maxY);
586         getMinShowed(minX,minY);
587         /***********/
588         getFactorZoom(factorZoom);
589         getOffsets(offsetX,offsetY);
590         /*
591         maxX=w.getMaxScrX();
592         maxY=w.getMaxScrY();
593         minX=w.getMinScrX();
594         minY=w.getMinScrY();
595         */
596         if((maxX-minX)!=0 && (maxY-minY)!=0)
597         {
598                 
599                 scaleX=(((double)scrwX-100)/(maxX-minX))*factorZoom;
600                 scaleY=(((double)scrwY-50)/(maxY-minY))*factorZoom;
601                 
602                 if(actual)
603                 {
604                         w.SetScaleX(scaleX);
605                         w.SetScaleY(scaleY);
606                         //w.setMinScrX(offsetX);
607                         //w.setMinScrY(offsetY);
608                 }
609                 
610         }
611         /*
612                 Managing the drawing
613         */
614         int orgx=70;
615
616         
617 //EED 14Mai2009
618 //      int orgy=w.GetScrY()-40;
619 //      dc.SetDeviceOrigin( orgx ,orgy);
620 //      dc.SetAxisOrientation(true,true);
621         
622         int orgy = 40;  
623         //dc.SetDeviceOrigin( orgx ,orgy);
624         dc.SetDeviceOrigin( orgx ,0);
625         int sizedc = dc.GetSize().GetHeight()-orgy;
626         //dc.SetAxisOrientation(true,false);
627
628         
629
630         //if the user dont want to see the points of the function and if he stops drawing
631         //we have to draw the function
632         if(!show && !drawing && type==1)
633                 drawFunction(dc,w,orgy);
634         else if(!show && !drawing && type==2)
635                 drawSplineCurve(dc,w,orgy);
636         //we just draw the point that the user just clicked
637         else if(drawing && type==1)
638         { 
639                 drawFunction(dc,w,orgy);
640                 drawLineToMousePoint(dc,w,orgy);
641                 drawPoints(dc,w,orgy);
642         }
643         else if(drawing && type==1)
644         {
645                 drawSplineCurve(dc,w,orgy);
646                 drawLineToMousePoint(dc,w,orgy);
647                 drawPoints(dc,w,orgy);
648         }
649         else if(show && type==1)
650         {
651                 drawFunction(dc,w,orgy);
652                 drawPoints(dc,w,orgy);
653         }
654         else if(show && type==2)
655         {
656                 drawSplineCurve(dc,w,orgy);
657                 drawPoints(dc,w,orgy);
658         }
659
660         // Drawing the guides according to real values entered according to the integrated interaction (IS NOT WORKING!!!)
661         if ( actual )
662         {
663                 dc.SetPen(wxPen(  wxColour(255,0,0),1,wxDOT ));
664                 int offsetpx = getOffsetPixelsXv();
665 //              int offsetpy = getOffsetPixelsYv();  //EED
666
667                 int realX_guide = w.getRealGuideX();
668                 if( realX_guide!=-1 )
669                 {
670                 dc.DrawLine( (realX_guide/*-w.getMinScrX()*/-offsetX)*scaleX + offsetpx, 
671                         GetYTranslated(sizedc,0), 
672                         (realX_guide/*-w.getMinScrX()*/-offsetX)*scaleX + offsetpx, 
673                         GetYTranslated(sizedc,scrwY));                  
674                 }
675                         
676                 int realY_guide = w.getRealGuideY();
677                 if( realY_guide!=-1 )
678                 {
679                         dc.DrawLine( 0,
680                                 GetYTranslated(sizedc,(realY_guide/*-w.getMinScrY()*/-offsetX)*scaleX + offsetpx), 
681                                 scrwX, 
682                                 GetYTranslated(sizedc,(realY_guide/*-w.getMinScrY()*/-offsetX)*scaleX + offsetpx));
683                 } // if realY_guide
684         } // if actual
685 }
686