+bool HYDROGUI_Module::isObjectVisible( const int theViewId,
+ const Handle(HYDROData_Entity)& theObject ) const
+{
+ if( theObject.IsNull() )
+ return false;
+
+ ViewId2Name2ObjectStateMap::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 ObjectState& anObjectState = anIter2.value();
+ return anObjectState.Visibility;
+ }
+ }
+ return false;
+}
+
+void HYDROGUI_Module::setObjectVisible( const int theViewId,
+ const Handle(HYDROData_Entity)& theObject,
+ const bool theState )
+{
+ if( !theObject.IsNull() )
+ {
+ Name2ObjectStateMap& aName2ObjectStateMap = myObjectStateMap[ theViewId ];
+ ObjectState& anObjectState = aName2ObjectStateMap[ theObject->GetName() ];
+ anObjectState.Visibility = theState;
+ }
+}
+
+HYDROGUI_Shape* HYDROGUI_Module::getObjectShape( const int theViewId,
+ const Handle(HYDROData_Entity)& theObject ) const
+{
+ HYDROGUI_Shape* aResShape = NULL;
+ if( theObject.IsNull() )
+ return aResShape;
+
+ if ( myShapesMap.contains( theViewId ) )
+ {
+ const ListOfShapes& aViewShapes = myShapesMap.value( theViewId );
+ foreach ( HYDROGUI_Shape* aShape, aViewShapes )
+ {
+ if ( !aShape || !IsEqual( aShape->getObject(), theObject ) )
+ continue;
+
+ aResShape = aShape;
+ break;
+ }
+ }
+
+ return aResShape;
+}
+
+void HYDROGUI_Module::setObjectShape( const int theViewId,
+ const Handle(HYDROData_Entity)& theObject,
+ HYDROGUI_Shape* theShape )
+{
+ if( theObject.IsNull() )
+ return;
+
+ ListOfShapes& aViewShapes = myShapesMap[ theViewId ];
+ aViewShapes.append( theShape );
+}
+
+void HYDROGUI_Module::removeObjectShape( const int theViewId,
+ const Handle(HYDROData_Entity)& theObject )
+{
+ if ( !myShapesMap.contains( theViewId ) )
+ return;
+
+ ListOfShapes& aViewShapes = myShapesMap[ theViewId ];
+ for ( int i = 0; i < aViewShapes.length(); )
+ {
+ HYDROGUI_Shape* aShape = aViewShapes.at( i );
+ if ( aShape && IsEqual( aShape->getObject(), theObject ) )
+ {
+ delete aShape;
+ aViewShapes.removeAt( i );
+ continue;
+ }
+
+ ++i;
+ }
+}
+
+void HYDROGUI_Module::removeViewShapes( const int theViewId )
+{
+ if ( !myShapesMap.contains( theViewId ) )
+ return;
+
+ const ListOfShapes& aViewShapes = myShapesMap.value( theViewId );
+ for ( int i = 0, n = aViewShapes.length(); i < n; ++i )
+ {
+ HYDROGUI_Shape* aShape = aViewShapes.at( i );
+ if ( aShape )
+ delete aShape;
+ }
+
+ myShapesMap.remove( theViewId );
+}
+