pLogicalFunction Class Reference

#include <pLogicalFunction.h>

List of all members.

Public Member Functions

 pLogicalFunction ()
 ~pLogicalFunction ()
void GetPoints (wxList &points)
int validPointOnFunction (wxPoint realPoint)
int getIndexOf (wxPoint realpoint)
wxNode * GetPointAt (int movingPointIndex)
bool AddNewPoint (int x, int y)
bool AddPoint (int aX, int aY, bool order=true)
bool DeletePoint (int aX, int aY)
bool changePoint (wxPoint newCoords, int movingIndexPoint)
double * getX_RealValues ()
double * getY_RealValues ()
bool orderPoints ()
void setStartPoints ()
void setEndPoints ()
void setMaxPoints ()
void setMinPoints ()
void setUp ()
void save (wxString fileName)
void load (wxString fileName)
void setStartX (double aStartX)
double getStartX ()
void setStartY (double aStartY)
double getStartY ()
void setEndX (double aEndX)
double getEndX ()
void setEndY (double aEndY)
double getEndY ()
void setScaleX (double aScaleX)
double getScaleX ()
void setScaleY (double aScaleY)
double getScaleY ()
void setMinX (double aMinX)
double getMinX ()
void setMinY (double aMinY)
double getMinY ()
void setMaxX (double aMaxX)
double getMaxX ()
void setMaxY (double aMaxY)
double getMaxY ()
void setOffsetX (double aOffsetX)
double getOffsetX ()
void setOffsetY (double aOffsetY)
double getOffsetY ()
void setType (int aType)
int getType ()
int getValidPointRange ()
void setValidPointRange (int theRange)
bool deletePointAt (int index)
int getSizePoints ()
void getDirection (bool &dir)

Private Attributes

double _startX
double _startY
double _endX
double _endY
double _scaleX
double _scaleY
double _minX
double _minY
double _maxX
double _maxY
double _offsetX
double _offsetY
int _type
wxList realPoints
double x_Values [50]
double y_Values [50]
int validPointRange
bool leftToRigthDef


Detailed Description

Definition at line 40 of file pLogicalFunction.h.


Constructor & Destructor Documentation

pLogicalFunction::pLogicalFunction (  ) 

Definition at line 29 of file pLogicalFunction.cxx.

00030 {
00031 
00032         realPoints.DeleteContents(TRUE); 
00033         validPointRange = 5;
00034         leftToRigthDef = true;
00035         _maxX=0;
00036         _maxY=0;
00037         _minX=0;
00038         _minY=0;
00039 }

pLogicalFunction::~pLogicalFunction (  ) 

Is the destructor!!!

Definition at line 43 of file pLogicalFunction.cxx.

References realPoints.

00044 {
00045         realPoints.DeleteContents(TRUE);
00046 }


Member Function Documentation

void pLogicalFunction::GetPoints ( wxList &  points  )  [inline]

Rewind Get locus value for next N. Override this function in your implementation.

Parameters:
x Returns X value
y Returns Y value Get Point list of the funcion
return points

Definition at line 84 of file pLogicalFunction.h.

References realPoints.

Referenced by pGraphicalFunction::GetPoints().

00085         {
00086                 points = realPoints;
00087         }  

Here is the caller graph for this function:

int pLogicalFunction::validPointOnFunction ( wxPoint  realPoint  ) 

Definition at line 51 of file pLogicalFunction.cxx.

References _scaleX, _scaleY, pFunctionPoint::getRealX(), pFunctionPoint::getRealY(), realPoints, and SENSIBLE_REGION.

00052 {
00053         int pointIndex = -1;
00054         wxNode* node= realPoints.GetFirst();
00055         while(node && pointIndex==-1)
00056         {
00057                 pFunctionPoint* point=(pFunctionPoint*)node->GetData();
00058                 int x = point->getRealX();
00059                 int y = point->getRealY();
00060                 double  vx=SENSIBLE_REGION/_scaleX;
00061                 double vy=SENSIBLE_REGION/_scaleY;
00062 
00063                 bool isInXRange= realPoint.x <= x + vx + SENSIBLE_REGION  && realPoint.x >= x - vx-SENSIBLE_REGION;
00064                 bool isInYRange= realPoint.y <= y + vy + SENSIBLE_REGION && realPoint.y >= y - vy-SENSIBLE_REGION;
00065                 if(isInXRange && isInYRange)
00066                         pointIndex = realPoints.IndexOf(point);
00067 
00068                 node = node->GetNext();
00069         }
00070         return pointIndex;
00071 }

Here is the call graph for this function:

int pLogicalFunction::getIndexOf ( wxPoint  realpoint  ) 

Definition at line 78 of file pLogicalFunction.cxx.

References pFunctionPoint::getRealX(), pFunctionPoint::getRealY(), and realPoints.

00079 {
00080         wxNode* node= realPoints.GetFirst();
00081         while(node)
00082         {
00083                 pFunctionPoint* point=(pFunctionPoint*)node->GetData();
00084                 if(point->getRealX()==realpoint.x && point->getRealY()==realpoint.y )
00085                 {
00086                         return realPoints.IndexOf(point);
00087                 }
00088 
00089                 node= node->GetNext();
00090         }
00091         return -1;
00092 
00093 }

