Salome HOME
17.12.2013. Added Partition algorithm (draft version).
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_Shape.cxx
index 9967bc006c2fdf2952ea63b4b5a1e5a3031919d2..597c9db775e82e70464816dee99f4e502f7c7f1c 100644 (file)
@@ -116,6 +116,7 @@ void HYDROGUI_Shape::update( const bool theIsUpdateViewer )
   if ( myContext.IsNull() )
     return;
 
+  bool isDeactivateSelection = false;
   // Try to retrieve information from object
   if ( !myObject.IsNull() )
   {
@@ -165,6 +166,9 @@ void HYDROGUI_Shape::update( const bool theIsUpdateViewer )
           updateShape( false, false );
         }
       }
+
+      QColor aWireColor = aPolyline->GetWireColor();
+      setBorderColor( aWireColor, false, false );
     }
     else if ( myObject->IsKind( STANDARD_TYPE(HYDROData_Polyline3D) ) )
     {
@@ -185,6 +189,9 @@ void HYDROGUI_Shape::update( const bool theIsUpdateViewer )
           updateShape( false, false );
         }
       }
+
+      QColor aWireColor = aPolyline->GetBorderColor();
+      setBorderColor( aWireColor, false, false );
     }
     else if ( myObject->IsKind( STANDARD_TYPE(HYDROData_Zone) ) )
     {
@@ -289,6 +296,7 @@ void HYDROGUI_Shape::update( const bool theIsUpdateViewer )
 
       setTextureFileName( aTextureFileName, false, false );
       setFace( aWire, false, false );
+      isDeactivateSelection = true;
     }
     else if ( myObject->IsKind( STANDARD_TYPE(HYDROData_Profile) ) )
     {
@@ -307,6 +315,9 @@ void HYDROGUI_Shape::update( const bool theIsUpdateViewer )
       }
 
       setWire( aProfileWire, false, false );  
+
+      QColor aWireColor = aProfile->GetBorderColor();
+      setBorderColor( aWireColor, false, false );
     }
     else if ( myObject->IsKind( STANDARD_TYPE(HYDROData_Stream) ) ||
               myObject->IsKind( STANDARD_TYPE(HYDROData_Channel) ) ||
@@ -329,7 +340,6 @@ void HYDROGUI_Shape::update( const bool theIsUpdateViewer )
     {
       Handle(HYDROData_DummyObject3D) anObject3D =
         Handle(HYDROData_DummyObject3D)::DownCast( myObject );
-
       TopoDS_Shape aShape3D = anObject3D->GetShape();
 
       setShape( aShape3D, false, false );
@@ -346,6 +356,8 @@ void HYDROGUI_Shape::update( const bool theIsUpdateViewer )
     return;
 
   myContext->Display( myShape, theIsUpdateViewer );
+  if (isDeactivateSelection)
+    myContext->Deactivate(myShape);
 }
 
 void HYDROGUI_Shape::setVisible( const bool theState,
@@ -365,7 +377,7 @@ void HYDROGUI_Shape::setVisible( const bool theState,
     myContext->Erase( myShape, theIsUpdateViewer );
 }
 
-void HYDROGUI_Shape::highlight( bool theIsHighlight )
+void HYDROGUI_Shape::highlight( bool theIsHighlight, bool isUpdateViewer )
 {
   if ( myIsHighlight == theIsHighlight )
     return;
@@ -376,7 +388,7 @@ void HYDROGUI_Shape::highlight( bool theIsHighlight )
     return;
 
   colorShapeBorder( getActiveColor() );
-  myContext->Display( myShape );
+  myContext->Display( myShape, isUpdateViewer );
 }
 
 bool HYDROGUI_Shape::isHighlighted() const
@@ -659,7 +671,10 @@ void HYDROGUI_Shape::colorShapeBorder( const QColor& theColor )
 
       Handle(Prs3d_LineAspect) aBoundaryAspect = anAttributes->FaceBoundaryAspect();
       if ( !aBoundaryAspect.IsNull() )
+      {
         aBoundaryAspect->SetColor( aBorderColor );
+        anAttributes->SetFaceBoundaryAspect( aBoundaryAspect );
+      }
     }
   }
   else if ( myDisplayMode == AIS_WireFrame )