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