1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0025695: Visualization, AIS_InteractiveContext - define default HilightMode

AIS_InteractiveContext - removed the following unused properties:
- PreSelectionColor(), DefaultColor(), WasCurrentTouched(), ZDetection().
AIS_InteractiveObject - removed unused property SelectionPriority().

Prs3d_Drawer - removed properties HighlightStyle() and SelectionStyle().
Graphic3d_HighlightStyle has been superseded by Prs3d_Drawer
inheriting from new class Graphic3d_PresentationAttributes.

Graphic3d_PresentationAttributes (as Graphic3d_HighlightStyle replacement)
has been extended with new properties:
- ZLayer() defining Z-Layer for highlighting presentation.
- DisplayMode() defining display mode for highlighting.

StdSelect_BRepSelectionTool methods have been corrected to take
SelectMgr_EntityOwner instead of StdSelect_BRepOwner.
StdSelect_Shape - duplicated field myDrawer has been dropped.

AIS_InteractiveObject - myDrawer->Color() is now used instead of myOwnColor,
myDrawer->Transparency() instead of myTransparency
and myDrawer->ZLayer() instead of myZLayer.

PrsMgr_PresentationManager::Unhighlight() now unhighlight all modes.
The method taking Mode as argument has been marked deprecated.

New enumeration Prs3d_TypeOfHighlight has been introduced
defining different highlight types.
AIS_InteractiveObject::HighlightStyle() now takes enumeration argument
and defines different styles for Global and Local selection.

ComesFromDecomposition() property has been moved
from StdSelect_BRepOwner to SelectMgr_EntityOwner.
This commit is contained in:
kgv
2016-11-02 17:36:18 +03:00
committed by apn
parent 404c893694
commit f838dac48b
106 changed files with 1624 additions and 2273 deletions

View File

@@ -17,7 +17,6 @@ StdSelect_Prs.lxx
StdSelect_SensitivityMode.hxx
StdSelect_Shape.cxx
StdSelect_Shape.hxx
StdSelect_Shape.lxx
StdSelect_ShapeTypeFilter.cxx
StdSelect_ShapeTypeFilter.hxx
StdSelect_ShapeTypeFilter.lxx

View File