Here is the call graph for this function:

wxNode * pLogicalFunction::GetPointAt ( int  movingPointIndex  ) 

Definition at line 100 of file pLogicalFunction.cxx.

References realPoints.

Referenced by pGraphicalFunction::addSplinesPoints(), changePoint(), deletePointAt(), pGraphicalFunction::getBefore(), pGraphicalFunction::Rewind(), pGraphicalFunction::setMinShowed(), and pGraphicalFunction::zooming().

00101 {
00102         if(!realPoints.IsEmpty())
00103         {       
00104                 wxNode* node= realPoints.Item(movingPointIndex);
00105                 return node;
00106         }
00107         else
00108                 return NULL;
00109 }

Here is the caller graph for this function:

bool pLogicalFunction::AddNewPoint ( int  x,
int  y 
)

Definition at line 115 of file pLogicalFunction.cxx.

References orderPoints(), and realPoints.

00116 {
00117         pFunctionPoint * newPoint = new pFunctionPoint ( x, y);
00118         bool includedPoint = realPoints.Append(newPoint)!=NULL;
00119         if(includedPoint)
00120         {
00121             bool order=orderPoints();
00122                 return order; 
00123         }
00124         return includedPoint;
00125 }

Here is the call graph for this function:

bool pLogicalFunction::AddPoint ( int  aX,
int  aY,
bool  order = true 
)

this method add a new logical point to the function, this point is one of those used to draw the function

Definition at line 248 of file pLogicalFunction.cxx.

References pFunctionPoint::getRealX(), leftToRigthDef, orderPoints(), and realPoints.

Referenced by load().

00249 {       
00250         pFunctionPoint * newPoint = new pFunctionPoint (aX, aY);
00251         wxNode* lastNode = realPoints.GetLast();
00252         bool addedPoint = false;
00253         if (lastNode)
00254         {
00255                 pFunctionPoint* lastPoint = (pFunctionPoint*)lastNode->GetData();               
00256                 if( lastPoint->getRealX() != aX )
00257                 {
00258                         addedPoint = realPoints.Append(newPoint)!=NULL;
00259                         //In case that the definition of points is being done backwards.
00260                         if( (aX < (lastPoint->getRealX()) ) && addedPoint )
00261                         {
00262                                 if( realPoints.GetCount() == 2 )
00263                                 {
00264                                         leftToRigthDef = false;                                 
00265                                 }
00266                         if(order)
00267                                 addedPoint = orderPoints();     
00268                         
00269                         }
00270                         else
00271                         {
00272                                 if( realPoints.GetCount() == 2 )
00273                                 {
00274                                         leftToRigthDef = true;                                  
00275                                 }                       
00276                         }
00277                 }                
00278         }
00279         else
00280         {
00281                 addedPoint = realPoints.Append(newPoint)!=NULL;         
00282         }
00283         
00284         return addedPoint;
00285 }

Here is the call graph for this function:

Here is the caller graph for this function:

bool pLogicalFunction::DeletePoint ( int  aX,
int  aY 
)

deletes the point given by the user from the collection of logical points of the function

deletes the point given by the user from the collection of logical points of the function IS NOT USE

Definition at line 414 of file pLogicalFunction.cxx.

References pFunctionPoint::getRealX(), pFunctionPoint::getRealY(), and realPoints.

00415 {
00416         wxNode* node= realPoints.GetFirst();
00417         while(node)
00418         {
00419                 pFunctionPoint* point=(pFunctionPoint*)node->GetData();
00420                 if(point->getRealX()==aX && point->getRealY()==aY)
00421                 {
00422                         realPoints.Erase(node);
00423                         return true;
00424                 }
00425                 node= node->GetNext();
00426         }
00427 
00428         return false;
00429 }

Here is the call graph for this function:

bool pLogicalFunction::changePoint ( wxPoint  newCoords,
int  movingIndexPoint 
)

Change de coordinates of the given point if it is possible and return the result of the invoked action. True if it was possible to do the change.

Change de coordinates of the given index point to the newCoords, if it is possible and return the result of the invoked action. 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.

Definition at line 460 of file pLogicalFunction.cxx.

References GetPointAt(), pFunctionPoint::getRealX(), and realPoints.

