0025695: Visualization, AIS_InteractiveContext - define default HilightMode
[occt.git] / src / StdSelect / StdSelect_BRepOwner.hxx
CommitLineData
42cf5bc1 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>
30class StdSelect_Shape;
31class TopoDS_Shape;
32class SelectMgr_SelectableObject;
33class PrsMgr_PresentationManager;
34class TopLoc_Location;
35
42cf5bc1 36DEFINE_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.
45class StdSelect_BRepOwner : public SelectMgr_EntityOwner
46{
f838dac4 47 DEFINE_STANDARD_RTTIEXT(StdSelect_BRepOwner, SelectMgr_EntityOwner)
42cf5bc1 48public:
49
42cf5bc1 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
f838dac4 71 Standard_Boolean HasShape() const { return !myShape.IsNull(); }
72
42cf5bc1 73 //! <FromDecomposition> indicates whether <aShape>
74 //! comes from decomposition of a bigger shape.
75 Standard_EXPORT void Set (const TopoDS_Shape& aShape, const Standard_Boolean FromDecomposition = Standard_False);
f838dac4 76
77 const TopoDS_Shape& Shape() const { return myShape; }
42cf5bc1 78
79 //! Returns true if this framework has a highlight mode defined for it.
f838dac4 80 Standard_Boolean HasHilightMode() const { return myCurMode == -1; }
42cf5bc1 81
82 //! Sets the highlight mode for this framework.
83 //! This defines the type of display used to highlight the
84 //! owner of the shape when it is detected by the selector.
85 //! The default type of display is wireframe, defined by the index 0.
f838dac4 86 void SetHilightMode (const Standard_Integer theMode) { myCurMode = theMode; }
87
42cf5bc1 88 //! Resets the higlight mode for this framework.
89 //! This defines the type of display used to highlight the
90 //! owner of the shape when it is detected by the selector.
91 //! The default type of display is wireframe, defined by the index 0.
f838dac4 92 void ResetHilightMode() { myCurMode = -1; }
93
42cf5bc1 94 //! Returns the highlight mode for this framework.
95 //! This defines the type of display used to highlight the
96 //! owner of the shape when it is detected by the selector.
97 //! The default type of display is wireframe, defined by the index 0.
f838dac4 98 Standard_Integer HilightMode() const { return myCurMode; }
99
42cf5bc1 100 //! Returns true if an object with the selection mode
101 //! aMode is highlighted in the presentation manager aPM.
102 Standard_EXPORT virtual Standard_Boolean IsHilighted (const Handle(PrsMgr_PresentationManager)& aPM, const Standard_Integer aMode = 0) const Standard_OVERRIDE;
103
8e5fb5ea 104 Standard_EXPORT virtual void HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
f838dac4 105 const Handle(Prs3d_Drawer)& theStyle,
8e5fb5ea 106 const Standard_Integer theMode = 0) Standard_OVERRIDE;
42cf5bc1 107
108 //! Removes highlighting from the type of shape
109 //! identified the selection mode aMode in the presentation manager aPM.
110 Standard_EXPORT virtual void Unhilight (const Handle(PrsMgr_PresentationManager)& aPM, const Standard_Integer aMode = 0) Standard_OVERRIDE;
111
112 //! Clears the presentation manager object aPM of all
113 //! shapes with the selection mode aMode.
114 Standard_EXPORT virtual void Clear (const Handle(PrsMgr_PresentationManager)& aPM, const Standard_Integer aMode = 0) Standard_OVERRIDE;
115
116 Standard_EXPORT virtual void SetLocation (const TopLoc_Location& aLoc) Standard_OVERRIDE;
117
118 Standard_EXPORT virtual void ResetLocation() Standard_OVERRIDE;
42cf5bc1 119
5396886c 120 //! Implements immediate application of location transformation of parent object to dynamic highlight structure
121 Standard_EXPORT virtual void UpdateHighlightTrsf (const Handle(V3d_Viewer)& theViewer,
122 const Handle(PrsMgr_PresentationManager3d)& theManager,
123 const Standard_Integer theDispMode) Standard_OVERRIDE;
42cf5bc1 124
42cf5bc1 125protected:
126
42cf5bc1 127 TopoDS_Shape myShape;
42cf5bc1 128 Handle(StdSelect_Shape) myPrsSh;
129 Standard_Integer myCurMode;
130
42cf5bc1 131};
132
42cf5bc1 133#endif // _StdSelect_BRepOwner_HeaderFile