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