]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
patch for correct immersible zone color in preview
authorasl <asl@opencascade.com>
Tue, 17 Nov 2015 06:04:09 +0000 (09:04 +0300)
committerasl <asl@opencascade.com>
Tue, 17 Nov 2015 06:04:09 +0000 (09:04 +0300)
src/HYDROGUI/HYDROGUI_ImmersibleZoneOp.cxx
src/HYDROGUI/HYDROGUI_Shape.cxx

index 3af761cbb32ab5d86e50805d510e272c093b376b..6a3326a974f2deb224ded09a6a735816770e8d1f 100644 (file)
@@ -249,12 +249,12 @@ void HYDROGUI_ImmersibleZoneOp::onCreatePreview( const QString& thePolylineName
       aBorderColor = myEditedObject->GetBorderColor();
     }
 
-    myPreviewPrs->setFillingColor( aFillingColor, false, false );
-    myPreviewPrs->setBorderColor( aBorderColor, false, false );
     TopoDS_Face aFace;
     if( !aZoneShape.IsNull() )
       aFace = TopoDS::Face( aZoneShape );
     myPreviewPrs->setFace( aFace, true, true, "" );
+    myPreviewPrs->setFillingColor( aFillingColor, false, false );
+    myPreviewPrs->setBorderColor( aBorderColor, false, false );
   }
 
   QApplication::restoreOverrideCursor();
index 4c3986651b2b24406a64e0d7303cde6eefcd471c..1feb96abd543ce574ea68ea8494ab18cc06b0502 100644 (file)
@@ -38,7 +38,6 @@
 #include <BRepBuilderAPI_MakeFace.hxx>
 #include <Graphic3d_AspectFillArea3d.hxx>
 #include <Prs3d_IsoAspect.hxx>
-#include <Prs3d_ShadingAspect.hxx>
 #include <TopoDS.hxx>
 #include <TopoDS_Face.hxx>
 #include <TopoDS_Wire.hxx>
@@ -167,11 +166,15 @@ void HYDROGUI_Shape::update( bool isUpdateViewer,
 
       TopoDS_Shape aPolylineShape = aPolyline->GetShape();
 
-      if ( !aPolylineShape.IsNull() ) {
-        if ( aPolylineShape.ShapeType() == TopAbs_WIRE ) {
+      if ( !aPolylineShape.IsNull() )
+      {
+        if ( aPolylineShape.ShapeType() == TopAbs_WIRE )
+        {
           TopoDS_Wire aPolylineWire = TopoDS::Wire( aPolylineShape );
           setWire( aPolylineWire, false, false );  
-        } else {
+        }
+        else
+        {
           myTopoShape = aPolylineShape;
           // 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 ).
@@ -218,7 +221,7 @@ void HYDROGUI_Shape::update( bool isUpdateViewer,
       TopoDS_Face aZoneFace = TopoDS::Face( aZone->GetShape() );
 
       setFace( aZoneFace, false, false, "" );
-      if (aZone->IsMergingNeed() && aZone->GetMergeType() == HYDROData_Zone::Merge_UNKNOWN )
+      ifaZone->IsMergingNeed() && aZone->GetMergeType() == HYDROData_Zone::Merge_UNKNOWN )
       {
         // Red color for a zone with bathymetry conflict
         setFillingColor( Qt::red );
@@ -533,23 +536,15 @@ void HYDROGUI_Shape::buildShape()
     }
       
     anIsoAspect = anAttributes->VIsoAspect();
-    if ( !anIsoAspect.IsNull() ) {
+    if ( !anIsoAspect.IsNull() )
+    {
       anIsoAspect->SetNumber( 0 );
       anAttributes->SetVIsoAspect( anIsoAspect );
     }
 
     if ( myDisplayMode == AIS_Shaded )
     {
-      Handle(Prs3d_ShadingAspect) aShadingAspect = anAttributes->ShadingAspect();
-      if ( !aShadingAspect.IsNull() )
-      {
-        Graphic3d_MaterialAspect aMatAspect( Graphic3d_NOM_PLASTIC );
-        //aMatAspect.SetAmbient( 1 );
-        //aMatAspect.SetDiffuse( 0 );
-
-        aShadingAspect->Aspect()->SetFrontMaterial( aMatAspect );
-        aShadingAspect->Aspect()->SetBackMaterial( aMatAspect );
-      }
+      myShape->SetMaterial( Graphic3d_NOM_PLASTIC );
     }
     else if ( myDisplayMode == AIS_WireFrame )
     {
@@ -569,18 +564,13 @@ void HYDROGUI_Shape::updateShape( const bool theToDisplay,
   {
     if ( myDisplayMode == AIS_Shaded )
     {
-      // Coloring face filling
-      Handle(Prs3d_ShadingAspect) aShadingAspect = anAttributes->ShadingAspect();
-      if ( !aShadingAspect.IsNull() )
-      {
-        Quantity_Color aFillingColor( getQuantityColorVal( myFillingColor.red() ), 
-                                      getQuantityColorVal( myFillingColor.green() ),
-                                      getQuantityColorVal( myFillingColor.blue() ),
-                                      Quantity_TOC_RGB );
+      Quantity_Color aFillingColor( getQuantityColorVal( myFillingColor.red() ), 
+                                    getQuantityColorVal( myFillingColor.green() ),
+                                    getQuantityColorVal( myFillingColor.blue() ),
+                                    Quantity_TOC_RGB );
 
-        aShadingAspect->SetColor( aFillingColor );
-        aShadingAspect->SetTransparency( 1 - getQuantityColorVal( myFillingColor.alpha() ) );
-      }
+      myShape->SetColor( aFillingColor );
+      myShape->SetTransparency( 1 - getQuantityColorVal( myFillingColor.alpha() ) );
     }
     else if ( myDisplayMode == AIS_WireFrame )
     {