@@ -14,6 +14,7 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <StdSelect_BRepOwner.hxx>
#include <Graphic3d_StructureManager.hxx>
#include <Prs3d_Drawer.hxx>
@@ -21,7 +22,6 @@
#include <SelectBasics_EntityOwner.hxx>
#include <SelectMgr_SelectableObject.hxx>
#include <Standard_Type.hxx>
#include <StdSelect_BRepOwner.hxx>
#include <StdSelect_Shape.hxx>
#include <TopLoc_Location.hxx>
#include <TopoDS_Shape.hxx>
@@ -29,35 +29,43 @@
IMPLEMENT_STANDARD_RTTIEXT(StdSelect_BRepOwner,SelectMgr_EntityOwner)
//==================================================
// Function:
// Function: StdSelect_BRepOwner
// Purpose :
//==================================================
StdSelect_BRepOwner::StdSelect_BRepOwner(const Standard_Integer aPriority):
SelectMgr_EntityOwner(aPriority),
myFromDecomposition(Standard_False),
myCurMode(0)
StdSelect_BRepOwner::StdSelect_BRepOwner (const Standard_Integer thePriority)
: SelectMgr_EntityOwner (thePriority),
myCurMode (0)
{
//
}
StdSelect_BRepOwner::StdSelect_BRepOwner(const TopoDS_Shape& aShape,
const Standard_Integer aPriority,
const Standard_Boolean ComesFromDecomposition):
SelectMgr_EntityOwner(aPriority),
myFromDecomposition(ComesFromDecomposition),
myShape(aShape),
myCurMode(0)
//==================================================
// Function: StdSelect_BRepOwner
// Purpose :
//==================================================
StdSelect_BRepOwner::StdSelect_BRepOwner (const TopoDS_Shape& theShape,
const Standard_Integer thePriority,
const Standard_Boolean theComesFromDecomposition)
: SelectMgr_EntityOwner (thePriority),
myShape (theShape),
myCurMode (0)
{
myFromDecomposition = theComesFromDecomposition;
}
StdSelect_BRepOwner::StdSelect_BRepOwner(const TopoDS_Shape& aShape,
const Handle (SelectMgr_SelectableObject)& theOrigin,
const Standard_Integer aPriority,
const Standard_Boolean ComesFromDecomposition):
SelectMgr_EntityOwner(theOrigin,aPriority),
myFromDecomposition(ComesFromDecomposition),
myShape(aShape),
myCurMode(0)
//==================================================
// Function: StdSelect_BRepOwner
// Purpose :
//==================================================
StdSelect_BRepOwner::StdSelect_BRepOwner (const TopoDS_Shape& theShape,
const Handle (SelectMgr_SelectableObject)& theOrigin,
const Standard_Integer thePriority,
const Standard_Boolean theComesFromDecomposition)
: SelectMgr_EntityOwner (theOrigin, thePriority),
myShape (theShape),
myCurMode (0)
{
myFromDecomposition = theComesFromDecomposition;
}
//=======================================================================
@@ -79,78 +87,69 @@ IsHilighted(const Handle(PrsMgr_PresentationManager)& PM,
//purpose :
//=======================================================================
void StdSelect_BRepOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
const Handle(Graphic3d_HighlightStyle)& theStyle,
const Handle(Prs3d_Drawer)& theStyle,
const Standard_Integer theMode)
{
Standard_Integer M = (theMode < 0) ? myCurMode : theMode;
Graphic3d_ZLayerId aHiLayer = this == Selectable()->GlobalSelOwner().get() ?
Graphic3d_ZLayerId_Top : Graphic3d_ZLayerId_Topmost;
if (!HasSelectable())
{
return;
}
const Standard_Integer aDispMode = (theMode < 0) ? myCurMode : theMode;
Handle(SelectMgr_SelectableObject) aSel = Selectable();
if (myFromDecomposition)
const Graphic3d_ZLayerId aHiLayer = theStyle->ZLayer() != Graphic3d_ZLayerId_UNKNOWN ? theStyle->ZLayer() : aSel->ZLayer();
if (!myFromDecomposition)
{
// do the update flag check
if (!myPrsSh.IsNull())
{
TColStd_ListOfInteger aModesList;
myPrsSh->ToBeUpdated (aModesList);
if (!aModesList.IsEmpty())
myPrsSh.Nullify();
}
thePM->Color (aSel, theStyle, aDispMode, NULL, aHiLayer);
return;
}
Handle(Prs3d_Drawer) aDrawer;
if (!aSel.IsNull())
// do the update flag check
if (!myPrsSh.IsNull())
{
TColStd_ListOfInteger aModesList;
myPrsSh->ToBeUpdated (aModesList);
if (!aModesList.IsEmpty())
myPrsSh.Nullify();
}
// generate new presentable shape
if (myPrsSh.IsNull())
{
if (HasLocation())
{
aDrawer = aSel->HilightAttributes();
TopLoc_Location lbid = Location() * myShape.Location();
TopoDS_Shape ShBis = myShape.Located(lbid);
myPrsSh = new StdSelect_Shape (ShBis, theStyle);
}
else
{
aDrawer = new Prs3d_Drawer();
SelectMgr_SelectableObject::InitDefaultHilightAttributes (aDrawer);
}
// generate new presentable shape
if(myPrsSh.IsNull())
{
if(HasLocation())
{
TopLoc_Location lbid = Location() * myShape.Location();
TopoDS_Shape ShBis = myShape.Located(lbid);
myPrsSh = new StdSelect_Shape(ShBis, aDrawer);
}
else
myPrsSh = new StdSelect_Shape(myShape, aDrawer);
}
if (!aSel.IsNull())
{
myPrsSh->SetZLayer (aSel->ZLayer());
myPrsSh->SetTransformPersistence (aSel->TransformPersistence());
}
// highlight with color and set layer
thePM->Color (myPrsSh, theStyle, M, aSel, aHiLayer);
}
else
{
if (!myPrsSh.IsNull())
{
thePM->Color (myPrsSh, theStyle, M, aSel, aHiLayer);
}
else
{
thePM->Color (aSel, theStyle, M, NULL, aHiLayer);
myPrsSh = new StdSelect_Shape (myShape, theStyle);
}
}
// initialize presentation attributes of child presentation
myPrsSh->SetZLayer (aSel->ZLayer());
myPrsSh->SetTransformPersistence (aSel->TransformPersistence());
myPrsSh->Attributes()->SetLink (theStyle);
myPrsSh->Attributes()->SetColor (theStyle->Color());
myPrsSh->Attributes()->SetTransparency (theStyle->Transparency());
myPrsSh->Attributes()->SetBasicFillAreaAspect (theStyle->BasicFillAreaAspect());
// highlight with color and set layer
thePM->Color (myPrsSh, theStyle, aDispMode, aSel, aHiLayer);
}
void StdSelect_BRepOwner::Unhilight(const Handle(PrsMgr_PresentationManager)& PM,
const Standard_Integer aMode)
void StdSelect_BRepOwner::Unhilight (const Handle(PrsMgr_PresentationManager)& thePrsMgr, const Standard_Integer )
{
Standard_Integer M = (aMode < 0) ? myCurMode : aMode;
if(myPrsSh.IsNull() || !myFromDecomposition)
PM->Unhighlight(Selectable(),M);
if (myPrsSh.IsNull() || !myFromDecomposition)
{
thePrsMgr->Unhighlight (Selectable());
}
else
PM->Unhighlight(myPrsSh,M);
{
thePrsMgr->Unhighlight (myPrsSh);
}
}
void StdSelect_BRepOwner::Clear(const Handle(PrsMgr_PresentationManager)& PM,
@@ -182,18 +181,6 @@ void StdSelect_BRepOwner::ResetLocation()
myPrsSh->SetToUpdate();
}
//=======================================================================
//function : SetZLayer
//purpose :
//=======================================================================
void StdSelect_BRepOwner::SetZLayer (const Graphic3d_ZLayerId theLayerId)
{
if (!myPrsSh.IsNull())
{
myPrsSh->SetZLayer (theLayerId);
}
}
//=======================================================================
//function : UpdateHighlightTrsf
//purpose :

