theShape = aComp;
}
-class ComparePnt
+class CompareSectionToPoint
{
public:
- ComparePnt( const gp_Pnt& thePoint ) : myPoint( thePoint) {};
- ~ComparePnt() {}
+ CompareSectionToPoint( const int theISection = -1, const int theIPoint = -1 )
+ : mySectionId( theISection ), myPointId( theIPoint ) {};
+ ~CompareSectionToPoint() {}
- bool operator < ( const ComparePnt& theOtherPoint ) const
+ bool operator < ( const CompareSectionToPoint& theOther ) const
{
- bool isLess = myPoint.X() < theOtherPoint.myPoint.X();
- if ( !isLess && myPoint.X() == theOtherPoint.myPoint.X() ) {
- isLess = myPoint.Y() < theOtherPoint.myPoint.Y();
- if ( !isLess && myPoint.Y() == theOtherPoint.myPoint.Y() )
- isLess = myPoint.Z() < theOtherPoint.myPoint.Z();
- }
+ bool isLess = mySectionId < theOther.mySectionId;
+ if ( !isLess && mySectionId == theOther.mySectionId )
+ isLess = myPointId < theOther.myPointId;
return isLess;
}
+
private:
- gp_Pnt myPoint;
+ int mySectionId;
+ int myPointId;
};
+
void CurveCreator_Utils::getSelectedPoints( Handle(AIS_InteractiveContext) theContext,
const CurveCreator_ICurve* theCurve,
CurveCreator_ICurve::SectionToPointList& thePoints )
std::list<float> aSelectedPoints;
gp_Pnt aPnt;
- std::map<ComparePnt, int> aPntMap;
+ std::map<CompareSectionToPoint, int> aPointsMap;
CurveCreator_ICurve::SectionToPointList aPoints;
for ( theContext->InitSelected(); theContext->MoreSelected(); theContext->NextSelected() ) {
if ( aVertex.IsNull() )
continue;
aPnt = BRep_Tool::Pnt( aVertex );
- if ( aPntMap.find( aPnt ) != aPntMap.end() )
- continue;
- aPntMap[aPnt] = 0;
CurveCreator_UtilsICurve::findSectionsToPoints( theCurve, aPnt.X(), aPnt.Y(), aPoints );
CurveCreator_ICurve::SectionToPointList::const_iterator anIt = aPoints.begin(),
aLast = aPoints.end();
- for ( ; anIt != aLast; anIt++ )
+ CompareSectionToPoint aPoint;
+ for ( ; anIt != aLast; anIt++ ) {
+ aPoint = CompareSectionToPoint( (*anIt).first, (*anIt).second );
+ if ( aPointsMap.find( aPoint ) != aPointsMap.end() )
+ continue;
+ aPointsMap[aPoint] = 0;
+
thePoints.push_back( *anIt );
+ }
}
}