b311480e |
1 | -- Created on: 1995-02-20 |
2 | -- Created by: Mister rmi |
3 | -- Copyright (c) 1995-1999 Matra Datavision |
4 | -- Copyright (c) 1999-2012 OPEN CASCADE SAS |
5 | -- |
6 | -- The content of this file is subject to the Open CASCADE Technology Public |
7 | -- License Version 6.5 (the "License"). You may not use the content of this file |
8 | -- except in compliance with the License. Please obtain a copy of the License |
9 | -- at http://www.opencascade.org and read it completely before using this file. |
10 | -- |
11 | -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
12 | -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
13 | -- |
14 | -- The Original Code and all software distributed under the License is |
15 | -- distributed on an "AS IS" basis, without warranty of any kind, and the |
16 | -- Initial Developer hereby disclaims all such warranties, including without |
17 | -- limitation, any warranties of merchantability, fitness for a particular |
18 | -- purpose or non-infringement. Please see the License for the specific terms |
19 | -- and conditions governing the rights and limitations under the License. |
20 | |
7fd59977 |
21 | |
22 | |
23 | |
24 | deferred class SelectableObject from SelectMgr inherits PresentableObject from PrsMgr |
25 | |
26 | ---Purpose: A framework to supply the structure of the object to be |
27 | -- selected. At the first pick, this structure is created by |
28 | -- calling the appropriate algorithm and retaining this |
29 | -- framework for further picking. |
30 | -- This abstract framework is inherited in Application |
31 | -- Interactive Services (AIS), notably in AIS_InteractiveObject. |
32 | -- Consequently, 3D selection should be handled by the |
33 | -- relevant daughter classes and their member functions |
34 | -- in AIS. This is particularly true in the creation of new interactive objects. |
35 | |
36 | |
37 | uses |
38 | |
39 | SelectionManager from SelectMgr, |
40 | Selection from SelectMgr, |
41 | SequenceOfSelection from SelectMgr, |
42 | TypeOfPresentation3d from PrsMgr, |
43 | Presentation from Prs3d, |
59f45b7c |
44 | PresentationManager from PrsMgr, |
7fd59977 |
45 | PresentationManager3d from PrsMgr, |
46 | SequenceOfOwner from SelectMgr, |
47 | NameOfColor from Quantity, |
48 | EntityOwner from SelectMgr, |
49 | TransModeFlags from Graphic3d |
50 | |
51 | raises |
52 | NotImplemented from Standard |
53 | |
54 | is |
55 | |
56 | |
57 | ---Category: deferred Methods |
58 | |
59 | |
60 | Initialize(aTypeOfPresentation3d: TypeOfPresentation3d from PrsMgr = PrsMgr_TOP_AllView); |
61 | |
62 | ComputeSelection(me:mutable; aSelection :mutable Selection from SelectMgr; |
63 | aMode : Integer) is deferred private; |
64 | ---Purpose: Recovers and calculates any sensitive primitive, |
65 | -- aSelection, available in Shape mode, specified by |
66 | -- aMode. As a rule, these are sensitive faces. |
67 | -- This method is defined as virtual. This enables you to |
68 | -- implement it in the creation of a new class of AIS |
69 | -- Interactive Object. You need to do this and in so |
70 | -- doing, redefine this method, if you create a class |
71 | -- which enriches the list of signatures and types. |
72 | |
73 | NbPossibleSelection(me) returns Integer from Standard is virtual; |
74 | ---Level: Public |
75 | ---Purpose: defines the number of different modes of selection |
76 | -- (or decomposition) for an Object. |
77 | |
78 | |
79 | |
80 | ---Category: |
81 | |
82 | |
83 | UpdateSelection (me:mutable) is static; |
84 | ---Purpose: re-computes the sensitive primitives for all modes |
85 | |
86 | UpdateSelection (me:mutable; aMode: Integer from Standard) is static; |
87 | ---Purpose: re-computes the sensitive primitives which correspond to |
88 | -- the <amode>th selection mode. |
89 | |
90 | |
91 | AddSelection(me:mutable ;aSelection:mutable Selection from SelectMgr; |
92 | aMode : Integer) |
93 | is static; |
94 | ---Purpose: Adds the selection aSelection with the selection mode |
95 | -- index aMode to this framework. |
96 | |
97 | |
98 | ClearSelections(me:mutable; update: Boolean from Standard = Standard_False) is static; |
99 | ---Level: Public |
100 | ---Purpose: Empties all the selections in the SelectableObject |
101 | -- <update> parameter defines whether all object's |
102 | -- selections should be flagged for further update or not. |
103 | -- This improved method can be used to recompute an |
104 | -- object's selection (without redisplaying the object |
105 | -- completely) when some selection mode is activated not for the first time. |
106 | |
107 | Selection(me;aMode : Integer) |
108 | returns any Selection from SelectMgr |
109 | is static; |
110 | ---C++: return const& |
111 | ---Purpose: Returns the selection Selection having the selection mode aMode. |
112 | |
113 | HasSelection(me; aMode: Integer) |
114 | returns Boolean from Standard is static ; |
115 | --- Purpose: Returns true if a selection corresponding to the |
116 | -- selection mode aMode is present in this framework. |
117 | |
118 | |
119 | |
120 | Init(me:mutable) is static; |
121 | ---Purpose: Begins the iteration scanning for sensitive primitives. |
122 | ---C++: inline |
123 | |
124 | |
125 | More(me) returns Boolean is static; |
126 | ---Purpose: Continues the iteration scanning for sensitive primitives. |
127 | ---C++: inline |
128 | |
129 | |
130 | |
131 | Next(me:mutable) is static; |
132 | ---Purpose: Continues the iteration scanning for sensitive primitives. |
133 | ---C++: inline |
134 | |
135 | |
136 | |
137 | CurrentSelection(me) returns any Selection from SelectMgr; |
138 | ---Purpose: Returns the current selection in this framework. |
139 | ---C++: return const& |
140 | ---C++: inline |
141 | |
142 | |
143 | ResetLocation(me:mutable) is redefined static; |
144 | |
145 | UpdateLocation(me:mutable) is redefined virtual; |
146 | ---Purpose: Recomputes the location of the selection aSelection. |
147 | |
148 | UpdateLocation(me:mutable;aSelection: Selection from SelectMgr) is virtual protected; |
149 | ---Level: Internal |
150 | ---Purpose: Updates locations in all sensitive entities from <aSelection> |
151 | -- and in corresponding entity owners. |
152 | |
153 | HilightSelected ( me : mutable; PM : PresentationManager3d from PrsMgr; |
154 | Seq : SequenceOfOwner from SelectMgr ) raises NotImplemented from Standard is virtual; |
155 | ---Purpose: Method which draws selected owners ( for fast presentation draw ) |
156 | |
157 | ClearSelected ( me : mutable ) is virtual; |
158 | ---Purpose: Method which clear all selected owners belonging |
159 | -- to this selectable object ( for fast presentation draw ) |
160 | |
161 | HilightOwnerWithColor ( me : mutable; thePM : PresentationManager3d from PrsMgr; |
162 | theColor : NameOfColor from Quantity; |
163 | theOwner : EntityOwner from SelectMgr ) raises NotImplemented from Standard is virtual; |
164 | ---Purpose: Method which hilight an owner belonging to |
165 | -- this selectable object ( for fast presentation draw ) |
166 | |
167 | IsAutoHilight ( me ) returns Boolean from Standard is virtual; |
168 | ---Purpose: If returns True, the old mechanism for highlighting |
169 | -- selected objects is used (HilightSelected Method may be empty). |
170 | -- If returns False, the HilightSelected method will be |
171 | -- fully responsible for highlighting selected entity |
172 | -- owners belonging to this selectable object. |
173 | |
174 | SetAutoHilight ( me : mutable; newAutoHilight : Boolean from Standard ) is virtual; |
175 | ---Purpose: Set AutoHilight property to true or false |
176 | |
177 | -- SetTransformPersistence( me : mutable; |
178 | -- aFlag : TransModeFlags from Graphic3d ) is redefined; |
179 | ---Level: Public |
180 | ---Purpose: Sets up Transform Persistence Mode for this object |
181 | ---Category: Graphic attributes management |
182 | |
183 | GetHilightPresentation( me: mutable; |
184 | TheMgr: PresentationManager3d from PrsMgr ) returns Presentation from Prs3d is static; |
185 | |
186 | GetSelectPresentation( me: mutable; |
187 | TheMgr: PresentationManager3d from PrsMgr ) returns Presentation from Prs3d is static; |
59f45b7c |
188 | |
189 | SetZLayer ( me : mutable; |
190 | thePrsMgr : PresentationManager from PrsMgr; |
191 | theLayerId : Integer from Standard ) |
192 | is redefined virtual; |
193 | ---Purpose: Set Z layer ID and update all presentations of |
194 | -- the selectable object. The layer can be set only for displayed object. |
195 | -- If all object presentations are removed, the layer ID will be set to |
196 | -- default value when computing presentation. The layers mechanism allows |
197 | -- drawing objects in higher layers in overlay of objects in lower layers. |
198 | |
7fd59977 |
199 | fields |
200 | |
201 | myselections : SequenceOfSelection is protected; |
202 | mycurrent : Integer; |
203 | myAutoHilight : Boolean from Standard; |
204 | |
205 | mySelectionPrs : Presentation from Prs3d; |
206 | myHilightPrs : Presentation from Prs3d; |
207 | |
208 | friends |
209 | class SelectionManager from SelectMgr |
210 | |
211 | end SelectableObject; |
212 | |
213 | |
214 | |