]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
refs #249 - Undo after Join selected sections operation works not properly
authornds <nds@opencascade.com>
Wed, 18 Dec 2013 07:15:28 +0000 (07:15 +0000)
committernds <nds@opencascade.com>
Wed, 18 Dec 2013 07:15:28 +0000 (07:15 +0000)
The points manipulation remove from the sections tree view

src/HYDROCurveCreator/CurveCreator_TreeView.cxx
src/HYDROCurveCreator/CurveCreator_TreeView.h
src/HYDROCurveCreator/CurveCreator_Widget.cxx
src/HYDROCurveCreator/CurveCreator_Widget.h
src/HYDROGUI/HYDROGUI_PolylineDlg.cxx
src/HYDROGUI/HYDROGUI_PolylineDlg.h
src/HYDROGUI/HYDROGUI_ProfileDlg.cxx
src/HYDROGUI/HYDROGUI_ProfileDlg.h

index c48eb510185e64da8fd76ee859f5b80a9b05edeb..9280713ac5b334ebba24ae907f16e99d036a89c1 100755 (executable)
@@ -253,39 +253,6 @@ QList<int> CurveCreator_TreeView::getSelectedSections() const
   return aSect;
 }
 
-void CurveCreator_TreeView::pointsAdded( int theSection, int thePoint, int thePointsCnt )
-{
-  CurveCreator_TreeViewModel* aModel = dynamic_cast<CurveCreator_TreeViewModel*>(model());
-  if( aModel ){
-    QModelIndex aSectIndx = aModel->sectionIndex( theSection );
-    rowsInserted(aSectIndx, thePoint, thePoint + thePointsCnt - 1 );
-//    expand( aSectIndx );
-    update( aModel->nbPointsIndex( theSection ) );
-  }
-}
-
-void CurveCreator_TreeView::pointDataChanged( int theSection, int thePoint )
-{
-  CurveCreator_TreeViewModel* aModel = dynamic_cast<CurveCreator_TreeViewModel*>(model());
-  if( aModel ){
-    QModelIndex aPointIndx = aModel->pointIndex( theSection, thePoint );
-    dataChanged( aPointIndx, aPointIndx );
-  }
-}
-
-void CurveCreator_TreeView::pointsRemoved( int theSection, int thePoint, int thePointsCnt )
-{
-  CurveCreator_TreeViewModel* aModel = dynamic_cast<CurveCreator_TreeViewModel*>(model());
-  if( aModel ){
-    for( int i = 0 ; i < thePointsCnt ; i++ ){
-      QModelIndex aSectIndx = aModel->pointIndex(theSection, thePoint + i);
-      selectionModel()->select(aSectIndx,QItemSelectionModel::Deselect);
-    }
-    QModelIndex aSectIndx = aModel->sectionIndex( theSection );
-    rowsRemoved(aSectIndx, thePoint, thePoint + thePointsCnt - 1 );
-  }
-}
-
 void CurveCreator_TreeView::sectionAdded( int theSection )
 {
   CurveCreator_TreeViewModel* aModel = dynamic_cast<CurveCreator_TreeViewModel*>(model());
@@ -365,16 +332,6 @@ void CurveCreator_TreeView::sectionsSwapped( int theSection, int theOffset )
   }
 }
 
-void CurveCreator_TreeView::pointsSwapped( int theSection, int thePointNum, int theOffset )
-{
-  CurveCreator_TreeViewModel* aModel = dynamic_cast<CurveCreator_TreeViewModel*>(model());
-  if( aModel ){
-    QModelIndex aFirstIndex = aModel->pointIndex( theSection, thePointNum );
-    QModelIndex aSecondIndex = aModel->pointIndex( theSection, thePointNum + theOffset );
-    swapIndexes( aFirstIndex, aSecondIndex );
-  }
-}
-
 void CurveCreator_TreeView::setSelectedSections( const QList<int>& theList )
 {
   CurveCreator_TreeViewModel* aModel = dynamic_cast<CurveCreator_TreeViewModel*>(model());
@@ -387,18 +344,6 @@ void CurveCreator_TreeView::setSelectedSections( const QList<int>& theList )
   }
 }
 
-void CurveCreator_TreeView::setSelectedPoints( const QList< QPair<int, int> >& thePointsList )
-{
-  CurveCreator_TreeViewModel* aModel = dynamic_cast<CurveCreator_TreeViewModel*>(model());
-  if( aModel ){
-    selectionModel()->clearSelection();
-    for( int i = 0 ; i < thePointsList.size() ; i++ ){
-      QModelIndex aSectIndx = aModel->pointIndex( thePointsList[i].first, thePointsList[i].second );
-      selectionModel()->select(aSectIndx, QItemSelectionModel::Select );
-    }
-  }
-}
-
 bool pointLessThan(const QPair<int,int> &s1, const QPair<int,int> &s2)
 {
   if( s1.first < s2.first )
@@ -408,25 +353,6 @@ bool pointLessThan(const QPair<int,int> &s1, const QPair<int,int> &s2)
   return s1.second < s2.second;
 }
 