00461 {
00462         wxNode* changingNode = GetPointAt(movingIndexPoint);
00463         bool validChange = false; 
00464         int newX = newCoords.x;
00465         int newY = newCoords.y;
00466         pFunctionPoint* changingPoint = (pFunctionPoint*)changingNode -> GetData();
00467         bool hasPrevious = movingIndexPoint>0;
00468         bool hasNext = movingIndexPoint < realPoints.size()-1;
00469         
00470         wxNode* prevNode = hasPrevious ? changingNode ->GetPrevious() : NULL;
00471         wxNode* nextNode = hasNext ? changingNode -> GetNext() : NULL;
00472         
00473         if( hasPrevious )
00474         {
00475                 pFunctionPoint* prevPoint = (pFunctionPoint*)prevNode -> GetData();
00476                 if ( hasNext )
00477                 {
00478                         pFunctionPoint* nextPoint = (pFunctionPoint*) nextNode -> GetData();
00479                         validChange = ((prevPoint->getRealX()) < newX) && ((nextPoint->getRealX()) > newX);
00480                         if ( (prevPoint->getRealX()) > newX )
00481                         {
00482                                 newX = prevPoint->getRealX()+1;
00483                                 validChange = true;
00484                         }
00485                         else if ( (nextPoint->getRealX()) < newX )
00486                         {
00487                                 newX = nextPoint->getRealX()-1;
00488                                 validChange = true;
00489                         }
00490                 }
00491                 else
00492                 {
00493                         // Is the last point of the function.
00494                         if ( (prevPoint->getRealX()) < newX )
00495                         {
00496                                 validChange = true;
00497                         }
00498                         else
00499                         {
00500                                 newX = prevPoint->getRealX();
00501                                 validChange = true;
00502                         }
00503                 }               
00504         }       
00505         else
00506         {
00507                 if ( hasNext )
00508                 {
00509                         // Is the first point of the function.
00510                         pFunctionPoint* nextPoint = (pFunctionPoint*) nextNode -> GetData();
00511                         if ((nextPoint->getRealX()) > newX )
00512                         {
00513                                 validChange = true;
00514                         }
00515                         else
00516                         {
00517                                 newX = nextPoint->getRealX();
00518                                 validChange = true;
00519                         }
00520                 }               
00521         }
00522         if( validChange )
00523         {
00524                 changingPoint -> setRealX( newX );
00525                 changingPoint -> setRealY( newY );
00526         }
00527         return validChange;
00528 }

Here is the call graph for this function:

double * pLogicalFunction::getX_RealValues (  ) 

Evaluates if the given point belongs to the function. IS NO USED Returns the real x values of the control points of the function. It dont includes the points calculated by interpolation.

Evaluates if the given point belongs to the function. Returns the real x values of the control points of the function. It dont includes the points calculated by interpolation.

Definition at line 553 of file pLogicalFunction.cxx.

References realPoints, and x_Values.

00554 {
00555         wxNode *nextNode = realPoints.GetFirst();
00556         int size = realPoints.GetCount();
00557         double * x_Values;
00558         int i=0;
00559 
00560         x_Values= new double[size];
00561 
00562         while (nextNode)
00563         {
00564                 pFunctionPoint* nextPoint = (pFunctionPoint*)nextNode->GetData();
00565                 x_Values[i] = nextPoint-> getRealX();
00566                 nextNode = nextNode->GetNext();
00567                 i++;
00568         }
00569         return x_Values;
00570 }

double * pLogicalFunction::getY_RealValues (  ) 

Returns the real y values of the control points of the function. It dont includes the points calculated by interpolation.

Definition at line 575 of file pLogicalFunction.cxx.

References realPoints, and y_Values.

00576 {  
00577         wxNode *nextNode = realPoints.GetFirst();
00578         int i =0;
00579         int size = realPoints.GetCount();
00580         double * y_Values;
00581 
00582         y_Values= new double[size];
00583 
00584         while (nextNode)
00585         {
00586                 pFunctionPoint*  nextPoint = (pFunctionPoint*)nextNode->GetData();
00587                 y_Values[i] = nextPoint-> getRealY();
00588                 nextNode = nextNode->GetNext();
00589                 i++;
00590         }
00591         return y_Values;
00592 }

bool pLogicalFunction::orderPoints (  ) 

Definition at line 130 of file pLogicalFunction.cxx.

References pFunctionPoint::getRealX(), pFunctionPoint::getRealY(), leftToRigthDef, and realPoints.

Referenced by AddNewPoint(), and AddPoint().

