#include <pLogicalFunction.h>
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 |
Definition at line 40 of file pLogicalFunction.h.
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 }
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=true; 00122 if(realPoints.size()>1){ 00123 order=orderPoints(); 00124 } 00125 00126 return order; 00127 } 00128 return includedPoint; 00129 }
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 258 of file pLogicalFunction.cxx.
References pFunctionPoint::getRealX(), leftToRigthDef, orderPoints(), and realPoints.
Referenced by load().
00259 { 00260 pFunctionPoint * newPoint = new pFunctionPoint (aX, aY); 00261 wxNode* lastNode = realPoints.GetLast(); 00262 bool addedPoint = false; 00263 if (lastNode) 00264 { 00265 pFunctionPoint* lastPoint = (pFunctionPoint*)lastNode->GetData(); 00266 if( lastPoint->getRealX() != aX ) 00267 { 00268 addedPoint = realPoints.Append(newPoint)!=NULL; 00269 //In case that the definition of points is being done backwards. 00270 if( (aX < (lastPoint->getRealX()) ) && addedPoint ) 00271 { 00272 if( realPoints.GetCount() == 2 ) 00273 { 00274 leftToRigthDef = false; 00275 } 00276 if(order) 00277 addedPoint = orderPoints(); 00278 00279 } 00280 else 00281 { 00282 if( realPoints.GetCount() == 2 ) 00283 { 00284 leftToRigthDef = true; 00285 } 00286 } 00287 } 00288 } 00289 else 00290 { 00291 addedPoint = realPoints.Append(newPoint)!=NULL; 00292 } 00293 00294 return addedPoint; 00295 }
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 470 of file pLogicalFunction.cxx.
References GetPointAt(), pFunctionPoint::getRealX(), and realPoints.
00471 { 00472 wxNode* changingNode = GetPointAt(movingIndexPoint); 00473 bool validChange = false; 00474 int newX = newCoords.x; 00475 int newY = newCoords.y; 00476 pFunctionPoint* changingPoint = (pFunctionPoint*)changingNode -> GetData(); 00477 bool hasPrevious = movingIndexPoint>0; 00478 bool hasNext = movingIndexPoint < realPoints.size()-1; 00479 00480 wxNode* prevNode = hasPrevious ? changingNode ->GetPrevious() : NULL; 00481 wxNode* nextNode = hasNext ? changingNode -> GetNext() : NULL; 00482 00483 if( hasPrevious ) 00484 { 00485 pFunctionPoint* prevPoint = (pFunctionPoint*)prevNode -> GetData(); 00486 if ( hasNext ) 00487 { 00488 pFunctionPoint* nextPoint = (pFunctionPoint*) nextNode -> GetData(); 00489 validChange = ((prevPoint->getRealX()) < newX) && ((nextPoint->getRealX()) > newX); 00490 if ( (prevPoint->getRealX()) > newX ) 00491 { 00492 newX = prevPoint->getRealX()+1; 00493 validChange = true; 00494 } 00495 else if ( (nextPoint->getRealX()) < newX ) 00496 { 00497 newX = nextPoint->getRealX()-1; 00498 validChange = true; 00499 } 00500 } 00501 else 00502 { 00503 // Is the last point of the function. 00504 if ( (prevPoint->getRealX()) < newX ) 00505 { 00506 validChange = true; 00507 } 00508 else 00509 { 00510 newX = prevPoint->getRealX(); 00511 validChange = true; 00512 } 00513 } 00514 } 00515 else 00516 { 00517 if ( hasNext ) 00518 { 00519 // Is the first point of the function. 00520 pFunctionPoint* nextPoint = (pFunctionPoint*) nextNode -> GetData(); 00521 if ((nextPoint->getRealX()) > newX ) 00522 { 00523 validChange = true; 00524 } 00525 else 00526 { 00527 newX = nextPoint->getRealX(); 00528 validChange = true; 00529 } 00530 } 00531 } 00532 if( validChange ) 00533 { 00534 changingPoint -> setRealX( newX ); 00535 changingPoint -> setRealY( newY ); 00536 } 00537 return validChange; 00538 }
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 424 of file pLogicalFunction.cxx.
References pFunctionPoint::getRealX(), pFunctionPoint::getRealY(), and realPoints.
00425 { 00426 wxNode* node= realPoints.GetFirst(); 00427 while(node) 00428 { 00429 pFunctionPoint* point=(pFunctionPoint*)node->GetData(); 00430 if(point->getRealX()==aX && point->getRealY()==aY) 00431 { 00432 realPoints.Erase(node); 00433 return true; 00434 } 00435 node= node->GetNext(); 00436 } 00437 00438 return false; 00439 }
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 444 of file pLogicalFunction.cxx.
References GetPointAt(), and realPoints.
00445 { 00446 if(index!=-1) 00447 { 00448 wxNode* node=GetPointAt(index); 00449 00450 if(node)//point!=NULL) 00451 { 00452 //pFunctionPoint* point=(pFunctionPoint*)node->GetData(); // JPRx 00453 bool deleted=realPoints.DeleteNode(node); 00454 //delete point; 00455 //delete node; 00456 /* 00457 if(index==0) 00458 realPoints=realPoints.; 00459 */ 00460 return deleted; 00461 } 00462 } 00463 return false; 00464 }
void pLogicalFunction::getDirection | ( | bool & | dir | ) |
Definition at line 811 of file pLogicalFunction.cxx.
References leftToRigthDef.
00812 { 00813 dir = leftToRigthDef; 00814 }
double pLogicalFunction::getEndX | ( | ) |
Definition at line 695 of file pLogicalFunction.cxx.
References _endX.
Referenced by pGraphicalFunction::getEndX(), and pGraphicalFunction::setUp().
00695 { 00696 return this->_endX; 00697 }
double pLogicalFunction::getEndY | ( | ) |
Definition at line 703 of file pLogicalFunction.cxx.
References _endY.
Referenced by pGraphicalFunction::getEndY(), and pGraphicalFunction::setUp().
00703 { 00704 return this->_endY; 00705 }
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 }
double pLogicalFunction::getMaxX | ( | ) |
Definition at line 749 of file pLogicalFunction.cxx.
References _maxX.
Referenced by pGraphicalFunction::getMaxX(), pGraphicalFunction::load(), and pGraphicalFunction::setUp().
00749 { 00750 return this->_maxX; 00751 }
double pLogicalFunction::getMaxY | ( | ) |
Definition at line 757 of file pLogicalFunction.cxx.
References _maxY.
Referenced by pGraphicalFunction::getMaxY(), pGraphicalFunction::load(), and pGraphicalFunction::setUp().
00757 { 00758 return this->_maxY; 00759 }
double pLogicalFunction::getMinX | ( | ) |
Definition at line 731 of file pLogicalFunction.cxx.
References _minX.
Referenced by pGraphicalFunction::getMinX(), pGraphicalFunction::load(), and pGraphicalFunction::setUp().
00731 { 00732 return this->_minX; 00733 }
double pLogicalFunction::getMinY | ( | ) |
Definition at line 739 of file pLogicalFunction.cxx.
References _minY.
Referenced by pGraphicalFunction::getMinY(), pGraphicalFunction::load(), and pGraphicalFunction::setUp().
00739 { 00740 return this->_minY; 00741 }
double pLogicalFunction::getOffsetX | ( | ) |
Definition at line 768 of file pLogicalFunction.cxx.
References _offsetX.
00768 { 00769 return this->_offsetX; 00770 }
double pLogicalFunction::getOffsetY | ( | ) |
Definition at line 776 of file pLogicalFunction.cxx.
References _offsetY.
00776 { 00777 return this->_offsetY; 00778 }
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 }
void pLogicalFunction::GetPoints | ( | wxList & | points | ) | [inline] |
Rewind Get locus value for next N. Override this function in your implementation.
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 }
double pLogicalFunction::getScaleX | ( | ) |
Definition at line 713 of file pLogicalFunction.cxx.
References _scaleX.
00713 { 00714 return this->_scaleX; 00715 }
double pLogicalFunction::getScaleY | ( | ) |
Definition at line 721 of file pLogicalFunction.cxx.
References _scaleY.
00721 { 00722 return this->_scaleY; 00723 }
int pLogicalFunction::getSizePoints | ( | ) |
Definition at line 807 of file pLogicalFunction.cxx.
References realPoints.
Referenced by pGraphicalFunction::getSizePoints(), pGraphicalFunction::GetSplinePoint(), pGraphicalFunction::initializeSplineVectors(), and save().
00808 { 00809 return realPoints.GetCount(); 00810 }
double pLogicalFunction::getStartX | ( | ) |
Definition at line 676 of file pLogicalFunction.cxx.
References _startX.
Referenced by pGraphicalFunction::getStartX(), pGraphicalFunction::setStartX(), and pGraphicalFunction::setUp().
00676 { 00677 return this->_startX; 00678 }
double pLogicalFunction::getStartY | ( | ) |
Definition at line 684 of file pLogicalFunction.cxx.
References _startY.
Referenced by pGraphicalFunction::getStartY(), and pGraphicalFunction::setUp().
00684 { 00685 return this->_startY; 00686 }
int pLogicalFunction::getType | ( | ) |
Definition at line 787 of file pLogicalFunction.cxx.
References _type.
00787 { 00788 return this->_type; 00789 }
int pLogicalFunction::getValidPointRange | ( | ) |
Definition at line 794 of file pLogicalFunction.cxx.
References validPointRange.
00795 { 00796 return validPointRange; 00797 }
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 563 of file pLogicalFunction.cxx.
References realPoints, and x_Values.
00564 { 00565 wxNode *nextNode = realPoints.GetFirst(); 00566 int size = realPoints.GetCount(); 00567 double * x_Values; 00568 int i=0; 00569 00570 x_Values= new double[size]; 00571 00572 while (nextNode) 00573 { 00574 pFunctionPoint* nextPoint = (pFunctionPoint*)nextNode->GetData(); 00575 x_Values[i] = nextPoint-> getRealX(); 00576 nextNode = nextNode->GetNext(); 00577 i++; 00578 } 00579 return x_Values; 00580 }
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 585 of file pLogicalFunction.cxx.
References realPoints, and y_Values.
00586 { 00587 wxNode *nextNode = realPoints.GetFirst(); 00588 int i =0; 00589 int size = realPoints.GetCount(); 00590 double * y_Values; 00591 00592 y_Values= new double[size]; 00593 00594 while (nextNode) 00595 { 00596 pFunctionPoint* nextPoint = (pFunctionPoint*)nextNode->GetData(); 00597 y_Values[i] = nextPoint-> getRealY(); 00598 nextNode = nextNode->GetNext(); 00599 i++; 00600 } 00601 return y_Values; 00602 }
void pLogicalFunction::load | ( | wxString | fileName | ) |
Definition at line 637 of file pLogicalFunction.cxx.
References AddPoint().
Referenced by pGraphicalFunction::load().
00638 { 00639 std::string line; 00640 std::ifstream file; 00641 file.open( (const char*)(fileName.mb_str()) ); 00642 00643 if(file.is_open()) 00644 { 00645 std::getline(file,line); 00646 int nPoints=atoi(line.c_str()); 00647 int i=0; 00648 while(!file.eof() && i<nPoints) 00649 { 00650 std::getline(file,line); 00651 int pos=line.find("\t"); 00652 int size=line.size(); 00653 std::string x=line.substr(0,pos); 00654 std::string y=line.substr(pos+1,size); 00655 int x0=atoi(x.c_str()); 00656 int y0=atoi(y.c_str()); 00657 AddPoint(x0,y0); 00658 i++; 00659 00660 } 00661 } 00662 }
bool pLogicalFunction::orderPoints | ( | ) |
Definition at line 134 of file pLogicalFunction.cxx.
References pFunctionPoint::getRealX(), pFunctionPoint::getRealY(), leftToRigthDef, and realPoints.
Referenced by AddNewPoint(), and AddPoint().
00135 { 00136 bool lastOrdered = false; 00137 bool validToContinue = false; 00138 00139 wxNode* lastNodeIncluded = realPoints.GetLast(); 00140 00141 wxNode* node = realPoints.GetFirst(); 00142 pFunctionPoint* lastPointIncluded = (pFunctionPoint*)lastNodeIncluded -> GetData(); 00143 int xToOrder = lastPointIncluded -> getRealX(); 00144 int actualX; 00145 int nextX; 00146 00147 // Used for validating 'leftToRigthDef' 00148 pFunctionPoint* ordFirstPoint = NULL; 00149 pFunctionPoint* ordLastPoint = NULL; 00150 if(node!=NULL){ 00151 ordFirstPoint = (pFunctionPoint*)realPoints.GetFirst()-> GetData(); 00152 } 00153 if(lastNodeIncluded->GetPrevious()!=NULL){ 00154 ordLastPoint = (pFunctionPoint*)(lastNodeIncluded->GetPrevious())-> GetData(); 00155 } 00156 00157 00158 // Normal drawing 00159 if (leftToRigthDef) 00160 { 00161 validToContinue = ordFirstPoint->getRealX() < xToOrder; 00162 } 00163 else 00164 { 00165 //validToContinue =ordFirstPoint->getRealX() > xToOrder; 00166 validToContinue =ordLastPoint->getRealX() > xToOrder; 00167 } 00168 00169 if ( validToContinue) 00170 { 00171 00172 while( node && !lastOrdered ) 00173 { 00174 pFunctionPoint* prevPoint =(pFunctionPoint*)node->GetData(); 00175 actualX = prevPoint ->getRealX(); 00176 if( actualX == xToOrder) 00177 { 00178 realPoints.DeleteNode(lastNodeIncluded); 00179 lastOrdered = false; 00180 } 00181 else if ( actualX < xToOrder ) 00182 { 00183 //firstNode 00184 wxNode* nextNode = node->GetNext(); 00185 pFunctionPoint* nextPoint; 00186 if( nextNode != lastNodeIncluded ) 00187 { 00188 nextPoint = (pFunctionPoint*)nextNode -> GetData(); 00189 nextX = nextPoint->getRealX(); 00190 int nextIndex = realPoints.IndexOf(nextPoint); 00191 if( nextX > xToOrder ) 00192 { 00193 //we need to change the direction in memory of our node 00194 pFunctionPoint* pointToInsert=new pFunctionPoint(lastPointIncluded->getRealX(),lastPointIncluded->getRealY()); 00195 // The last inserted point is ordered like: prevPoint - lastPointIncluded - nextPoint 00196 lastOrdered = (realPoints.Insert(nextIndex, pointToInsert))!= NULL; 00197 bool lastNodeDeleted=realPoints.DeleteNode(lastNodeIncluded); 00198 return lastOrdered && lastNodeDeleted; 00199 00200 } 00201 00202 } 00203 else 00204 { 00205 lastOrdered = true; 00206 } 00207 } 00208 else 00209 { 00210 //firstNode 00211 wxNode* prevNode = node->GetPrevious(); 00212 int insertIndex=realPoints.IndexOf(prevPoint); 00213 pFunctionPoint* prPoint; 00214 if(prevNode) 00215 { 00216 prPoint = (pFunctionPoint*)prevNode -> GetData(); 00217 int beforeX =prPoint->getRealX(); 00218 if( beforeX < xToOrder) 00219 { 00220 //we need to change the direction in memory of our node 00221 pFunctionPoint* pointToInsert=new pFunctionPoint(lastPointIncluded->getRealX(),lastPointIncluded->getRealY()); 00222 // The last inserted point is ordered like: prevPoint - lastPointIncluded - nextPoint 00223 lastOrdered = (realPoints.Insert(insertIndex, pointToInsert))!= NULL; 00224 bool lastNodeDeleted=realPoints.DeleteNode(lastNodeIncluded); 00225 return lastOrdered && lastNodeDeleted; 00226 } 00227 } 00228 //is just the second point 00229 else 00230 { 00231 //we need to change the direction in memory of our node 00232 pFunctionPoint* pointToInsert=new pFunctionPoint(lastPointIncluded->getRealX(),lastPointIncluded->getRealY()); 00233 // The last inserted point is ordered like: prevPoint - lastPointIncluded - nextPoint 00234 lastOrdered = (realPoints.Insert(insertIndex, pointToInsert))!= NULL; 00235 bool lastNodeDeleted=realPoints.DeleteNode(lastNodeIncluded); 00236 return lastOrdered && lastNodeDeleted; 00237 } 00238 } 00239 00240 node = node->GetNext(); 00241 } 00242 00243 } 00244 else 00245 { 00246 bool lastNodeDeleted = realPoints.DeleteNode(lastNodeIncluded); 00247 lastOrdered = lastOrdered && lastNodeDeleted; 00248 } 00249 return lastOrdered; 00250 }
void pLogicalFunction::save | ( | wxString | fileName | ) |
Definition at line 615 of file pLogicalFunction.cxx.
References pFunctionPoint::getRealX(), pFunctionPoint::getRealY(), getSizePoints(), and realPoints.
Referenced by pGraphicalFunction::save().
00616 { 00617 00618 std::ofstream file; 00619 file.open( (const char*)(fileName.mb_str()) ); 00620 if(file.is_open()) 00621 { 00622 file << getSizePoints()<< std::endl; 00623 wxNode* node= realPoints.GetFirst(); 00624 pFunctionPoint* p; 00625 while(node) 00626 { 00627 p=(pFunctionPoint*)node->GetData(); 00628 file <<p->getRealX()<<"\t"<<p->getRealY()<<std::endl; 00629 node=node->GetNext(); 00630 } 00631 } 00632 file.close(); 00633 }
void pLogicalFunction::setEndPoints | ( | ) |
Definition at line 334 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().
00335 { 00336 wxNode* last=realPoints.GetLast(); 00337 if(last) 00338 { 00339 pFunctionPoint* lastPoint=(pFunctionPoint*)last->GetData(); 00340 setEndX(lastPoint->getRealX()); 00341 setEndY(lastPoint->getRealY()); 00342 } 00343 else 00344 { 00345 setEndX(-1); 00346 setEndY(-1); 00347 00348 } 00349 }
void pLogicalFunction::setEndX | ( | double | aEndX | ) |
Definition at line 691 of file pLogicalFunction.cxx.
References _endX.
Referenced by setEndPoints(), and pGraphicalFunction::setEndX().
00691 { 00692 this->_endX = aEndX; 00693 }
void pLogicalFunction::setEndY | ( | double | aEndY | ) |
Definition at line 699 of file pLogicalFunction.cxx.
References _endY.
Referenced by setEndPoints(), and pGraphicalFunction::setEndY().
00699 { 00700 this->_endY = aEndY; 00701 }
void pLogicalFunction::setMaxPoints | ( | ) |
Definition at line 388 of file pLogicalFunction.cxx.
References pFunctionPoint::getRealX(), pFunctionPoint::getRealY(), realPoints, setMaxX(), and setMaxY().
Referenced by setUp().
00389 { 00390 int maxX,maxY; 00391 wxNode* node=realPoints.GetFirst(); 00392 if(node) 00393 { 00394 pFunctionPoint* point=(pFunctionPoint*)node->GetData(); 00395 maxX=point->getRealX(); 00396 maxY=point->getRealY(); 00397 wxNode* nextNode=node->GetNext(); 00398 while(nextNode) 00399 { 00400 point=(pFunctionPoint*)nextNode->GetData(); 00401 int x=point->getRealX(); 00402 int y=point->getRealY(); 00403 if(x>maxX) 00404 maxX=x; 00405 if(y>maxY) 00406 maxY=y; 00407 nextNode=nextNode->GetNext(); 00408 } 00409 setMaxX(maxX); 00410 setMaxY(maxY); 00411 } 00412 else 00413 { 00414 setMaxX(0); 00415 setMaxY(0); 00416 } 00417 }
void pLogicalFunction::setMaxX | ( | double | aMaxX | ) |
Definition at line 745 of file pLogicalFunction.cxx.
References _maxX.
Referenced by setMaxPoints(), and pGraphicalFunction::setMaxX().
00745 { 00746 this->_maxX = aMaxX; 00747 }
void pLogicalFunction::setMaxY | ( | double | aMaxY | ) |
Definition at line 753 of file pLogicalFunction.cxx.
References _maxY.
Referenced by setMaxPoints(), and pGraphicalFunction::setMaxY().
00753 { 00754 this->_maxY = aMaxY; 00755 }
void pLogicalFunction::setMinPoints | ( | ) |
Definition at line 354 of file pLogicalFunction.cxx.
References pFunctionPoint::getRealX(), pFunctionPoint::getRealY(), realPoints, setMinX(), and setMinY().
Referenced by setUp().
00355 { 00356 int minX,minY; 00357 wxNode* node=realPoints.GetFirst(); 00358 if(node) 00359 { 00360 pFunctionPoint* point=(pFunctionPoint*)node->GetData(); 00361 minX=point->getRealX(); 00362 minY=point->getRealY(); 00363 wxNode* nextNode=node->GetNext(); 00364 while(nextNode) 00365 { 00366 point=(pFunctionPoint*)nextNode->GetData(); 00367 int x=point->getRealX(); 00368 int y=point->getRealY(); 00369 if(x<minX) 00370 minX=x; 00371 if(y<minY) 00372 minY=y; 00373 nextNode=nextNode->GetNext(); 00374 } 00375 setMinX(minX); 00376 setMinY(minY); 00377 } 00378 else 00379 { 00380 setMinX(0); 00381 setMinY(0); 00382 } 00383 00384 }
void pLogicalFunction::setMinX | ( | double | aMinX | ) |
Definition at line 727 of file pLogicalFunction.cxx.
References _minX.
Referenced by setMinPoints(), and pGraphicalFunction::setMinX().
00727 { 00728 this->_minX = aMinX; 00729 }
void pLogicalFunction::setMinY | ( | double | aMinY | ) |
Definition at line 735 of file pLogicalFunction.cxx.
References _minY.
Referenced by setMinPoints(), and pGraphicalFunction::setMinY().
00735 { 00736 this->_minY = aMinY; 00737 }
void pLogicalFunction::setOffsetX | ( | double | aOffsetX | ) |
Definition at line 764 of file pLogicalFunction.cxx.
References _offsetX.
Referenced by pGraphicalFunction::setOffsetX().
00764 { 00765 this->_offsetX = aOffsetX; 00766 }
void pLogicalFunction::setOffsetY | ( | double | aOffsetY | ) |
Definition at line 772 of file pLogicalFunction.cxx.
References _offsetY.
Referenced by pGraphicalFunction::setOffsetY().
00772 { 00773 this->_offsetY = aOffsetY; 00774 }
void pLogicalFunction::setScaleX | ( | double | aScaleX | ) |
Definition at line 709 of file pLogicalFunction.cxx.
References _scaleX.
Referenced by pGraphicalFunction::setScales(), and pGraphicalFunction::setScaleX().
00709 { 00710 this->_scaleX = aScaleX; 00711 }
void pLogicalFunction::setScaleY | ( | double | aScaleY | ) |
Definition at line 717 of file pLogicalFunction.cxx.
References _scaleY.
Referenced by pGraphicalFunction::setScales(), and pGraphicalFunction::setScaleY().
00717 { 00718 this->_scaleY = aScaleY; 00719 }
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.
realX | ||
realY | IS NOT USED |
Definition at line 316 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().
00317 { 00318 wxNode* first=realPoints.GetFirst(); 00319 if(first) 00320 { 00321 pFunctionPoint* startPoint=(pFunctionPoint*)first->GetData(); 00322 setStartX(startPoint->getRealX()); 00323 setStartY(startPoint->getRealY()); 00324 } 00325 else 00326 { 00327 setStartX(-1); 00328 setStartY(-1); 00329 } 00330 }
void pLogicalFunction::setStartX | ( | double | aStartX | ) |
Definition at line 672 of file pLogicalFunction.cxx.
References _startX.
Referenced by setStartPoints(), and pGraphicalFunction::setStartX().
00672 { 00673 this->_startX = aStartX; 00674 }
void pLogicalFunction::setStartY | ( | double | aStartY | ) |
Definition at line 680 of file pLogicalFunction.cxx.
References _startY.
Referenced by setStartPoints(), and pGraphicalFunction::setStartY().
00680 { 00681 this->_startY = aStartY; 00682 }
void pLogicalFunction::setType | ( | int | aType | ) |
Definition at line 783 of file pLogicalFunction.cxx.
References _type.
Referenced by pGraphicalFunction::setType().
00783 { 00784 this->_type = aType; 00785 }
void pLogicalFunction::setUp | ( | ) |
Definition at line 300 of file pLogicalFunction.cxx.
References setEndPoints(), setMaxPoints(), setMinPoints(), and setStartPoints().
Referenced by pGraphicalFunction::load(), and pGraphicalFunction::setUp().
00301 { 00302 //sets the start point of the function 00303 setStartPoints(); 00304 //set the Last point of the function 00305 setEndPoints(); 00306 //set the min value in x and y between all the points of the function 00307 setMinPoints(); 00308 //set the max value in x and y between all the points of the function 00309 setMaxPoints(); 00310 }
void pLogicalFunction::setValidPointRange | ( | int | theRange | ) |
Definition at line 799 of file pLogicalFunction.cxx.
References validPointRange.
Referenced by pGraphicalFunction::setValidPointRange().
00800 { 00801 validPointRange = theRange; 00802 }
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 }
double pLogicalFunction::_endX [private] |
Is the last discrete point on x axis of the drawed function.
Definition at line 287 of file pLogicalFunction.h.
double pLogicalFunction::_endY [private] |
Is the last discrete point on y axis of the drawed function.
Definition at line 291 of file pLogicalFunction.h.
double pLogicalFunction::_maxX [private] |
Is the maximun y-real value reacheable by the function.
Definition at line 311 of file pLogicalFunction.h.
double pLogicalFunction::_maxY [private] |
Is the maximun y-real value reacheable by the function.
Definition at line 316 of file pLogicalFunction.h.
double pLogicalFunction::_minX [private] |
Is the minimun x-real value reacheable by the function.
Definition at line 303 of file pLogicalFunction.h.
double pLogicalFunction::_minY [private] |
Is the minimun y-real value reacheable by the function.
Definition at line 307 of file pLogicalFunction.h.
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().
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::_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().
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.
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().
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().
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().
double pLogicalFunction::x_Values[50] [private] |
double pLogicalFunction::y_Values[50] [private] |