+ SectionToPointList aSelPoints;
+ startCurveModification( aSelPoints );
+
+ CurveCreator::Coordinates aCoords;
+ aCoords.push_back( aPoint.X() );
+ aCoords.push_back( aPoint.Y() );
+
+ SectionToPointList aPoints1, aPoints2;
+ findSectionsToPoints( aPoint1.X(), aPoint1.Y(), aPoints1 );
+ findSectionsToPoints( aPoint2.X(), aPoint2.Y(), aPoints2 );
+ SectionToPointList::const_iterator anIt = aPoints1.begin(), aLast = aPoints1.end();
+ int aSectionId = -1;
+ // there can be a case when a new point is added into two sections
+ int aPoint1Id = -1, aPoint2Id = -1;
+ for ( ; anIt != aLast && aSectionId < 0; anIt++ ) {
+ int aSectionCur = anIt->first;
+ SectionToPointList::const_iterator anIt2 = aPoints2.begin(), aLast2 = aPoints2.end();
+ for ( ; anIt2 != aLast2 && aSectionId < 0; anIt2++ ) {
+ if ( anIt2->first == aSectionCur ) {
+ aSectionId = aSectionCur;
+ aPoint1Id = anIt->second;
+ aPoint2Id = anIt2->second;
+ }
+ }
+ }
+
+ int anInsertPos = -1;
+ int aLastPoint = myCurve->getNbPoints( aSectionId )-1;
+ if ( ( aPoint1Id == aLastPoint && aPoint2Id == 0 ) ||
+ ( aPoint2Id == aLastPoint && aPoint1Id == 0 ) )
+ anInsertPos = -1; // if the section happens between first and last points
+ else
+ anInsertPos = aPoint1Id < aPoint2Id ? aPoint1Id + 1 : aPoint2Id + 1;
+
+ myCurve->addPoints( aCoords, aSectionId, anInsertPos );
+ mySectionView->pointsAdded( aSectionId, myCurve->getNbPoints( aSectionId ) );
+
+ finishCurveModification( aSelPoints );
+
+ setSelectedPonts();
+ updateUndoRedo();
+}
+
+void CurveCreator_Widget::moveSelectedPoints( const int theXPosition,
+ const int theYPosition )
+{
+ OCCViewer_Viewer* aViewer = getOCCViewer();
+ if ( !aViewer )
+ return;