View File

@@ -33,8 +33,6 @@ class SelectMgr_SelectableObject;
class PrsMgr_PresentationManager;
class TopLoc_Location;
class StdSelect_BRepOwner;
DEFINE_STANDARD_HANDLE(StdSelect_BRepOwner, SelectMgr_EntityOwner)
//! Defines Specific Owners for Sensitive Primitives
@@ -46,10 +44,9 @@ DEFINE_STANDARD_HANDLE(StdSelect_BRepOwner, SelectMgr_EntityOwner)
//! must be redefined by each User.
class StdSelect_BRepOwner : public SelectMgr_EntityOwner
{
DEFINE_STANDARD_RTTIEXT(StdSelect_BRepOwner, SelectMgr_EntityOwner)
public:
//! Constructs an owner specification framework defined
//! by the priority aPriority.
Standard_EXPORT StdSelect_BRepOwner(const Standard_Integer aPriority);
@@ -71,44 +68,41 @@ public:
Standard_EXPORT StdSelect_BRepOwner(const TopoDS_Shape& aShape, const Handle(SelectMgr_SelectableObject)& theOrigin, const Standard_Integer aPriority = 0, const Standard_Boolean FromDecomposition = Standard_False);
//! returns False if no shape was set
Standard_Boolean HasShape() const;
Standard_Boolean HasShape() const { return !myShape.IsNull(); }
//! <FromDecomposition> indicates whether <aShape>
//! comes from decomposition of a bigger shape.
Standard_EXPORT void Set (const TopoDS_Shape& aShape, const Standard_Boolean FromDecomposition = Standard_False);
Standard_Boolean ComesFromDecomposition() const;
const TopoDS_Shape& Shape() const;
const TopoDS_Shape& Shape() const { return myShape; }
//! Returns true if this framework has a highlight mode defined for it.
Standard_Boolean HasHilightMode() const;
Standard_Boolean HasHilightMode() const { return myCurMode == -1; }
//! Sets the highlight mode for this framework.
//! This defines the type of display used to highlight the
//! owner of the shape when it is detected by the selector.
//! The default type of display is wireframe, defined by the index 0.
void SetHilightMode (const Standard_Integer aMode);
void SetHilightMode (const Standard_Integer theMode) { myCurMode = theMode; }
//! Resets the higlight mode for this framework.
//! This defines the type of display used to highlight the
//! owner of the shape when it is detected by the selector.
//! The default type of display is wireframe, defined by the index 0.
void ResetHilightMode();
void ResetHilightMode() { myCurMode = -1; }
//! Returns the highlight mode for this framework.
//! This defines the type of display used to highlight the
//! owner of the shape when it is detected by the selector.
//! The default type of display is wireframe, defined by the index 0.
Standard_Integer HilightMode() const;
Standard_Integer HilightMode() const { return myCurMode; }
//! Returns true if an object with the selection mode
//! aMode is highlighted in the presentation manager aPM.
Standard_EXPORT virtual Standard_Boolean IsHilighted (const Handle(PrsMgr_PresentationManager)& aPM, const Standard_Integer aMode = 0) const Standard_OVERRIDE;
Standard_EXPORT virtual void HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
const Handle(Graphic3d_HighlightStyle)& theStyle,
const Handle(Prs3d_Drawer)& theStyle,
const Standard_Integer theMode = 0) Standard_OVERRIDE;
//! Removes highlighting from the type of shape
@@ -122,38 +116,18 @@ public:
Standard_EXPORT virtual void SetLocation (const TopLoc_Location& aLoc) Standard_OVERRIDE;
Standard_EXPORT virtual void ResetLocation() Standard_OVERRIDE;
//! Set Z layer ID and update all presentations.
Standard_EXPORT virtual void SetZLayer (const Graphic3d_ZLayerId theLayerId) Standard_OVERRIDE;
//! Implements immediate application of location transformation of parent object to dynamic highlight structure
Standard_EXPORT virtual void UpdateHighlightTrsf (const Handle(V3d_Viewer)& theViewer,
const Handle(PrsMgr_PresentationManager3d)& theManager,
const Standard_Integer theDispMode) Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(StdSelect_BRepOwner,SelectMgr_EntityOwner)
protected:
Standard_Boolean myFromDecomposition;
TopoDS_Shape myShape;
private:
Handle(StdSelect_Shape) myPrsSh;
Standard_Integer myCurMode;
};
#include <StdSelect_BRepOwner.lxx>
#endif // _StdSelect_BRepOwner_HeaderFile