00131 {
00132         bool lastOrdered = false;
00133         bool validToContinue = false;
00134 
00135         wxNode* lastNodeIncluded = realPoints.GetLast();
00136 
00137         wxNode* node = realPoints.GetFirst();
00138         pFunctionPoint* lastPointIncluded = (pFunctionPoint*)lastNodeIncluded -> GetData();             
00139         int xToOrder = lastPointIncluded -> getRealX();
00140         int actualX;
00141         int nextX;
00142 
00143         // Used for validating 'leftToRigthDef'
00144         pFunctionPoint* ordFirstPoint = (pFunctionPoint*)realPoints.GetFirst()-> GetData();
00145         pFunctionPoint* ordLastPoint = (pFunctionPoint*)(lastNodeIncluded->GetPrevious())-> GetData();
00146 
00147 
00148         // Normal drawing
00149         if (leftToRigthDef)
00150         {
00151                 validToContinue = ordFirstPoint->getRealX() < xToOrder; 
00152         }
00153         else
00154         {
00155                 //validToContinue =ordFirstPoint->getRealX() >  xToOrder;
00156                 validToContinue =ordLastPoint->getRealX() >  xToOrder;
00157         }
00158 
00159         if ( validToContinue)
00160         {               
00161 
00162                 while( node && !lastOrdered )
00163                 {
00164                         pFunctionPoint* prevPoint =(pFunctionPoint*)node->GetData();
00165                         actualX = prevPoint ->getRealX();
00166                         if( actualX == xToOrder)
00167                         {
00168                                 realPoints.DeleteNode(lastNodeIncluded);
00169                                 lastOrdered = false;
00170                         }
00171                         else if ( actualX < xToOrder )
00172                         {
00173                                 //firstNode
00174                                 wxNode* nextNode = node->GetNext();
00175                                 pFunctionPoint* nextPoint;
00176                                 if( nextNode != lastNodeIncluded )                      
00177                                 {
00178                                         nextPoint = (pFunctionPoint*)nextNode -> GetData();     
00179                                         nextX = nextPoint->getRealX();
00180                                         int nextIndex = realPoints.IndexOf(nextPoint);
00181                                         if( nextX > xToOrder )
00182                                         {
00183                                                 //we need to change the direction in memory of our node
00184                                                 pFunctionPoint* pointToInsert=new pFunctionPoint(lastPointIncluded->getRealX(),lastPointIncluded->getRealY());
00185                                                 // The last inserted point is ordered like: prevPoint - lastPointIncluded - nextPoint
00186                                                 lastOrdered = (realPoints.Insert(nextIndex, pointToInsert))!= NULL;
00187                                                 bool lastNodeDeleted=realPoints.DeleteNode(lastNodeIncluded);
00188                                                 return lastOrdered && lastNodeDeleted;
00189 
00190                                         }
00191 
00192                                 }
00193                                 else 
00194                                 {
00195                                         lastOrdered = true;
00196                                 }
00197                         }
00198                         else 
00199                         {
00200                                 //firstNode
00201                                 wxNode* prevNode = node->GetPrevious();
00202                                 int insertIndex=realPoints.IndexOf(prevPoint);
00203                                 pFunctionPoint* prPoint;
00204                                 if(prevNode)
00205                                 {
00206                                         prPoint = (pFunctionPoint*)prevNode -> GetData();       
00207                                         int beforeX =prPoint->getRealX();
00208                                         if( beforeX < xToOrder)
00209                                         {
00210                                                 //we need to change the direction in memory of our node
00211                                                 pFunctionPoint* pointToInsert=new pFunctionPoint(lastPointIncluded->getRealX(),lastPointIncluded->getRealY());
00212                                                 // The last inserted point is ordered like: prevPoint - lastPointIncluded - nextPoint
00213                                                 lastOrdered = (realPoints.Insert(insertIndex, pointToInsert))!= NULL;
00214                                                 bool lastNodeDeleted=realPoints.DeleteNode(lastNodeIncluded);
00215                                                 return lastOrdered && lastNodeDeleted;
00216                                         }
00217                                 }
00218                                 //is just the second point
00219                                 else
00220                                 {
00221                                         //we need to change the direction in memory of our node
00222                                         pFunctionPoint* pointToInsert=new pFunctionPoint(lastPointIncluded->getRealX(),lastPointIncluded->getRealY());
00223                                         // The last inserted point is ordered like: prevPoint - lastPointIncluded - nextPoint
00224                                         lastOrdered = (realPoints.Insert(insertIndex, pointToInsert))!= NULL;
00225                                         bool lastNodeDeleted=realPoints.DeleteNode(lastNodeIncluded);
00226                                         return lastOrdered && lastNodeDeleted;
00227                                 }
00228                         }
00229 
00230                         node = node->GetNext();
00231                 }
00232 
00233         }
00234         else
00235         {
00236                 bool lastNodeDeleted = realPoints.DeleteNode(lastNodeIncluded);
00237                 lastOrdered = lastOrdered && lastNodeDeleted;
00238         }
00239         return lastOrdered;
00240 }

Here is the call graph for this function:

Here is the caller graph for this function:

void pLogicalFunction::setStartPoints (  ) 

This method get a pointer to the node in the real points list that is inmediately previous to the searched by parameter.

Precondition:
The seached point (realX, realY) is not the first point of the list.
Parameters:
realX 
realY IS NOT USED

Definition at line 306 of file pLogicalFunction.cxx.

References pFunctionPoint::getRealX(), pFunctionPoint::getRealY(), realPoints, setStartX(), and setStartY().

Referenced by pGraphicalFunction::AddNewPoint(), pGraphicalFunction::AddPoint(), pGraphicalFunction::changePoint(), pGraphicalFunction::DeletePoint(), pGraphicalFunction::deletePointAt(), and setUp().

00307 {
00308   wxNode* first=realPoints.GetFirst();
00309   if(first)
00310         {
00311           pFunctionPoint* startPoint=(pFunctionPoint*)first->GetData();
00312           setStartX(startPoint->getRealX());
00313           setStartY(startPoint->getRealY());
00314         }
00315   else
00316   {
00317           setStartX(-1);
00318           setStartY(-1);
00319   }
00320 }

