startCurveModification( aSelPoints, false );
// the points should be removed in a decreased order
- qSort( aPoints );
- SectionToPointList::const_iterator anIt = aPoints.end(), aFirst = aPoints.begin();
- anIt--;
- for ( ; anIt != aFirst; anIt-- ) {
- int aSectionId = anIt->first;
- int aPointId = anIt->second;
- myCurve->removePoint( aSectionId, aPointId );
- mySectionView->pointsRemoved( aSectionId, aPointId );
+ QMap<int, QList<int> > aConvPoints;
+ convert( aPoints, aConvPoints );
+ QMap<int, QList<int> >::const_iterator anIt = aConvPoints.begin(),
+ aLast = aConvPoints.end();
+ for ( ; anIt != aLast; anIt++ ) {
+ int aSectionId = anIt.key();
+
+ QList<int> aSectionPoints = anIt.value();
+ qSort( aPoints );
+ for( int i = aSectionPoints.size()-1; i >= 0; i-- ){
+ int aPntIndx = aSectionPoints[i];
+ myCurve->removePoint( aSectionId, aPntIndx );
+ mySectionView->pointsRemoved( aSectionId, aPntIndx );
+ }
}
+
finishCurveModification( SectionToPointList() );
}
}
}
+void CurveCreator_Widget::convert( const SectionToPointList& thePoints,
+ QMap<int, QList<int> >& theConvPoints )
+{
+ theConvPoints.clear();
+
+ SectionToPointList::const_iterator anIt = thePoints.begin(), aLast = thePoints.end();
+ QList<int> aPoints;
+ int aSectionId, aPointId;
+ for ( ; anIt != aLast; anIt++ ) {
+ aSectionId = anIt->first;
+ aPointId = anIt->second;
+ aPoints.clear();
+ if ( theConvPoints.contains( aSectionId ) )
+ aPoints = theConvPoints[aSectionId];
+ if ( aPoints.contains( aPointId ) )
+ continue;
+ aPoints.append( aPointId );
+ theConvPoints[aSectionId] = aPoints;
+ }
+}
+
/**
* Checks whether the point belongs to the OCC object
* \param theObject a line or shape with a bspline inside
}
if ( isFound ) {
thePoint = aPoint;
-
thePoint1 = aPnt1;
thePoint2 = aPnt2;
- //thePoint1 = findLocalPointIndex( 0, aPnt1.X(), aPnt1.Y() );
- //thePoint2 = findLocalPointIndex( 0, aPnt2.X(), aPnt2.Y() );
- //isFound = thePoint1 >= 0 && thePoint2 >= 0;
}
return isFound;
}
int findLocalPointIndex( int theSectionId, float theX, float theY );
void findSectionsToPoints( const double theX, const double theY,
SectionToPointList& thePoints );
+ void convert( const SectionToPointList& thePoints,
+ QMap<int, QList<int> >& theConvPoints );
// OCC algorithm
bool pointOnObject( Handle(AIS_InteractiveObject) theObject,