Salome HOME
patch for install error on Linux
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_Shape.cxx
index 1feb96abd543ce574ea68ea8494ab18cc06b0502..ac85dfbf182df46ad22e4ca92d738c422f46c9d7 100644 (file)
@@ -19,6 +19,7 @@
 #include <HYDROGUI_Shape.h>
 #include <HYDROGUI_Tool.h>
 #include <HYDROGUI_Polyline.h>
+#include <HYDROGUI_AISShape.h>
 
 #include <HYDROData_Channel.h>
 #include <HYDROData_Document.h>
 #include <HYDROData_Zone.h>
 #include <HYDROData_LandCoverMap.h>
 
-#include <AIS_Shape.hxx>
 #include <BRep_Builder.hxx>
 #include <BRepBuilderAPI_MakeFace.hxx>
-#include <Graphic3d_AspectFillArea3d.hxx>
 #include <Prs3d_IsoAspect.hxx>
 #include <TopoDS.hxx>
 #include <TopoDS_Face.hxx>
@@ -425,10 +424,11 @@ void HYDROGUI_Shape::setFace( const TopoDS_Face& theFace,
 
 void HYDROGUI_Shape::setShape( const TopoDS_Shape& theShape,
                                const bool          theToDisplay,
-                               const bool          theIsUpdateViewer )
+                               const bool          theIsUpdateViewer,
+                               const int           theDisplayMode )
 {
   myTopoShape = theShape;
-  myDisplayMode = AIS_Shaded;
+  myDisplayMode = theDisplayMode;
 
   buildShape();
   updateShape( theToDisplay, theIsUpdateViewer );
@@ -500,14 +500,14 @@ Handle_AIS_InteractiveObject HYDROGUI_Shape::createShape() const
   if ( aShapeType==TopAbs_EDGE || aShapeType==TopAbs_WIRE || IsWireEdgeCompound) {
     return new HYDROGUI_Polyline( myTopoShape );
   } else {
-    return new AIS_Shape( myTopoShape );
+    return new HYDROGUI_AISShape( myTopoShape );
   }
 }
 
 void HYDROGUI_Shape::buildShape()
 {
   // Erase previously created shape
-  erase();
+  erase(false);
 
   myShape = createShape();
   if( myShape.IsNull() )
@@ -562,7 +562,7 @@ void HYDROGUI_Shape::updateShape( const bool theToDisplay,
   const Handle(Prs3d_Drawer)& anAttributes = myShape->Attributes();
   if ( !anAttributes.IsNull() )
   {
-    if ( myDisplayMode == AIS_Shaded )
+    if ( myDisplayMode == AIS_Shaded && myFillingColor.isValid() )
     {
       Quantity_Color aFillingColor( getQuantityColorVal( myFillingColor.red() ), 
                                     getQuantityColorVal( myFillingColor.green() ),
@@ -577,7 +577,7 @@ void HYDROGUI_Shape::updateShape( const bool theToDisplay,
     }
 
     // Coloring borders
-    colorShapeBorder( getActiveColor() );
+    colorShapeBorder( myBorderColor );
   }
 
   if ( !theToDisplay || !isVisible() || myContext.IsNull() )
@@ -658,27 +658,9 @@ void HYDROGUI_Shape::colorShapeBorder( const QColor& theColor )
     }
     else if ( myDisplayMode == AIS_Shaded )
     {
-      if ( theColor.alpha() == 0 )
-      {
-        anAttributes->SetFaceBoundaryDraw( false );
-      }
-      else
-      {
-        anAttributes->SetFaceBoundaryDraw( true );
-  
-        Handle(Prs3d_LineAspect) aBoundaryAspect = anAttributes->FaceBoundaryAspect();
-        if ( !aBoundaryAspect.IsNull() )
-        {
-          aBoundaryAspect->SetColor( aBorderColor );
-          anAttributes->SetFaceBoundaryAspect( aBoundaryAspect );
-        }
-        Handle(Prs3d_LineAspect) aWireAspect = anAttributes->WireAspect();
-        if ( !aWireAspect.IsNull() )
-        {
-          aWireAspect->SetColor( aBorderColor );
-          anAttributes->SetWireAspect( aWireAspect );
-        }
-      }
+      Handle(HYDROGUI_AISShape) aShape = Handle(HYDROGUI_AISShape)::DownCast( myShape );
+      if( !aShape.IsNull() )
+        aShape->SetBorderColor( aBorderColor );
     }
     else if ( myDisplayMode == AIS_WireFrame )
     {