Salome HOME
Fix for the bug #45: check and warning when the same image is used in 2 arguments.
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_Shape.cxx
index 0bb923b57f4e1573db4be1bd47fb17b3d6446f51..4ba2ed2dd7422ba0768d12003154d2bfb9796140 100644 (file)
@@ -37,6 +37,7 @@
 #include <Graphic3d_AspectFillArea3d.hxx>
 #include <Graphic3d_MaterialAspect.hxx>
 
+#include <HYDROData_Channel.h>
 #include <HYDROData_Document.h>
 #include <HYDROData_Image.h>
 #include <HYDROData_ImmersibleZone.h>
@@ -82,7 +83,7 @@ HYDROGUI_Shape::HYDROGUI_Shape( const Handle(AIS_InteractiveContext)& theContext
 
 HYDROGUI_Shape::~HYDROGUI_Shape()
 {
-  erase();
+  erase( false );
 
   if ( !myShape.IsNull() )
     myShape.Nullify();
@@ -317,6 +318,21 @@ void HYDROGUI_Shape::update( const bool theIsUpdateViewer )
       QColor aFillingColor = aStream->GetFillingColor();
       QColor aBorderColor = aStream->GetBorderColor();
 
+      setFillingColor( aFillingColor, false, false );
+      setBorderColor( aBorderColor, false, false );
+    }
+    else if ( myObject->IsKind( STANDARD_TYPE(HYDROData_Channel) ) )
+    {
+      Handle(HYDROData_Channel) aChannel =
+        Handle(HYDROData_Channel)::DownCast( myObject );
+
+      TopoDS_Face aChannelShape = TopoDS::Face( aChannel->GetTopShape() );
+
+      setShape( aChannelShape, false, false );
+
+      QColor aFillingColor = aChannel->GetFillingColor();
+      QColor aBorderColor = aChannel->GetBorderColor();
+
       setFillingColor( aFillingColor, false, false );
       setBorderColor( aBorderColor, false, false );
     }
@@ -534,16 +550,20 @@ void HYDROGUI_Shape::buildShape()
   const Handle(AIS_Drawer)& anAttributes = myShape->Attributes();
   if ( !anAttributes.IsNull() )
   {
-    if ( myDisplayMode == AIS_Shaded )
-    {
-      Handle(Prs3d_IsoAspect) anIsoAspect = anAttributes->UIsoAspect();
-      if ( !anIsoAspect.IsNull() )
-        anIsoAspect->SetNumber( 0 );
+    Handle(Prs3d_IsoAspect) anIsoAspect = anAttributes->UIsoAspect();
+    if ( !anIsoAspect.IsNull() ) {
+      anIsoAspect->SetNumber( 0 );
+      anAttributes->SetUIsoAspect( anIsoAspect );
+    }
       
-      anIsoAspect = anAttributes->VIsoAspect();
-      if ( !anIsoAspect.IsNull() )
-        anIsoAspect->SetNumber( 0 );
+    anIsoAspect = anAttributes->VIsoAspect();
+    if ( !anIsoAspect.IsNull() ) {
+      anIsoAspect->SetNumber( 0 );
+      anAttributes->SetVIsoAspect( anIsoAspect );
+    }
 
+    if ( myDisplayMode == AIS_Shaded )
+    {
       Handle(Prs3d_ShadingAspect) aShadingAspect = anAttributes->ShadingAspect();
       if ( !aShadingAspect.IsNull() )
       {