]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pLogicalFunction.cxx
Support #1768 CREATIS Licence insertion
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / pPlotter / pLogicalFunction.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 //----------------------------------------------------------------------------
28 // Class definition include
29 //----------------------------------------------------------------------------
30 #include "pLogicalFunction.h"
31 #include <iostream>
32 #include <fstream>
33 #include <string>
34
35
36 // ----------------------------------------------------------------------------
37 // WX headers inclusion.
38 // For compilers that support precompilation, includes <wx/wx.h>.
39 // ----------------------------------------------------------------------------
40
41 #ifndef WX_PRECOMP
42 #include <wx/wx.h>
43 #endif
44
45 //----------------------------------------------------------------------------
46 // Class implementation
47 //----------------------------------------------------------------------------
48
49 IMPLEMENT_CLASS(pLogicalFunction, wxObject)
50
51 //----------------------------------------------------------------------------
52 // Constructors
53 //----------------------------------------------------------------------------
54 pLogicalFunction:: pLogicalFunction( )
55 {
56
57         realPoints.DeleteContents(TRUE); 
58         validPointRange = 5;
59         leftToRigthDef = true;
60         _maxX=0;
61         _maxY=0;
62         _minX=0;
63         _minY=0;
64 }
65 /**
66 * Is the destructor!!!
67 */
68 pLogicalFunction:: ~pLogicalFunction ()
69 {
70         realPoints.DeleteContents(TRUE);
71 }
72 /*
73 * validate if the function has that point in a sensible area returning the index where the point was found or -1 if is in not part of the function: define the sensible area is  
74 * x1-validPointRange<x<x1+validPointRange y1-validPointRange<y<y1+validPointRange
75 */
76 int pLogicalFunction::validPointOnFunction(wxPoint realPoint)
77 {
78         int pointIndex = -1;
79         wxNode* node= realPoints.GetFirst();
80         while(node && pointIndex==-1)
81         {
82                 pFunctionPoint* point=(pFunctionPoint*)node->GetData();
83                 int x = point->getRealX();
84                 int y = point->getRealY();
85                 double  vx=SENSIBLE_REGION/_scaleX;
86                 double vy=SENSIBLE_REGION/_scaleY;
87
88                 bool isInXRange= realPoint.x <= x + vx + SENSIBLE_REGION  && realPoint.x >= x - vx-SENSIBLE_REGION;
89                 bool isInYRange= realPoint.y <= y + vy + SENSIBLE_REGION && realPoint.y >= y - vy-SENSIBLE_REGION;
90                 if(isInXRange && isInYRange)
91                         pointIndex = realPoints.IndexOf(point);
92
93                 node = node->GetNext();
94         }
95         return pointIndex;
96 }
97
98
99
100 /*
101 * returns the index in the list of the point 
102 */
103 int pLogicalFunction::getIndexOf(wxPoint realpoint)
104 {
105         wxNode* node= realPoints.GetFirst();
106         while(node)
107         {
108                 pFunctionPoint* point=(pFunctionPoint*)node->GetData();
109                 if(point->getRealX()==realpoint.x && point->getRealY()==realpoint.y )
110                 {
111                         return realPoints.IndexOf(point);
112                 }
113
114                 node= node->GetNext();
115         }
116         return -1;
117
118 }
119
120 /*
121 * This metohd returns the node of the point that is the movingPointIndex position in the list of points.
122 * @param: int movingPointIndex, Is the index value of the searched node. 
123 * @return: Return a pointer to the node corresponding to the index value by parameter.
124 */
125 wxNode* pLogicalFunction::GetPointAt( int movingPointIndex )
126 {
127         if(!realPoints.IsEmpty())
128         {       
129                 wxNode* node= realPoints.Item(movingPointIndex);
130                 return node;
131         }
132         else
133                 return NULL;
134 }
135
136 /*
137 * Includes a point between two existing points of this function. The new point (x,y) was not defined when the function was created.
138 * @return Returns true is the point was succcesfully added to the funcion.
139 */
140 bool pLogicalFunction:: AddNewPoint(int x,int y)
141 {
142         pFunctionPoint * newPoint = new pFunctionPoint ( x, y);
143         bool includedPoint = realPoints.Append(newPoint)!=NULL;
144         if(includedPoint)
145         {
146                 bool order=true;
147                 if(realPoints.size()>1){
148                         order=orderPoints();
149                 }
150             
151                 return order; 
152         }
153         return includedPoint;
154 }
155 /*
156 * This method orders the list of points taking into account that the last appended node in the list (realPoint) is the only one disordered. 
157 * @return Returns true if the last point included has a valid value for x and was ordered, according to the definition of function.
158 */
159 bool pLogicalFunction::orderPoints()
160 {
161         bool lastOrdered = false;
162         bool validToContinue = false;
163
164         wxNode* lastNodeIncluded = realPoints.GetLast();
165
166         wxNode* node = realPoints.GetFirst();
167         pFunctionPoint* lastPointIncluded = (pFunctionPoint*)lastNodeIncluded -> GetData();             
168         int xToOrder = lastPointIncluded -> getRealX();
169         int actualX;
170         int nextX;
171
172         // Used for validating 'leftToRigthDef'
173         pFunctionPoint* ordFirstPoint = NULL;
174         pFunctionPoint* ordLastPoint =  NULL;
175         if(node!=NULL){
176                 ordFirstPoint = (pFunctionPoint*)realPoints.GetFirst()-> GetData();
177         }
178         if(lastNodeIncluded->GetPrevious()!=NULL){
179                 ordLastPoint = (pFunctionPoint*)(lastNodeIncluded->GetPrevious())-> GetData();
180         }
181
182
183         // Normal drawing
184         if (leftToRigthDef)
185         {
186                 validToContinue = ordFirstPoint->getRealX() < xToOrder; 
187         }
188         else
189         {
190                 //validToContinue =ordFirstPoint->getRealX() >  xToOrder;
191                 validToContinue =ordLastPoint->getRealX() >  xToOrder;
192         }
193
194         if ( validToContinue)
195         {               
196
197                 while( node && !lastOrdered )
198                 {
199                         pFunctionPoint* prevPoint =(pFunctionPoint*)node->GetData();
200                         actualX = prevPoint ->getRealX();
201                         if( actualX == xToOrder)
202                         {
203                                 realPoints.DeleteNode(lastNodeIncluded);
204                                 lastOrdered = false;
205                         }
206                         else if ( actualX < xToOrder )
207                         {
208                                 //firstNode
209                                 wxNode* nextNode = node->GetNext();
210                                 pFunctionPoint* nextPoint;
211                                 if( nextNode != lastNodeIncluded )                      
212                                 {
213                                         nextPoint = (pFunctionPoint*)nextNode -> GetData();     
214                                         nextX = nextPoint->getRealX();
215                                         int nextIndex = realPoints.IndexOf(nextPoint);
216                                         if( nextX > xToOrder )
217                                         {
218                                                 //we need to change the direction in memory of our node
219                                                 pFunctionPoint* pointToInsert=new pFunctionPoint(lastPointIncluded->getRealX(),lastPointIncluded->getRealY());
220                                                 // The last inserted point is ordered like: prevPoint - lastPointIncluded - nextPoint
221                                                 lastOrdered = (realPoints.Insert(nextIndex, pointToInsert))!= NULL;
222                                                 bool lastNodeDeleted=realPoints.DeleteNode(lastNodeIncluded);
223                                                 return lastOrdered && lastNodeDeleted;
224
225                                         }
226
227                                 }
228                                 else 
229                                 {
230                                         lastOrdered = true;
231                                 }
232                         }
233                         else 
234                         {
235                                 //firstNode
236                                 wxNode* prevNode = node->GetPrevious();
237                                 int insertIndex=realPoints.IndexOf(prevPoint);
238                                 pFunctionPoint* prPoint;
239                                 if(prevNode)
240                                 {
241                                         prPoint = (pFunctionPoint*)prevNode -> GetData();       
242                                         int beforeX =prPoint->getRealX();
243                                         if( beforeX < xToOrder)
244                                         {
245                                                 //we need to change the direction in memory of our node
246                                                 pFunctionPoint* pointToInsert=new pFunctionPoint(lastPointIncluded->getRealX(),lastPointIncluded->getRealY());
247                                                 // The last inserted point is ordered like: prevPoint - lastPointIncluded - nextPoint
248                                                 lastOrdered = (realPoints.Insert(insertIndex, pointToInsert))!= NULL;
249                                                 bool lastNodeDeleted=realPoints.DeleteNode(lastNodeIncluded);
250                                                 return lastOrdered && lastNodeDeleted;
251                                         }
252                                 }
253                                 //is just the second point
254                                 else
255                                 {
256                                         //we need to change the direction in memory of our node
257                                         pFunctionPoint* pointToInsert=new pFunctionPoint(lastPointIncluded->getRealX(),lastPointIncluded->getRealY());
258                                         // The last inserted point is ordered like: prevPoint - lastPointIncluded - nextPoint
259                                         lastOrdered = (realPoints.Insert(insertIndex, pointToInsert))!= NULL;
260                                         bool lastNodeDeleted=realPoints.DeleteNode(lastNodeIncluded);
261                                         return lastOrdered && lastNodeDeleted;
262                                 }
263                         }
264
265                         node = node->GetNext();
266                 }
267
268         }
269         else
270         {
271                 bool lastNodeDeleted = realPoints.DeleteNode(lastNodeIncluded);
272                 lastOrdered = lastOrdered && lastNodeDeleted;
273         }
274         return lastOrdered;
275 }
276 /*
277 * This tries to Add a point to the function if possible it returns true.
278 * @pre: The list of existing points is ordered.
279 * @param: int aX, The x value of the point.
280 * @param: int aY, The y value of the point.
281 * @param: return Returns TRUE if the point was succesfuly included in the realPoints list.
282 */
283 bool pLogicalFunction::AddPoint(int aX, int aY,bool order) 
284 {       
285         pFunctionPoint * newPoint = new pFunctionPoint (aX, aY);
286         wxNode* lastNode = realPoints.GetLast();
287         bool addedPoint = false;
288         if (lastNode)
289         {
290                 pFunctionPoint* lastPoint = (pFunctionPoint*)lastNode->GetData();               
291                 if( lastPoint->getRealX() != aX )
292                 {
293                         addedPoint = realPoints.Append(newPoint)!=NULL;
294                         //In case that the definition of points is being done backwards.
295                         if( (aX < (lastPoint->getRealX()) ) && addedPoint )
296                         {
297                                 if( realPoints.GetCount() == 2 )
298                                 {
299                                         leftToRigthDef = false;                                 
300                                 }
301                         if(order)
302                                 addedPoint = orderPoints();     
303                         
304                         }
305                         else
306                         {
307                                 if( realPoints.GetCount() == 2 )
308                                 {
309                                         leftToRigthDef = true;                                  
310                                 }                       
311                         }
312                 }                
313         }
314         else
315         {
316                 addedPoint = realPoints.Append(newPoint)!=NULL;         
317         }
318         
319         return addedPoint;
320 }
321
322 /*
323  * Set Up startPoint, endPoint, maxY,maxX points        
324 */
325 void pLogicalFunction::setUp()
326 {
327         //sets the start point of the function
328         setStartPoints();
329         //set the Last point of the function
330         setEndPoints();
331         //set the min value in x and y between all the points of the function
332         setMinPoints();
333         //set the max value in x and y between all the points of the function
334         setMaxPoints();
335 }
336
337
338 /*
339  * sets the start point of the function
340  */
341 void pLogicalFunction:: setStartPoints()
342 {
343   wxNode* first=realPoints.GetFirst();
344   if(first)
345         {
346           pFunctionPoint* startPoint=(pFunctionPoint*)first->GetData();
347           setStartX(startPoint->getRealX());
348           setStartY(startPoint->getRealY());
349         }
350   else
351   {
352           setStartX(-1);
353           setStartY(-1);
354   }
355 }
356 /*
357  * sets the end point of the function
358  */
359 void pLogicalFunction:: setEndPoints()
360 {
361   wxNode* last=realPoints.GetLast();
362   if(last)
363   {
364           pFunctionPoint* lastPoint=(pFunctionPoint*)last->GetData();
365           setEndX(lastPoint->getRealX());
366           setEndY(lastPoint->getRealY());
367   }
368   else
369   {
370           setEndX(-1);
371           setEndY(-1);
372   
373   }
374 }
375
376 /*
377  * set the min value in x and y between all the points of the function
378  */
379 void pLogicalFunction::setMinPoints()
380 {
381     int minX,minY;  
382         wxNode* node=realPoints.GetFirst();
383         if(node)
384         {
385                 pFunctionPoint* point=(pFunctionPoint*)node->GetData();
386                 minX=point->getRealX();
387                 minY=point->getRealY();
388                 wxNode* nextNode=node->GetNext();
389                 while(nextNode)
390                         {
391                                 point=(pFunctionPoint*)nextNode->GetData();
392                                 int x=point->getRealX();
393                                 int y=point->getRealY();
394                                 if(x<minX)
395                                         minX=x;
396                                 if(y<minY)
397                                         minY=y;
398                                 nextNode=nextNode->GetNext();
399                         }
400                 setMinX(minX);
401                 setMinY(minY);
402         }
403         else
404         {
405                 setMinX(0);
406                 setMinY(0);
407         }
408                 
409 }
410 /*
411  * set the max value in x and y between all the points of the function
412  */
413 void pLogicalFunction::setMaxPoints()
414 {
415     int maxX,maxY;  
416         wxNode* node=realPoints.GetFirst();
417         if(node)
418         {
419                 pFunctionPoint* point=(pFunctionPoint*)node->GetData();
420                 maxX=point->getRealX();
421                 maxY=point->getRealY();
422                 wxNode* nextNode=node->GetNext();
423                 while(nextNode)
424                         {
425                                 point=(pFunctionPoint*)nextNode->GetData();
426                                 int x=point->getRealX();
427                                 int y=point->getRealY();
428                                 if(x>maxX)
429                                         maxX=x;
430                                 if(y>maxY)
431                                         maxY=y;
432                                 nextNode=nextNode->GetNext();
433                         }
434                 setMaxX(maxX);
435                 setMaxY(maxY);
436         }
437         else
438         {
439                 setMaxX(0);
440                 setMaxY(0);
441         }
442 }
443
444 /**
445 * deletes the point given by the  user  from the collection of logical points of the function
446 * IS NOT USE
447 */
448
449 bool pLogicalFunction::DeletePoint(int aX, int aY) 
450 {
451         wxNode* node= realPoints.GetFirst();
452         while(node)
453         {
454                 pFunctionPoint* point=(pFunctionPoint*)node->GetData();
455                 if(point->getRealX()==aX && point->getRealY()==aY)
456                 {
457                         realPoints.Erase(node);
458                         return true;
459                 }
460                 node= node->GetNext();
461         }
462
463         return false;
464 }
465
466 /**
467 * deletes a point of the functio given its index
468 */
469 bool pLogicalFunction::deletePointAt(int index)
470 {
471         if(index!=-1)  
472         {       
473                 wxNode* node=GetPointAt(index);
474                 
475                 if(node)//point!=NULL)
476                 {
477                         //pFunctionPoint* point=(pFunctionPoint*)node->GetData(); // JPRx
478                         bool deleted=realPoints.DeleteNode(node);
479                         //delete point;
480                         //delete node;
481                         /*
482                         if(index==0)
483                                 realPoints=realPoints.;
484                         */
485                         return deleted;
486                 }
487         }
488         return false;
489 }
490
491 /**
492 * Change de coordinates of the given index point to the newCoords, if it is possible and return the result of the invoked action. 
493 * @retun Return TRUE if it was possible to do the change. A valid change is when the new x value of the point is still between the previous and next point, when condition.
494 */
495 bool pLogicalFunction::changePoint(wxPoint newCoords, int movingIndexPoint) 
496 {
497         wxNode* changingNode = GetPointAt(movingIndexPoint);
498         bool validChange = false; 
499         int newX = newCoords.x;
500         int newY = newCoords.y;
501         pFunctionPoint* changingPoint = (pFunctionPoint*)changingNode -> GetData();
502         bool hasPrevious = movingIndexPoint>0;
503         bool hasNext = movingIndexPoint < realPoints.size()-1;
504         
505         wxNode* prevNode = hasPrevious ? changingNode ->GetPrevious() : NULL;
506         wxNode* nextNode = hasNext ? changingNode -> GetNext() : NULL;
507         
508         if( hasPrevious )
509         {
510                 pFunctionPoint* prevPoint = (pFunctionPoint*)prevNode -> GetData();
511                 if ( hasNext )
512                 {
513                         pFunctionPoint* nextPoint = (pFunctionPoint*) nextNode -> GetData();
514                         validChange = ((prevPoint->getRealX()) < newX) && ((nextPoint->getRealX()) > newX);
515                         if ( (prevPoint->getRealX()) > newX )
516                         {
517                                 newX = prevPoint->getRealX()+1;
518                                 validChange = true;
519                         }
520                         else if ( (nextPoint->getRealX()) < newX )
521                         {
522                                 newX = nextPoint->getRealX()-1;
523                                 validChange = true;
524                         }
525                 }
526                 else
527                 {
528                         // Is the last point of the function.
529                         if ( (prevPoint->getRealX()) < newX )
530                         {
531                                 validChange = true;
532                         }
533                         else
534                         {
535                                 newX = prevPoint->getRealX();
536                                 validChange = true;
537                         }
538                 }               
539         }       
540         else
541         {
542                 if ( hasNext )
543                 {
544                         // Is the first point of the function.
545                         pFunctionPoint* nextPoint = (pFunctionPoint*) nextNode -> GetData();
546                         if ((nextPoint->getRealX()) > newX )
547                         {
548                                 validChange = true;
549                         }
550                         else
551                         {
552                                 newX = nextPoint->getRealX();
553                                 validChange = true;
554                         }
555                 }               
556         }
557         if( validChange )
558         {
559                 changingPoint -> setRealX( newX );
560                 changingPoint -> setRealY( newY );
561         }
562         return validChange;
563 }
564 /**
565 * Evaluates if the given point belongs to the function.
566 */
567 /*
568 bool pLogicalFunction::hasPoint(wxPoint aPoint) 
569 {
570         bool existPoint = false;
571         wxNode *nextNode = realPoints.GetFirst();                 
572
573         while (nextNode && !existPoint)
574         {
575                 pFunctionPoint* nextPoint = (pFunctionPoint*)nextNode->GetData();
576                 if( nextPoint -> getRealX() == aPoint.x && nextPoint-> getRealY() == aPoint.y)          
577                 {
578                         existPoint = true;
579                 }
580                 nextNode = nextNode->GetNext();
581         }
582         return existPoint;
583 }
584 */
585 /**
586 * Returns the real x values of the control points of the function. It dont includes the points calculated by interpolation.
587 */
588 double* pLogicalFunction::getX_RealValues() 
589 {
590         wxNode *nextNode = realPoints.GetFirst();
591         int size = realPoints.GetCount();
592         double * x_Values;
593         int i=0;
594
595         x_Values= new double[size];
596
597         while (nextNode)
598         {
599                 pFunctionPoint* nextPoint = (pFunctionPoint*)nextNode->GetData();
600                 x_Values[i] = nextPoint-> getRealX();
601                 nextNode = nextNode->GetNext();
602                 i++;
603         }
604         return x_Values;
605 }
606
607 /**
608 * Returns the real y values of the control points of the function. It dont includes the points calculated by interpolation.
609 */
610 double * pLogicalFunction::getY_RealValues() 
611 {  
612         wxNode *nextNode = realPoints.GetFirst();
613         int i =0;
614         int size = realPoints.GetCount();
615         double * y_Values;
616
617         y_Values= new double[size];
618
619         while (nextNode)
620         {
621                 pFunctionPoint*  nextPoint = (pFunctionPoint*)nextNode->GetData();
622                 y_Values[i] = nextPoint-> getRealY();
623                 nextNode = nextNode->GetNext();
624                 i++;
625         }
626         return y_Values;
627 }
628
629 //-----------------------
630 // Persistence
631 //-----------------------
632
633 /*
634  Save the points of the function
635  format: 
636         #number of points
637         x<<"\t"<<y<<endl 
638         for all (x,y) in the function
639 */
640 void pLogicalFunction::save(wxString fileName)
641 {
642
643         std::ofstream file;
644         file.open( (const char*)(fileName.mb_str()) );
645         if(file.is_open())
646         {
647                 file << getSizePoints()<< std::endl;
648                 wxNode* node= realPoints.GetFirst();
649                 pFunctionPoint* p;
650                 while(node)
651                 {
652                         p=(pFunctionPoint*)node->GetData();
653                         file <<p->getRealX()<<"\t"<<p->getRealY()<<std::endl;
654                         node=node->GetNext();
655                 }
656         }
657         file.close();
658 }
659 /*
660  Load the points of a function 
661 */
662 void pLogicalFunction::load(wxString fileName)
663 {
664         std::string line;
665         std::ifstream file;
666         file.open( (const char*)(fileName.mb_str()) );
667         
668         if(file.is_open())
669         {
670                 std::getline(file,line);
671                 int nPoints=atoi(line.c_str());
672                 int i=0;
673                 while(!file.eof() && i<nPoints)
674                 {
675                         std::getline(file,line);
676                         int pos=line.find("\t");
677                         int size=line.size();
678                         std::string x=line.substr(0,pos);
679                         std::string y=line.substr(pos+1,size);
680                         int x0=atoi(x.c_str());
681                         int y0=atoi(y.c_str());
682                         AddPoint(x0,y0);
683                         i++;
684
685                 }
686         }
687 }
688
689
690 //---------------------
691 //Getters and Setters
692 //---------------------
693
694 /*
695  * STARTS
696  */
697 void pLogicalFunction::setStartX(double aStartX) {
698         this->_startX = aStartX;
699 }
700
701 double pLogicalFunction::getStartX() {
702         return this->_startX;
703 }
704
705 void pLogicalFunction::setStartY(double aStartY) {
706         this->_startY = aStartY;
707 }
708
709 double pLogicalFunction::getStartY() {
710         return this->_startY;
711 }
712
713 /*
714  * ENDS
715  */
716 void pLogicalFunction::setEndX(double aEndX) {
717         this->_endX = aEndX;
718 }
719
720 double pLogicalFunction::getEndX() {
721         return this->_endX;
722 }
723
724 void pLogicalFunction::setEndY(double aEndY) {
725         this->_endY = aEndY;
726 }
727
728 double pLogicalFunction::getEndY() {
729         return this->_endY;
730 }
731 /*
732  * SCALES
733  */
734 void pLogicalFunction::setScaleX(double aScaleX) {
735         this->_scaleX = aScaleX;
736 }
737
738 double pLogicalFunction::getScaleX() {
739         return this->_scaleX;
740 }
741
742 void pLogicalFunction::setScaleY(double aScaleY) {
743         this->_scaleY = aScaleY;
744 }
745
746 double pLogicalFunction::getScaleY() {
747         return this->_scaleY;
748 }
749 /*
750  * MINS
751  */
752 void pLogicalFunction::setMinX(double aMinX) {
753         this->_minX = aMinX;
754 }
755
756 double pLogicalFunction::getMinX() {
757         return this->_minX;
758 }
759
760 void pLogicalFunction::setMinY(double aMinY) {
761         this->_minY = aMinY;
762 }
763
764 double pLogicalFunction::getMinY() {
765         return this->_minY;
766 }
767 /*
768  * MAXS
769  */
770 void pLogicalFunction::setMaxX(double aMaxX) {
771         this->_maxX = aMaxX;
772 }
773
774 double pLogicalFunction::getMaxX() {
775         return this->_maxX;
776 }
777
778 void pLogicalFunction::setMaxY(double aMaxY) {
779         this->_maxY = aMaxY;
780 }
781
782 double pLogicalFunction::getMaxY() {
783         return this->_maxY;
784 }
785
786 /*
787  * OFFSETS
788  */
789 void pLogicalFunction::setOffsetX(double aOffsetX) {
790         this->_offsetX = aOffsetX;
791 }
792
793 double pLogicalFunction:: getOffsetX() {
794         return this->_offsetX;
795 }
796
797 void pLogicalFunction:: setOffsetY(double aOffsetY) {
798         this->_offsetY = aOffsetY;
799 }
800
801 double pLogicalFunction:: getOffsetY() {
802         return this->_offsetY;
803 }
804
805 /*
806  * TYPE
807  */
808 void pLogicalFunction:: setType(int aType) {
809         this->_type = aType;
810 }
811
812 int pLogicalFunction :: getType() {
813         return this->_type;
814 }
815
816 /*
817  * ValidPoint
818  */
819 int pLogicalFunction :: getValidPointRange()
820 {
821         return validPointRange;
822 }
823
824 void pLogicalFunction :: setValidPointRange(int theRange)
825 {
826         validPointRange = theRange;
827 }
828 /*
829 * Returns the number of points that the function
830 * has
831 */
832 int pLogicalFunction::getSizePoints()
833 {
834         return realPoints.GetCount();
835 }
836 void pLogicalFunction::getDirection(bool &dir)
837 {
838         dir = leftToRigthDef;
839 }
840
841