AIS_Shape::AcceptDisplayMode() now accepts only modes 0,1 and 2.
AIS_ColoredShape::Compute() no more computes presentation for unknown display mode.
//function : Compute
//purpose :
//=======================================================================
-void AIS_ColoredShape::Compute (const Handle(PrsMgr_PresentationManager3d)& ,
+void AIS_ColoredShape::Compute (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode)
{
thePrs->SetInfiniteState (Standard_True);
}
- if (theMode == AIS_Shaded)
+ switch (theMode)
{
- if (myDrawer->IsAutoTriangulation())
+ case AIS_WireFrame:
{
- // compute mesh for entire shape beforehand to ensure consistency and optimizations (parallelization)
StdPrs_ToolTriangulatedShape::ClearOnOwnDeflectionChange (myshape, myDrawer, Standard_True);
// After this call if type of deflection is relative
// computed deflection coefficient is stored as absolute.
- Standard_Boolean wasRecomputed = StdPrs_ToolTriangulatedShape::Tessellate (myshape, myDrawer);
-
- // Set to update wireframe presentation on triangulation.
- if (myDrawer->IsoOnTriangulation() && wasRecomputed)
+ Prs3d::GetDeflection (myshape, myDrawer);
+ break;
+ }
+ case AIS_Shaded:
+ {
+ if (myDrawer->IsAutoTriangulation())
{
- SetToUpdate (AIS_WireFrame);
+ // compute mesh for entire shape beforehand to ensure consistency and optimizations (parallelization)
+ StdPrs_ToolTriangulatedShape::ClearOnOwnDeflectionChange (myshape, myDrawer, Standard_True);
+
+ // After this call if type of deflection is relative
+ // computed deflection coefficient is stored as absolute.
+ Standard_Boolean wasRecomputed = StdPrs_ToolTriangulatedShape::Tessellate (myshape, myDrawer);
+
+ // Set to update wireframe presentation on triangulation.
+ if (myDrawer->IsoOnTriangulation() && wasRecomputed)
+ {
+ SetToUpdate (AIS_WireFrame);
+ }
}
+ break;
+ }
+ case 2:
+ {
+ AIS_Shape::Compute (thePrsMgr, thePrs, theMode);
+ return;
+ }
+ default:
+ {
+ return;
}
- }
- else // WireFrame mode
- {
- StdPrs_ToolTriangulatedShape::ClearOnOwnDeflectionChange (myshape, myDrawer, Standard_True);
-
- // After this call if type of deflection is relative
- // computed deflection coefficient is stored as absolute.
- Prs3d::GetDeflection (myshape, myDrawer);
}
// Extract myShapeColors map (KeyshapeColored -> Color) to subshapes map (Subshape -> Color).
#include <AIS_GraphicTool.hxx>
#include <AIS_InteractiveContext.hxx>
#include <Aspect_TypeOfLine.hxx>
-#include <Bnd_Box.hxx>
#include <BRep_Builder.hxx>
#include <BRepBndLib.hxx>
#include <BRepTools.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS_Iterator.hxx>
-#include <TopoDS_Shape.hxx>
IMPLEMENT_STANDARD_RTTIEXT(AIS_Shape,AIS_InteractiveObject)
//
}
-//=======================================================================
-//function : Type
-//purpose :
-//=======================================================================
-AIS_KindOfInteractive AIS_Shape::Type() const
-{return AIS_KOI_Shape;}
-
-
-//=======================================================================
-//function : Signature
-//purpose :
-//=======================================================================
-Standard_Integer AIS_Shape::Signature() const
-{return 0;}
-
-//=======================================================================
-//function : AcceptShapeDecomposition
-//purpose :
-//=======================================================================
-Standard_Boolean AIS_Shape::AcceptShapeDecomposition() const
-{return Standard_True;}
-
//=======================================================================
//function : Compute
//purpose :
#include <AIS_InteractiveObject.hxx>
#include <Bnd_Box.hxx>
-#include <TopAbs_ShapeEnum.hxx>
#include <TopoDS_Shape.hxx>
#include <Prs3d_Drawer.hxx>
#include <Prs3d_TypeOfHLR.hxx>
-class TopoDS_Shape;
-class Bnd_Box;
-
//! A framework to manage presentation and selection of shapes.
//! AIS_Shape is the interactive object which is used the
//! most by applications. There are standard functions
//! Initializes construction of the shape shap from wires,
//! edges and vertices.
Standard_EXPORT AIS_Shape(const TopoDS_Shape& shap);
-
+
//! Returns index 0. This value refers to SHAPE from TopAbs_ShapeEnum
- Standard_EXPORT virtual Standard_Integer Signature() const Standard_OVERRIDE;
-
+ virtual Standard_Integer Signature() const Standard_OVERRIDE { return 0; }
+
//! Returns Object as the type of Interactive Object.
- Standard_EXPORT virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE;
-
+ virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE { return AIS_KOI_Shape; }
+
//! Returns true if the Interactive Object accepts shape decomposition.
- Standard_EXPORT virtual Standard_Boolean AcceptShapeDecomposition() const Standard_OVERRIDE;
-
+ virtual Standard_Boolean AcceptShapeDecomposition() const Standard_OVERRIDE { return Standard_True; }
+
+ //! Return true if specified display mode is supported.
+ virtual Standard_Boolean AcceptDisplayMode (const Standard_Integer theMode) const Standard_OVERRIDE { return theMode >= 0 && theMode <= 2; }
+
+ //! Returns this shape object.
+ const TopoDS_Shape& Shape() const { return myshape; }
+
//! Constructs an instance of the shape object theShape.
- void Set (const TopoDS_Shape& theShape)
+ void SetShape (const TopoDS_Shape& theShape)
{
myshape = theShape;
myCompBB = Standard_True;
}
- //! Returns this shape object.
- const TopoDS_Shape& Shape() const { return myshape; }
+ //! Alias for ::SetShape().
+ void Set (const TopoDS_Shape& theShape) { SetShape (theShape); }
//! Sets a local value for deviation coefficient for this specific shape.
Standard_EXPORT Standard_Boolean SetOwnDeviationCoefficient();