From eb4c70da2d640f24dfbfe76f6a60506d887c310f Mon Sep 17 00:00:00 2001 From: nds Date: Tue, 24 Dec 2013 13:06:31 +0000 Subject: [PATCH] Refs #279 - Behavior of polyline object is strange after changing the name --- src/HYDROGUI/HYDROGUI_Module.cxx | 17 +++++++++++------ src/HYDROGUI/HYDROGUI_Module.h | 6 +++--- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/HYDROGUI/HYDROGUI_Module.cxx b/src/HYDROGUI/HYDROGUI_Module.cxx index 572fc650..ff2d3a0f 100644 --- a/src/HYDROGUI/HYDROGUI_Module.cxx +++ b/src/HYDROGUI/HYDROGUI_Module.cxx @@ -24,6 +24,7 @@ #include "HYDROGUI.h" #include "HYDROGUI_DataModel.h" +#include "HYDROGUI_DataObject.h" #include "HYDROGUI_Displayer.h" #include "HYDROGUI_GVSelector.h" #include "HYDROGUI_InputPanel.h" @@ -834,12 +835,14 @@ bool HYDROGUI_Module::isObjectVisible( const int theViewId, if( theObject.IsNull() ) return false; - ViewId2Name2ObjectStateMap::const_iterator anIter1 = myObjectStateMap.find( theViewId ); + ViewId2Entry2ObjectStateMap::const_iterator anIter1 = myObjectStateMap.find( theViewId ); if( anIter1 != myObjectStateMap.end() ) { - const Name2ObjectStateMap& aName2ObjectStateMap = anIter1.value(); - Name2ObjectStateMap::const_iterator anIter2 = aName2ObjectStateMap.find( theObject->GetName()); - if( anIter2 != aName2ObjectStateMap.end() ) + const Entry2ObjectStateMap& aEntry2ObjectStateMap = anIter1.value(); + QString anEntry = HYDROGUI_DataObject::dataObjectEntry( theObject ); + + Entry2ObjectStateMap::const_iterator anIter2 = aEntry2ObjectStateMap.find( anEntry ); + if( anIter2 != aEntry2ObjectStateMap.end() ) { const ObjectState& anObjectState = anIter2.value(); return anObjectState.Visibility; @@ -854,8 +857,10 @@ void HYDROGUI_Module::setObjectVisible( const int theViewId, { if( !theObject.IsNull() ) { - Name2ObjectStateMap& aName2ObjectStateMap = myObjectStateMap[ theViewId ]; - ObjectState& anObjectState = aName2ObjectStateMap[ theObject->GetName() ]; + Entry2ObjectStateMap& aEntry2ObjectStateMap = myObjectStateMap[ theViewId ]; + QString anEntry = HYDROGUI_DataObject::dataObjectEntry( theObject ); + + ObjectState& anObjectState = aEntry2ObjectStateMap[ anEntry ]; anObjectState.Visibility = theState; } } diff --git a/src/HYDROGUI/HYDROGUI_Module.h b/src/HYDROGUI/HYDROGUI_Module.h index f7957e9c..a0b91265 100644 --- a/src/HYDROGUI/HYDROGUI_Module.h +++ b/src/HYDROGUI/HYDROGUI_Module.h @@ -79,8 +79,8 @@ public: double ZValue; ObjectState() : Visibility( false ), Transparency( 1.0 ), ZValue( 0.0 ) {} }; - typedef QMap< QString, ObjectState > Name2ObjectStateMap; - typedef QMap< int, Name2ObjectStateMap > ViewId2Name2ObjectStateMap; + typedef QMap< QString, ObjectState > Entry2ObjectStateMap; + typedef QMap< int, Entry2ObjectStateMap > ViewId2Entry2ObjectStateMap; typedef QList ListOfShapes; typedef QMap ViewId2ListOfShapes; @@ -233,7 +233,7 @@ private: HYDROGUI_VTKPrsDisplayer* myVTKDisplayer; ViewManagerMap myViewManagerMap; - ViewId2Name2ObjectStateMap myObjectStateMap; + ViewId2Entry2ObjectStateMap myObjectStateMap; ViewId2ListOfShapes myShapesMap; ViewId2ListOfVTKPrs myVTKPrsMap; -- 2.39.2