#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>
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 );
myContext->SetZLayer( myShape, myZLayer );
}
-Handle_AIS_InteractiveObject HYDROGUI_Shape::createShape() const
+Handle(AIS_InteractiveObject) HYDROGUI_Shape::createShape() const
{
if( myTopoShape.IsNull() ) {
- return Handle_AIS_InteractiveObject();
+ return Handle(AIS_InteractiveObject)();
}
TopAbs_ShapeEnum aShapeType = myTopoShape.ShapeType();
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() )
return;
- Handle_AIS_Shape anAISShape = Handle_AIS_Shape::DownCast( myShape );
+ Handle(AIS_Shape) anAISShape = Handle(AIS_Shape)::DownCast( myShape );
if( !anAISShape.IsNull() )
anAISShape ->SetHLRAngleAndDeviation( 0.001 );
if ( !myObject.IsNull() && !myObject->IsKind( STANDARD_TYPE(HYDROData_LandCoverMap) ) )
myShape->SetTransparency( 0 );
myShape->SetDisplayMode( (AIS_DisplayMode)myDisplayMode );
- myShape->SetSelectionMode( (Standard_Integer)mySelectionMode );
- // Init default params for shape
+ // Init default params for shape
const Handle(Prs3d_Drawer)& anAttributes = myShape->Attributes();
if ( !anAttributes.IsNull() )
{
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() ),
}
// Coloring borders
- colorShapeBorder( getActiveColor() );
+ colorShapeBorder( myBorderColor );
}
if ( !theToDisplay || !isVisible() || myContext.IsNull() )
}
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 )
{
void HYDROGUI_Shape::setSelectionMode( int theSelectionMode )
{
mySelectionMode = theSelectionMode;
-}
\ No newline at end of file
+}