From 6abd5665aad2b21172cd5125aec238534eddaceb Mon Sep 17 00:00:00 2001 From: mkr Date: Tue, 23 Jun 2015 16:01:21 +0300 Subject: [PATCH] refs #578: hide geometry objects and land covers, when panels with constructed regions inside calculation case dialog are active, only generated zones are shown in the viewer in this case. --- src/HYDROGUI/HYDROGUI_CalculationOp.cxx | 49 +++++++++++++++++++++++-- src/HYDROGUI/HYDROGUI_CalculationOp.h | 4 ++ 2 files changed, 49 insertions(+), 4 deletions(-) diff --git a/src/HYDROGUI/HYDROGUI_CalculationOp.cxx b/src/HYDROGUI/HYDROGUI_CalculationOp.cxx index ecb496c2..93528ff5 100644 --- a/src/HYDROGUI/HYDROGUI_CalculationOp.cxx +++ b/src/HYDROGUI/HYDROGUI_CalculationOp.cxx @@ -56,6 +56,8 @@ HYDROGUI_CalculationOp::HYDROGUI_CalculationOp( HYDROGUI_Module* theModule, bool myIsEdit( theIsEdit ), myActiveViewManager( NULL ), myPreviewViewManager( NULL ), + myShowGeomObjects( true ), + myShowLandCovers( false ), myShowZones( false ) { setName( myIsEdit ? tr( "EDIT_CALCULATION" ) : tr( "CREATE_CALCULATION" ) ); @@ -877,6 +879,8 @@ void HYDROGUI_CalculationOp::onNext( const int theIndex ) if ( !aPanel ) return; + setLandCoversVisible( true ); + QStringList aList; QStringList anEntryList; HYDROData_SequenceOfObjects aSeq; @@ -956,6 +960,9 @@ void HYDROGUI_CalculationOp::onNext( const int theIndex ) QApplication::setOverrideCursor( Qt::WaitCursor ); + setGeomObjectsVisible( false ); + setLandCoversVisible( false ); + QString aNewCaseName = aPanel->getObjectName(); QString anOldCaseName = myEditedObject->GetName(); bool isNameChanged = anOldCaseName != aNewCaseName; @@ -1109,11 +1116,15 @@ void HYDROGUI_CalculationOp::onHideZones( const int theIndex ) { if( theIndex==1 ) { + setGeomObjectsVisible( true ); + closePreview( false ); createPreview( false ); } if( theIndex==2 ) { + setLandCoversVisible( true ); + closePreview( false ); createPreview( true ); @@ -1170,6 +1181,30 @@ void HYDROGUI_CalculationOp::setZonesVisible( bool theIsVisible, const bool theL } } +void HYDROGUI_CalculationOp::setGeomObjectsVisible( bool theIsVisible ) +{ + myShowGeomObjects = theIsVisible; + + HYDROData_SequenceOfObjects aSeq = myEditedObject->GetGeometryObjects(); + + HYDROData_SequenceOfObjects::Iterator anIter( aSeq ); + for ( ; anIter.More(); anIter.Next() ) { + setObjectVisibility( anIter.Value(), theIsVisible ); + } +} + +void HYDROGUI_CalculationOp::setLandCoversVisible( bool theIsVisible ) +{ + myShowLandCovers = theIsVisible; + + HYDROData_SequenceOfObjects aSeq = myEditedObject->GetLandCovers(); + + HYDROData_SequenceOfObjects::Iterator anIter( aSeq ); + for ( ; anIter.More(); anIter.Next() ) { + setObjectVisibility( anIter.Value(), theIsVisible ); + } +} + void HYDROGUI_CalculationOp::AssignDefaultZonesColors( const bool theLandCover ) { HYDROData_SequenceOfObjects aRegions = myEditedObject->GetRegions( theLandCover ); @@ -1303,10 +1338,16 @@ void HYDROGUI_CalculationOp::createPreview( const bool theLandCover ) { LightApp_Application* anApp = module()->getApp(); HYDROData_SequenceOfObjects aSeq; - if ( theLandCover ) - aSeq = myEditedObject->GetLandCovers(); - else - aSeq = myEditedObject->GetGeometryObjects(); + if ( theLandCover && myShowLandCovers ) + { + HYDROData_SequenceOfObjects aSeqLC = myEditedObject->GetLandCovers(); + aSeq.Append( aSeqLC ); + } + else if ( !theLandCover && myShowGeomObjects ) + { + HYDROData_SequenceOfObjects aSeqGO = myEditedObject->GetGeometryObjects(); + aSeq.Append( aSeqGO ); + } Handle(HYDROData_Entity) anEntity; diff --git a/src/HYDROGUI/HYDROGUI_CalculationOp.h b/src/HYDROGUI/HYDROGUI_CalculationOp.h index e40a21a2..4aa6485b 100644 --- a/src/HYDROGUI/HYDROGUI_CalculationOp.h +++ b/src/HYDROGUI/HYDROGUI_CalculationOp.h @@ -155,6 +155,8 @@ private: void closePreview( bool theRemoveViewManager = true ); void setObjectVisibility( Handle(HYDROData_Entity) theEntity, const bool theIsVisible ); void setZonesVisible( bool theIsVisible, const bool theLandCover ); + void setGeomObjectsVisible( bool theIsVisible ); + void setLandCoversVisible( bool theIsVisible ); void getNamesAndEntries( const HYDROData_SequenceOfObjects& theSeq, QStringList& theNames, QStringList& theEntries ) const; @@ -194,6 +196,8 @@ private: private: bool myIsEdit; bool myShowZones; + bool myShowGeomObjects; + bool myShowLandCovers; Handle(HYDROData_CalculationCase) myEditedObject; SUIT_ViewManager* myActiveViewManager; -- 2.39.2