b311480e |
1 | // Created on: 1995-02-13 |
2 | // Created by: Mister rmi |
3 | // Copyright (c) 1995-1999 Matra Datavision |
973c2be1 |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | // |
973c2be1 |
6 | // This file is part of Open CASCADE Technology software library. |
b311480e |
7 | // |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
13 | // |
973c2be1 |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
7fd59977 |
16 | |
42cf5bc1 |
17 | |
18 | #include <OSD_Environment.hxx> |
19 | #include <SelectMgr_DataMapIteratorOfDataMapOfObjectSelectors.hxx> |
20 | #include <SelectMgr_SelectableObject.hxx> |
7fd59977 |
21 | #include <SelectMgr_Selection.hxx> |
42cf5bc1 |
22 | #include <SelectMgr_SelectionManager.hxx> |
7fd59977 |
23 | #include <SelectMgr_SequenceOfSelector.hxx> |
42cf5bc1 |
24 | #include <SelectMgr_ViewerSelector.hxx> |
25 | #include <Standard_Type.hxx> |
7fd59977 |
26 | #include <TCollection_AsciiString.hxx> |
7fd59977 |
27 | #include <TColStd_ListIteratorOfListOfInteger.hxx> |
42cf5bc1 |
28 | #include <TColStd_ListOfInteger.hxx> |
29 | #include <TColStd_MapIteratorOfMapOfTransient.hxx> |
7fd59977 |
30 | |
92efcf78 |
31 | IMPLEMENT_STANDARD_RTTIEXT(SelectMgr_SelectionManager,MMgt_TShared) |
32 | |
f751596e |
33 | static Standard_Integer FindIndex (const SelectMgr_SequenceOfSelector& theSelectorsSeq, |
34 | const Handle(SelectMgr_ViewerSelector)& theSelector) |
7fd59977 |
35 | { |
f751596e |
36 | Standard_Integer aFoundIdx = 0; |
7fd59977 |
37 | |
f751596e |
38 | for (Standard_Integer anIdx = 1; anIdx <= theSelectorsSeq.Length() && aFoundIdx==0; anIdx++) |
39 | { |
40 | if (theSelector == theSelectorsSeq.Value (anIdx)) |
41 | aFoundIdx = anIdx; |
42 | } |
7fd59977 |
43 | |
f751596e |
44 | return aFoundIdx; |
45 | } |
7fd59977 |
46 | |
7fd59977 |
47 | //================================================== |
48 | // Function: Create |
49 | // Purpose : |
50 | //================================================== |
f751596e |
51 | SelectMgr_SelectionManager::SelectMgr_SelectionManager() {} |
7fd59977 |
52 | |
53 | //================================================== |
54 | // Function: Add |
55 | // Purpose : |
56 | //================================================== |
f751596e |
57 | void SelectMgr_SelectionManager::Add (const Handle(SelectMgr_ViewerSelector)& theSelector) |
7fd59977 |
58 | { |
f751596e |
59 | mySelectors.Add (theSelector); |
7fd59977 |
60 | } |
61 | |
7fd59977 |
62 | //================================================== |
63 | // Function: Remove |
64 | // Purpose : |
65 | //================================================== |
f751596e |
66 | void SelectMgr_SelectionManager::Remove (const Handle(SelectMgr_ViewerSelector)& theSelector) |
7fd59977 |
67 | { |
f751596e |
68 | for (SelectMgr_DataMapIteratorOfDataMapOfObjectSelectors aSelIter (myLocal); aSelIter.More(); aSelIter.Next()) |
7fd59977 |
69 | { |
f751596e |
70 | SelectMgr_SequenceOfSelector& theSelectors = myLocal.ChangeFind (aSelIter.Key()); |
71 | Standard_Integer aRank = FindIndex (theSelectors, theSelector); |
72 | if (aRank != 0 && aRank <= theSelectors.Length()) |
73 | theSelectors.Remove (aRank); |
7fd59977 |
74 | } |
f751596e |
75 | |
76 | if (mySelectors.Contains (theSelector)) |
77 | mySelectors.Remove (theSelector); |
7fd59977 |
78 | } |
79 | |
80 | //================================================== |
81 | // Function: Contains |
82 | // Purpose : |
83 | //================================================== |
f751596e |
84 | Standard_Boolean SelectMgr_SelectionManager::Contains (const Handle(SelectMgr_ViewerSelector)& theSelector) const |
85 | { |
86 | return mySelectors.Contains (theSelector); |
87 | } |
7fd59977 |
88 | |
89 | //================================================== |
90 | // Function: Contains |
91 | // Purpose : |
92 | //================================================== |
f751596e |
93 | Standard_Boolean SelectMgr_SelectionManager::Contains (const Handle(SelectMgr_SelectableObject)& theObject) const |
94 | { |
95 | if (myGlobal.Contains (theObject)) |
96 | return Standard_True; |
7fd59977 |
97 | |
f751596e |
98 | if (myLocal.IsBound (theObject)) |
99 | return Standard_True; |
7fd59977 |
100 | |
f751596e |
101 | return Standard_False; |
7fd59977 |
102 | } |
103 | |
7fd59977 |
104 | //================================================== |
105 | // Function: Load |
106 | // Purpose : |
107 | //================================================== |
f751596e |
108 | void SelectMgr_SelectionManager::Load (const Handle(SelectMgr_SelectableObject)& theObject, |
109 | const Standard_Integer theMode) |
7fd59977 |
110 | { |
f751596e |
111 | if (myGlobal.Contains(theObject)) |
112 | return; |
7fd59977 |
113 | |
f751596e |
114 | for (PrsMgr_ListOfPresentableObjectsIter anChildrenIter (theObject->Children()); anChildrenIter.More(); anChildrenIter.Next()) |
115 | { |
116 | Load (Handle(SelectMgr_SelectableObject)::DownCast (anChildrenIter.Value()), theMode); |
7fd59977 |
117 | } |
f751596e |
118 | |
119 | if (!theObject->HasOwnPresentations()) |
120 | return; |
121 | |
122 | myGlobal.Add(theObject); |
123 | for (TColStd_MapIteratorOfMapOfTransient aSelectorsIter (mySelectors); aSelectorsIter.More(); aSelectorsIter.Next()) |
124 | { |
125 | Handle(SelectMgr_ViewerSelector) aSelector = |
126 | Handle(SelectMgr_ViewerSelector)::DownCast (aSelectorsIter.Key()); |
127 | if (!aSelector->Contains (theObject) && theObject->HasOwnPresentations()) |
128 | { |
129 | aSelector->AddSelectableObject (theObject); |
7fd59977 |
130 | } |
131 | } |
f751596e |
132 | if (theMode != -1) |
133 | loadMode (theObject, theMode); |
7fd59977 |
134 | } |
135 | |
136 | |
137 | //================================================== |
f751596e |
138 | // Function: Load |
7fd59977 |
139 | // Purpose : |
140 | //================================================== |
f751596e |
141 | void SelectMgr_SelectionManager::Load (const Handle(SelectMgr_SelectableObject)& theObject, |
142 | const Handle(SelectMgr_ViewerSelector)& theSelector, |
143 | const Standard_Integer theMode) |
7fd59977 |
144 | { |
f751596e |
145 | if (!mySelectors.Contains (theSelector)) |
146 | { |
147 | mySelectors.Add (theSelector); |
148 | } |
7fd59977 |
149 | |
f751596e |
150 | if (theMode != -1) |
151 | loadMode (theObject, theMode, theSelector); |
7fd59977 |
152 | |
f751596e |
153 | if (theObject->HasOwnPresentations()) |
154 | theSelector->AddSelectableObject (theObject); |
155 | |
156 | if (myLocal.IsBound (theObject)) |
157 | { |
158 | SelectMgr_SequenceOfSelector& aSelectors = myLocal.ChangeFind (theObject); |
159 | if (FindIndex (aSelectors, theSelector) == 0) |
160 | { |
161 | aSelectors.Append (theSelector); |
7fd59977 |
162 | } |
7fd59977 |
163 | } |
f751596e |
164 | else |
165 | { |
166 | if (!myGlobal.Contains (theObject)) |
167 | { |
520cde87 |
168 | for (PrsMgr_ListOfPresentableObjectsIter anChildrenIter (theObject->Children()); anChildrenIter.More(); anChildrenIter.Next()) |
f751596e |
169 | { |
520cde87 |
170 | Load (Handle(SelectMgr_SelectableObject)::DownCast (anChildrenIter.Value()), theSelector, theMode); |
7fd59977 |
171 | } |
520cde87 |
172 | if (!theObject->HasOwnPresentations()) |
173 | return; |
174 | |
175 | SelectMgr_SequenceOfSelector aSelectors; |
176 | aSelectors.Append (theSelector); |
177 | myLocal.Bind (theObject, aSelectors); |
7fd59977 |
178 | } |
7fd59977 |
179 | } |
180 | } |
181 | |
f751596e |
182 | |
7fd59977 |
183 | //================================================== |
184 | // Function: Remove |
185 | // Purpose : |
186 | //================================================== |
f751596e |
187 | void SelectMgr_SelectionManager::Remove (const Handle(SelectMgr_SelectableObject)& theObject) |
7fd59977 |
188 | { |
520cde87 |
189 | for (PrsMgr_ListOfPresentableObjectsIter anChildrenIter (theObject->Children()); anChildrenIter.More(); anChildrenIter.Next()) |
190 | { |
191 | Remove (Handle(SelectMgr_SelectableObject)::DownCast (anChildrenIter.Value())); |
192 | } |
193 | |
194 | if (!theObject->HasOwnPresentations()) |
195 | return; |
196 | |
f751596e |
197 | if (myGlobal.Contains (theObject)) |
198 | { |
199 | for (TColStd_MapIteratorOfMapOfTransient aSelectorsIter (mySelectors); aSelectorsIter.More(); aSelectorsIter.Next()) |
200 | { |
201 | Handle(SelectMgr_ViewerSelector) aCurSelector = |
202 | Handle(SelectMgr_ViewerSelector)::DownCast (aSelectorsIter.Key()); |
7fd59977 |
203 | |
f751596e |
204 | if (!aCurSelector->Contains (theObject)) |
205 | continue; |
7fd59977 |
206 | |
f751596e |
207 | for (theObject->Init(); theObject->More(); theObject->Next()) |
208 | { |
209 | aCurSelector->RemoveSelectionOfObject (theObject, theObject->CurrentSelection()); |
210 | theObject->CurrentSelection()->UpdateBVHStatus (SelectMgr_TBU_Remove); |
7fd59977 |
211 | } |
f751596e |
212 | aCurSelector->RemoveSelectableObject (theObject); |
7fd59977 |
213 | } |
f751596e |
214 | |
215 | myGlobal.Remove (theObject); |
7fd59977 |
216 | } |
f751596e |
217 | else if (myLocal.IsBound (theObject)) |
218 | { |
219 | SelectMgr_SequenceOfSelector& aSelectors = myLocal.ChangeFind (theObject); |
220 | for (Standard_Integer aSelectorsIdx = 1; aSelectorsIdx <= aSelectors.Length(); aSelectorsIdx++) |
221 | { |
a9dde4a3 |
222 | Handle(SelectMgr_ViewerSelector) aCurSelector = aSelectors (aSelectorsIdx); |
f751596e |
223 | if (!aCurSelector->Contains (theObject)) |
224 | continue; |
225 | |
226 | for (theObject->Init(); theObject->More(); theObject->Next()) |
227 | { |
228 | aCurSelector->RemoveSelectionOfObject (theObject, theObject->CurrentSelection()); |
229 | theObject->CurrentSelection()->UpdateBVHStatus (SelectMgr_TBU_Remove); |
230 | } |
231 | aCurSelector->RemoveSelectableObject (theObject); |
232 | } |
233 | |
234 | myLocal.UnBind (theObject); |
235 | } |
f751596e |
236 | |
237 | theObject->ClearSelections(); |
7fd59977 |
238 | } |
239 | |
240 | //================================================== |
f751596e |
241 | // Function: Remove |
7fd59977 |
242 | // Purpose : |
243 | //================================================== |
f751596e |
244 | void SelectMgr_SelectionManager::Remove (const Handle(SelectMgr_SelectableObject)& theObject, |
245 | const Handle(SelectMgr_ViewerSelector)& theSelector) |
7fd59977 |
246 | { |
f751596e |
247 | if (!theSelector->Contains (theObject)) |
248 | return; |
7fd59977 |
249 | |
f751596e |
250 | for (PrsMgr_ListOfPresentableObjectsIter anChildrenIter (theObject->Children()); anChildrenIter.More(); anChildrenIter.Next()) |
251 | { |
252 | Remove (Handle(SelectMgr_SelectableObject)::DownCast (anChildrenIter.Value()), theSelector); |
253 | } |
7fd59977 |
254 | |
f751596e |
255 | if (!theObject->HasOwnPresentations()) |
256 | return; |
7fd59977 |
257 | |
f751596e |
258 | for (theObject->Init(); theObject->More(); theObject->Next()) |
259 | { |
260 | theSelector->RemoveSelectionOfObject (theObject, theObject->CurrentSelection()); |
261 | theObject->CurrentSelection()->UpdateBVHStatus (SelectMgr_TBU_Remove); |
7fd59977 |
262 | } |
263 | |
f751596e |
264 | theSelector->RemoveSelectableObject (theObject); |
7fd59977 |
265 | |
f751596e |
266 | if (myLocal.IsBound (theObject)) |
267 | { |
268 | SelectMgr_SequenceOfSelector& aSelectors = myLocal.ChangeFind (theObject); |
269 | for (Standard_Integer aSelectorIdx = 1; aSelectorIdx <= aSelectors.Length(); aSelectorIdx++) |
270 | { |
271 | if (aSelectors (aSelectorIdx) == theSelector) |
272 | { |
273 | aSelectors.Remove (aSelectorIdx); |
7fd59977 |
274 | break; |
7fd59977 |
275 | } |
f751596e |
276 | } |
7fd59977 |
277 | |
f751596e |
278 | if (aSelectors.IsEmpty()) |
279 | { |
280 | myLocal.UnBind (theObject); |
7fd59977 |
281 | } |
282 | } |
283 | } |
284 | |
7fd59977 |
285 | //================================================== |
286 | // Function: Activate |
287 | // Purpose : |
288 | //================================================== |
f751596e |
289 | void SelectMgr_SelectionManager::Activate (const Handle(SelectMgr_SelectableObject)& theObject, |
290 | const Standard_Integer theMode, |
291 | const Handle(SelectMgr_ViewerSelector)& theSelector) |
7fd59977 |
292 | { |
f751596e |
293 | if (theMode == -1) |
294 | return; |
7fd59977 |
295 | |
f751596e |
296 | if (!theSelector.IsNull() && !mySelectors.Contains (theSelector)) |
297 | return; |
7fd59977 |
298 | |
520cde87 |
299 | for (PrsMgr_ListOfPresentableObjectsIter anChildIter (theObject->Children()); anChildIter.More(); anChildIter.Next()) |
f751596e |
300 | { |
520cde87 |
301 | Activate (Handle(SelectMgr_SelectableObject)::DownCast (anChildIter.Value()), theMode, theSelector); |
302 | } |
7fd59977 |
303 | |
520cde87 |
304 | if (!theObject->HasOwnPresentations()) |
f751596e |
305 | return; |
7fd59977 |
306 | |
f751596e |
307 | Standard_Boolean isComputed = Standard_False; |
308 | if (theObject->HasSelection (theMode)) |
309 | { |
310 | isComputed = theObject->Selection (theMode)->IsEmpty() ? 0 : 1; |
311 | } |
312 | |
313 | if (!isComputed) |
314 | loadMode (theObject, theMode); |
315 | |
316 | if (theSelector.IsNull()) |
317 | { |
318 | if (myGlobal.Contains (theObject)) |
7fd59977 |
319 | { |
f751596e |
320 | for (TColStd_MapIteratorOfMapOfTransient aSelectorsIter (mySelectors); aSelectorsIter.More(); aSelectorsIter.Next()) |
321 | { |
322 | Handle(SelectMgr_ViewerSelector) aCurSelector = |
323 | Handle(SelectMgr_ViewerSelector)::DownCast (aSelectorsIter.Key()); |
324 | Activate (theObject, theMode, aCurSelector); |
325 | } |
326 | } |
327 | else if (myLocal.IsBound (theObject)) |
328 | { |
329 | SelectMgr_SequenceOfSelector& theSelectors = myLocal.ChangeFind (theObject); |
330 | for (Standard_Integer aSelectorIdx = 1; aSelectorIdx <= theSelectors.Length(); aSelectorIdx++) |
331 | { |
a9dde4a3 |
332 | Handle(SelectMgr_ViewerSelector) aCurSelector = theSelectors (aSelectorIdx); |
f751596e |
333 | Activate (theObject, theMode, aCurSelector); |
334 | } |
7fd59977 |
335 | } |
f751596e |
336 | } |
337 | |
338 | const Handle(SelectMgr_Selection)& aSelection = theObject->Selection (theMode); |
339 | |
340 | switch (aSelection->UpdateStatus()) |
341 | { |
342 | case SelectMgr_TOU_Full: |
343 | if (theObject->HasSelection (theMode)) |
344 | theSelector->RemoveSelectionOfObject (theObject, aSelection); |
345 | theObject->RecomputePrimitives (theMode); |
346 | case SelectMgr_TOU_Partial: |
347 | if(theObject->HasTransformation()) |
348 | theObject->UpdateTransformations (aSelection); |
349 | theSelector->RebuildObjectsTree(); |
350 | break; |
7fd59977 |
351 | default: |
352 | break; |
7fd59977 |
353 | } |
f751596e |
354 | aSelection->UpdateStatus(SelectMgr_TOU_None); |
7fd59977 |
355 | |
f751596e |
356 | switch (aSelection->BVHUpdateStatus()) |
357 | { |
358 | case SelectMgr_TBU_Add: |
359 | case SelectMgr_TBU_Renew: |
360 | theSelector->AddSelectionToObject (theObject, aSelection); |
361 | break; |
362 | case SelectMgr_TBU_Remove: |
363 | if (aSelection->GetSelectionState() == SelectMgr_SOS_Deactivated) |
364 | theSelector->AddSelectionToObject (theObject, aSelection); |
365 | break; |
366 | default: |
367 | break; |
368 | } |
369 | aSelection->UpdateBVHStatus (SelectMgr_TBU_None); |
7fd59977 |
370 | |
f751596e |
371 | if (myGlobal.Contains (theObject)) |
372 | { |
0d5880e1 |
373 | const Standard_Integer aGlobalSelMode = theObject->GlobalSelectionMode(); |
374 | if (theMode != aGlobalSelMode && theSelector->IsActive (theObject, aGlobalSelMode)) |
f751596e |
375 | { |
0d5880e1 |
376 | theSelector->Deactivate (theObject->Selection (aGlobalSelMode)); |
f751596e |
377 | } |
378 | theSelector->Activate (theObject->Selection (theMode)); |
379 | } |
380 | else |
381 | { |
382 | if (myLocal.IsBound (theObject)) |
383 | { |
384 | if (FindIndex (myLocal.Find (theObject), theSelector) == 0) |
385 | (myLocal.ChangeFind (theObject)).Append (theSelector); |
386 | theSelector->Activate (theObject->Selection (theMode)); |
7fd59977 |
387 | } |
388 | } |
389 | } |
390 | |
391 | //================================================== |
392 | // Function: Deactivate |
393 | // Purpose : |
394 | //================================================== |
f751596e |
395 | void SelectMgr_SelectionManager::Deactivate (const Handle(SelectMgr_SelectableObject)& theObject, |
396 | const Standard_Integer theMode, |
397 | const Handle(SelectMgr_ViewerSelector)& theSelector) |
7fd59977 |
398 | { |
520cde87 |
399 | for (PrsMgr_ListOfPresentableObjectsIter anChildrenIter (theObject->Children()); anChildrenIter.More(); anChildrenIter.Next()) |
f751596e |
400 | { |
520cde87 |
401 | Deactivate (Handle(SelectMgr_SelectableObject)::DownCast (anChildrenIter.Value()), theMode, theSelector); |
402 | } |
7fd59977 |
403 | |
520cde87 |
404 | if (!theObject->HasOwnPresentations()) |
f751596e |
405 | return; |
7fd59977 |
406 | |
f751596e |
407 | Standard_Boolean isInGlobal = myGlobal.Contains (theObject); |
408 | Standard_Boolean hasSelection = theMode == -1 ? Standard_True : theObject->HasSelection (theMode); |
7fd59977 |
409 | |
f751596e |
410 | if (theSelector.IsNull()) |
411 | { |
412 | Handle(SelectMgr_ViewerSelector) aSelector; |
413 | for (TColStd_MapIteratorOfMapOfTransient aSelectorIter (mySelectors); aSelectorIter.More(); aSelectorIter.Next()) |
414 | { |
415 | aSelector = Handle(SelectMgr_ViewerSelector)::DownCast (aSelectorIter.Key()); |
416 | if (isInGlobal || myLocal.IsBound (theObject)) |
417 | { |
418 | if (theMode == -1) |
419 | { |
420 | for (theObject->Init(); theObject->More(); theObject->Next()) |
421 | { |
422 | aSelector->Deactivate (theObject->CurrentSelection()); |
423 | } |
424 | } |
425 | else |
426 | { |
427 | if (hasSelection) |
428 | aSelector->Deactivate (theObject->Selection (theMode)); |
429 | } |
430 | } |
7fd59977 |
431 | } |
432 | } |
f751596e |
433 | else |
7fd59977 |
434 | { |
f751596e |
435 | if (theMode == -1) |
436 | { |
437 | for (theObject->Init(); theObject->More(); theObject->Next()) |
438 | { |
439 | theSelector->Deactivate (theObject->CurrentSelection()); |
440 | } |
441 | } |
442 | else |
443 | if (hasSelection) |
444 | theSelector->Deactivate (theObject->Selection (theMode)); |
445 | } |
7fd59977 |
446 | } |
7fd59977 |
447 | |
f751596e |
448 | //======================================================================= |
449 | //function : IsActivated |
450 | //purpose : |
451 | //======================================================================= |
452 | Standard_Boolean SelectMgr_SelectionManager::IsActivated (const Handle(SelectMgr_SelectableObject)& theObject, |
453 | const Standard_Integer theMode, |
454 | const Handle(SelectMgr_ViewerSelector)& theSelector) const |
7fd59977 |
455 | { |
520cde87 |
456 | for (PrsMgr_ListOfPresentableObjectsIter anChildrenIter (theObject->Children()); anChildrenIter.More(); anChildrenIter.Next()) |
7fd59977 |
457 | { |
520cde87 |
458 | if (IsActivated (Handle(SelectMgr_SelectableObject)::DownCast (anChildrenIter.Value()), theMode, theSelector)) |
459 | return Standard_True; |
460 | } |
7fd59977 |
461 | |
520cde87 |
462 | if (!theObject->HasOwnPresentations()) |
f751596e |
463 | return Standard_False; |
7fd59977 |
464 | |
f751596e |
465 | if (!(myGlobal.Contains (theObject) || myLocal.IsBound (theObject))) |
466 | return Standard_False; |
7fd59977 |
467 | |
f751596e |
468 | if (theMode == -1 && theSelector.IsNull()) |
469 | { |
470 | for (theObject->Init(); theObject->More(); theObject->Next()) |
471 | { |
472 | if (IsActivated (theObject, theObject->CurrentSelection()->Mode())) |
473 | return Standard_True; |
474 | } |
7fd59977 |
475 | |
f751596e |
476 | return Standard_False; |
477 | } |
7fd59977 |
478 | |
f751596e |
479 | if (!theObject->HasSelection (theMode)) |
480 | return Standard_False; |
7fd59977 |
481 | |
f751596e |
482 | const Handle(SelectMgr_Selection)& aSelection = theObject->Selection (theMode); |
483 | if (theSelector.IsNull()) |
484 | { |
485 | for (TColStd_MapIteratorOfMapOfTransient aSelectorIter (mySelectors); aSelectorIter.More(); aSelectorIter.Next()) |
486 | { |
c5f3a425 |
487 | Handle(SelectMgr_ViewerSelector) aSelector (Handle(SelectMgr_ViewerSelector)::DownCast (aSelectorIter.Key())); |
f751596e |
488 | if (aSelector->Status (aSelection) == SelectMgr_SOS_Activated) |
489 | return Standard_True; |
490 | } |
7fd59977 |
491 | } |
f751596e |
492 | else |
493 | { |
494 | return theSelector->Status (aSelection) == SelectMgr_SOS_Activated; |
7fd59977 |
495 | } |
496 | |
f751596e |
497 | return Standard_False; |
7fd59977 |
498 | } |
499 | |
500 | //======================================================================= |
f751596e |
501 | //function : ClearSelectionStructures |
502 | //purpose : Removes sensitive entities from all viewer selectors |
503 | // after method Clear() was called to the selection they belonged to |
504 | // or it was recomputed somehow |
7fd59977 |
505 | //======================================================================= |
f751596e |
506 | void SelectMgr_SelectionManager::ClearSelectionStructures (const Handle(SelectMgr_SelectableObject)& theObj, |
507 | const Standard_Integer theMode, |
508 | const Handle(SelectMgr_ViewerSelector)& theSelector) |
7fd59977 |
509 | { |
f751596e |
510 | for (PrsMgr_ListOfPresentableObjectsIter anChildrenIter (theObj->Children()); anChildrenIter.More(); anChildrenIter.Next()) |
511 | { |
e11850fd |
512 | ClearSelectionStructures (Handle(SelectMgr_SelectableObject)::DownCast (anChildrenIter.Value()), theMode, theSelector); |
7fd59977 |
513 | } |
7fd59977 |
514 | |
f751596e |
515 | if (!theObj->HasOwnPresentations()) |
516 | return; |
7fd59977 |
517 | |
c04c30b3 |
518 | if (theSelector.IsNull()) |
f751596e |
519 | { |
520 | if (!(myGlobal.Contains (theObj) || myLocal.IsBound(theObj))) |
521 | return; |
7fd59977 |
522 | |
f751596e |
523 | TColStd_MapIteratorOfMapOfTransient aSelectorsIter (mySelectors); |
524 | Handle(SelectMgr_ViewerSelector) aSelector; |
525 | for( ; aSelectorsIter.More(); aSelectorsIter.Next()) |
526 | { |
527 | aSelector = Handle(SelectMgr_ViewerSelector)::DownCast (aSelectorsIter.Key()); |
528 | ClearSelectionStructures (theObj, theMode, aSelector); |
529 | } |
7fd59977 |
530 | } |
f751596e |
531 | else |
532 | { |
533 | if (!(myGlobal.Contains (theObj) || myLocal.IsBound (theObj))) |
534 | return; |
535 | |
536 | if (theMode != -1) |
537 | { |
538 | if (theObj->HasSelection (theMode)) |
539 | { |
540 | const Handle(SelectMgr_Selection)& aSelection = theObj->Selection (theMode); |
541 | if (theObj->HasSelection (theMode)) |
542 | { |
543 | theSelector->RemoveSelectionOfObject (theObj, aSelection); |
544 | aSelection->UpdateBVHStatus (SelectMgr_TBU_Add); |
545 | } |
546 | } |
547 | } |
548 | else |
549 | { |
550 | for (theObj->Init(); theObj->More(); theObj->Next()) |
551 | { |
552 | const Handle(SelectMgr_Selection)& aSelection = theObj->CurrentSelection(); |
553 | theSelector->RemoveSelectionOfObject (theObj, aSelection); |
554 | aSelection->UpdateBVHStatus (SelectMgr_TBU_Add); |
555 | } |
556 | } |
557 | theSelector->RebuildObjectsTree(); |
7fd59977 |
558 | } |
559 | } |
560 | |
561 | //======================================================================= |
f751596e |
562 | //function : RestoreSelectionStructuress |
563 | //purpose : Re-adds newely calculated sensitive entities of recomputed selection |
564 | // defined by mode theMode to all viewer selectors contained that selection. |
7fd59977 |
565 | //======================================================================= |
f751596e |
566 | void SelectMgr_SelectionManager::RestoreSelectionStructures (const Handle(SelectMgr_SelectableObject)& theObj, |
567 | const Standard_Integer theMode, |
568 | const Handle(SelectMgr_ViewerSelector)& theSelector) |
7fd59977 |
569 | { |
f751596e |
570 | for (PrsMgr_ListOfPresentableObjectsIter anChildrenIter (theObj->Children()); anChildrenIter.More(); anChildrenIter.Next()) |
571 | { |
e11850fd |
572 | RestoreSelectionStructures (Handle(SelectMgr_SelectableObject)::DownCast (anChildrenIter.Value()), theMode, theSelector); |
7fd59977 |
573 | } |
7fd59977 |
574 | |
f751596e |
575 | if (!theObj->HasOwnPresentations()) |
576 | return; |
7fd59977 |
577 | |
c04c30b3 |
578 | if (theSelector.IsNull()) |
f751596e |
579 | { |
580 | if (!(myGlobal.Contains (theObj) || myLocal.IsBound(theObj))) |
581 | return; |
7fd59977 |
582 | |
f751596e |
583 | TColStd_MapIteratorOfMapOfTransient aSelectorsIter (mySelectors); |
584 | Handle(SelectMgr_ViewerSelector) aSelector; |
585 | for( ; aSelectorsIter.More(); aSelectorsIter.Next()) |
586 | { |
587 | aSelector = Handle(SelectMgr_ViewerSelector)::DownCast (aSelectorsIter.Key()); |
588 | RestoreSelectionStructures (theObj, theMode, aSelector); |
589 | } |
7fd59977 |
590 | } |
f751596e |
591 | else |
592 | { |
593 | if (!(myGlobal.Contains (theObj) || myLocal.IsBound (theObj))) |
594 | return; |
7fd59977 |
595 | |
f751596e |
596 | if (theMode != -1) |
597 | { |
598 | if (theObj->HasSelection (theMode)) |
599 | { |
600 | const Handle(SelectMgr_Selection)& aSelection = theObj->Selection (theMode); |
601 | if (theObj->HasSelection (theMode)) |
602 | { |
603 | theSelector->AddSelectionToObject (theObj, aSelection); |
604 | aSelection->UpdateBVHStatus (SelectMgr_TBU_None); |
605 | } |
606 | } |
607 | } |
608 | else |
609 | { |
610 | for (theObj->Init(); theObj->More(); theObj->Next()) |
611 | { |
612 | const Handle(SelectMgr_Selection)& aSelection = theObj->CurrentSelection(); |
613 | theSelector->AddSelectionToObject (theObj, aSelection); |
614 | aSelection->UpdateBVHStatus (SelectMgr_TBU_None); |
615 | } |
616 | } |
617 | theSelector->RebuildObjectsTree(); |
7fd59977 |
618 | } |
7fd59977 |
619 | } |
620 | |
621 | //======================================================================= |
f751596e |
622 | //function : rebuildSelectionStructures |
623 | //purpose : Internal function that marks 1st level BVH of object theObj |
624 | // as outdated |
7fd59977 |
625 | //======================================================================= |
f751596e |
626 | void SelectMgr_SelectionManager::rebuildSelectionStructures (const Handle(SelectMgr_ViewerSelector)& theSelector) |
7fd59977 |
627 | { |
c04c30b3 |
628 | if (theSelector.IsNull()) |
f751596e |
629 | { |
630 | Handle(SelectMgr_ViewerSelector) aSelector; |
631 | for(TColStd_MapIteratorOfMapOfTransient aSelectorsIter (mySelectors); aSelectorsIter.More(); aSelectorsIter.Next()) |
632 | { |
633 | aSelector = Handle(SelectMgr_ViewerSelector)::DownCast (aSelectorsIter.Key()); |
634 | rebuildSelectionStructures (aSelector); |
635 | } |
636 | } |
637 | else |
638 | { |
639 | theSelector->RebuildObjectsTree(); |
640 | } |
7fd59977 |
641 | } |
642 | |
45d5cbf8 |
643 | //================================================== |
644 | // Function: recomputeSelectionMode |
645 | // Purpose : |
646 | //================================================== |
647 | void SelectMgr_SelectionManager::recomputeSelectionMode (const Handle(SelectMgr_SelectableObject)& theObject, |
648 | const Handle(SelectMgr_Selection)& theSelection, |
649 | const Standard_Integer theMode) |
650 | { |
651 | theSelection->UpdateStatus (SelectMgr_TOU_Full); |
652 | |
653 | for (TColStd_MapIteratorOfMapOfTransient aSelectorIter (mySelectors); aSelectorIter.More(); aSelectorIter.Next()) |
654 | { |
655 | Handle(SelectMgr_ViewerSelector) aCurSelector = Handle(SelectMgr_ViewerSelector)::DownCast (aSelectorIter.Key()); |
656 | |
657 | ClearSelectionStructures (theObject, theMode, aCurSelector); |
658 | theObject->RecomputePrimitives (theMode); |
659 | RestoreSelectionStructures (theObject, theMode, aCurSelector); |
660 | theSelection->UpdateStatus (SelectMgr_TOU_None); |
661 | theSelection->UpdateBVHStatus (SelectMgr_TBU_None); |
662 | } |
663 | } |
664 | |
7fd59977 |
665 | //================================================== |
666 | // Function: Update |
667 | // Purpose : |
668 | //================================================== |
f751596e |
669 | void SelectMgr_SelectionManager::RecomputeSelection (const Handle(SelectMgr_SelectableObject)& theObject, |
670 | const Standard_Boolean theIsForce, |
671 | const Standard_Integer theMode) |
7fd59977 |
672 | { |
f751596e |
673 | if (theIsForce) |
674 | { |
675 | if (theMode == -1) |
676 | { |
677 | ClearSelectionStructures (theObject); |
678 | theObject->RecomputePrimitives(); |
679 | theObject->UpdateTransformation(); |
680 | RestoreSelectionStructures (theObject); |
7fd59977 |
681 | } |
f751596e |
682 | else if (theObject->HasSelection (theMode)) |
683 | { |
684 | ClearSelectionStructures (theObject, theMode); |
685 | theObject->RecomputePrimitives (theMode); |
686 | theObject->UpdateTransformation(); |
687 | RestoreSelectionStructures (theObject, theMode); |
7fd59977 |
688 | } |
689 | return; |
690 | } |
f751596e |
691 | |
692 | for (PrsMgr_ListOfPresentableObjectsIter anChildrenIter (theObject->Children()); anChildrenIter.More(); anChildrenIter.Next()) |
693 | { |
694 | RecomputeSelection (Handle(SelectMgr_SelectableObject)::DownCast (anChildrenIter.Value()), theIsForce, theMode); |
695 | } |
696 | |
697 | if (!theObject->HasOwnPresentations()) |
698 | return; |
699 | |
700 | if (!(myGlobal.Contains (theObject) || myLocal.IsBound (theObject))) |
701 | return; |
702 | |
45d5cbf8 |
703 | if (theMode == -1) |
f751596e |
704 | { |
45d5cbf8 |
705 | for (theObject->Init(); theObject->More(); theObject->Next()) |
f751596e |
706 | { |
45d5cbf8 |
707 | const Handle(SelectMgr_Selection)& aSelection = theObject->CurrentSelection(); |
708 | Standard_Integer aSelMode = aSelection->Mode(); |
709 | recomputeSelectionMode (theObject, aSelection, aSelMode); |
7fd59977 |
710 | } |
711 | } |
45d5cbf8 |
712 | else |
713 | { |
714 | if (!theObject->HasSelection (theMode)) |
715 | return; |
716 | |
717 | const Handle(SelectMgr_Selection)& aSelection = theObject->Selection (theMode); |
718 | recomputeSelectionMode (theObject, aSelection, theMode); |
719 | } |
7fd59977 |
720 | } |
721 | |
722 | //======================================================================= |
723 | //function : Update |
81bba717 |
724 | //purpose : Selections are recalculated if they are flagged |
725 | // "TO RECALCULATE" and activated in one of selectors. |
726 | // If ForceUpdate = True, and they are "TO RECALCULATE" |
727 | // This is done without caring for the state of activation. |
7fd59977 |
728 | //======================================================================= |
f751596e |
729 | void SelectMgr_SelectionManager::Update (const Handle(SelectMgr_SelectableObject)& theObject, |
730 | const Standard_Boolean theIsForce) |
7fd59977 |
731 | { |
f751596e |
732 | for (PrsMgr_ListOfPresentableObjectsIter aChildIter (theObject->Children()); aChildIter.More(); aChildIter.Next()) |
0717ddc1 |
733 | { |
f751596e |
734 | Update (Handle(SelectMgr_SelectableObject)::DownCast (aChildIter.Value()), theIsForce); |
0717ddc1 |
735 | } |
736 | |
f751596e |
737 | if (!theObject->HasOwnPresentations()) |
738 | return; |
7fd59977 |
739 | |
f751596e |
740 | for (theObject->Init(); theObject->More(); theObject->Next()) |
741 | { |
742 | const Handle(SelectMgr_Selection)& aSelection = theObject->CurrentSelection(); |
743 | if (theIsForce) |
744 | { |
745 | switch (aSelection->UpdateStatus()) |
746 | { |
7fd59977 |
747 | case SelectMgr_TOU_Full: |
f751596e |
748 | ClearSelectionStructures (theObject, aSelection->Mode()); |
749 | theObject->RecomputePrimitives (aSelection->Mode()); // no break on purpose... |
750 | RestoreSelectionStructures (theObject, aSelection->Mode()); |
7fd59977 |
751 | case SelectMgr_TOU_Partial: |
f751596e |
752 | theObject->UpdateTransformations (aSelection); |
753 | rebuildSelectionStructures(); |
7fd59977 |
754 | break; |
7fd59977 |
755 | default: |
756 | break; |
7fd59977 |
757 | } |
f751596e |
758 | aSelection->UpdateStatus (SelectMgr_TOU_None); |
759 | aSelection->UpdateBVHStatus (SelectMgr_TBU_None); |
7fd59977 |
760 | } |
761 | |
f751596e |
762 | for (TColStd_MapIteratorOfMapOfTransient aSelectorIter (mySelectors); aSelectorIter.More(); aSelectorIter.Next()) |
763 | { |
c5f3a425 |
764 | Handle(SelectMgr_ViewerSelector) aSelector (Handle(SelectMgr_ViewerSelector)::DownCast (aSelectorIter.Key())); |
f751596e |
765 | Update (theObject, aSelector, Standard_False); |
7fd59977 |
766 | } |
767 | } |
768 | } |
769 | |
7fd59977 |
770 | //================================================== |
771 | // Function: Update |
81bba717 |
772 | // Purpose : Attention, it is required to know what is done... |
7fd59977 |
773 | //================================================== |
f751596e |
774 | void SelectMgr_SelectionManager::Update (const Handle(SelectMgr_SelectableObject)& theObject, |
775 | const Handle(SelectMgr_ViewerSelector)& theSelector, |
776 | const Standard_Boolean theIsForce) |
777 | { |
778 | if (!mySelectors.Contains (theSelector)) |
779 | return; |
780 | |
781 | Standard_Boolean isKnown = myGlobal.Contains (theObject); |
782 | if (!isKnown) |
783 | isKnown = (myLocal.IsBound (theObject) && (FindIndex (myLocal.Find (theObject), theSelector) != 0)); |
784 | if (!isKnown) |
785 | return; |
786 | |
787 | for (PrsMgr_ListOfPresentableObjectsIter aChildIter (theObject->Children()); aChildIter.More(); aChildIter.Next()) |
788 | { |
789 | Update (Handle(SelectMgr_SelectableObject)::DownCast (aChildIter.Value()), theSelector, theIsForce); |
790 | } |
791 | |
792 | if (!theObject->HasOwnPresentations()) |
793 | return; |
794 | |
795 | for (theObject->Init(); theObject->More(); theObject->Next()) |
796 | { |
797 | const Handle(SelectMgr_Selection)& aSelection = theObject->CurrentSelection(); |
798 | if (theIsForce) |
799 | { |
800 | switch (aSelection->UpdateStatus()) |
801 | { |
7fd59977 |
802 | case SelectMgr_TOU_Full: |
f751596e |
803 | ClearSelectionStructures (theObject, aSelection->Mode()); |
804 | theObject->RecomputePrimitives (aSelection->Mode()); |
805 | RestoreSelectionStructures (theObject, aSelection->Mode()); |
7fd59977 |
806 | case SelectMgr_TOU_Partial: |
f751596e |
807 | theObject->UpdateTransformations (aSelection); |
808 | rebuildSelectionStructures(); |
7fd59977 |
809 | break; |
7fd59977 |
810 | default: |
811 | break; |
7fd59977 |
812 | } |
f751596e |
813 | aSelection->UpdateStatus (SelectMgr_TOU_None); |
814 | aSelection->UpdateBVHStatus (SelectMgr_TBU_None); |
7fd59977 |
815 | } |
816 | |
f751596e |
817 | if (theSelector->Status (aSelection) == SelectMgr_SOS_Activated) |
818 | { |
819 | switch (aSelection->UpdateStatus()) |
820 | { |
7fd59977 |
821 | case SelectMgr_TOU_Full: |
f751596e |
822 | ClearSelectionStructures (theObject, aSelection->Mode(), theSelector); |
823 | theObject->RecomputePrimitives (aSelection->Mode()); |
824 | RestoreSelectionStructures (theObject, aSelection->Mode(), theSelector); |
7fd59977 |
825 | case SelectMgr_TOU_Partial: |
f751596e |
826 | if (theObject->HasTransformation()) |
827 | { |
828 | theObject->UpdateTransformations (aSelection); |
829 | theSelector->RebuildObjectsTree(); |
830 | } |
7fd59977 |
831 | break; |
7fd59977 |
832 | default: |
833 | break; |
7fd59977 |
834 | } |
f751596e |
835 | |
836 | aSelection->UpdateStatus(SelectMgr_TOU_None); |
837 | aSelection->UpdateBVHStatus (SelectMgr_TBU_None); |
7fd59977 |
838 | } |
839 | } |
840 | } |
841 | |
842 | //================================================== |
f751596e |
843 | // Function: loadMode |
844 | // Purpose : Private Method |
7fd59977 |
845 | //================================================== |
f751596e |
846 | void SelectMgr_SelectionManager::loadMode (const Handle(SelectMgr_SelectableObject)& theObject, |
847 | const Standard_Integer theMode, |
848 | const Handle(SelectMgr_ViewerSelector)& theSelector) |
7fd59977 |
849 | { |
f751596e |
850 | if (theMode == -1) |
851 | return; |
7fd59977 |
852 | |
f751596e |
853 | if (!theObject->HasSelection (theMode)) |
854 | { |
855 | Handle(SelectMgr_Selection) aNewSel = new SelectMgr_Selection (theMode); |
856 | theObject->AddSelection (aNewSel, theMode); |
c04c30b3 |
857 | if (theSelector.IsNull()) |
f751596e |
858 | { |
859 | if (myGlobal.Contains (theObject)) |
860 | { |
861 | TColStd_MapIteratorOfMapOfTransient aSelectorIter (mySelectors); |
862 | for ( ; aSelectorIter.More(); aSelectorIter.Next()) |
863 | { |
864 | Handle(SelectMgr_ViewerSelector) aSelector = |
865 | Handle(SelectMgr_ViewerSelector)::DownCast (aSelectorIter.Key()); |
866 | aSelector->AddSelectionToObject (theObject, aNewSel); |
867 | aNewSel->UpdateBVHStatus (SelectMgr_TBU_None); |
868 | } |
869 | } |
870 | else if (myLocal.IsBound (theObject)) |
871 | { |
872 | const SelectMgr_SequenceOfSelector& aSelectors = myLocal (theObject); |
873 | for (Standard_Integer aSelectorIdx = 1; aSelectorIdx <= aSelectors.Length(); ++aSelectorIdx) |
874 | { |
875 | aSelectors (aSelectorIdx)->AddSelectionToObject (theObject, aNewSel); |
876 | aNewSel->UpdateBVHStatus (SelectMgr_TBU_None); |
877 | } |
878 | } |
879 | } |
880 | else |
881 | { |
882 | theSelector->AddSelectionToObject (theObject, aNewSel); |
883 | aNewSel->UpdateBVHStatus (SelectMgr_TBU_None); |
884 | } |
7fd59977 |
885 | } |
f751596e |
886 | else if (theObject->Selection (theMode)->IsEmpty()) |
7fd59977 |
887 | { |
f751596e |
888 | if (theObject->Selection (theMode)->BVHUpdateStatus() == SelectMgr_TBU_Remove) |
889 | { |
890 | Handle(SelectMgr_Selection) aNewSel = new SelectMgr_Selection (theMode); |
891 | theObject->AddSelection (aNewSel, theMode); |
892 | theObject->Selection (theMode)->UpdateBVHStatus (SelectMgr_TBU_Remove); |
893 | theObject->Selection (theMode)->SetSelectionState (SelectMgr_SOS_Deactivated); |
894 | } |
7fd59977 |
895 | } |
896 | } |
897 | |
7fd59977 |
898 | //======================================================================= |
899 | //function : SetUpdateMode |
f751596e |
900 | //purpose : |
7fd59977 |
901 | //======================================================================= |
f751596e |
902 | void SelectMgr_SelectionManager::SetUpdateMode (const Handle(SelectMgr_SelectableObject)& theObject, |
903 | const SelectMgr_TypeOfUpdate theType) |
7fd59977 |
904 | { |
f751596e |
905 | for (theObject->Init(); theObject->More(); theObject->Next()) |
906 | theObject->CurrentSelection()->UpdateStatus (theType); |
7fd59977 |
907 | } |
908 | |
f751596e |
909 | //======================================================================= |
910 | //function : SetUpdateMode |
911 | //purpose : |
912 | //======================================================================= |
913 | void SelectMgr_SelectionManager::SetUpdateMode (const Handle(SelectMgr_SelectableObject)& theObject, |
914 | const Standard_Integer theMode, |
915 | const SelectMgr_TypeOfUpdate theType) |
7fd59977 |
916 | { |
f751596e |
917 | if (theObject->HasSelection (theMode)) |
918 | theObject->Selection (theMode)->UpdateStatus (theType); |
7fd59977 |
919 | } |
920 | |
8a1170ad |
921 | //======================================================================= |
922 | //function : SetSelectionSensitivity |
923 | //purpose : Allows to manage sensitivity of a particular selection of interactive object theObject and |
924 | // changes previous sensitivity value of all sensitive entities in selection with theMode |
925 | // to the given theNewSensitivity. |
926 | //======================================================================= |
927 | void SelectMgr_SelectionManager::SetSelectionSensitivity (const Handle(SelectMgr_SelectableObject)& theObject, |
928 | const Standard_Integer theMode, |
929 | const Standard_Integer theNewSens) |
930 | { |
931 | Standard_ASSERT_RAISE (theNewSens > 0, |
932 | "Error! Selection sensitivity have positive value."); |
933 | |
934 | if (theObject.IsNull() || !theObject->HasSelection (theMode)) |
935 | return; |
936 | |
937 | Handle(SelectMgr_Selection) aSel = theObject->Selection (theMode); |
938 | const Standard_Integer aPrevSens = aSel->Sensitivity(); |
939 | aSel->SetSensitivity (theNewSens); |
940 | |
941 | if (!(myGlobal.Contains (theObject) || myLocal.IsBound (theObject))) |
942 | return; |
943 | |
944 | if (myGlobal.Contains (theObject)) |
945 | { |
946 | for (TColStd_MapIteratorOfMapOfTransient aSelectorsIter (mySelectors); aSelectorsIter.More(); aSelectorsIter.Next()) |
947 | { |
948 | Handle(SelectMgr_ViewerSelector) aSelector = Handle(SelectMgr_ViewerSelector)::DownCast (aSelectorsIter.Key()); |
949 | if (aSelector->Contains (theObject)) |
950 | { |
951 | aSelector->myTolerances.Decrement (aPrevSens); |
952 | aSelector->myTolerances.Add (theNewSens); |
953 | aSelector->myToUpdateTolerance = Standard_True; |
954 | } |
955 | } |
956 | } |
957 | if (myLocal.IsBound (theObject)) |
958 | { |
959 | const SelectMgr_SequenceOfSelector& aSelectors = myLocal (theObject); |
960 | for (SelectMgr_SequenceOfSelector::Iterator aLocalIter (aSelectors); aLocalIter.More(); aLocalIter.Next()) |
961 | { |
962 | Handle(SelectMgr_ViewerSelector)& aCurSel = aLocalIter.ChangeValue(); |
963 | aCurSel->myTolerances.Decrement (aPrevSens); |
964 | aCurSel->myTolerances.Add (theNewSens); |
965 | aCurSel->myToUpdateTolerance = Standard_True; |
966 | } |
967 | } |
968 | } |
1d92133e |
969 | |
970 | //======================================================================= |
971 | //function : UpdateSelection |
972 | //purpose : |
973 | //======================================================================= |
974 | void SelectMgr_SelectionManager::UpdateSelection (const Handle(SelectMgr_SelectableObject)& theObject) |
975 | { |
976 | if (myGlobal.Contains (theObject)) |
977 | { |
978 | for (TColStd_MapIteratorOfMapOfTransient aSelectorsIter (mySelectors); aSelectorsIter.More(); aSelectorsIter.Next()) |
979 | { |
980 | Handle(SelectMgr_ViewerSelector) aSelector = Handle(SelectMgr_ViewerSelector)::DownCast (aSelectorsIter.Key()); |
981 | if (aSelector->Contains (theObject)) |
982 | { |
983 | aSelector->MoveSelectableObject (theObject); |
984 | } |
985 | } |
986 | } |
987 | |
988 | if (myLocal.IsBound (theObject)) |
989 | { |
990 | const SelectMgr_SequenceOfSelector& aSelectors = myLocal (theObject); |
991 | for (SelectMgr_SequenceOfSelector::Iterator aSelectorsIter (aSelectors); aSelectorsIter.More(); aSelectorsIter.Next()) |
992 | { |
993 | Handle(SelectMgr_ViewerSelector)& aSelector = aSelectorsIter.ChangeValue(); |
994 | if (aSelector->Contains (theObject)) |
995 | { |
996 | aSelector->MoveSelectableObject (theObject); |
997 | } |
998 | } |
999 | } |
1000 | } |