b311480e |
1 | // Created on: 1997-01-17 |
2 | // Created by: Robert COUBLANC |
3 | // Copyright (c) 1997-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. |
b311480e |
16 | |
7fd59977 |
17 | //Modified by ROB : Traque des UpdateConversion intempestifs. |
18 | |
42cf5bc1 |
19 | #include <AIS_DataMapIteratorOfDataMapOfSelStat.hxx> |
20 | #include <AIS_InteractiveContext.hxx> |
21 | #include <AIS_InteractiveObject.hxx> |
7fd59977 |
22 | #include <AIS_ListIteratorOfListOfInteractive.hxx> |
23 | #include <AIS_ListOfInteractive.hxx> |
42cf5bc1 |
24 | #include <AIS_LocalContext.hxx> |
25 | #include <AIS_LocalStatus.hxx> |
42cf5bc1 |
26 | #include <AIS_Shape.hxx> |
27 | #include <Aspect_TypeOfMarker.hxx> |
7fd59977 |
28 | #include <Graphic3d_Structure.hxx> |
29 | #include <Prs3d_LineAspect.hxx> |
30 | #include <Prs3d_PlaneAspect.hxx> |
31 | #include <Prs3d_PointAspect.hxx> |
32 | #include <Prs3d_Presentation.hxx> |
42cf5bc1 |
33 | #include <SelectMgr_CompositionFilter.hxx> |
34 | #include <SelectMgr_EntityOwner.hxx> |
35 | #include <SelectMgr_Filter.hxx> |
36 | #include <SelectMgr_OrFilter.hxx> |
37 | #include <SelectMgr_SelectableObject.hxx> |
38 | #include <SelectMgr_SelectionManager.hxx> |
39 | #include <Standard_Transient.hxx> |
40 | #include <Standard_Type.hxx> |
7fd59977 |
41 | #include <StdSelect_ShapeTypeFilter.hxx> |
f751596e |
42 | #include <StdSelect_ViewerSelector3d.hxx> |
42cf5bc1 |
43 | #include <TCollection_AsciiString.hxx> |
44 | #include <TColStd_ListIteratorOfListOfInteger.hxx> |
45 | #include <TopAbs_ShapeEnum.hxx> |
46 | #include <TopoDS_Shape.hxx> |
7fd59977 |
47 | #include <V3d_View.hxx> |
42cf5bc1 |
48 | #include <V3d_Viewer.hxx> |
7fd59977 |
49 | |
7fd59977 |
50 | #include <stdio.h> |
92efcf78 |
51 | IMPLEMENT_STANDARD_RTTIEXT(AIS_LocalContext,MMgt_TShared) |
52 | |
7fd59977 |
53 | //======================================================================= |
54 | //function : AIS_LocalContext |
55 | //purpose : |
56 | //======================================================================= |
57 | |
58 | |
59 | AIS_LocalContext::AIS_LocalContext(){} |
60 | |
61 | AIS_LocalContext::AIS_LocalContext(const Handle(AIS_InteractiveContext)& aCtx, |
62 | const Standard_Integer Index, |
63 | const Standard_Boolean LoadDisplayed, |
64 | const Standard_Boolean AcceptStandardModes, |
65 | const Standard_Boolean AcceptEraseOfTemp, |
35e08fe8 |
66 | const Standard_Boolean /*BothViewers*/): |
7fd59977 |
67 | myCTX(aCtx), |
68 | myLoadDisplayed(LoadDisplayed), |
69 | myAcceptStdMode(AcceptStandardModes), |
70 | myAcceptErase(AcceptEraseOfTemp), |
71 | mySM(aCtx->SelectionManager()), |
f751596e |
72 | myMainVS(aCtx->MainSelector()), |
7fd59977 |
73 | myFilters(new SelectMgr_OrFilter()), |
74 | myAutoHilight(Standard_True), |
b586500b |
75 | myMapOfOwner (new SelectMgr_IndexedMapOfOwner()), |
016e5959 |
76 | mySelection(new AIS_Selection()), |
7fd59977 |
77 | mylastindex(0), |
78 | mylastgood(0), |
d2094e11 |
79 | myCurDetected(0), |
80 | myAISCurDetected(0) |
81 | |
7fd59977 |
82 | { |
64e2d3bd |
83 | // bind self to AIS_InteractiveContext::myLocalContexts. Further, the |
84 | // constructor executes logic that implies that the context is already |
85 | // created and mapped. |
86 | aCtx->myLocalContexts.Bind (Index, this); |
87 | |
f751596e |
88 | myMainVS->ResetSelectionActivationStatus(); |
7fd59977 |
89 | myMainPM = aCtx->MainPrsMgr(); |
7fd59977 |
90 | |
91 | mySM->Add(myMainVS); |
92 | if(myLoadDisplayed) LoadContextObjects(); |
f751596e |
93 | Process(); |
7fd59977 |
94 | |
95 | } |
96 | |
97 | |
98 | //======================================================================= |
99 | //function : SetContext |
100 | //purpose : |
101 | //======================================================================= |
102 | |
103 | void AIS_LocalContext::SetContext(const Handle(AIS_InteractiveContext)& aCtx) |
104 | { myCTX = aCtx;} |
105 | |
106 | //======================================================================= |
107 | //function : Display |
108 | //purpose : |
109 | //======================================================================= |
110 | |
111 | Standard_Boolean AIS_LocalContext::Display(const Handle(AIS_InteractiveObject)& anInteractive, |
112 | const Standard_Integer WhichMode, |
113 | const Standard_Boolean AllowShapeDecomposition, |
114 | const Standard_Integer ActivationMode) |
115 | { |
116 | if(myActiveObjects.IsBound(anInteractive)){ |
117 | const Handle(AIS_LocalStatus)& STAT = myActiveObjects(anInteractive); |
118 | |
119 | if(STAT->DisplayMode() == -1){ |
120 | if(!myMainPM->IsDisplayed(anInteractive,WhichMode)) |
121 | myMainPM->Display(anInteractive,WhichMode); |
122 | if(STAT->IsTemporary()) |
123 | STAT->SetDisplayMode(WhichMode); |
124 | } |
125 | else if(STAT->DisplayMode()!=WhichMode && STAT->IsTemporary()){ |
126 | myMainPM->Erase(anInteractive,STAT->DisplayMode()); |
127 | STAT->SetDisplayMode(WhichMode); |
128 | if(!myMainPM->IsDisplayed(anInteractive,WhichMode)) |
129 | myMainPM->Display(anInteractive,WhichMode); |
130 | } |
131 | |
132 | if(ActivationMode!=-1){ |
133 | if(!STAT->IsActivated(ActivationMode)){ |
134 | STAT->ClearSelectionModes(); |
135 | mySM->Load(anInteractive,myMainVS); |
136 | STAT->AddSelectionMode(ActivationMode); |
137 | mySM->Activate(anInteractive,ActivationMode,myMainVS); |
138 | } |
139 | } |
140 | } |
141 | else { |
142 | Handle(AIS_LocalStatus) Att = new AIS_LocalStatus(); |
143 | |
144 | if(anInteractive->AcceptShapeDecomposition() && AllowShapeDecomposition) |
145 | Att->SetDecomposition(Standard_True); |
146 | else |
147 | Att->SetDecomposition(Standard_False); |
81bba717 |
148 | // status temporary or not |
7fd59977 |
149 | if(myCTX->DisplayStatus(anInteractive) == AIS_DS_None || |
150 | myCTX->DisplayStatus(anInteractive) == AIS_DS_Temporary) |
151 | Att->SetTemporary(Standard_True); |
152 | else |
153 | Att->SetTemporary(Standard_False); |
154 | |
155 | |
156 | |
157 | if(!myCTX->IsDisplayed(anInteractive,WhichMode)){ |
158 | |
159 | //storing information.... |
160 | Att->SetDisplayMode(WhichMode); |
161 | if (ActivationMode!=-1) |
162 | Att->AddSelectionMode(ActivationMode); |
163 | Standard_Integer HiMod = anInteractive->HasHilightMode()? anInteractive->HilightMode(): WhichMode; |
164 | Att->SetHilightMode(HiMod); |
165 | |
166 | if(!myMainPM->IsDisplayed(anInteractive,WhichMode)) |
167 | myMainPM->Display(anInteractive,WhichMode); |
168 | |
169 | if(ActivationMode!=-1){ |
170 | mySM->Load(anInteractive,myMainVS); |
171 | mySM->Activate(anInteractive,ActivationMode,myMainVS); |
172 | } |
173 | } |
174 | else{ |
175 | Standard_Integer HiMod = anInteractive->HasHilightMode()? anInteractive->HilightMode(): WhichMode; |
176 | Att->SetHilightMode(HiMod); |
177 | } |
178 | myActiveObjects.Bind(anInteractive,Att); |
179 | } |
180 | Process(anInteractive); |
181 | |
182 | |
183 | |
184 | |
185 | return Standard_True; |
186 | } |
187 | |
188 | //======================================================================= |
189 | //function : Load |
190 | //purpose : |
191 | //======================================================================= |
192 | |
193 | Standard_Boolean AIS_LocalContext:: |
194 | Load(const Handle(AIS_InteractiveObject)& anInteractive, |
195 | const Standard_Boolean AllowShapeDecomposition, |
196 | const Standard_Integer ActivationMode) |
197 | { |
f751596e |
198 | if (myActiveObjects.IsBound (anInteractive)) |
199 | { |
200 | if (anInteractive->HasSelection (ActivationMode)) |
201 | { |
202 | const Handle(SelectMgr_Selection)& aSel = anInteractive->Selection (ActivationMode); |
203 | if (aSel->GetSelectionState() != SelectMgr_SOS_Activated) |
204 | { |
205 | if (!myMainVS->Contains (anInteractive)) |
206 | { |
207 | mySM->Load (anInteractive, myMainVS); |
208 | } |
209 | mySM->Activate (anInteractive, ActivationMode, myMainVS); |
210 | return Standard_True; |
211 | } |
212 | } |
213 | return Standard_False; |
214 | } |
215 | |
7fd59977 |
216 | Handle(AIS_LocalStatus) Att = new AIS_LocalStatus(); |
217 | |
218 | if(anInteractive->AcceptShapeDecomposition() && AllowShapeDecomposition) |
219 | Att->SetDecomposition(Standard_True); |
220 | else |
221 | Att->SetDecomposition(Standard_False); |
222 | |
223 | if(!myCTX->IsDisplayed(anInteractive)) |
224 | Att->SetTemporary(Standard_True); |
225 | else |
226 | Att->SetTemporary(Standard_False); |
227 | Att->SetDisplayMode(-1); |
228 | |
229 | //storing information.... |
230 | if(ActivationMode!=-1) |
231 | Att->AddSelectionMode(ActivationMode); |
232 | Standard_Integer HiMod = anInteractive->HasHilightMode()? anInteractive->HilightMode():0; |
233 | Att->SetHilightMode(HiMod); |
234 | //Action |
235 | |
236 | mySM->Load(anInteractive,myMainVS); |
237 | if(ActivationMode != -1){ |
238 | mySM->Activate(anInteractive,ActivationMode,myMainVS); |
239 | } |
240 | myActiveObjects.Bind(anInteractive,Att); |
241 | Process(anInteractive); |
242 | return Standard_True; |
243 | } |
244 | |
245 | //======================================================================= |
246 | //function : ClearPrs |
247 | //purpose : |
248 | //======================================================================= |
249 | |
250 | Standard_Boolean AIS_LocalContext:: |
251 | ClearPrs(const Handle(AIS_InteractiveObject)& anInteractive, |
252 | const Standard_Integer aMode) |
253 | { |
254 | if(!myActiveObjects.IsBound(anInteractive)) |
255 | return Standard_False; |
256 | |
257 | Standard_Boolean jobdone(Standard_False); |
258 | const Handle(AIS_LocalStatus)& STAT = myActiveObjects(anInteractive); |
259 | |
260 | //Display step |
261 | if(STAT->IsSubIntensityOn()) { |
262 | STAT->SubIntensityOff(); |
263 | if(STAT->HilightMode()==aMode) |
264 | myMainPM->Unhighlight(anInteractive,STAT->HilightMode()); |
265 | } |
266 | myMainPM->Clear(anInteractive,aMode); // correction connexions 23/09/97 |
267 | jobdone = Standard_True; |
268 | if(STAT->DisplayMode()==aMode) |
269 | STAT->SetDisplayMode(-1); |
270 | return jobdone; |
271 | } |
272 | //======================================================================= |
273 | //function : Erase |
274 | //purpose : |
275 | //======================================================================= |
276 | |
277 | Standard_Boolean AIS_LocalContext:: |
278 | Erase(const Handle(AIS_InteractiveObject)& anInteractive) |
279 | { |
280 | if(!myActiveObjects.IsBound(anInteractive)) |
281 | return Standard_False; |
282 | const Handle(AIS_LocalStatus)& STAT = myActiveObjects(anInteractive); |
283 | |
284 | //Display step |
285 | if(STAT->IsSubIntensityOn()) { |
286 | STAT->SubIntensityOff(); |
287 | myMainPM->Unhighlight(anInteractive,STAT->HilightMode()); |
288 | } |
289 | |
290 | Standard_Boolean status(Standard_False); |
291 | |
292 | if(STAT->DisplayMode()!=-1) { |
293 | if(IsSelected(anInteractive)) |
294 | AddOrRemoveSelected(anInteractive); |
295 | if(myMainPM->IsHighlighted(anInteractive,STAT->HilightMode())) |
296 | myMainPM->Unhighlight(anInteractive,STAT->HilightMode()); |
eb4320f2 |
297 | myMainPM->SetVisibility (anInteractive, STAT->DisplayMode(), Standard_False); |
7fd59977 |
298 | STAT->SetDisplayMode(-1); |
299 | status = Standard_True; |
300 | } |
301 | if(STAT->IsTemporary()){ |
302 | if(myMainPM->IsDisplayed(anInteractive,STAT->HilightMode())) |
eb4320f2 |
303 | myMainPM->SetVisibility (anInteractive, STAT->HilightMode(), Standard_False); |
7fd59977 |
304 | } |
fb4b684a |
305 | |
306 | // Deactivate selectable entities of interactive object |
543a9964 |
307 | const Handle(SelectMgr_SelectableObject)& anObj = anInteractive; // to avoid ambiguity |
308 | if (mySM->Contains (anObj)) |
fb4b684a |
309 | { |
c3282ec1 |
310 | while (!STAT->SelectionModes().IsEmpty()) |
fb4b684a |
311 | { |
c3282ec1 |
312 | mySM->Deactivate (anInteractive, STAT->SelectionModes().Last(), myMainVS); |
313 | STAT->RemoveSelectionMode (STAT->SelectionModes().Last()); |
fb4b684a |
314 | } |
315 | } |
316 | |
bc677575 |
317 | ClearOutdatedSelection (anInteractive, Standard_True); |
fb4b684a |
318 | |
7fd59977 |
319 | return status; |
320 | } |
321 | |
322 | |
323 | //======================================================================= |
324 | //function : SetShapeDecomposition |
325 | //purpose : |
326 | //======================================================================= |
327 | |
328 | void AIS_LocalContext::SetShapeDecomposition(const Handle(AIS_InteractiveObject)& aStoredObject, |
329 | const Standard_Boolean aStatus) |
330 | { |
331 | if(!myActiveObjects.IsBound(aStoredObject)) return; |
332 | |
333 | if(aStatus == myActiveObjects(aStoredObject)->Decomposed()) |
334 | return; |
335 | |
336 | myActiveObjects(aStoredObject)->SetDecomposition(aStatus); |
337 | |
338 | Process(aStoredObject); |
339 | } |
340 | |
341 | //======================================================================= |
342 | //function : Clear |
343 | //purpose : |
344 | //======================================================================= |
345 | |
346 | void AIS_LocalContext::Clear(const AIS_ClearMode aType) |
347 | { |
348 | switch (aType){ |
349 | case AIS_CM_All: |
350 | { |
351 | ClearObjects(); |
352 | myFilters->Clear(); |
353 | while(!myListOfStandardMode.IsEmpty()) |
354 | DeactivateStandardMode(AIS_Shape::SelectionType(myListOfStandardMode.Last())); |
355 | break; |
356 | } |
357 | case AIS_CM_Interactive: |
358 | ClearObjects(); |
359 | break; |
360 | case AIS_CM_Filters: |
361 | myFilters->Clear(); |
362 | break; |
363 | case AIS_CM_StandardModes: |
364 | { |
365 | while(!myListOfStandardMode.IsEmpty()) |
366 | DeactivateStandardMode(AIS_Shape::SelectionType(myListOfStandardMode.Last())); |
367 | break; |
368 | } |
369 | case AIS_CM_TemporaryShapePrs: |
370 | ClearDetected(); |
371 | } |
7fd59977 |
372 | } |
373 | //======================================================================= |
374 | //function : ActivateMode |
375 | //purpose : |
376 | //======================================================================= |
377 | |
378 | void AIS_LocalContext::ActivateMode(const Handle(AIS_InteractiveObject)& aSelectable, |
379 | const Standard_Integer aMode) |
380 | { |
381 | if(!myActiveObjects.IsBound(aSelectable)) return; |
382 | // if(myActiveObjects(aSelectable)->SelectionMode()!=aMode) |
383 | // mySM->Deactivate(aSelectable,aMode,myMainVS); |
384 | if(aMode != -1){ |
385 | myActiveObjects(aSelectable)->AddSelectionMode(aMode); |
386 | mySM->Activate(aSelectable,aMode,myMainVS); |
387 | } |
7fd59977 |
388 | } |
389 | //======================================================================= |
390 | //function : ActivateMode |
391 | //purpose : |
392 | //======================================================================= |
393 | |
394 | void AIS_LocalContext::DeactivateMode(const Handle(AIS_InteractiveObject)& aSelectable, |
395 | const Standard_Integer aMode) |
396 | { |
397 | if(!myActiveObjects.IsBound(aSelectable)) return; |
398 | |
399 | if(aMode==-1) return; |
400 | |
401 | myActiveObjects(aSelectable)->RemoveSelectionMode(aMode); |
402 | mySM->Deactivate(aSelectable,aMode,myMainVS); |
7fd59977 |
403 | } |
404 | //======================================================================= |
405 | //function : ActivateMode |
406 | //purpose : |
407 | //======================================================================= |
408 | |
409 | void AIS_LocalContext::Deactivate(const Handle(AIS_InteractiveObject)& aSelectable) |
410 | { |
411 | if(!myActiveObjects.IsBound(aSelectable)) return; |
412 | |
f751596e |
413 | mySM->Deactivate(aSelectable, -1, myMainVS); |
7fd59977 |
414 | myActiveObjects(aSelectable)->ClearSelectionModes(); |
7fd59977 |
415 | } |
416 | |
417 | //======================================================================= |
418 | //function : Remove |
419 | //purpose : |
420 | //======================================================================= |
421 | |
422 | Standard_Boolean AIS_LocalContext::Remove(const Handle(AIS_InteractiveObject)& aSelectable) |
423 | { |
7fd6425d |
424 | if(!myActiveObjects.IsBound (aSelectable)) |
425 | { |
426 | return Standard_False; |
427 | } |
428 | |
429 | if (IsSelected (aSelectable)) |
430 | { |
431 | AddOrRemoveSelected (aSelectable, Standard_False); |
432 | } |
433 | |
434 | const Handle(AIS_LocalStatus)& Att = myActiveObjects (aSelectable); |
7fd59977 |
435 | |
7fd59977 |
436 | TColStd_ListIteratorOfListOfInteger It; |
7fd59977 |
437 | |
7fd6425d |
438 | // Deactivate standard modes |
439 | if (Att->Decomposed()) |
440 | { |
441 | for (It.Initialize (myListOfStandardMode); It.More(); It.Next()) |
442 | { |
443 | mySM->Deactivate (aSelectable, It.Value(), myMainVS); |
7fd59977 |
444 | } |
445 | } |
7fd6425d |
446 | |
447 | // If object or temporary presentations |
448 | if (Att->IsTemporary()) |
449 | { |
450 | if (Att->IsSubIntensityOn()) |
7fd59977 |
451 | { |
7fd6425d |
452 | myMainPM->Unhighlight (aSelectable, Att->HilightMode()); |
7fd59977 |
453 | } |
7fd6425d |
454 | |
455 | myMainPM->Erase (aSelectable, Att->DisplayMode()); |
456 | myMainPM->Clear (aSelectable, Att->DisplayMode()); |
457 | if (myMainPM->IsDisplayed (aSelectable, Att->HilightMode())) |
7fd59977 |
458 | { |
7fd6425d |
459 | myMainPM->Erase (aSelectable, Att->HilightMode()); |
7fd59977 |
460 | } |
7fd59977 |
461 | } |
7fd6425d |
462 | // If subintensity used |
463 | else if (Att->IsSubIntensityOn()) |
464 | { |
465 | myCTX->SubIntensityOff (aSelectable); |
466 | } |
7fd59977 |
467 | |
7fd6425d |
468 | // Deactivate stored selection modes |
469 | for (It.Initialize (Att->SelectionModes()); It.More(); It.Next()) |
470 | { |
471 | mySM->Deactivate (aSelectable, It.Value(), myMainVS); |
472 | } |
7fd59977 |
473 | |
fb4b684a |
474 | // Remove the interactive object from selection manager |
543a9964 |
475 | const Handle(SelectMgr_SelectableObject)& anObj = aSelectable; // to avoid ambiguity |
476 | if (mySM->Contains (anObj)) |
7fd59977 |
477 | { |
543a9964 |
478 | mySM->Remove (anObj); |
7fd59977 |
479 | } |
bc677575 |
480 | ClearOutdatedSelection (aSelectable, Standard_True); |
7fd59977 |
481 | |
7fd6425d |
482 | // This should be done at the very end because most methods use |
483 | // myActiveObjects even during clean-up |
484 | myActiveObjects.UnBind (aSelectable); |
7fd59977 |
485 | return Standard_True; |
486 | } |
487 | |
488 | //======================================================================= |
489 | //function : ActivateStandardMode |
490 | //purpose : |
491 | //======================================================================= |
492 | |
493 | void AIS_LocalContext::ActivateStandardMode(const TopAbs_ShapeEnum aType) |
494 | { |
495 | |
81bba717 |
496 | //check if it is not in the list |
7fd59977 |
497 | TColStd_ListIteratorOfListOfInteger It(myListOfStandardMode); |
498 | for(;It.More();It.Next()) |
499 | if(It.Value()==aType) return; |
500 | Standard_Integer IMode = AIS_Shape::SelectionMode(aType); |
501 | |
502 | |
81bba717 |
503 | // create a hidden filter answering ok to the type except for : |
504 | // if the type is shape... |
505 | // if the filters already impact at the type <aType> |
7fd59977 |
506 | if(aType != TopAbs_SHAPE){ |
507 | if(myStdFilters[IMode].IsNull()) |
508 | myStdFilters[IMode] = new StdSelect_ShapeTypeFilter(aType); |
509 | if(!HasFilters(aType)) |
510 | myFilters->Add(myStdFilters[IMode]); |
511 | } |
512 | |
81bba717 |
513 | // the mode is activated for all objects of type Shape |
514 | // accepting the decomposition in standard mode. |
7fd59977 |
515 | myListOfStandardMode.Append(IMode); |
516 | |
517 | AIS_DataMapIteratorOfDataMapOfSelStat ItM(myActiveObjects); |
518 | |
519 | for(;ItM.More();ItM.Next()){ |
7fd59977 |
520 | if(ItM.Value()->Decomposed()) |
7fd59977 |
521 | myCTX->SelectionManager()->Activate(ItM.Key(), |
522 | IMode, |
523 | myMainVS); |
325e442b |
524 | ItM.Value()->AddSelectionMode (IMode); |
7fd59977 |
525 | } |
526 | |
527 | } |
528 | |
529 | //======================================================================= |
530 | //function : DeActivateStandardMode |
531 | //purpose : |
532 | //======================================================================= |
533 | |
534 | void AIS_LocalContext::DeactivateStandardMode(const TopAbs_ShapeEnum aType) |
535 | { |
536 | TColStd_ListIteratorOfListOfInteger It(myListOfStandardMode); |
537 | Standard_Integer IMode = AIS_Shape::SelectionMode(aType); |
538 | for(;It.More();It.Next()) |
539 | if(It.Value()==IMode) { |
540 | AIS_DataMapIteratorOfDataMapOfSelStat ItM(myActiveObjects); |
541 | |
542 | for(;ItM.More();ItM.Next()){ |
543 | if(ItM.Value()->Decomposed()){ |
544 | myCTX->SelectionManager()->Deactivate(ItM.Key(), |
545 | IMode, |
546 | myMainVS); |
547 | ItM.Value()->RemoveSelectionMode(IMode); |
548 | } |
549 | } |
550 | myListOfStandardMode.Remove(It); |
551 | if(myFilters->IsIn(myStdFilters[IMode])) |
552 | myFilters->Remove(myStdFilters[IMode]); |
7fd59977 |
553 | return; |
554 | } |
7fd59977 |
555 | } |
556 | |
557 | //======================================================================= |
558 | //function : AddFilter |
559 | //purpose : |
560 | //======================================================================= |
561 | |
562 | void AIS_LocalContext::AddFilter(const Handle(SelectMgr_Filter)& aFilter) |
563 | { |
81bba717 |
564 | // it is checked if the filter impacts at the type of active sub-shape |
565 | // for which a filter of type has been already implemented... |
7fd59977 |
566 | |
567 | TColStd_ListIteratorOfListOfInteger It(myListOfStandardMode); |
568 | |
569 | for(;It.More();It.Next()){ |
570 | if(aFilter->ActsOn(AIS_Shape::SelectionType(It.Value()))) |
571 | if(myFilters->IsIn(myStdFilters[It.Value()])) |
572 | myFilters->Remove(myStdFilters[It.Value()]); |
573 | } |
574 | myFilters->Add(aFilter); |
575 | } |
576 | |
577 | //======================================================================= |
578 | //function : RemoveFilter |
579 | //purpose : |
580 | //======================================================================= |
581 | |
582 | void AIS_LocalContext::RemoveFilter(const Handle(SelectMgr_Filter)& aFilter) |
583 | { |
584 | if(myFilters->IsIn(aFilter)) myFilters->Remove(aFilter); |
585 | |
81bba717 |
586 | // it is checked if the filter for type standard is active. |
587 | // if yes, it is checked there are still similarities among the |
588 | // remaining filters... |
589 | // otherwise, the standard filter is restored to |
590 | // continu selecting active modes... |
7fd59977 |
591 | TColStd_ListIteratorOfListOfInteger It(myListOfStandardMode); |
592 | TopAbs_ShapeEnum SE; |
593 | for(;It.More();It.Next()){ |
594 | SE = AIS_Shape::SelectionType(It.Value()); |
595 | if(aFilter->ActsOn(SE)) |
596 | if(!HasFilters(SE)) |
597 | myFilters->Add(myStdFilters[It.Value()]); |
598 | } |
599 | } |
600 | |
7fd59977 |
601 | //======================================================================= |
602 | //function : Terminate |
679ecdee |
603 | //purpose : |
7fd59977 |
604 | //======================================================================= |
605 | |
679ecdee |
606 | void AIS_LocalContext::Terminate (const Standard_Boolean theToUpdate) |
7fd59977 |
607 | { |
608 | ClearDetected(); |
609 | Clear(); |
b586500b |
610 | myMapOfOwner->Clear(); |
7fd59977 |
611 | |
612 | mylastindex=0; |
81bba717 |
613 | // clear the selector... |
7fd59977 |
614 | myMainVS->Clear(); |
7fd59977 |
615 | |
7fd59977 |
616 | Handle(Standard_Transient) Tr; |
016e5959 |
617 | for (mySelection->Init(); mySelection->More(); mySelection->Next()){ |
618 | Tr = mySelection->Value(); |
c5f3a425 |
619 | Handle(SelectMgr_EntityOwner)::DownCast (Tr)->SetSelected (Standard_False); |
7fd59977 |
620 | } |
621 | |
016e5959 |
622 | mySelection->Select(); |
7fd59977 |
623 | |
679ecdee |
624 | Handle(V3d_View) aDummyView; |
679ecdee |
625 | myMainVS->ClearSensitive (aDummyView); |
7fd59977 |
626 | |
679ecdee |
627 | if (theToUpdate) |
628 | { |
629 | myCTX->UpdateCurrentViewer(); |
630 | } |
7fd59977 |
631 | } |
632 | |
633 | |
634 | //======================================================================= |
635 | //function : SubIntensity |
636 | //purpose : |
637 | //======================================================================= |
638 | |
639 | void AIS_LocalContext::SubIntensityOn(const Handle(AIS_InteractiveObject)& anObject) |
640 | { |
641 | if(!myActiveObjects.IsBound(anObject)) return; |
642 | |
643 | const Handle(AIS_LocalStatus)& Att = myActiveObjects(anObject); |
644 | |
645 | if(Att->IsTemporary()) |
646 | myMainPM->Color(anObject,myCTX->SubIntensityColor(),Att->DisplayMode()); |
647 | |
648 | Att->SubIntensityOn(); |
649 | } |
650 | //======================================================================= |
651 | //function : SubIntensity |
652 | //purpose : |
653 | //======================================================================= |
654 | |
655 | void AIS_LocalContext::SubIntensityOff(const Handle(AIS_InteractiveObject)& anObject) |
656 | { |
657 | if(!myActiveObjects.IsBound(anObject)) return; |
658 | |
659 | const Handle(AIS_LocalStatus)& Att = myActiveObjects(anObject); |
660 | |
661 | if(Att->IsTemporary()) |
662 | myMainPM->Unhighlight(anObject); |
663 | Att->SubIntensityOff(); |
664 | } |
665 | |
666 | |
667 | //======================================================================= |
668 | //function : Hilight |
669 | //purpose : |
670 | //======================================================================= |
671 | |
672 | void AIS_LocalContext::Hilight(const Handle(AIS_InteractiveObject)& anObject) |
673 | { |
674 | if(!myActiveObjects.IsBound(anObject)){ |
675 | Standard_Integer HiMod = anObject->HasHilightMode()? anObject->HilightMode() : 0; |
676 | Handle(AIS_LocalStatus) Att = new AIS_LocalStatus(Standard_True, |
677 | Standard_False, |
678 | -1,-1,HiMod); |
679 | myActiveObjects.Bind(anObject,Att); |
680 | |
681 | } |
682 | const Handle(AIS_LocalStatus)& Att = myActiveObjects(anObject); |
683 | myMainPM->Color(anObject,myCTX->HilightColor(),Att->HilightMode()); |
684 | Att->SubIntensityOn(); |
685 | } |
686 | //======================================================================= |
687 | //function : Hilight |
688 | //purpose : |
689 | //======================================================================= |
690 | |
691 | void AIS_LocalContext::Hilight(const Handle(AIS_InteractiveObject)& anObject, |
692 | const Quantity_NameOfColor Col) |
693 | { |
694 | if(!myActiveObjects.IsBound(anObject)){ |
695 | Standard_Integer HiMod = anObject->HasHilightMode()? anObject->HilightMode() : 0; |
696 | Handle(AIS_LocalStatus) Att = new AIS_LocalStatus(Standard_True, |
697 | Standard_False, |
698 | -1,-1,HiMod); |
699 | myActiveObjects.Bind(anObject,Att); |
700 | |
701 | } |
702 | const Handle(AIS_LocalStatus)& Att = myActiveObjects(anObject); |
703 | myMainPM->Color(anObject,Col,Att->HilightMode()); |
704 | Att->SubIntensityOn(); |
705 | Att->SetHilightColor(Col); |
706 | } |
707 | |
708 | //======================================================================= |
709 | //function : Unhilight |
710 | //purpose : |
711 | //======================================================================= |
712 | |
713 | void AIS_LocalContext::Unhilight(const Handle(AIS_InteractiveObject)& anObject) |
714 | { |
715 | if(!myActiveObjects.IsBound(anObject)) return; |
716 | |
81bba717 |
717 | // chieck if by hazard the object is somewhere else... |
7fd59977 |
718 | Standard_Integer Indx; |
719 | Standard_Boolean IsSomeWhereElse = |
720 | myCTX->IsInLocal(anObject,Indx) && Indx != myCTX->IndexOfCurrentLocal(); |
721 | |
722 | const Handle(AIS_LocalStatus)& Att = myActiveObjects(anObject); |
723 | myMainPM->Unhighlight(anObject,Att->HilightMode()); |
724 | if(Att->IsTemporary() && Att->DisplayMode()==-1) |
725 | if(!IsSomeWhereElse) |
eb4320f2 |
726 | myMainPM->SetVisibility (anObject, Att->HilightMode(), Standard_False); |
727 | |
7fd59977 |
728 | Att->SubIntensityOff(); |
729 | Att->SetHilightColor(Quantity_NOC_WHITE); |
730 | } |
731 | |
732 | |
733 | //======================================================================= |
734 | //function : IsIn |
735 | //purpose : |
736 | //======================================================================= |
737 | |
738 | Standard_Boolean AIS_LocalContext:: |
739 | IsIn(const Handle(AIS_InteractiveObject)& anObject) const |
740 | { |
741 | return myActiveObjects.IsBound(anObject); |
742 | } |
743 | |
744 | //======================================================================= |
745 | //function : IsHilighted |
746 | //purpose : |
747 | //======================================================================= |
748 | |
749 | Standard_Boolean AIS_LocalContext::IsHilighted(const Handle(AIS_InteractiveObject)& anObject) const |
750 | { |
751 | if(!myActiveObjects.IsBound(anObject)) return Standard_False; |
752 | return myActiveObjects(anObject)->IsSubIntensityOn(); |
753 | } |
754 | |
755 | Standard_Boolean AIS_LocalContext::IsHilighted(const Handle(AIS_InteractiveObject)& anObject, |
756 | Standard_Boolean& WithColor, |
757 | Quantity_NameOfColor& HiCol) const |
758 | { |
759 | if(!myActiveObjects.IsBound(anObject)) return Standard_False; |
760 | if( myActiveObjects(anObject)->IsSubIntensityOn()){ |
761 | HiCol = myActiveObjects(anObject)->HilightColor(); |
762 | if(HiCol==Quantity_NOC_WHITE) |
763 | WithColor = Standard_True; |
764 | else |
765 | WithColor = Standard_False; |
766 | return Standard_True; |
767 | } |
768 | return Standard_False; |
769 | } |
770 | |
771 | |
772 | void AIS_LocalContext::SetDisplayPriority(const Handle(AIS_InteractiveObject)& anObject, |
773 | const Standard_Integer Prior) |
774 | { |
775 | if(!myActiveObjects.IsBound(anObject)) return; |
776 | const Handle(AIS_LocalStatus)& STAT = myActiveObjects(anObject); |
777 | if(STAT->DisplayMode()==-1) return; |
778 | myMainPM->SetDisplayPriority(anObject,STAT->DisplayMode(),Prior); |
779 | if(STAT->IsSubIntensityOn()) |
780 | myMainPM->SetDisplayPriority(anObject,STAT->HilightMode(),Prior); |
781 | |
782 | |
783 | } |
784 | |
7fd59977 |
785 | //======================================================================= |
786 | //function : DisplayedObjects |
787 | //purpose : |
788 | //======================================================================= |
789 | Standard_Integer AIS_LocalContext::DisplayedObjects(TColStd_MapOfTransient& theMap) const |
790 | { |
791 | Standard_Integer NbDisp(0); |
792 | for(AIS_DataMapIteratorOfDataMapOfSelStat it(myActiveObjects);it.More();it.Next()){ |
793 | const Handle(SelectMgr_SelectableObject)& SO = it.Key(); |
794 | if(!theMap.Contains(SO)) |
795 | if(it.Value()->DisplayMode()!=-1){ |
796 | theMap.Add(SO); |
797 | NbDisp++; |
798 | } |
799 | } |
800 | return NbDisp; |
801 | } |
802 | |
803 | |
804 | //======================================================================= |
805 | //function : IsDisplayed |
806 | //purpose : |
807 | //======================================================================= |
808 | |
809 | Standard_Boolean AIS_LocalContext::IsDisplayed(const Handle(AIS_InteractiveObject)& anObject) const |
810 | { |
811 | if(!myActiveObjects.IsBound(anObject)) return Standard_False; |
812 | return (myActiveObjects(anObject)->DisplayMode()!=-1); |
813 | } |
814 | |
815 | //======================================================================= |
816 | //function : IsDisplayed |
817 | //purpose : |
818 | //======================================================================= |
819 | |
820 | Standard_Boolean AIS_LocalContext::IsDisplayed(const Handle(AIS_InteractiveObject)& anObject, |
821 | const Standard_Integer aMode) const |
822 | { |
823 | if(!myActiveObjects.IsBound(anObject)) return Standard_False; |
824 | return (myActiveObjects(anObject)->DisplayMode()==aMode); |
825 | } |
826 | |
827 | //======================================================================= |
828 | //function : SelectionModes |
829 | //purpose : |
830 | //======================================================================= |
831 | |
832 | const TColStd_ListOfInteger& AIS_LocalContext:: |
833 | SelectionModes(const Handle(AIS_InteractiveObject)& anObject) const |
834 | { |
835 | return myActiveObjects(anObject)->SelectionModes(); |
836 | } |
837 | |
838 | //======================================================================= |
839 | //function : Status |
840 | //purpose : |
841 | //======================================================================= |
842 | |
843 | TCollection_AsciiString AIS_LocalContext::Status() const |
844 | { |
845 | TCollection_AsciiString t; |
846 | return t; |
847 | } |
848 | |
849 | const Handle(AIS_LocalStatus)& AIS_LocalContext::Status(const Handle(AIS_InteractiveObject)& anObject) const |
850 | { |
851 | return myActiveObjects(anObject); |
852 | } |
853 | |
854 | //======================================================================= |
855 | //function : LoadContextObjects |
856 | //purpose : |
857 | //======================================================================= |
858 | |
859 | void AIS_LocalContext::LoadContextObjects() |
860 | { |
861 | AIS_ListIteratorOfListOfInteractive It; |
862 | if(myLoadDisplayed) { |
863 | AIS_ListOfInteractive LL; |
864 | myCTX->DisplayedObjects(LL,Standard_True); |
865 | Handle(AIS_LocalStatus) Att; |
866 | for (It.Initialize(LL);It.More();It.Next()){ |
f751596e |
867 | const Handle(AIS_InteractiveObject)& anObj = It.Value(); |
7fd59977 |
868 | Att= new AIS_LocalStatus(); |
f751596e |
869 | Att->SetDecomposition((anObj->AcceptShapeDecomposition() && myAcceptStdMode)); |
7fd59977 |
870 | Att->SetTemporary(Standard_False); |
f751596e |
871 | Att->SetHilightMode(anObj->HasHilightMode()? anObj->HilightMode(): 0); |
872 | for (anObj->Init(); anObj->More(); anObj->Next()) |
873 | { |
874 | const Handle(SelectMgr_Selection)& aSel = anObj->CurrentSelection(); |
875 | aSel->SetSelectionState (SelectMgr_SOS_Deactivated); |
876 | } |
877 | myActiveObjects.Bind(anObj,Att); |
7fd59977 |
878 | } |
879 | } |
880 | } |
881 | |
882 | void AIS_LocalContext::UnloadContextObjects() |
883 | { |
884 | AIS_ListIteratorOfListOfInteractive It; |
885 | if(myLoadDisplayed) |
886 | { |
887 | AIS_ListOfInteractive LL; |
888 | myCTX->DisplayedObjects(LL,Standard_True); |
889 | |
890 | for (It.Initialize(LL);It.More();It.Next()) |
891 | { |
892 | myActiveObjects.UnBind(It.Value()); |
893 | } |
894 | } |
895 | } |
896 | //======================================================================= |
897 | //function : Process |
898 | //purpose : |
899 | //======================================================================= |
900 | |
f751596e |
901 | void AIS_LocalContext::Process(const Handle(SelectMgr_SelectableObject)& anObject) |
7fd59977 |
902 | { |
903 | if(!myActiveObjects.IsBound(anObject)) return; |
904 | if(myActiveObjects(anObject)->Decomposed()) |
f751596e |
905 | ActivateStandardModes(anObject); |
7fd59977 |
906 | else |
907 | { |
908 | TColStd_ListIteratorOfListOfInteger It(myActiveObjects(anObject)->SelectionModes()); |
909 | for(;It.More();It.Next()) |
f751596e |
910 | myCTX->SelectionManager()->Activate(anObject,It.Value(),myMainVS); |
7fd59977 |
911 | } |
912 | } |
913 | |
914 | //======================================================================= |
915 | //function : Process |
916 | //purpose : |
917 | //======================================================================= |
918 | |
f751596e |
919 | void AIS_LocalContext::Process() |
7fd59977 |
920 | { |
921 | |
922 | myMainVS->Clear(); |
923 | |
924 | AIS_DataMapIteratorOfDataMapOfSelStat It(myActiveObjects); |
925 | |
926 | for(;It.More();It.Next()){ |
927 | myCTX->SelectionManager()->Load(It.Key(),myMainVS); |
928 | if(It.Value()->Decomposed()) |
f751596e |
929 | ActivateStandardModes(It.Key()); |
7fd59977 |
930 | else if( myCTX->GetAutoActivateSelection() ) |
931 | { |
932 | It.Value()->AddSelectionMode(0); |
f751596e |
933 | myCTX->SelectionManager()->Activate(It.Key(),0,myMainVS); |
7fd59977 |
934 | } |
935 | } |
936 | |
937 | } |
938 | |
939 | //======================================================================= |
940 | //function : ActivateModes |
941 | //purpose : |
942 | //======================================================================= |
943 | |
f751596e |
944 | void AIS_LocalContext::ActivateStandardModes(const Handle(SelectMgr_SelectableObject)& anObject) |
7fd59977 |
945 | { |
946 | if(!myActiveObjects.IsBound(anObject)) return; |
947 | |
948 | TColStd_ListIteratorOfListOfInteger itl (myListOfStandardMode); |
949 | |
950 | const Handle(AIS_LocalStatus)& LS = myActiveObjects(anObject); |
951 | if(LS->Decomposed()){ |
952 | for(;itl.More();itl.Next()){ |
f751596e |
953 | myCTX->SelectionManager()->Activate(anObject,itl.Value(),myMainVS); |
7fd59977 |
954 | LS->AddSelectionMode(itl.Value()); |
955 | } |
956 | } |
957 | } |
958 | |
959 | |
960 | //======================================================================= |
961 | //function : ClearObjects |
962 | //purpose : |
963 | //======================================================================= |
964 | |
965 | void AIS_LocalContext::ClearObjects() |
966 | { |
967 | AIS_DataMapIteratorOfDataMapOfSelStat It(myActiveObjects); |
968 | for(;It.More();It.Next()) |
969 | { |
970 | Handle(AIS_InteractiveObject) SO = |
971 | Handle(AIS_InteractiveObject)::DownCast(It.Key()); |
972 | |
973 | const Handle(AIS_LocalStatus)& CurAtt = It.Value(); |
974 | //TColStd_ListIteratorOfListOfInteger ItL; |
81bba717 |
975 | // if object is temporary the presentations managed by myMainPM are removed |
7fd59977 |
976 | AIS_DisplayStatus TheDS = myCTX->DisplayStatus(SO); |
977 | |
978 | if(TheDS != AIS_DS_Displayed){ |
979 | if(myMainPM->IsDisplayed(SO,CurAtt->DisplayMode())){ |
980 | if(CurAtt->IsSubIntensityOn()&& |
981 | myMainPM->IsHighlighted(SO,CurAtt->HilightMode())) |
982 | myMainPM->Unhighlight(SO,CurAtt->HilightMode()); |
983 | myMainPM->Erase(SO,CurAtt->DisplayMode()); |
984 | } |
985 | |
986 | if(CurAtt->IsTemporary()){ |
987 | myMainPM->Erase(SO,CurAtt->DisplayMode());} |
988 | // myMainPM->Clear(SO,CurAtt->DisplayMode());} |
989 | } |
990 | else { |
a9dde4a3 |
991 | if (CurAtt->IsSubIntensityOn()) |
992 | { |
993 | myCTX->SubIntensityOff(SO); |
994 | } |
7fd59977 |
995 | Standard_Integer DiMo = SO->HasDisplayMode()? |
996 | SO->DisplayMode():myCTX->DisplayMode(); |
997 | if(CurAtt->DisplayMode()!=-1 && |
998 | CurAtt->DisplayMode()!= DiMo) |
999 | myMainPM->Erase(SO,CurAtt->DisplayMode()); |
1000 | } |
1001 | |
f751596e |
1002 | TColStd_ListIteratorOfListOfInteger aSelModeIter (CurAtt->SelectionModes()); |
1003 | for ( ; aSelModeIter.More(); aSelModeIter.Next()) |
1004 | { |
1005 | Standard_Integer aSelMode = aSelModeIter.Value(); |
1006 | mySM->Deactivate (SO, aSelMode, myMainVS); |
1007 | } |
1008 | |
7fd59977 |
1009 | } |
1010 | ClearSelected( Standard_False ); |
b3c433fe |
1011 | |
1012 | // Clear selection structures for temporary objects, created in local context |
1013 | for (AIS_DataMapIteratorOfDataMapOfSelStat anIter (myActiveObjects); anIter.More(); anIter.Next()) |
1014 | { |
1015 | if (anIter.Value()->IsTemporary()) |
1016 | { |
1017 | mySM->Remove (anIter.Key(), myMainVS); |
1018 | } |
1019 | } |
1020 | |
7fd59977 |
1021 | myActiveObjects.Clear(); |
7fd59977 |
1022 | } |
1023 | |
1024 | |
1025 | Standard_Boolean AIS_LocalContext::IsDecompositionOn() const |
1026 | {return !myListOfStandardMode.IsEmpty();} |
1027 | |
1028 | |
1029 | |
1030 | |
1031 | //======================================================================= |
1032 | //function : HasAlreadyFilters |
1033 | //purpose : |
1034 | //======================================================================= |
1035 | |
1036 | Standard_Boolean AIS_LocalContext:: |
1037 | HasFilters(const TopAbs_ShapeEnum aType) const |
1038 | { |
1039 | return myFilters->ActsOn(aType); |
1040 | } |
1041 | |
1042 | void AIS_LocalContext::ClearDetected() |
1043 | { |
b586500b |
1044 | for(Standard_Integer I=1;I<=myMapOfOwner->Extent();I++) |
eb4320f2 |
1045 | { |
b586500b |
1046 | if(!myMapOfOwner->FindKey (I).IsNull()) |
eb4320f2 |
1047 | { |
b586500b |
1048 | if(myMapOfOwner->FindKey (I)->IsHilighted(myMainPM)) |
1049 | myMapOfOwner->FindKey (I)->Unhilight(myMainPM); |
eb4320f2 |
1050 | else |
1051 | { |
1052 | const Handle(SelectMgr_SelectableObject)& SO = |
b586500b |
1053 | myMapOfOwner->FindKey (I)->Selectable(); |
eb4320f2 |
1054 | if(myActiveObjects.IsBound(SO)) |
1055 | { |
1056 | const Handle(AIS_LocalStatus)& Att = myActiveObjects(SO); |
1057 | |
1058 | if(Att->IsTemporary() && |
1059 | Att->DisplayMode()==-1 && |
1060 | Att->SelectionModes().IsEmpty()) |
1061 | { |
b586500b |
1062 | myMapOfOwner->FindKey (I)->Clear(myMainPM); |
eb4320f2 |
1063 | } |
1064 | } |
7fd59977 |
1065 | } |
1066 | } |
1067 | } |
7fd59977 |
1068 | } |
1069 | |
7fd59977 |
1070 | //======================================================================= |
679ecdee |
1071 | //function : BeginImmediateDraw |
1072 | //purpose : |
7fd59977 |
1073 | //======================================================================= |
679ecdee |
1074 | Standard_Boolean AIS_LocalContext::BeginImmediateDraw() |
7fd59977 |
1075 | { |
679ecdee |
1076 | if (myMainPM->IsImmediateModeOn()) |
1077 | { |
1078 | myMainPM->BeginImmediateDraw(); |
7fd59977 |
1079 | return Standard_True; |
1080 | } |
1081 | return Standard_False; |
1082 | } |
1083 | |
679ecdee |
1084 | //======================================================================= |
1085 | //function : ImmediateAdd |
1086 | //purpose : |
1087 | //======================================================================= |
1088 | Standard_Boolean AIS_LocalContext::ImmediateAdd (const Handle(AIS_InteractiveObject)& theObj, |
1089 | const Standard_Integer theMode) |
7fd59977 |
1090 | { |
679ecdee |
1091 | if (!myMainPM->IsImmediateModeOn()) |
1092 | { |
7fd59977 |
1093 | return Standard_False; |
679ecdee |
1094 | } |
1095 | |
af324faa |
1096 | myMainPM->AddToImmediateList (myMainPM->Presentation (theObj, theMode)->Presentation()); |
7fd59977 |
1097 | return Standard_True; |
1098 | } |
1099 | |
679ecdee |
1100 | //======================================================================= |
1101 | //function : EndImmediateDraw |
1102 | //purpose : |
1103 | //======================================================================= |
c3282ec1 |
1104 | Standard_Boolean AIS_LocalContext::EndImmediateDraw (const Handle(V3d_Viewer)& theViewer) |
7fd59977 |
1105 | { |
679ecdee |
1106 | if (!myMainPM->IsImmediateModeOn()) |
1107 | { |
1108 | return Standard_False; |
1109 | } |
1110 | |
c3282ec1 |
1111 | myMainPM->EndImmediateDraw (theViewer); |
7fd59977 |
1112 | return Standard_True; |
1113 | } |
1114 | |
679ecdee |
1115 | // ======================================================================= |
1116 | // function : ClearImmediateDraw |
1117 | // purpose : |
1118 | // ======================================================================= |
1119 | void AIS_LocalContext::ClearImmediateDraw() |
7fd59977 |
1120 | { |
679ecdee |
1121 | myMainPM->ClearImmediateDraw(); |
7fd59977 |
1122 | } |
1123 | |
679ecdee |
1124 | //======================================================================= |
1125 | //function : IsImmediateModeOn |
1126 | //purpose : |
1127 | //======================================================================= |
7fd59977 |
1128 | Standard_Boolean AIS_LocalContext::IsImmediateModeOn() const |
679ecdee |
1129 | { |
1130 | return myMainPM->IsImmediateModeOn(); |
1131 | } |
7fd59977 |
1132 | |
3bf9a45f |
1133 | void AIS_LocalContext::SetPixelTolerance(const Standard_Integer aPrecision) { |
3c982548 |
1134 | |
1135 | myMainVS->SetPixelTolerance(aPrecision); |
1136 | } |
1137 | |
3bf9a45f |
1138 | Standard_Integer AIS_LocalContext::PixelTolerance() const { |
3c982548 |
1139 | |
1140 | return myMainVS->PixelTolerance(); |
7fd59977 |
1141 | } |
8a1170ad |
1142 | |
1143 | //======================================================================= |
1144 | //function : SetSelectionSensitivity |
1145 | //purpose : Allows to manage sensitivity of a particular selection of interactive object theObject |
1146 | //======================================================================= |
1147 | void AIS_LocalContext::SetSelectionSensitivity (const Handle(AIS_InteractiveObject)& theObject, |
1148 | const Standard_Integer theMode, |
1149 | const Standard_Integer theNewSensitivity) |
1150 | { |
1151 | mySM->SetSelectionSensitivity (theObject, theMode, theNewSensitivity); |
1152 | } |