Here is the call graph for this function:

Here is the caller graph for this function:

void pLogicalFunction::setEndPoints (  ) 

Definition at line 324 of file pLogicalFunction.cxx.

References pFunctionPoint::getRealX(), pFunctionPoint::getRealY(), realPoints, setEndX(), and setEndY().

Referenced by pGraphicalFunction::AddNewPoint(), pGraphicalFunction::AddPoint(), pGraphicalFunction::changePoint(), pGraphicalFunction::DeletePoint(), pGraphicalFunction::deletePointAt(), and setUp().

00325 {
00326   wxNode* last=realPoints.GetLast();
00327   if(last)
00328   {
00329           pFunctionPoint* lastPoint=(pFunctionPoint*)last->GetData();
00330           setEndX(lastPoint->getRealX());
00331           setEndY(lastPoint->getRealY());
00332   }
00333   else
00334   {
00335           setEndX(-1);
00336           setEndY(-1);
00337   
00338   }
00339 }

Here is the call graph for this function:

Here is the caller graph for this function:

void pLogicalFunction::setMaxPoints (  ) 

Definition at line 378 of file pLogicalFunction.cxx.

References pFunctionPoint::getRealX(), pFunctionPoint::getRealY(), realPoints, setMaxX(), and setMaxY().

Referenced by setUp().

00379 {
00380     int maxX,maxY;  
00381         wxNode* node=realPoints.GetFirst();
00382         if(node)
00383         {
00384                 pFunctionPoint* point=(pFunctionPoint*)node->GetData();
00385                 maxX=point->getRealX();
00386                 maxY=point->getRealY();
00387                 wxNode* nextNode=node->GetNext();
00388                 while(nextNode)
00389                         {
00390                                 point=(pFunctionPoint*)nextNode->GetData();
00391                                 int x=point->getRealX();
00392                                 int y=point->getRealY();
00393                                 if(x>maxX)
00394                                         maxX=x;
00395                                 if(y>maxY)
00396                                         maxY=y;
00397                                 nextNode=nextNode->GetNext();
00398                         }
00399                 setMaxX(maxX);
00400                 setMaxY(maxY);
00401         }
00402         else
00403         {
00404                 setMaxX(0);
00405                 setMaxY(0);
00406         }
00407 }

Here is the call graph for this function:

Here is the caller graph for this function:

void pLogicalFunction::setMinPoints (  ) 

Definition at line 344 of file pLogicalFunction.cxx.

References pFunctionPoint::getRealX(), pFunctionPoint::getRealY(), realPoints, setMinX(), and setMinY().

Referenced by setUp().

00345 {
00346     int minX,minY;  
00347         wxNode* node=realPoints.GetFirst();
00348         if(node)
00349         {
00350                 pFunctionPoint* point=(pFunctionPoint*)node->GetData();
00351                 minX=point->getRealX();
00352                 minY=point->getRealY();
00353                 wxNode* nextNode=node->GetNext();
00354                 while(nextNode)
00355                         {
00356                                 point=(pFunctionPoint*)nextNode->GetData();
00357                                 int x=point->getRealX();
00358                                 int y=point->getRealY();
00359                                 if(x<minX)
00360                                         minX=x;
00361                                 if(y<minY)
00362                                         minY=y;
00363                                 nextNode=nextNode->GetNext();
00364                         }
00365                 setMinX(minX);
00366                 setMinY(minY);
00367         }
00368         else
00369         {
00370                 setMinX(0);
00371                 setMinY(0);
00372         }
00373                 
00374 }

Here is the call graph for this function:

Here is the caller graph for this function:

void pLogicalFunction::setUp (  ) 

Definition at line 290 of file pLogicalFunction.cxx.

References setEndPoints(), setMaxPoints(), setMinPoints(), and setStartPoints().

Referenced by pGraphicalFunction::load(), and pGraphicalFunction::setUp().

00291 {
00292         //sets the start point of the function
00293         setStartPoints();
00294         //set the Last point of the function
00295         setEndPoints();
00296         //set the min value in x and y between all the points of the function
00297         setMinPoints();
00298         //set the max value in x and y between all the points of the function
00299         setMaxPoints();
00300 }

Here is the call graph for this function:

Here is the caller graph for this function:

void pLogicalFunction::save ( wxString  fileName  ) 

Definition at line 605 of file pLogicalFunction.cxx.

References pFunctionPoint::getRealX(), pFunctionPoint::getRealY(), getSizePoints(), and realPoints.

Referenced by pGraphicalFunction::save().

00606 {
00607 
00608         std::ofstream file;
00609         file.open( (const char*)(fileName.mb_str()) );
00610         if(file.is_open())
00611         {
00612                 file << getSizePoints()<< std::endl;
00613                 wxNode* node= realPoints.GetFirst();
00614                 pFunctionPoint* p;
00615                 while(node)
00616                 {
00617                         p=(pFunctionPoint*)node->GetData();
00618                         file <<p->getRealX()<<"\t"<<p->getRealY()<<std::endl;
00619                         node=node->GetNext();
00620                 }
00621         }
00622         file.close();
00623 }

