Salome HOME
refs #430: incorrect coordinates in dump polyline
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_Shape.cxx
index 0dd9f0ba5d51125e76bfd90a10abb6b26e603b38..eb05a9b4dd816d214b3f9fb818d9e4a49b1d7e32 100644 (file)
@@ -165,7 +165,9 @@ void HYDROGUI_Shape::update( const bool theIsUpdateViewer )
           setWire( aPolylineWire, false, false );  
         } else {
           myTopoShape = aPolylineShape;
-          myDisplayMode = AIS_WireFrame;
+          // Set shading mode to avoid that hilight presentation is equal to "normal" object presentation.
+          // Note that hilight presentation is always to be on top ( i.e. in the top Z layer ).
+          myDisplayMode = AIS_Shaded;
 
           buildShape();
           updateShape( false, false );
@@ -188,7 +190,9 @@ void HYDROGUI_Shape::update( const bool theIsUpdateViewer )
           setWire( aPolylineWire, false, false );  
         } else {
           myTopoShape = aPolylineShape;
-          myDisplayMode = AIS_WireFrame;
+          // Set shading mode to avoid that hilight presentation is equal to "normal" object presentation.
+          // Note that hilight presentation is always to be on top ( i.e. in the top Z layer ).
+          myDisplayMode = AIS_Shaded;
 
           buildShape();
           updateShape( false, false );
@@ -303,6 +307,12 @@ void HYDROGUI_Shape::update( const bool theIsUpdateViewer )
       gp_Pnt aPnt3( aRect.bottomRight().x(), aRect.bottomRight().y(), 0 );
       gp_Pnt aPnt4( aRect.bottomLeft().x(), aRect.bottomLeft().y(), 0 );
 
+      Handle_HYDROData_Document aDoc = HYDROData_Document::Document( anImageObj->Label() );
+      aDoc->Transform( aPnt1, true );
+      aDoc->Transform( aPnt2, true );
+      aDoc->Transform( aPnt3, true );
+      aDoc->Transform( aPnt4, true );
+
       TopoDS_Edge anEdge1 = BRepBuilderAPI_MakeEdge( aPnt1, aPnt2 ).Edge();
       TopoDS_Edge anEdge2 = BRepBuilderAPI_MakeEdge( aPnt2, aPnt3 ).Edge();
       TopoDS_Edge anEdge3 = BRepBuilderAPI_MakeEdge( aPnt3, aPnt4 ).Edge();
@@ -441,7 +451,9 @@ void HYDROGUI_Shape::setWire( const TopoDS_Wire& theWire,
                               const bool         theIsUpdateViewer )
 {
   myTopoShape = theWire;
-  myDisplayMode = AIS_WireFrame;
+  // To avoid that hilight presentation is equal to "normal" object presentation.
+  // Note that hilight presentation is always to be on top ( i.e. in the top Z layer ).
+  myDisplayMode = AIS_Shaded;
 
   buildShape();
   updateShape( theToDisplay, theIsUpdateViewer );
@@ -721,7 +733,12 @@ void HYDROGUI_Shape::colorShapeBorder( const QColor& theColor )
                                getQuantityColorVal( theColor.green() ),
                                getQuantityColorVal( theColor.blue() ),
                                Quantity_TOC_RGB );
-  if ( myDisplayMode == AIS_Shaded )
+
+  
+  if ( myTopoShape.ShapeType() == TopAbs_WIRE ) // Note that we display polylines in shaded mode
+  {
+    myShape->SetColor( aBorderColor );
+  } else if ( myDisplayMode == AIS_Shaded )
   {
     if ( theColor.alpha() == 0 )
     {
@@ -737,6 +754,12 @@ void HYDROGUI_Shape::colorShapeBorder( const QColor& theColor )
         aBoundaryAspect->SetColor( aBorderColor );
         anAttributes->SetFaceBoundaryAspect( aBoundaryAspect );
       }
+      Handle(Prs3d_LineAspect) aWireAspect = anAttributes->WireAspect();
+      if ( !aWireAspect.IsNull() )
+      {
+        aWireAspect->SetColor( aBorderColor );
+        anAttributes->SetWireAspect( aWireAspect );
+      }
     }
   }
   else if ( myDisplayMode == AIS_WireFrame )