-QList< QPair< int, int > > CurveCreator_TreeView::getSelectedPoints() const
-{
-  QList< QPair< int, int > > aPoints;
-  CurveCreator_TreeViewModel* aModel = dynamic_cast<CurveCreator_TreeViewModel*>(model());
-  if( !aModel )
-    return aPoints;
-  QModelIndexList anIndxs = selectionModel()->selectedIndexes();
-  for( int i = 0 ; i < anIndxs.size() ; i++ ){
-    if( !aModel->isSection( anIndxs[i] ) ){
-      int aSect = aModel->getSection(anIndxs[i]);
-      int aPointNum = aModel->getPoint(anIndxs[i]);
-      QPair< int, int > aPoint = QPair<int,int>( aSect, aPointNum );
-      aPoints.push_back( aPoint );
-    }
-  }
-  qSort( aPoints.begin(), aPoints.end(), pointLessThan );
-  return aPoints;
-}
-
 CurveCreator_TreeView::SelectionType CurveCreator_TreeView::getSelectionType() const
 {
   CurveCreator_TreeViewModel* aModel = dynamic_cast<CurveCreator_TreeViewModel*>(model());
@@ -474,10 +400,7 @@ void CurveCreator_TreeView::onActivated( QModelIndex theIndx )
   int aSect = aModel->getSection(theIndx);
   if( aModel->isSection(theIndx) ){
     emit sectionEntered( aSect );
-    return;
   }
-  int aPointNum = aModel->getPoint( theIndx );
-  emit pointEntered( aSect, aPointNum );
 }
 
 void CurveCreator_TreeView::setCurve( CurveCreator_ICurve* theCurve )
index ee0260c75267e7116db873e63f256c0dcf2f0bc0..b96f2b1a031e76ad563b0bf01f031b774c315797 100755 (executable)
@@ -62,12 +62,6 @@ public:
   explicit CurveCreator_TreeView( CurveCreator_ICurve* theCurve, QWidget *parent = 0);
   SelectionType getSelectionType() const;
   QList<int> getSelectedSections() const;
-  QList< QPair< int, int > > getSelectedPoints() const;
-
-  void    pointsAdded( int theSection, int thePoint, int thePointsCnt=1 );
-  void    pointDataChanged( int theSection, int thePoint );
-  void    pointsRemoved(int theSection, int thePoint, int thePointsCnt=1 );
-  void    pointsSwapped( int theSection, int thePointNum, int theOffset );
 
   void    sectionAdded( int theSection );
   void    sectionChanged(int theSection , int aSectCnt = 1);
@@ -75,7 +69,6 @@ public:
   void    sectionsSwapped( int theSection, int theOffset );
 
   void    setSelectedSections( const QList<int>& theList );
-  void    setSelectedPoints( const QList< QPair<int, int> >& thePointsList );
 
   void    setCurve( CurveCreator_ICurve* theCurve );
 
@@ -84,8 +77,7 @@ public:
 signals:
   void    selectionChanged();
   void    sectionEntered(int);
-  void    pointEntered(int,int);
-public slots:
+
 protected slots:
   void onActivated( QModelIndex theIndx );
 protected:
index a808b1406c1442132ca2f63ad7fd01e9a5813761..42bbaf6cc909fe516c7a3a812c1ba1fa7df01f37 100644 (file)
@@ -343,7 +343,6 @@ void CurveCreator_Widget::updateActionsStates()
     if ( removeEnabled() )
       anEnabledAct << REMOVE_ID;
     QList<int> aSelSections = mySectionView->getSelectedSections();
-    QList< QPair< int, int > > aSelPoints = mySectionView->getSelectedPoints();
     CurveCreator_TreeView::SelectionType aSelType = mySectionView->getSelectionType();
     switch( aSelType ){
     case CurveCreator_TreeView::ST_NOSEL:{
@@ -455,13 +454,6 @@ void CurveCreator_Widget::onAdditionMode(bool checked)
   if( aSelSection.size() > 0 ){
     mySection = aSelSection[0];
   }
-  else{
-    QList< QPair<int,int> > aSelPoints = mySectionView->getSelectedPoints();
-    if( aSelPoints.size() > 0 ){
-      mySection = aSelPoints[0].first;
-      myPointNum = aSelPoints[0].second + 1;
-    }
-  }
 //  emit subOperationStarted( myNewPointEditor );
 }
 
@@ -680,9 +672,6 @@ void CurveCreator_Widget::onJoin()
     myCurve->join( aMainSect, aSectNum );
     mySectionView->sectionsRemoved( aSectNum );
   }
