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