myBorderColor( Qt::black ),
myHighlightColor( Qt::white ),
myIsToUpdate( false ),
- myIsVisible( true )
+ myIsVisible( true ),
+ myDisplayMode( AIS_WireFrame )
{
}
void HYDROGUI_Shape::display( const bool theIsUpdateViewer )
{
- if ( myContext.IsNull() || myShape.IsNull() )
+ if ( myContext.IsNull() || myShape.IsNull() || !isVisible() )
return;
myContext->Display( myShape, theIsUpdateViewer );
}
}
- if ( myShape.IsNull() )
+ if ( myShape.IsNull() || !isVisible() )
return;
myContext->Display( myShape, theIsUpdateViewer );
void HYDROGUI_Shape::setWire( const TopoDS_Wire& theWire,
const bool theToDisplay,
const bool theIsUpdateViewer )
+{
+ myTopoShape = theWire;
+ myDisplayMode = AIS_WireFrame;
+
+ buildShape();
+ updateShape( theToDisplay, theIsUpdateViewer );
+}
+
+void HYDROGUI_Shape::setFace( const TopoDS_Wire& theWire,
+ const bool theToDisplay,
+ const bool theIsUpdateViewer )
{
BRepBuilderAPI_MakeFace aFaceBuilder( theWire, Standard_True );
aFaceBuilder.Build();
const bool theToDisplay,
const bool theIsUpdateViewer )
{
- myFace = theFace;
+ myTopoShape = theFace;
+ myDisplayMode = AIS_Shaded;
+
buildShape();
updateShape( theToDisplay, theIsUpdateViewer );
}
// Erase previously created shape
erase();
- if( myFace.IsNull() )
+ if ( myTopoShape.IsNull() )
return;
- myShape = new AIS_Shape( myFace );
+ myShape = new AIS_Shape( myTopoShape );
if ( !myObject.IsNull() )
myShape->SetOwner( myObject );
myShape->SetTransparency( 0 );
- myShape->SetDisplayMode( AIS_Shaded );
+ myShape->SetDisplayMode( (AIS_DisplayMode)myDisplayMode );
- // Init default params for shape
+ // Init default params for shape
const Handle(AIS_Drawer)& anAttributes = myShape->Attributes();
if ( !anAttributes.IsNull() )
{
- Handle(Prs3d_IsoAspect) anIsoAspect = anAttributes->UIsoAspect();
- if ( !anIsoAspect.IsNull() )
- anIsoAspect->SetNumber( 0 );
-
- anIsoAspect = anAttributes->VIsoAspect();
- if ( !anIsoAspect.IsNull() )
- anIsoAspect->SetNumber( 0 );
-
- Handle(Prs3d_ShadingAspect) aShadingAspect = anAttributes->ShadingAspect();
- if ( !aShadingAspect.IsNull() )
+ if ( myDisplayMode == AIS_Shaded )
{
- Graphic3d_MaterialAspect aMatAspect;
- aMatAspect.SetAmbient( 1 );
- aMatAspect.SetDiffuse( 0 );
-
- aShadingAspect->Aspect()->SetFrontMaterial( aMatAspect );
- aShadingAspect->Aspect()->SetBackMaterial( aMatAspect );
+ Handle(Prs3d_IsoAspect) anIsoAspect = anAttributes->UIsoAspect();
+ if ( !anIsoAspect.IsNull() )
+ anIsoAspect->SetNumber( 0 );
+
+ anIsoAspect = anAttributes->VIsoAspect();
+ if ( !anIsoAspect.IsNull() )
+ anIsoAspect->SetNumber( 0 );
+
+ Handle(Prs3d_ShadingAspect) aShadingAspect = anAttributes->ShadingAspect();
+ if ( !aShadingAspect.IsNull() )
+ {
+ Graphic3d_MaterialAspect aMatAspect;
+ aMatAspect.SetAmbient( 1 );
+ aMatAspect.SetDiffuse( 0 );
+
+ aShadingAspect->Aspect()->SetFrontMaterial( aMatAspect );
+ aShadingAspect->Aspect()->SetBackMaterial( aMatAspect );
+ }
+ }
+ else if ( myDisplayMode == AIS_WireFrame )
+ {
+ anAttributes->SetWireDraw( true );
}
}
}
const Handle(AIS_Drawer)& anAttributes = myShape->Attributes();
if ( !anAttributes.IsNull() )
{
- // Coloring face filling
- Handle(Prs3d_ShadingAspect) aShadingAspect = anAttributes->ShadingAspect();
- if ( !aShadingAspect.IsNull() )
+ 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 );
+
+ aShadingAspect->SetColor( aFillingColor );
+ aShadingAspect->SetTransparency( 1 - getQuantityColorVal( myFillingColor.alpha() ) );
+ }
+ }
+ else if ( myDisplayMode == AIS_WireFrame )
{
- Quantity_Color aFillingColor( getQuantityColorVal( myFillingColor.red() ),
- getQuantityColorVal( myFillingColor.green() ),
- getQuantityColorVal( myFillingColor.blue() ),
- Quantity_TOC_RGB );
-
- aShadingAspect->SetColor( aFillingColor );
- aShadingAspect->SetTransparency( 1 - getQuantityColorVal( myFillingColor.alpha() ) );
}
// Coloring borders
colorShapeBorder( getActiveColor() );
}
- if ( !theToDisplay || myContext.IsNull() )
+ if ( !theToDisplay || !isVisible() || myContext.IsNull() )
return;
myContext->Display( myShape, theIsUpdateViewer );
if ( anAttributes.IsNull() )
return;
- if ( theColor.alpha() == 0 )
+ Quantity_Color aBorderColor( getQuantityColorVal( theColor.red() ),
+ getQuantityColorVal( theColor.green() ),
+ getQuantityColorVal( theColor.blue() ),
+ Quantity_TOC_RGB );
+ if ( myDisplayMode == AIS_Shaded )
{
- anAttributes->SetFaceBoundaryDraw( false );
- }
- else
- {
- Quantity_Color aBorderColor( getQuantityColorVal( theColor.red() ),
- getQuantityColorVal( theColor.green() ),
- getQuantityColorVal( theColor.blue() ),
- Quantity_TOC_RGB );
-
- anAttributes->SetFaceBoundaryDraw( true );
-
- Handle(Prs3d_LineAspect) aBoundaryAspect = anAttributes->FaceBoundaryAspect();
- if ( !aBoundaryAspect.IsNull() )
+ if ( theColor.alpha() == 0 )
+ {
+ anAttributes->SetFaceBoundaryDraw( false );
+ }
+ else
{
- aBoundaryAspect->SetColor( aBorderColor );
+ anAttributes->SetFaceBoundaryDraw( true );
+
+ Handle(Prs3d_LineAspect) aBoundaryAspect = anAttributes->FaceBoundaryAspect();
+ if ( !aBoundaryAspect.IsNull() )
+ aBoundaryAspect->SetColor( aBorderColor );
}
}
+ else if ( myDisplayMode == AIS_WireFrame )
+ {
+ myShape->SetColor( aBorderColor );
+ }
}