1 // Created on: 1995-03-08
2 // Created by: Mister rmi
3 // Copyright (c) 1995-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _StdSelect_BRepOwner_HeaderFile
18 #define _StdSelect_BRepOwner_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
23 #include <Standard_Integer.hxx>
24 #include <Standard_Boolean.hxx>
25 #include <TopoDS_Shape.hxx>
26 #include <SelectMgr_EntityOwner.hxx>
27 #include <PrsMgr_PresentationManager3d.hxx>
28 #include <Quantity_NameOfColor.hxx>
29 #include <Graphic3d_ZLayerId.hxx>
30 class StdSelect_Shape;
32 class SelectMgr_SelectableObject;
33 class PrsMgr_PresentationManager;
34 class TopLoc_Location;
36 DEFINE_STANDARD_HANDLE(StdSelect_BRepOwner, SelectMgr_EntityOwner)
38 //! Defines Specific Owners for Sensitive Primitives
39 //! (Sensitive Segments,Circles...).
40 //! Used in Dynamic Selection Mechanism.
41 //! A BRepOwner has an Owner (the shape it represents)
42 //! and Users (One or More Transient entities).
43 //! The highlight-unhighlight methods are empty and
44 //! must be redefined by each User.
45 class StdSelect_BRepOwner : public SelectMgr_EntityOwner
47 DEFINE_STANDARD_RTTIEXT(StdSelect_BRepOwner, SelectMgr_EntityOwner)
50 //! Constructs an owner specification framework defined
51 //! by the priority aPriority.
52 Standard_EXPORT StdSelect_BRepOwner(const Standard_Integer aPriority);
54 //! Constructs an owner specification framework defined
55 //! by the shape aShape and the priority aPriority.
56 //! aShape and aPriority are stored in this framework. If
57 //! more than one owner are detected during dynamic
58 //! selection, the one with the highest priority is the one stored.
59 Standard_EXPORT StdSelect_BRepOwner(const TopoDS_Shape& aShape, const Standard_Integer aPriority = 0, const Standard_Boolean ComesFromDecomposition = Standard_False);
61 //! Constructs an owner specification framework defined
62 //! by the shape aShape, the selectable object theOrigin
63 //! and the priority aPriority.
64 //! aShape, theOrigin and aPriority are stored in this
65 //! framework. If more than one owner are detected
66 //! during dynamic selection, the one with the highest
67 //! priority is the one stored.
68 Standard_EXPORT StdSelect_BRepOwner(const TopoDS_Shape& aShape, const Handle(SelectMgr_SelectableObject)& theOrigin, const Standard_Integer aPriority = 0, const Standard_Boolean FromDecomposition = Standard_False);
70 //! returns False if no shape was set
71 Standard_Boolean HasShape() const { return !myShape.IsNull(); }
73 //! Returns the shape.
74 const TopoDS_Shape& Shape() const { return myShape; }
76 //! Returns true if this framework has a highlight mode defined for it.
77 Standard_Boolean HasHilightMode() const { return myCurMode == -1; }
79 //! Sets the highlight mode for this framework.
80 //! This defines the type of display used to highlight the
81 //! owner of the shape when it is detected by the selector.
82 //! The default type of display is wireframe, defined by the index 0.
83 void SetHilightMode (const Standard_Integer theMode) { myCurMode = theMode; }
85 //! Resets the higlight mode for this framework.
86 //! This defines the type of display used to highlight the
87 //! owner of the shape when it is detected by the selector.
88 //! The default type of display is wireframe, defined by the index 0.
89 void ResetHilightMode() { myCurMode = -1; }
91 //! Returns the highlight mode for this framework.
92 //! This defines the type of display used to highlight the
93 //! owner of the shape when it is detected by the selector.
94 //! The default type of display is wireframe, defined by the index 0.
95 Standard_Integer HilightMode() const { return myCurMode; }
97 //! Returns true if an object with the selection mode
98 //! aMode is highlighted in the presentation manager aPM.
99 Standard_EXPORT virtual Standard_Boolean IsHilighted (const Handle(PrsMgr_PresentationManager)& aPM, const Standard_Integer aMode = 0) const Standard_OVERRIDE;
101 Standard_EXPORT virtual void HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
102 const Handle(Prs3d_Drawer)& theStyle,
103 const Standard_Integer theMode = 0) Standard_OVERRIDE;
105 //! Removes highlighting from the type of shape
106 //! identified the selection mode aMode in the presentation manager aPM.
107 Standard_EXPORT virtual void Unhilight (const Handle(PrsMgr_PresentationManager)& aPM, const Standard_Integer aMode = 0) Standard_OVERRIDE;
109 //! Clears the presentation manager object aPM of all
110 //! shapes with the selection mode aMode.
111 Standard_EXPORT virtual void Clear (const Handle(PrsMgr_PresentationManager)& aPM, const Standard_Integer aMode = 0) Standard_OVERRIDE;
113 Standard_EXPORT virtual void SetLocation (const TopLoc_Location& aLoc) Standard_OVERRIDE;
115 //! Implements immediate application of location transformation of parent object to dynamic highlight structure
116 Standard_EXPORT virtual void UpdateHighlightTrsf (const Handle(V3d_Viewer)& theViewer,
117 const Handle(PrsMgr_PresentationManager3d)& theManager,
118 const Standard_Integer theDispMode) Standard_OVERRIDE;
120 //! Dumps the content of me into the stream
121 Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
125 TopoDS_Shape myShape;
126 Handle(StdSelect_Shape) myPrsSh;
127 Standard_Integer myCurMode;
131 #endif // _StdSelect_BRepOwner_HeaderFile