Here is the call graph for this function:

Here is the caller graph for this function:

void pLogicalFunction::load ( wxString  fileName  ) 

Definition at line 627 of file pLogicalFunction.cxx.

References AddPoint().

Referenced by pGraphicalFunction::load().

00628 {
00629         std::string line;
00630         std::ifstream file;
00631         file.open( (const char*)(fileName.mb_str()) );
00632         
00633         if(file.is_open())
00634         {
00635                 std::getline(file,line);
00636                 int nPoints=atoi(line.c_str());
00637                 int i=0;
00638                 while(!file.eof() && i<nPoints)
00639                 {
00640                         std::getline(file,line);
00641                         int pos=line.find("\t");
00642                         int size=line.size();
00643                         std::string x=line.substr(0,pos);
00644                         std::string y=line.substr(pos+1,size);
00645                         int x0=atoi(x.c_str());
00646                         int y0=atoi(y.c_str());
00647                         AddPoint(x0,y0);
00648                         i++;
00649 
00650                 }
00651         }
00652 }

Here is the call graph for this function:

Here is the caller graph for this function:

void pLogicalFunction::setStartX ( double  aStartX  ) 

Definition at line 662 of file pLogicalFunction.cxx.

References _startX.

Referenced by setStartPoints(), and pGraphicalFunction::setStartX().

00662                                                {
00663         this->_startX = aStartX;
00664 }

Here is the caller graph for this function:

double pLogicalFunction::getStartX (  ) 

Definition at line 666 of file pLogicalFunction.cxx.

References _startX.

Referenced by pGraphicalFunction::getStartX(), pGraphicalFunction::setStartX(), and pGraphicalFunction::setUp().

00666                                    {
00667         return this->_startX;
00668 }

Here is the caller graph for this function:

void pLogicalFunction::setStartY ( double  aStartY  ) 

Definition at line 670 of file pLogicalFunction.cxx.

References _startY.

Referenced by setStartPoints(), and pGraphicalFunction::setStartY().

00670                                                {
00671         this->_startY = aStartY;
00672 }

Here is the caller graph for this function:

double pLogicalFunction::getStartY (  ) 

Definition at line 674 of file pLogicalFunction.cxx.

References _startY.

Referenced by pGraphicalFunction::getStartY(), and pGraphicalFunction::setUp().

00674                                    {
00675         return this->_startY;
00676 }

Here is the caller graph for this function:

void pLogicalFunction::setEndX ( double  aEndX  ) 

Definition at line 681 of file pLogicalFunction.cxx.

References _endX.

Referenced by setEndPoints(), and pGraphicalFunction::setEndX().

00681                                            {
00682         this->_endX = aEndX;
00683 }

Here is the caller graph for this function:

double pLogicalFunction::getEndX (  ) 

Definition at line 685 of file pLogicalFunction.cxx.

References _endX.

Referenced by pGraphicalFunction::getEndX(), and pGraphicalFunction::setUp().

00685                                  {
00686         return this->_endX;
00687 }

Here is the caller graph for this function:

void pLogicalFunction::setEndY ( double  aEndY  ) 

Definition at line 689 of file pLogicalFunction.cxx.

References _endY.

Referenced by setEndPoints(), and pGraphicalFunction::setEndY().

00689                                            {
00690         this->_endY = aEndY;
00691 }

Here is the caller graph for this function:

double pLogicalFunction::getEndY (  ) 

Definition at line 693 of file pLogicalFunction.cxx.

References _endY.

Referenced by pGraphicalFunction::getEndY(), and pGraphicalFunction::setUp().

00693                                  {
00694         return this->_endY;
00695 }

Here is the caller graph for this function:

void pLogicalFunction::setScaleX ( double  aScaleX  ) 

Definition at line 699 of file pLogicalFunction.cxx.

References _scaleX.

Referenced by pGraphicalFunction::setScales(), and pGraphicalFunction::setScaleX().

00699                                                {
00700         this->_scaleX = aScaleX;
00701 }

Here is the caller graph for this function:

double pLogicalFunction::getScaleX (  ) 

Definition at line 703 of file pLogicalFunction.cxx.

References _scaleX.

00703                                    {
00704         return this->_scaleX;
00705 }

void pLogicalFunction::setScaleY ( double  aScaleY  ) 

Definition at line 707 of file pLogicalFunction.cxx.

References _scaleY.

Referenced by pGraphicalFunction::setScales(), and pGraphicalFunction::setScaleY().

00707                                                {
00708         this->_scaleY = aScaleY;
00709 }

Here is the caller graph for this function:

double pLogicalFunction::getScaleY (  ) 

Definition at line 711 of file pLogicalFunction.cxx.

References _scaleY.

00711                                    {
00712         return this->_scaleY;
00713 }

void pLogicalFunction::setMinX ( double  aMinX  ) 

Definition at line 717 of file pLogicalFunction.cxx.

References _minX.

Referenced by setMinPoints(), and pGraphicalFunction::setMinX().

00717                                            {
00718         this->_minX = aMinX;
00719 }