-  int aNewSectSize = myCurve->getNbPoints(aMainSect);
-  if( aNewSectSize != aMainSectSize )
-    mySectionView->pointsAdded( aMainSect, aMainSectSize, aNewSectSize-aMainSectSize );
   updateUndoRedo();
 }
 
@@ -873,11 +862,6 @@ QList<int> CurveCreator_Widget::getSelectedSections()
   return mySectionView->getSelectedSections();
 }
 
-QList< QPair< int, int > > CurveCreator_Widget::getSelectedPoints()
-{
-  return mySectionView->getSelectedPoints();
-}
-
 /**
  * According to the widget state, performs the remove action
  */
@@ -1124,19 +1108,6 @@ void CurveCreator_Widget::removeSection()
 {
   stopActionMode();
 
-  QList< QPair<int,int> > aSelPoints = mySectionView->getSelectedPoints();
-  int aCurrSect=-1;
-  int aRemoveCnt = 0;
-  for( int i = 0 ; i < aSelPoints.size() ; i++ ){
-    if( aCurrSect != aSelPoints[i].first ){
-      aRemoveCnt = 0;
-      aCurrSect = aSelPoints[i].first;
-    }
-    int aPntIndx = aSelPoints[i].second - aRemoveCnt;
-    myCurve->removePoint( aCurrSect, aPntIndx );
-    mySectionView->pointsRemoved( aCurrSect, aPntIndx );
-    aRemoveCnt++;
-  }
   QList<int> aSections = mySectionView->getSelectedSections();
   for( int i = 0 ; i < aSections.size() ; i++ ){
     int aSectNum = aSections[i] - (i);
@@ -1174,7 +1145,6 @@ void CurveCreator_Widget::addNewPoint(const CurveCreator::Coordinates& theCoords
   }
   int aSection = aSections[0];
   myCurve->addPoints(theCoords, aSection); // add to the end of section
-  mySectionView->pointsAdded( aSection, myCurve->getNbPoints( aSection ) );
   updateActionsStates();
   updateUndoRedo();
 }
@@ -1237,7 +1207,6 @@ void CurveCreator_Widget::insertPointToSelectedSegment( const int theX,
     anInsertPos = aPoint1Id < aPoint2Id ? aPoint1Id + 1 : aPoint2Id + 1;
 
   myCurve->addPoints( aCoords, aSectionId, anInsertPos );
-  mySectionView->pointsAdded( aSectionId, myCurve->getNbPoints( aSectionId ) );
 
   finishCurveModification( aSelPoints );
 
index 2d8a3e02171b5d8743545f0d1fd99241237e76f7..7ab17331db1cb62f909107616235a272e4078ee7 100644 (file)
@@ -78,7 +78,6 @@ public:
   void setCurve( CurveCreator_ICurve* theCurve );
 
   QList<int> getSelectedSections();
-  QList< QPair< int, int > > getSelectedPoints();
 
   void  removeSelected();
   bool  removeEnabled();
index 6e5f2b8935fd8310fc6b11a5771bb1c0fecc1376..abbd6ae4850f1c7f001de1df568cbb0b18dd33aa 100755 (executable)
@@ -117,11 +117,6 @@ QList<int> HYDROGUI_PolylineDlg::getSelectedSections()
   return myEditorWidget->getSelectedSections();
 }
 
-QList< QPair< int, int > > HYDROGUI_PolylineDlg::getSelectedPoints()
-{
-  return myEditorWidget->getSelectedPoints();
-}
-
 /**
  * Redirect the delete action to editor widget
  */
index aa78a5c6a7bd97b91a6c535a693200ee0ab64073..95d93eaac80fb348776557a55fde1cbc0755228f 100755 (executable)
@@ -49,7 +49,6 @@ public:
   void  reset();
 
   QList<int> getSelectedSections();
-  QList< QPair< int, int > > getSelectedPoints();
 
   void  deleteSelected();
   bool  deleteEnabled();
index 1dc3901f0cfee0cc26178b1391ee5e1db7bec247..e4725a2a174115a69f966747d9eaf6d5f5550bda 100644 (file)
@@ -154,11 +154,6 @@ QList<int> HYDROGUI_ProfileDlg::getSelectedSections()
   return myEditorWidget->getSelectedSections();
 }
 
-QList< QPair< int, int > > HYDROGUI_ProfileDlg::getSelectedPoints()
-{
-  return myEditorWidget->getSelectedPoints();
-}
-
 /**
  * Redirect the delete action to editor widget
  */
index 253e26eb24ea49ef5d1fe565af79d72c88288af0..7c9e0d46d5340aa2200a5e89d176b48aa87bb55f 100644 (file)
@@ -53,7 +53,6 @@ public:
   void  reset();
 
   QList<int> getSelectedSections();
-  QList< QPair< int, int > > getSelectedPoints();
 
   void  deleteSelected();
   bool  deleteEnabled();