View File

@@ -14,6 +14,7 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <StdSelect_BRepSelectionTool.hxx>
#include <Bnd_Box.hxx>
#include <BRep_Tool.hxx>
@@ -51,7 +52,6 @@
#include <Standard_ErrorHandler.hxx>
#include <Standard_NullObject.hxx>
#include <StdSelect_BRepOwner.hxx>
#include <StdSelect_BRepSelectionTool.hxx>
#include <TColgp_HArray1OfPnt.hxx>
#include <TColgp_SequenceOfPnt.hxx>
#include <TColStd_Array1OfReal.hxx>
@@ -101,16 +101,15 @@ void StdSelect_BRepSelectionTool::PreBuildBVH (const Handle(SelectMgr_Selection)
// Function: Load
// Purpose :
//==================================================
void StdSelect_BRepSelectionTool
::Load (const Handle(SelectMgr_Selection)& theSelection,
const TopoDS_Shape& theShape,
const TopAbs_ShapeEnum theType,
const Standard_Real theDeflection,
const Standard_Real theDeviationAngle,
const Standard_Boolean isAutoTriangulation,
const Standard_Integer thePriority,
const Standard_Integer theNbPOnEdge,
const Standard_Real theMaxParam)
void StdSelect_BRepSelectionTool::Load (const Handle(SelectMgr_Selection)& theSelection,
const TopoDS_Shape& theShape,
const TopAbs_ShapeEnum theType,
const Standard_Real theDeflection,
const Standard_Real theDeviationAngle,
const Standard_Boolean isAutoTriangulation,
const Standard_Integer thePriority,
const Standard_Integer theNbPOnEdge,
const Standard_Real theMaxParam)
{
Standard_Integer aPriority = (thePriority == -1) ? GetStandardPriority (theShape, theType) : thePriority;
@@ -166,17 +165,16 @@ void StdSelect_BRepSelectionTool
// Function: Load
// Purpose :
//==================================================
void StdSelect_BRepSelectionTool
::Load (const Handle(SelectMgr_Selection)& theSelection,
const Handle(SelectMgr_SelectableObject)& theSelectableObj,
const TopoDS_Shape& theShape,
const TopAbs_ShapeEnum theType,
const Standard_Real theDeflection,
const Standard_Real theDeviationAngle,
const Standard_Boolean isAutoTriangulation,
const Standard_Integer thePriority,
const Standard_Integer theNbPOnEdge,
const Standard_Real theMaxParam)
void StdSelect_BRepSelectionTool::Load (const Handle(SelectMgr_Selection)& theSelection,
const Handle(SelectMgr_SelectableObject)& theSelectableObj,
const TopoDS_Shape& theShape,
const TopAbs_ShapeEnum theType,
const Standard_Real theDeflection,
const Standard_Real theDeviationAngle,
const Standard_Boolean isAutoTriangulation,
const Standard_Integer thePriority,
const Standard_Integer theNbPOnEdge,
const Standard_Real theMaxParam)
{
Load (theSelection,
theShape,
@@ -203,15 +201,14 @@ void StdSelect_BRepSelectionTool
// Function: ComputeSensitive
// Purpose :
//==================================================
void StdSelect_BRepSelectionTool
::ComputeSensitive (const TopoDS_Shape& theShape,
const Handle(StdSelect_BRepOwner)& theOwner,
const Handle(SelectMgr_Selection)& theSelection,
const Standard_Real theDeflection,
const Standard_Real theDeviationAngle,
const Standard_Integer theNbPOnEdge,
const Standard_Real theMaxParam,
const Standard_Boolean isAutoTriangulation)
void StdSelect_BRepSelectionTool::ComputeSensitive (const TopoDS_Shape& theShape,
const Handle(SelectMgr_EntityOwner)& theOwner,
const Handle(SelectMgr_Selection)& theSelection,
const Standard_Real theDeflection,
const Standard_Real theDeviationAngle,
const Standard_Integer theNbPOnEdge,
const Standard_Real theMaxParam,
const Standard_Boolean isAutoTriangulation)
{
switch (theShape.ShapeType())
{
@@ -434,21 +431,16 @@ static Standard_Boolean FindLimits (const Adaptor3d_Curve& theCurve,
//=====================================================
// Function : GetEdgeSensitive
// Purpose : create a sensitive edge to add it
// in computeselection to "aselection" (case of selection of an edge)
// or to "aSensitiveWire" (case of selection of a wire; in this case,
// the sensitive wire is added to "aselection" )
// odl - for selection by rectangle -
// Purpose :
//=====================================================
void StdSelect_BRepSelectionTool
::GetEdgeSensitive (const TopoDS_Shape& theShape,
const Handle(StdSelect_BRepOwner)& theOwner,
const Handle(SelectMgr_Selection)& theSelection,
const Standard_Real theDeflection,
const Standard_Real theDeviationAngle,
const Standard_Integer theNbPOnEdge,
const Standard_Real theMaxParam,
Handle(Select3D_SensitiveEntity)& theSensitive)
void StdSelect_BRepSelectionTool::GetEdgeSensitive (const TopoDS_Shape& theShape,
const Handle(SelectMgr_EntityOwner)& theOwner,
const Handle(SelectMgr_Selection)& theSelection,
const Standard_Real theDeflection,
const Standard_Real theDeviationAngle,
const Standard_Integer theNbPOnEdge,
const Standard_Real theMaxParam,
Handle(Select3D_SensitiveEntity)& theSensitive)
{
const TopoDS_Edge& anEdge = TopoDS::Edge (theShape);
BRepAdaptor_Curve cu3d;
@@ -560,50 +552,17 @@ void StdSelect_BRepSelectionTool
}
}
//=====================================================
// Function : GetStandardPriority
// Purpose :
//=====================================================
Standard_Integer StdSelect_BRepSelectionTool::GetStandardPriority (const TopoDS_Shape& theShape,
const TopAbs_ShapeEnum theType)
{
switch (theType)
{
case TopAbs_VERTEX: return 8;
case TopAbs_EDGE: return 7;
case TopAbs_WIRE: return 6;
case TopAbs_FACE: return 5;
case TopAbs_SHAPE:
default:
switch (theShape.ShapeType())
{
case TopAbs_VERTEX: return 9;
case TopAbs_EDGE: return 8;
case TopAbs_WIRE: return 7;
case TopAbs_FACE: return 6;
case TopAbs_SHELL: return 5;
case TopAbs_COMPOUND:
case TopAbs_COMPSOLID:
case TopAbs_SOLID:
case TopAbs_SHAPE:
default:
return 4;
}
}
}
//=======================================================================
//function : GetSensitiveEntityForFace
//purpose :
//=======================================================================
Standard_Boolean StdSelect_BRepSelectionTool
::GetSensitiveForFace (const TopoDS_Face& theFace,
const Handle(StdSelect_BRepOwner)& theOwner,
Select3D_EntitySequence& theSensitiveList,
const Standard_Boolean /*theAutoTriangulation*/,
const Standard_Integer NbPOnEdge,
const Standard_Real theMaxParam,
const Standard_Boolean theInteriorFlag)
Standard_Boolean StdSelect_BRepSelectionTool::GetSensitiveForFace (const TopoDS_Face& theFace,
const Handle(SelectMgr_EntityOwner)& theOwner,
Select3D_EntitySequence& theSensitiveList,
const Standard_Boolean /*theAutoTriangulation*/,
const Standard_Integer NbPOnEdge,
const Standard_Real theMaxParam,
const Standard_Boolean theInteriorFlag)
{
// check if there is triangulation of the face...
TopLoc_Location aLoc;

View File

@@ -66,10 +66,8 @@ class TopoDS_Face;
class StdSelect_BRepSelectionTool
{
public:
DEFINE_STANDARD_ALLOC
//! Decomposition of <aShape> into sensitive entities following
//! a mode of decomposition <aType>. These entities are stored in <aSelection>.
//! BrepOwners are created to store the identity of the picked shapes
@@ -99,50 +97,90 @@ public:
//! You can use the function Load to modify the
//! selection priority of an owner to make one entity
//! more selectable than another one.
Standard_EXPORT static Standard_Integer GetStandardPriority (const TopoDS_Shape& aShap, const TopAbs_ShapeEnum aType);
//! Computes the sensitive primitives corresponding to
//! the subshape aShape with the owner anOwner.
//! Stores them in the SelectMgr_Selection object, and returns this object.
//! The number NbPOnEdge is used to define edges and wires.
//! In the case of infinite objects, the value
//! MaximalParameter serves to limit computation time
//! by limiting the sensitive area. The default value is 500.
//! If AutoTriangulation is true, triangulation will be
//! computed for the faces which have none. If it is false,
//! sensitive entities on these faces will be calculated.
Standard_EXPORT static void ComputeSensitive (const TopoDS_Shape& aShape, const Handle(StdSelect_BRepOwner)& anOwner, const Handle(SelectMgr_Selection)& aSelection, const Standard_Real theDeflection, const Standard_Real theDeviationAngle, const Standard_Integer NbPOnEdge, const Standard_Real MaximalParameter, const Standard_Boolean AutoTriangulation = Standard_True);
//! appends to <OutList> the 3D
//! sensitive entities created for selection of <aFace>
//! if<InteriorFlag> = False the face will be sensitive only on its boundary
Standard_EXPORT static Standard_Boolean GetSensitiveForFace (const TopoDS_Face& aFace, const Handle(StdSelect_BRepOwner)& anOwner, Select3D_EntitySequence& OutList, const Standard_Boolean AutoTriangulation = Standard_True, const Standard_Integer NbPOnEdge = 9, const Standard_Real MaxiParam = 500, const Standard_Boolean InteriorFlag = Standard_True);
static Standard_Integer GetStandardPriority (const TopoDS_Shape& theShape,
const TopAbs_ShapeEnum theType)
{
switch (theType)
{
case TopAbs_VERTEX: return 8;
case TopAbs_EDGE: return 7;
case TopAbs_WIRE: return 6;
case TopAbs_FACE: return 5;
case TopAbs_SHAPE:
default: break;
}
switch (theShape.ShapeType())
{
case TopAbs_VERTEX: return 9;
case TopAbs_EDGE: return 8;
case TopAbs_WIRE: return 7;
case TopAbs_FACE: return 6;
case TopAbs_SHELL: return 5;
case TopAbs_COMPOUND:
case TopAbs_COMPSOLID:
case TopAbs_SOLID:
case TopAbs_SHAPE:
default:
return 4;
}
}
//! Computes the sensitive primitives, stores them in the SelectMgr_Selection object, and returns this object.
//! @param theShape shape to compute sensitive entities
//! @param theOwner selectable owner object
//! @param theSelection selection to append new sensitive entities
//! @param theDeflection linear deflection
//! @param theDeflAngle angular deflection
//! @param theNbPOnEdge sensitivity parameters for edges and wires
//! @param theMaxiParam sensitivity parameters for infinite objects (the default value is 500)
//! @param theAutoTriang flag to compute triangulation for the faces which have none
Standard_EXPORT static void ComputeSensitive (const TopoDS_Shape& theShape,
const Handle(SelectMgr_EntityOwner)& theOwner,
const Handle(SelectMgr_Selection)& theSelection,
const Standard_Real theDeflection,
const Standard_Real theDeflAngle,
const Standard_Integer theNbPOnEdge,
const Standard_Real theMaxiParam,
const Standard_Boolean theAutoTriang = Standard_True);
//! Creates the 3D sensitive entities for Face selection.
//! @param theFace face to compute sensitive entities
//! @param theOwner selectable owner object
//! @param theOutList output result list to append created entities
//! @param theAutoTriang obsolete flag (has no effect)
//! @param theNbPOnEdge sensitivity parameters
//! @param theMaxiParam sensitivity parameters
//! @param theInteriorFlag flag indicating that face interior (TRUE) or face boundary (FALSE) should be selectable
Standard_EXPORT static Standard_Boolean GetSensitiveForFace (const TopoDS_Face& theFace,
const Handle(SelectMgr_EntityOwner)& theOwner,
Select3D_EntitySequence& theOutList,
const Standard_Boolean theAutoTriang = Standard_True,
const Standard_Integer theNbPOnEdge = 9,
const Standard_Real theMaxiParam = 500,
const Standard_Boolean theInteriorFlag = Standard_True);
//! Create a sensitive edge or sensitive wire.
//! @param theShape either TopoDS_Edge or TopoDS_Wire to compute sensitive entities
//! @param theOwner selectable owner object
//! @param theSelection selection to append new sensitive entities
//! @param theDeflection linear deflection
//! @param theDeviationAngle angular deflection
//! @param theNbPOnEdge sensitivity parameters
//! @param theMaxiParam sensitivity parameters
Standard_EXPORT static void GetEdgeSensitive (const TopoDS_Shape& theShape,
const Handle(SelectMgr_EntityOwner)& theOwner,
const Handle(SelectMgr_Selection)& theSelection,
const Standard_Real theDeflection,
const Standard_Real theDeviationAngle,
const Standard_Integer theNbPOnEdge,
const Standard_Real theMaxiParam,
Handle(Select3D_SensitiveEntity)& theSensitive);
//! Traverses the selection given and pre-builds BVH trees for heavyweight
//! sensitive entities containing more than BVH_PRIMITIVE_LIMIT (defined in .cxx file)
//! sub-elements
//! sensitive entities containing more than BVH_PRIMITIVE_LIMIT (defined in .cxx file) sub-elements.
Standard_EXPORT static void PreBuildBVH (const Handle(SelectMgr_Selection)& theSelection);
protected:
private:
Standard_EXPORT static void GetEdgeSensitive (const TopoDS_Shape& aShape, const Handle(StdSelect_BRepOwner)& anOwner, const Handle(SelectMgr_Selection)& aSelection, const Standard_Real theDeflection, const Standard_Real theDeflectionAngle, const Standard_Integer NbPOnEdge, const Standard_Real MaximalParameter, Handle(Select3D_SensitiveEntity)& aSensitive);
};
#endif // _StdSelect_BRepSelectionTool_HeaderFile

View File

@@ -14,6 +14,7 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <StdSelect_Shape.hxx>
#include <Geom_Transformation.hxx>
#include <Prs3d_Drawer.hxx>
@@ -22,16 +23,20 @@
#include <Standard_Type.hxx>
#include <StdPrs_WFShape.hxx>
#include <StdPrs_ShadedShape.hxx>
#include <StdSelect_Shape.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <TopoDS_Shape.hxx>
IMPLEMENT_STANDARD_RTTIEXT(StdSelect_Shape,PrsMgr_PresentableObject)
StdSelect_Shape::StdSelect_Shape (const TopoDS_Shape& theShape, const Handle(Prs3d_Drawer)& theDrawer):
mysh (theShape),
myDrawer (theDrawer)
{}
StdSelect_Shape::StdSelect_Shape (const TopoDS_Shape& theShape,
const Handle(Prs3d_Drawer)& theDrawer)
: mysh (theShape)
{
if (!theDrawer.IsNull())
{
myDrawer->SetLink (theDrawer);
}
}
void StdSelect_Shape::Compute(const Handle(PrsMgr_PresentationManager3d)& /*PM*/,
const Handle(Prs3d_Presentation)& P,

View File

@@ -25,23 +25,19 @@
#include <PrsMgr_PresentableObject.hxx>
#include <PrsMgr_PresentationManager3d.hxx>
#include <Standard_Integer.hxx>
class TopoDS_Shape;
class Prs3d_Presentation;
class Prs3d_Projector;
class Geom_Transformation;
class StdSelect_Shape;
DEFINE_STANDARD_HANDLE(StdSelect_Shape, PrsMgr_PresentableObject)
//! Presentable shape only for purpose of display for BRepOwner...
class StdSelect_Shape : public PrsMgr_PresentableObject
{
DEFINE_STANDARD_RTTIEXT(StdSelect_Shape, PrsMgr_PresentableObject)
public:
Standard_EXPORT StdSelect_Shape(const TopoDS_Shape& theShape, const Handle(Prs3d_Drawer)& theDrawer);
Standard_EXPORT StdSelect_Shape(const TopoDS_Shape& theShape, const Handle(Prs3d_Drawer)& theDrawer = Handle(Prs3d_Drawer)());
Standard_EXPORT void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE;
@@ -53,37 +49,21 @@ public:
//! WARNING :<aTrsf> must be applied
//! to the object to display before computation !!!
Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
const TopoDS_Shape& Shape() const;
void Shape (const TopoDS_Shape& sh);
DEFINE_STANDARD_RTTIEXT(StdSelect_Shape,PrsMgr_PresentableObject)
protected:
const TopoDS_Shape& Shape() const { return mysh; }
void Shape (const TopoDS_Shape& theShape) { mysh = theShape; }
private:
Standard_EXPORT void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
TopoDS_Shape mysh;
Handle(Prs3d_Drawer) myDrawer;
private:
TopoDS_Shape mysh;
};
#include <StdSelect_Shape.lxx>
DEFINE_STANDARD_HANDLE(StdSelect_Shape, PrsMgr_PresentableObject)
#endif // _StdSelect_Shape_HeaderFile

View File

@@ -1,13 +0,0 @@
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.