From: mzn Date: Thu, 25 Jun 2015 13:11:26 +0000 (+0300) Subject: refs #569: fix remarks. X-Git-Tag: v1.4.2~31^2~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=17d2b0ba69b972ca2527da6922eb763a18668e23;p=modules%2Fhydro.git refs #569: fix remarks. --- diff --git a/src/HYDROGUI/HYDROGUI_DeleteOp.cxx b/src/HYDROGUI/HYDROGUI_DeleteOp.cxx index 8a852379..1ef77793 100644 --- a/src/HYDROGUI/HYDROGUI_DeleteOp.cxx +++ b/src/HYDROGUI/HYDROGUI_DeleteOp.cxx @@ -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(); diff --git a/src/HYDROGUI/HYDROGUI_Module.cxx b/src/HYDROGUI/HYDROGUI_Module.cxx index 77aecede..80d85173 100644 --- a/src/HYDROGUI/HYDROGUI_Module.cxx +++ b/src/HYDROGUI/HYDROGUI_Module.cxx @@ -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 aViewIds; + QMutableMapIterator anIter( myLandCoverColoringMap ); + while ( anIter.hasNext() ) { + if ( HYDROGUI_DataObject::dataObjectEntry( anIter.next().value() ) == + HYDROGUI_DataObject::dataObjectEntry( aTable ) ) { + anIter.remove(); + } + } + } +} \ No newline at end of file diff --git a/src/HYDROGUI/HYDROGUI_Module.h b/src/HYDROGUI/HYDROGUI_Module.h index 3798c08d..ddd8faad 100644 --- a/src/HYDROGUI/HYDROGUI_Module.h +++ b/src/HYDROGUI/HYDROGUI_Module.h @@ -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(); diff --git a/src/HYDROGUI/HYDROGUI_OCCDisplayer.cxx b/src/HYDROGUI/HYDROGUI_OCCDisplayer.cxx index 6cfbf67e..433ce8a6 100644 --- a/src/HYDROGUI/HYDROGUI_OCCDisplayer.cxx +++ b/src/HYDROGUI/HYDROGUI_OCCDisplayer.cxx @@ -415,7 +415,7 @@ void HYDROGUI_OCCDisplayer::UpdateColorScale( const OCCViewer_Viewer* theViewer OCCViewer_ViewWindow* aWnd = dynamic_cast( 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;