]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
refs #569: fix remarks.
authormzn <mzn@opencascade.com>
Thu, 25 Jun 2015 13:11:26 +0000 (16:11 +0300)
committermzn <mzn@opencascade.com>
Thu, 25 Jun 2015 13:11:26 +0000 (16:11 +0300)
src/HYDROGUI/HYDROGUI_DeleteOp.cxx
src/HYDROGUI/HYDROGUI_Module.cxx
src/HYDROGUI/HYDROGUI_Module.h
src/HYDROGUI/HYDROGUI_OCCDisplayer.cxx

index 8a85237954bf2078226d85a6eef5001eac94f329..1ef77793f9e786513d5392d6a4cf5074c8eddad8 100644 (file)
@@ -123,8 +123,11 @@ void HYDROGUI_DeleteOp::startOperation()
   for( Standard_Integer anIndex = 1, aLength = aSeq.Length(); anIndex <= aLength; anIndex++ )
   {
     Handle(HYDROData_Entity) anObject = aSeq.Value( anIndex );
-    if ( !anObject.IsNull() && !anObject->IsRemoved() )
+
+    if ( !anObject.IsNull() && !anObject->IsRemoved() ) {
       anObject->Remove();
+      module()->setObjectRemoved( anObject );
+    }
   }
 
   commitDocOperation();
index 77aecedec32b355f6ba39745ce9d1507bdb22943..80d85173d25091d5edd911cb4c128ed798089ae8 100644 (file)
@@ -655,8 +655,13 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
         theMenu->addAction( action( DuplicateStricklerTableId ) );
         theMenu->addSeparator();
 
-        if ( !isLandCoversScalarMapModeOn( anActiveViewId ) && 
-             !getObjectShapes( anActiveViewId, KIND_LAND_COVER ).isEmpty() ) {
+        Handle(HYDROData_StricklerTable) aTable = 
+          Handle(HYDROData_StricklerTable)::DownCast( aSeq.First() );
+        QString aCurrentTable = 
+          HYDROGUI_DataObject::dataObjectEntry( getLandCoverColoringTable( anActiveViewId ) );
+        bool isUsed = aCurrentTable == HYDROGUI_DataObject::dataObjectEntry( aTable );
+
+        if ( !isUsed && !getObjectShapes( anActiveViewId, KIND_LAND_COVER ).isEmpty() ) {
           theMenu->addAction( action( LandCoverScalarMapModeOnId ) );
           theMenu->addSeparator();
         }
@@ -1798,3 +1803,23 @@ bool HYDROGUI_Module::isLandCoversScalarMapModeOn( const int theViewId ) const
 {
   return myLandCoverColoringMap.contains( theViewId );
 }
+
+void HYDROGUI_Module::setObjectRemoved( const Handle(HYDROData_Entity)& theObject )
+{
+  if ( theObject.IsNull() || !theObject->IsRemoved() ) {
+    return;
+  }
+
+  if ( theObject->GetKind() == KIND_STRICKLER_TABLE ) {
+    Handle(HYDROData_StricklerTable) aTable = 
+      Handle(HYDROData_StricklerTable)::DownCast( theObject );
+    QList<int> aViewIds;
+    QMutableMapIterator<int, Handle(HYDROData_StricklerTable)> anIter( myLandCoverColoringMap );
+    while ( anIter.hasNext() ) {
+      if ( HYDROGUI_DataObject::dataObjectEntry( anIter.next().value() ) == 
+           HYDROGUI_DataObject::dataObjectEntry( aTable ) ) {
+        anIter.remove();
+      }
+    }
+  }
+}
\ No newline at end of file
index 3798c08d62a01fea7729a6b25c898e1291286927..ddd8faad4961d03d31b62222851a4c9a86c9de6a 100644 (file)
@@ -236,6 +236,12 @@ public:
    */
   bool                             isLandCoversScalarMapModeOn( const int theViewId ) const;
 
+  /**
+   * Set object as removed.
+   * @param theObject the removed object
+   */
+  void                            setObjectRemoved( const Handle(HYDROData_Entity)& theObject );
+
 protected:
   CAM_DataModel*                  createDataModel();
 
index 6cfbf67e20ebbfedb2ef2d6d431a2159eb88628b..433ce8a615bedbf11ccd6fb5e2166797bd46aa82 100644 (file)
@@ -415,7 +415,7 @@ void HYDROGUI_OCCDisplayer::UpdateColorScale( const OCCViewer_Viewer* theViewer
   
   OCCViewer_ViewWindow* aWnd = dynamic_cast<OCCViewer_ViewWindow*>( theViewer->getViewManager()->getActiveView() );
   Handle(V3d_View) aView = aWnd->getViewPort()->getView();
-    
+      
   int aViewerId = (size_t)theViewer;//TODO: check if viewer id is correct
   bool isLandCoverColoringOn = module()->isLandCoversScalarMapModeOn( aViewerId );
     
@@ -439,7 +439,8 @@ void HYDROGUI_OCCDisplayer::UpdateColorScale( const OCCViewer_Viewer* theViewer
   if ( isLandCoverColoringOn ) {
     aTable = module()->getLandCoverColoringTable( aViewerId );
     if ( !aTable.IsNull() ) {
-      aColorScaleTitle = TCollection_ExtendedString( aTable->GetName().toLatin1().constData() );
+      // TODO: non-empty title leads to buggy behaviour
+      // aColorScaleTitle = TCollection_ExtendedString( aTable->GetName().toLatin1().constData() );
       aTable->GetCoefficientRange( aColorScaleMin, aColorScaleMax );
       aTableTypes = aTable->GetTypes();
     }
@@ -535,9 +536,6 @@ void HYDROGUI_OCCDisplayer::UpdateColorScale( const OCCViewer_Viewer* theViewer
     aLandCoverShape->setFillingColor( aColor, true, true );
     aLandCoverShape->setScalarMapModeEnabled( isLandCoverColoringOn );
     theViewer->getAISContext()->Redisplay( aLandCoverShape->getAISObject() );
-    //theViewer->getAISContext()->UpdateCurrentViewer(); //@MZN
-    //theViewer->getAISContext()->UpdateCurrent();
-    //theViewer->getAISContext()->UpdateSelected( true );
   }
 
   myToUpdateColorScale = false;