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