From: Paul RASCLE Date: Sat, 5 Sep 2020 22:47:21 +0000 (+0200) Subject: bug on display (bathy, selection...) seems fixed ! X-Git-Tag: SH_V2_2_0~54 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=589644db0f864df77954812038602639630350d1;p=modules%2Fhydro.git bug on display (bathy, selection...) seems fixed ! --- diff --git a/src/HYDROGUI/HYDROGUI_DataModel.cxx b/src/HYDROGUI/HYDROGUI_DataModel.cxx index 38c283fc..90f5aee8 100644 --- a/src/HYDROGUI/HYDROGUI_DataModel.cxx +++ b/src/HYDROGUI/HYDROGUI_DataModel.cxx @@ -1383,7 +1383,7 @@ void HYDROGUI_DataModel::setObjectVisibilityState( Handle(HYDROData_Entity) theM if ( treeModel ) { HYDROGUI_Module* aModule = dynamic_cast( module() ); - bool isVisible = aModule->isObjectVisible( -1, theModelObject ); + bool isVisible = aModule->isObjectVisible( 0, theModelObject ); Qtx::VisibilityState aVisState = isVisible ? Qtx::ShownState : Qtx::HiddenState; treeModel->setVisibilityState( theObject->text( theObject->customData( Qtx::IdType ).toInt() ), aVisState, false ); } diff --git a/src/HYDROGUI/HYDROGUI_LandCoverMapOp.cxx b/src/HYDROGUI/HYDROGUI_LandCoverMapOp.cxx index 5c982205..7ef2e0a8 100644 --- a/src/HYDROGUI/HYDROGUI_LandCoverMapOp.cxx +++ b/src/HYDROGUI/HYDROGUI_LandCoverMapOp.cxx @@ -458,7 +458,7 @@ void HYDROGUI_LandCoverMapOp::onPolylineFaceChanged() myPolylineFacePreviewPrs = 0; } - int aViewerId = (size_t)aViewer; + size_t aViewerId = (size_t)aViewer; if ( !module()->isObjectVisible( aViewerId, aPolylineFace ) ) { Handle(AIS_InteractiveContext) aCtx = aViewer->getAISContext(); diff --git a/src/HYDROGUI/HYDROGUI_Module.cxx b/src/HYDROGUI/HYDROGUI_Module.cxx index 96823ea6..7cee9227 100755 --- a/src/HYDROGUI/HYDROGUI_Module.cxx +++ b/src/HYDROGUI/HYDROGUI_Module.cxx @@ -111,7 +111,7 @@ #include #include -//#define _DEVDEBUG_ +#define _DEVDEBUG_ #include "HYDRO_trace.hxx" static int ViewManagerId = 0; @@ -208,12 +208,12 @@ bool HYDROGUI_Module::activateModule( SUIT_Study* theStudy ) // Remove defunct view managers from the map. // It's essential to do this before "update( UF_All )" call! - QList anObsoleteIds; + QList anObsoleteIds; ViewManagerList anAllViewManagers = anApp->viewManagers(); ViewManagerList aHydroViewManagers; // view managers created inside the HYDRO module ViewManagerMapIterator anIter( myViewManagerMap ); while( anIter.hasNext() ) { - int anId = anIter.next().key(); + size_t anId = anIter.next().key(); const ViewManagerInfo& anInfo = anIter.value(); aHydroViewManagers << anInfo.first; @@ -222,7 +222,7 @@ bool HYDROGUI_Module::activateModule( SUIT_Study* theStudy ) anObsoleteIds << anId; } } - foreach ( const int anId, anObsoleteIds ) { + foreach ( const size_t anId, anObsoleteIds ) { myViewManagerMap.remove( anId ); myObjectStateMap.remove( anId ); myShapesMap.remove( anId ); @@ -1275,16 +1275,16 @@ void HYDROGUI_Module::setViewManagerRole( SUIT_ViewManager* theViewManager, } } -bool HYDROGUI_Module::isObjectVisible( const int theViewId, +bool HYDROGUI_Module::isObjectVisible( const size_t theViewId, const Handle(HYDROData_Entity)& theObject ) const { if( theObject.IsNull() ) return false; - if( theViewId < 0 ) + if( theViewId == 0 ) { //search in all - foreach( int aViewId, myObjectStateMap.keys() ) + foreach( size_t aViewId, myObjectStateMap.keys() ) { if( isObjectVisible( aViewId, theObject ) ) return true; @@ -1308,14 +1308,21 @@ bool HYDROGUI_Module::isObjectVisible( const int theViewId, return false; } -void HYDROGUI_Module::setObjectVisible( const int theViewId, +void HYDROGUI_Module::setObjectVisible( const size_t theViewId, const Handle(HYDROData_Entity)& theObject, const bool theState ) { + DEBTRACE("setObjectVisible, theViewId: " << theViewId); if( !theObject.IsNull() ) { - Entry2ObjectStateMap& aEntry2ObjectStateMap = myObjectStateMap[ theViewId ]; - QString anEntry = HYDROGUI_DataObject::dataObjectEntry( theObject ); + DEBTRACE("myObjectStateMap.size: " << myObjectStateMap.size()); + QString anEntry = HYDROGUI_DataObject::dataObjectEntry( theObject ); + DEBTRACE("anEntry: " << anEntry.toStdString()); + if (myObjectStateMap.find(theViewId) == myObjectStateMap.end()) + { + DEBTRACE("theViewId is not a valid key for myObjectStateMap, created"); + } + Entry2ObjectStateMap& aEntry2ObjectStateMap = myObjectStateMap[ theViewId ]; // created OK if it does not exist ObjectState& anObjectState = aEntry2ObjectStateMap[ anEntry ]; anObjectState.Visibility = theState; diff --git a/src/HYDROGUI/HYDROGUI_Module.h b/src/HYDROGUI/HYDROGUI_Module.h index e39ca956..a8daaaa2 100644 --- a/src/HYDROGUI/HYDROGUI_Module.h +++ b/src/HYDROGUI/HYDROGUI_Module.h @@ -102,8 +102,8 @@ public: }; typedef QPair< SUIT_ViewManager*, ViewManagerRole > ViewManagerInfo; - typedef QMap < int, ViewManagerInfo > ViewManagerMap; - typedef QMapIterator< int, ViewManagerInfo > ViewManagerMapIterator; + typedef QMap < size_t, ViewManagerInfo > ViewManagerMap; + typedef QMapIterator< size_t, ViewManagerInfo > ViewManagerMapIterator; struct ObjectState { @@ -113,7 +113,7 @@ public: ObjectState() : Visibility( false ), Transparency( 1.0 ), ZValue( 0.0 ) {} }; typedef QMap< QString, ObjectState > Entry2ObjectStateMap; - typedef QMap< int, Entry2ObjectStateMap > ViewId2Entry2ObjectStateMap; + typedef QMap< size_t, Entry2ObjectStateMap > ViewId2Entry2ObjectStateMap; typedef QList ListOfShapes; typedef QMap ViewId2ListOfShapes; @@ -157,9 +157,9 @@ public: void setViewManagerRole( SUIT_ViewManager* theViewManager, const ViewManagerRole theRole ); - bool isObjectVisible( const int theViewId, + bool isObjectVisible( const size_t theViewId, const Handle(HYDROData_Entity)& theObject ) const; - void setObjectVisible( const int theViewId, + void setObjectVisible( const size_t theViewId, const Handle(HYDROData_Entity)& theObject, const bool theState ); diff --git a/src/HYDROGUI/HYDROGUI_OCCDisplayer.cxx b/src/HYDROGUI/HYDROGUI_OCCDisplayer.cxx index 2bb54eda..f3ab5f2f 100644 --- a/src/HYDROGUI/HYDROGUI_OCCDisplayer.cxx +++ b/src/HYDROGUI/HYDROGUI_OCCDisplayer.cxx @@ -423,7 +423,7 @@ void HYDROGUI_OCCDisplayer::UpdateColorScale( const OCCViewer_Viewer* theViewer HYDROGUI_Module* aModule = module(); - int aViewerId = (size_t)theViewer;//TODO: check if viewer id is correct + size_t aViewerId = (size_t)theViewer;//TODO: check if viewer id is correct bool isLandCoverColoringOn = aModule->isLandCoversScalarMapModeOn( aViewerId ); QList aLandCoverMapShapes = aModule->getObjectShapes( aViewerId, KIND_LAND_COVER_MAP );