Here is the caller graph for this function:

double pLogicalFunction::getMinX (  ) 

Definition at line 721 of file pLogicalFunction.cxx.

References _minX.

Referenced by pGraphicalFunction::getMinX(), pGraphicalFunction::load(), and pGraphicalFunction::setUp().

00721                                  {
00722         return this->_minX;
00723 }

Here is the caller graph for this function:

void pLogicalFunction::setMinY ( double  aMinY  ) 

Definition at line 725 of file pLogicalFunction.cxx.

References _minY.

Referenced by setMinPoints(), and pGraphicalFunction::setMinY().

00725                                            {
00726         this->_minY = aMinY;
00727 }

Here is the caller graph for this function:

double pLogicalFunction::getMinY (  ) 

Definition at line 729 of file pLogicalFunction.cxx.

References _minY.

Referenced by pGraphicalFunction::getMinY(), pGraphicalFunction::load(), and pGraphicalFunction::setUp().

00729                                  {
00730         return this->_minY;
00731 }

Here is the caller graph for this function:

void pLogicalFunction::setMaxX ( double  aMaxX  ) 

Definition at line 735 of file pLogicalFunction.cxx.

References _maxX.

Referenced by setMaxPoints(), and pGraphicalFunction::setMaxX().

00735                                            {
00736         this->_maxX = aMaxX;
00737 }

Here is the caller graph for this function:

double pLogicalFunction::getMaxX (  ) 

Definition at line 739 of file pLogicalFunction.cxx.

References _maxX.

Referenced by pGraphicalFunction::getMaxX(), pGraphicalFunction::load(), and pGraphicalFunction::setUp().

00739                                  {
00740         return this->_maxX;
00741 }

Here is the caller graph for this function:

void pLogicalFunction::setMaxY ( double  aMaxY  ) 

Definition at line 743 of file pLogicalFunction.cxx.

References _maxY.

Referenced by setMaxPoints(), and pGraphicalFunction::setMaxY().

00743                                            {
00744         this->_maxY = aMaxY;
00745 }

Here is the caller graph for this function:

double pLogicalFunction::getMaxY (  ) 

Definition at line 747 of file pLogicalFunction.cxx.

References _maxY.

Referenced by pGraphicalFunction::getMaxY(), pGraphicalFunction::load(), and pGraphicalFunction::setUp().

00747                                  {
00748         return this->_maxY;
00749 }

Here is the caller graph for this function:

void pLogicalFunction::setOffsetX ( double  aOffsetX  ) 

Definition at line 754 of file pLogicalFunction.cxx.

References _offsetX.

Referenced by pGraphicalFunction::setOffsetX().

00754                                                  {
00755         this->_offsetX = aOffsetX;
00756 }

Here is the caller graph for this function:

double pLogicalFunction::getOffsetX (  ) 

Definition at line 758 of file pLogicalFunction.cxx.

References _offsetX.

00758                                      {
00759         return this->_offsetX;
00760 }

void pLogicalFunction::setOffsetY ( double  aOffsetY  ) 

Definition at line 762 of file pLogicalFunction.cxx.

References _offsetY.

Referenced by pGraphicalFunction::setOffsetY().

00762                                                   {
00763         this->_offsetY = aOffsetY;
00764 }

Here is the caller graph for this function:

double pLogicalFunction::getOffsetY (  ) 

Definition at line 766 of file pLogicalFunction.cxx.

References _offsetY.

00766                                      {
00767         return this->_offsetY;
00768 }

void pLogicalFunction::setType ( int  aType  ) 

Definition at line 773 of file pLogicalFunction.cxx.

References _type.

Referenced by pGraphicalFunction::setType().

00773                                          {
00774         this->_type = aType;
00775 }

Here is the caller graph for this function:

int pLogicalFunction::getType (  ) 

Definition at line 777 of file pLogicalFunction.cxx.

References _type.

00777                                 {
00778         return this->_type;
00779 }

int pLogicalFunction::getValidPointRange (  ) 

Definition at line 784 of file pLogicalFunction.cxx.

References validPointRange.

00785 {
00786         return validPointRange;
00787 }

void pLogicalFunction::setValidPointRange ( int  theRange  ) 

Definition at line 789 of file pLogicalFunction.cxx.

References validPointRange.

Referenced by pGraphicalFunction::setValidPointRange().

00790 {
00791         validPointRange = theRange;
00792 }

Here is the caller graph for this function:

bool pLogicalFunction::deletePointAt ( int  index  ) 

Deletes a point of the function given its index

deletes a point of the functio given its index

Definition at line 434 of file pLogicalFunction.cxx.

References GetPointAt(), and realPoints.

00435 {
00436         if(index!=-1)  
00437         {       
00438                 wxNode* node=GetPointAt(index);
00439                 
00440                 if(node)//point!=NULL)
00441                 {
00442                         //pFunctionPoint* point=(pFunctionPoint*)node->GetData(); // JPRx
00443                         bool deleted=realPoints.DeleteNode(node);
00444                         //delete point;
00445                         //delete node;
00446                         /*
00447                         if(index==0)
00448                                 realPoints=realPoints.;
00449                         */
00450                         return deleted;
00451                 }
00452         }
00453         return false;
00454 }

