if(xRealValue>=minValue && xRealValue<=maxValue)
{
- bool ifContinue = true;
+ // bool ifContinue = true; // JPRx
//pColorPoint * colorPoint, nextColorPoint;
int maxIndex= logicColorPoints.size()-1;
- int nextIndex = 0;
- int nextX = 0;
+ // int nextIndex = 0; // JPRx
+ //int nextX = 0; // JPRx
int i = 0;
std::vector <pColorPoint*>::iterator iter;
{
logicColorPoints.push_back(newColorPoint);
addedPoint = true;
- }
- for ( iter = logicColorPoints.begin(); i<=maxIndex && !addedPoint; iter++ )
- {
- nextIter = iter;
- int before = (*iter)->getRealX() ;
- if(before>xRealValue && i==0)
- {
- //Is the first point
- logicColorPoints.insert( iter, newColorPoint );
- addedPoint =true;
- lastAddedPoint = newColorPoint;
- }
- else if(before<xRealValue && i==maxIndex)
+ }else{
+ iter = logicColorPoints.begin();
+ for (i=0; i<=maxIndex && !addedPoint; i++)
{
- //Is the last point
- logicColorPoints.insert( iter+1, newColorPoint );
- addedPoint =true;
- lastAddedPoint = newColorPoint;
- }
- else if(i<maxIndex)
- {
- //
- nextIter++;
- int after = (*nextIter)->getRealX();
- if( before < xRealValue && after> xRealValue)
+ nextIter = iter;
+ int before = (*iter)->getRealX() ;
+ if(before>xRealValue && i==0)
+ {
+ //Is the first point
+ logicColorPoints.insert( iter, newColorPoint );
+ addedPoint =true;
+ lastAddedPoint = newColorPoint;
+ }
+ else if(before<xRealValue && i==maxIndex)
{
- logicColorPoints.insert( nextIter, newColorPoint );
+ //Is the last point
+ logicColorPoints.push_back(newColorPoint );
addedPoint =true;
lastAddedPoint = newColorPoint;
}
- }
- i++;
- }
+ else if(i<maxIndex)
+ {
+ //
+ nextIter++;
+ int after = (*nextIter)->getRealX();
+ if( before < xRealValue && after> xRealValue)
+ {
+ logicColorPoints.insert( nextIter, newColorPoint );
+ addedPoint =true;
+ lastAddedPoint = newColorPoint;
+ }
+ }
+ //std::cout<<"JCPaddColorPoint iterator "<<*iter<<std::endl;
+ if(!addedPoint)
+ ++iter;
+ }
+ }
}
return addedPoint;
}