0030687: Visualization - remove redundant interfaces SelectBasics_EntityOwner and...
[occt.git] / src / StdSelect / StdSelect_BRepOwner.hxx
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
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
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.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #ifndef _StdSelect_BRepOwner_HeaderFile
18 #define _StdSelect_BRepOwner_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
22
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;
31 class TopoDS_Shape;
32 class SelectMgr_SelectableObject;
33 class PrsMgr_PresentationManager;
34 class TopLoc_Location;
35
36 DEFINE_STANDARD_HANDLE(StdSelect_BRepOwner, SelectMgr_EntityOwner)
37
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
46 {
47   DEFINE_STANDARD_RTTIEXT(StdSelect_BRepOwner, SelectMgr_EntityOwner)
48 public:
49
50   //! Constructs an owner specification framework defined
51   //! by the priority aPriority.
52   Standard_EXPORT StdSelect_BRepOwner(const Standard_Integer aPriority);
53   
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);
60   
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);
69   
70   //! returns False if no shape was set
71   Standard_Boolean HasShape() const { return !myShape.IsNull(); }
72
73   //! Returns the shape.
74   const TopoDS_Shape& Shape() const { return myShape; }
75
76   //! Returns true if this framework has a highlight mode defined for it.
77   Standard_Boolean HasHilightMode() const { return myCurMode == -1; }
78   
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; }
84
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; }
90
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; }
96
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;
100   
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;
104   
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;
108   
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;
112   
113   Standard_EXPORT virtual void SetLocation (const TopLoc_Location& aLoc) Standard_OVERRIDE;
114
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;
119
120 protected:
121
122   TopoDS_Shape myShape;
123   Handle(StdSelect_Shape) myPrsSh;
124   Standard_Integer myCurMode;
125
126 };
127
128 #endif // _StdSelect_BRepOwner_HeaderFile