1 -- Created on: 1995-05-23
2 -- Created by: Robert COUBLANC
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 --Modified by rob October 25 97 store locations...
18 -- jun 17 98 : Add virtual methods HasShape, GetShape.
19 -- by default return False and Null Shape...
24 class EntityOwner from SelectMgr inherits EntityOwner from SelectBasics
26 ---Purpose: A framework to define classes of owners of sensitive primitives.
27 -- The owner is the link between application and
28 -- selection data structures.
29 -- For the application to make its own objects selectable,
30 -- it must define owner classes inheriting this framework.
34 SelectableObject from SelectMgr,
36 NameOfColor from Quantity,
38 PresentationManager from PrsMgr,
39 PresentationManager3d from PrsMgr
42 NoSuchObject from Standard
45 Create (aPriority: Integer = 0) returns EntityOwner from SelectMgr;
46 --- Purpose: Initializes the selection priority aPriority.
47 Create (aSO : SelectableObject;
48 aPriority : Integer=0)
49 returns EntityOwner from SelectMgr;
50 ---Purpose: Constructs a framework with the selectable object
51 -- anSO being attributed the selection priority aPriority.
53 Create (theOwner : EntityOwner from SelectMgr;
54 aPriority : Integer=0)
55 returns EntityOwner from SelectMgr;
56 ---Purpose: Constructs a framework from existing one
57 -- anSO being attributed the selection priority aPriority.
59 HasSelectable(me) returns Boolean from Standard;
60 ---Purpose: Returns true if there is a selectable object to serve as an owner.
62 Selectable(me) returns any SelectableObject from SelectMgr
63 ---Purpose: Returns a selectable object detected in the working context.
64 raises NoSuchObject from Standard
67 Set(me:mutable; aSO : SelectableObject) is static;
68 ---Purpose: Sets the selectable object anSO to be used by the
69 -- second constructor above.
71 ---Category: hilight of the owner when detected...
72 -- the following virtual methods have a default
73 -- implementation which acts on stored selectable
74 -- if it exists. else does nothing.
75 -- WARNING: if methods are redefined in inheriting
77 -- if the hilight methods don't use presentable objects
79 -- 1) ask The presentationManager if it is in
81 -- 2) if it is, add your presentation to
82 -- the immediate list of presentation manager.
85 Hilight(me:mutable) is virtual;
86 ---Purpose: Provides a framework to highlight any selectable
87 -- object found subsequently which can serve as an
88 -- owner of a sensitive primitive.
90 aPM : PresentationManager from PrsMgr;
91 aMode : Integer from Standard =0)
92 returns Boolean from Standard is virtual;
93 ---Purpose: Returns true if the presentation manager aPM
94 -- highlights selections corresponding to the selection mode aMode.
97 aPM : PresentationManager from PrsMgr;
98 aMode : Integer from Standard =0) is virtual;
99 ---Purpose: Highlights the owner of a detected selectable object in
100 -- the presentation manager aPM. This object could be
101 -- the owner of a sensitive primitive.
102 -- The display mode for the highlight is aMode; this has
103 -- the default value of 0, that is, wireframe mode.
105 HilightWithColor (me : mutable;
106 aPM : PresentationManager3d from PrsMgr;
107 aColor: NameOfColor from Quantity;
108 aMode : Integer from Standard =0) is virtual;
110 Unhilight(me : mutable;
111 aPM : PresentationManager from PrsMgr;
112 aMode : Integer from Standard =0) is virtual;
113 ---Purpose: Removes highlighting from the owner of a detected
114 -- selectable object in the presentation manager aPM.
115 -- This object could be the owner of a sensitive primitive.
116 -- The display mode for the highlight is aMode; this has
117 -- the default value of 0, that is, wireframe mode.
120 aPM : PresentationManager from PrsMgr;
121 aMode : Integer from Standard =0) is virtual;
122 ---Purpose: Clears the owners matching the value of the selection
123 -- mode aMode from the presentation manager object aPM.
125 ---Category: internal methods for location on objects...
126 -- Default implementations of HasLocation() and Location() rely on
127 -- location obtained from <mySelectable> field, to minimize memory usage.
128 -- SetLocation() and ResetLocation() do nothing by default.
129 HasLocation(me) returns Boolean from Standard is redefined;
130 SetLocation(me:mutable; aLoc : Location from TopLoc) is redefined;
131 ResetLocation(me:mutable) is redefined;
132 Location(me) returns Location from TopLoc is redefined;
134 --very Internal method (to be used in selection process only...)
136 SetSelected(me:mutable;theIsSelected : Boolean from Standard);
138 ---Purpose:Set the state of the owner.
139 -- @param theIsSelected [in] shows if owner is selected.
140 IsSelected(me) returns Boolean from Standard;
142 ---Purpose: @return Standard_True if the owner is selected.
144 State(me:mutable;aStatus:Integer from Standard);
146 ---Purpose:Set the state of the owner.
147 -- The method is deprecated. Use SetSelected() instead.
149 State(me) returns Integer from Standard;
151 -- @return 1 if the owner is selected and 0 otherwise.
152 -- The method is deprecated. Use IsSelected() instead.
154 IsAutoHilight ( me ) returns Boolean from Standard is virtual;
155 ---Purpose: if owner is not auto hilighted, for group contains many such owners
156 -- will be called one method HilightSelected of SelectableObject
158 IsForcedHilight ( me ) returns Boolean from Standard is virtual;
159 ---Purpose: if this method returns TRUE the owner will allways call method
160 -- Hilight for SelectableObject when the owner is detected. By default
161 -- it always return FALSE.
163 SetZLayer ( me : mutable;
164 thePrsMgr : PresentationManager from PrsMgr;
165 theLayerId : Integer from Standard )
167 ---Purpose: Set Z layer ID and update all presentations.
171 mySelectable : SOPtr;
173 myIsSelected : Boolean from Standard;
174 ---Purpose: Describes selection state of this owner:
175 -- Standard_False: the owner not selected
176 -- Standard_True: the owner is selected.