]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
Using stl container instead of Qt.
authornds <nds@opencascade.com>
Wed, 20 Nov 2013 12:11:02 +0000 (12:11 +0000)
committernds <nds@opencascade.com>
Wed, 20 Nov 2013 12:11:02 +0000 (12:11 +0000)
src/HYDROCurveCreator/CurveCreator_Widget.cxx

index f55d43d4eb32a881c14cb3f66b40b20bff7d532b..73ffd42b2dc9aed542f1f06255f94e1388aa13bc 100644 (file)
@@ -75,6 +75,8 @@ const int POINT_INDEX_COLUMN_WIDTH = 40;
 
 const int SCENE_PIXEL_TOLERANCE = 10;
 
+//#define USE_SEVERAL_POINTS
+
 CurveCreator_Widget::CurveCreator_Widget(QWidget* parent,
                                          CurveCreator_ICurve *theCurve,
                                          Qt::WindowFlags fl)
@@ -1001,6 +1003,9 @@ void CurveCreator_Widget::removePoint()
   SectionToPointList aSelPoints;
   startCurveModification( aSelPoints, false );
 
+#ifdef USE_SEVERAL_POINTS
+  myCurve->removeSeveralPoints( aPoints );
+#else
   // the points should be removed in a decreased order
   QMap<int, QList<int> > aConvPoints;
   convert( aPoints, aConvPoints );
@@ -1017,7 +1022,7 @@ void CurveCreator_Widget::removePoint()
       mySectionView->pointsRemoved( aSectionId, aPntIndx );
     }
   }
-
+#endif
   finishCurveModification( SectionToPointList() );
 }
 
@@ -1113,20 +1118,23 @@ void CurveCreator_Widget::moveSelectedPoints( const int theXPosition,
   double aXDelta = aStartPnt.X() - anEndPnt.X();
   double anYDelta = aStartPnt.Y() - anEndPnt.Y();
 
-  int aSectionId;
-  int aPointId;
+  CurveCreator_ICurve::SectionToPointCoordsList aCoordList;
   std::deque<float> aChangedPos;
   SectionToPointList::const_iterator anIt = myDragPoints.begin(), aLast = myDragPoints.end();
   for ( ; anIt != aLast; anIt++ ) {
-    aSectionId = anIt->first;
-    aPointId = anIt->second;
-    aChangedPos = myCurve->getPoint( aSectionId, aPointId );
+    aChangedPos = myCurve->getPoint( anIt->first, anIt->second );
     if ( aChangedPos.size() < 2 )
       continue;
     aChangedPos[0] = aChangedPos[0] - aXDelta;
     aChangedPos[1] = aChangedPos[1] - anYDelta;
-    myCurve->setPoint( aSectionId, aPointId, aChangedPos );
+#ifndef USE_SEVERAL_POINTS
+    myCurve->setPoint( anIt->first, anIt->second, aChangedPos );
+#endif
   }
+#ifdef USE_SEVERAL_POINTS
+  myCurve->setSeveralPoints( aCoordList );
+#endif
+
   myDragged = true;
   finishCurveModification( myDragPoints );
 }