Salome HOME
Save for a list of the local selected points.
[modules/hydro.git] / src / HYDROCurveCreator / CurveCreator_Widget.cxx
index 580cab4907572f2956fb94ae808ef12caf3e4af1..66534638175a8a784e944b657fc2302d2a2edddf 100644 (file)
@@ -1015,7 +1015,7 @@ void CurveCreator_Widget::onMouseRelease( SUIT_ViewWindow*, QMouseEvent* theEven
     if ( aDraggedPoints.size() > 0 )
     {
       START_MEASURE_TIME;
-      setSelectedPonts( aDraggedPoints );
+      setSelectedPoints( aDraggedPoints );
       END_MEASURE_TIME( "drop" );
     }
   }
@@ -1129,7 +1129,7 @@ void CurveCreator_Widget::removeSection()
 void CurveCreator_Widget::removePoint()
 {
   CurveCreator_ICurve::SectionToPointList aPoints;
-  getSelectedPonts( aPoints );
+  getSelectedPoints( aPoints );
   if ( aPoints.size() == 0 )
     return;
 
@@ -1201,7 +1201,7 @@ void CurveCreator_Widget::insertPointToSelectedSegment( const int theX,
 
   finishCurveModification( aSelPoints );
 
-  setSelectedPonts();
+  setSelectedPoints();
 }
 
 void CurveCreator_Widget::moveSelectedPoints( const int theXPosition,
@@ -1253,27 +1253,21 @@ void CurveCreator_Widget::updateLocalPointView()
   if ( aContext.IsNull() )
     return;
 
-  std::list<float> aSelectedList = CurveCreator_Utils::getSelectedPoints( aContext );
-  /*int aNbPoints = aSelectedList.size()/3;
+  CurveCreator_Utils::getSelectedPoints( aContext, myCurve, myLocalPoints );
+  int aNbPoints = myLocalPoints.size();
   bool isRowLimit = aNbPoints > myLocalPointRowLimit;
   myLocalPointView->setVisible( !isRowLimit );
-  if ( isRowLimit )
-    return;
-  */
-  std::list<float>::const_iterator anIt = aSelectedList.begin(), aLast = aSelectedList.end();
 
-  bool isBlocked = myLocalPointView->blockSignals(true);
-  myLocalPointView->setRowCount( 0 );
-  for ( ; anIt != aLast; anIt++ )
-  {
-    float aX = *anIt;
-    anIt++;
-    float anY = *anIt;
-    anIt++;
-    float aZ = *anIt;
-    myLocalPointView->addLocalPointToTable( aX, anY );
+  if ( !isRowLimit ) {
+    bool isBlocked = myLocalPointView->blockSignals(true);
+    myLocalPointView->setRowCount( 0 );
+    CurveCreator_ICurve::SectionToPointList::const_iterator anIt = myLocalPoints.begin(),
+                                                            aLast = myLocalPoints.end();
+    for ( ; anIt != aLast; anIt++ )
+      myLocalPointView->addLocalPointToTable( *anIt );
+
+    myLocalPointView->blockSignals( isBlocked );
   }
-  myLocalPointView->blockSignals(isBlocked);
 }
 
 /**
@@ -1294,7 +1288,7 @@ void CurveCreator_Widget::setLocalPointContext( const bool theOpen, const bool i
 void CurveCreator_Widget::setDragStarted( const bool theState, const QPoint& thePoint )
 {
   if ( theState ) {
-    getSelectedPonts( myDragPoints );
+    getSelectedPoints( myDragPoints );
     myDragStarted = myDragPoints.size();
     myDragStartPosition = thePoint;
     if ( myDragStarted ) {
@@ -1311,12 +1305,10 @@ void CurveCreator_Widget::setDragStarted( const bool theState, const QPoint& the
   myDragged = false;
 }
 
-void CurveCreator_Widget::getSelectedPonts( CurveCreator_ICurve::SectionToPointList& thePoints )
+void CurveCreator_Widget::getSelectedPoints( CurveCreator_ICurve::SectionToPointList& thePoints )
 {
   thePoints.clear();
-  for ( int i = 0, aNb = myLocalPointView->rowCount(); i < aNb; i++ )
-    thePoints.push_back( std::make_pair( myLocalPointView->getSectionId( i ),
-                                         myLocalPointView->getPointId( i ) ) );
+  thePoints = myLocalPoints;
 }
 
 
@@ -1338,7 +1330,7 @@ bool CurveCreator_Widget::isIntersectVertexToPoint( const TopoDS_Vertex& theVert
 }
 
 
-void CurveCreator_Widget::setSelectedPonts( const CurveCreator_ICurve::SectionToPointList& thePoints )
+void CurveCreator_Widget::setSelectedPoints( const CurveCreator_ICurve::SectionToPointList& thePoints )
 {
   if ( myDragStarted )
     return;
@@ -1464,7 +1456,7 @@ void CurveCreator_Widget::startCurveModification(
 {
   if ( theFillPoints ) {
     thePoints.clear();
-    getSelectedPonts( thePoints );
+    getSelectedPoints( thePoints );
   }
   setLocalPointContext( false );
 }
@@ -1479,7 +1471,7 @@ void CurveCreator_Widget::finishCurveModification(
 {
   if ( getActionMode() == ModificationMode )
     setLocalPointContext( true );
-  setSelectedPonts( thePoints );
+  setSelectedPoints( thePoints );
   updateUndoRedo();
 }