From: asl Date: Tue, 17 Nov 2015 06:04:09 +0000 (+0300) Subject: patch for correct immersible zone color in preview X-Git-Tag: v1.5~34 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=36005df362d7bee6db949b079960cec90333aed2;p=modules%2Fhydro.git patch for correct immersible zone color in preview --- diff --git a/src/HYDROGUI/HYDROGUI_ImmersibleZoneOp.cxx b/src/HYDROGUI/HYDROGUI_ImmersibleZoneOp.cxx index 3af761cb..6a3326a9 100644 --- a/src/HYDROGUI/HYDROGUI_ImmersibleZoneOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ImmersibleZoneOp.cxx @@ -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(); diff --git a/src/HYDROGUI/HYDROGUI_Shape.cxx b/src/HYDROGUI/HYDROGUI_Shape.cxx index 4c398665..1feb96ab 100644 --- a/src/HYDROGUI/HYDROGUI_Shape.cxx +++ b/src/HYDROGUI/HYDROGUI_Shape.cxx @@ -38,7 +38,6 @@ #include #include #include -#include #include #include #include @@ -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 ) + if( aZone->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 ) {