Here is the call graph for this function:

int pLogicalFunction::getSizePoints (  ) 

Definition at line 797 of file pLogicalFunction.cxx.

References realPoints.

Referenced by pGraphicalFunction::getSizePoints(), pGraphicalFunction::GetSplinePoint(), pGraphicalFunction::initializeSplineVectors(), and save().

00798 {
00799         return realPoints.GetCount();
00800 }

Here is the caller graph for this function:

void pLogicalFunction::getDirection ( bool &  dir  ) 

Definition at line 801 of file pLogicalFunction.cxx.

References leftToRigthDef.

00802 {
00803         dir = leftToRigthDef;
00804 }


Member Data Documentation

double pLogicalFunction::_startX [private]

Is the initial discrete point on x axis of the drawed function.

Definition at line 279 of file pLogicalFunction.h.

Referenced by getStartX(), and setStartX().

double pLogicalFunction::_startY [private]

Is the initial discrete point on y axis of the drawed function.

Definition at line 283 of file pLogicalFunction.h.

Referenced by getStartY(), and setStartY().

double pLogicalFunction::_endX [private]

Is the last discrete point on x axis of the drawed function.

Definition at line 287 of file pLogicalFunction.h.

Referenced by getEndX(), and setEndX().

double pLogicalFunction::_endY [private]

Is the last discrete point on y axis of the drawed function.

Definition at line 291 of file pLogicalFunction.h.

Referenced by getEndY(), and setEndY().

double pLogicalFunction::_scaleX [private]

Is the x-scale percentage according to the context device.

Definition at line 295 of file pLogicalFunction.h.

Referenced by getScaleX(), setScaleX(), and validPointOnFunction().

double pLogicalFunction::_scaleY [private]

Is the y-scale percentage according to the context device.

Definition at line 299 of file pLogicalFunction.h.

Referenced by getScaleY(), setScaleY(), and validPointOnFunction().

double pLogicalFunction::_minX [private]

Is the minimun x-real value reacheable by the function.

Definition at line 303 of file pLogicalFunction.h.

Referenced by getMinX(), and setMinX().

double pLogicalFunction::_minY [private]

Is the minimun y-real value reacheable by the function.

Definition at line 307 of file pLogicalFunction.h.

Referenced by getMinY(), and setMinY().

double pLogicalFunction::_maxX [private]

Is the maximun y-real value reacheable by the function.

Definition at line 311 of file pLogicalFunction.h.

Referenced by getMaxX(), and setMaxX().

double pLogicalFunction::_maxY [private]

Is the maximun y-real value reacheable by the function.

Definition at line 316 of file pLogicalFunction.h.

Referenced by getMaxY(), and setMaxY().

double pLogicalFunction::_offsetX [private]

Is the logical x-offset of the drawed function.

Definition at line 321 of file pLogicalFunction.h.

Referenced by getOffsetX(), and setOffsetX().

double pLogicalFunction::_offsetY [private]

Is the logical y-offset of the drawed function.

Definition at line 325 of file pLogicalFunction.h.

Referenced by getOffsetY(), and setOffsetY().

int pLogicalFunction::_type [private]

Is the way of how points are going to be connected. It could be smooth, line.

Definition at line 329 of file pLogicalFunction.h.

Referenced by getType(), and setType().

wxList pLogicalFunction::realPoints [private]

The list of the function points

Definition at line 333 of file pLogicalFunction.h.

Referenced by AddNewPoint(), AddPoint(), changePoint(), DeletePoint(), deletePointAt(), getIndexOf(), GetPointAt(), GetPoints(), getSizePoints(), getX_RealValues(), getY_RealValues(), orderPoints(), save(), setEndPoints(), setMaxPoints(), setMinPoints(), setStartPoints(), validPointOnFunction(), and ~pLogicalFunction().

double pLogicalFunction::x_Values[50] [private]

x-values

Definition at line 338 of file pLogicalFunction.h.

Referenced by getX_RealValues().

double pLogicalFunction::y_Values[50] [private]

y-values

Definition at line 342 of file pLogicalFunction.h.

Referenced by getY_RealValues().

int pLogicalFunction::validPointRange [private]

node of the realPoints where are we Number that determines the radius range for the valid area the point (sensible radius). Default value 5.

Definition at line 351 of file pLogicalFunction.h.

Referenced by getValidPointRange(), and setValidPointRange().

bool pLogicalFunction::leftToRigthDef [private]

Indicates the way the function is being drawed when defining it. So that it is true if the direction is from left-to-right, and false if it is from right-to-left. It is initialized when the second point is included in the funcion.

Definition at line 357 of file pLogicalFunction.h.

Referenced by AddPoint(), getDirection(), and orderPoints().


The documentation for this class was generated from the following files:
Generated on Wed Jul 29 16:36:06 2009 for creaMaracasVisu_lib by  doxygen 1.5.3