0026477: Porting PRODUCTS and OCCT QT samples for OCCT 7.0.0
[occt.git] / src / AIS / AIS_InteractiveContext_1.cxx
CommitLineData
b311480e 1// Created on: 1997-01-29
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.
7fd59977 16
7fd59977 17
18#include <AIS_DataMapIteratorOfDataMapOfIOStatus.hxx>
7fd59977 19#include <AIS_GlobalStatus.hxx>
42cf5bc1 20#include <AIS_InteractiveContext.hxx>
21#include <AIS_InteractiveObject.hxx>
22#include <AIS_LocalContext.hxx>
23#include <AIS_MapIteratorOfMapOfInteractive.hxx>
24#include <AIS_MapOfInteractive.hxx>
25#include <AIS_Selection.hxx>
7fd59977 26#include <AIS_Shape.hxx>
42cf5bc1 27#include <AIS_StatusOfDetection.hxx>
28#include <AIS_StatusOfPick.hxx>
679ecdee 29#include <Aspect_Grid.hxx>
42cf5bc1 30#include <Prs3d_BasicAspect.hxx>
31#include <Prs3d_LineAspect.hxx>
32#include <Prs3d_Presentation.hxx>
33#include <Quantity_Color.hxx>
34#include <SelectBasics_SensitiveEntity.hxx>
35#include <SelectMgr_EntityOwner.hxx>
36#include <SelectMgr_Filter.hxx>
37#include <SelectMgr_OrFilter.hxx>
38#include <SelectMgr_Selection.hxx>
39#include <SelectMgr_SelectionManager.hxx>
40#include <Standard_Transient.hxx>
41#include <StdSelect_ViewerSelector3d.hxx>
42#include <TCollection_AsciiString.hxx>
43#include <TCollection_ExtendedString.hxx>
44#include <TColStd_ListIteratorOfListOfInteger.hxx>
45#include <TopLoc_Location.hxx>
46#include <TopoDS_Shape.hxx>
47#include <V3d_AmbientLight.hxx>
48#include <V3d_DirectionalLight.hxx>
7fd59977 49#include <V3d_Light.hxx>
50#include <V3d_PositionalLight.hxx>
51#include <V3d_SpotLight.hxx>
42cf5bc1 52#include <V3d_View.hxx>
53#include <V3d_Viewer.hxx>
a272ed94 54#include <Visual3d_View.hxx>
7fd59977 55
7fd59977 56//=======================================================================
57//function : MoveTo
679ecdee 58//purpose :
7fd59977 59//=======================================================================
679ecdee 60AIS_StatusOfDetection AIS_InteractiveContext::MoveTo (const Standard_Integer theXPix,
61 const Standard_Integer theYPix,
62 const Handle(V3d_View)& theView,
63 const Standard_Boolean theToRedrawOnUpdate)
7fd59977 64{
679ecdee 65 if (HasOpenedContext())
66 {
7fd59977 67 myWasLastMain = Standard_True;
679ecdee 68 return myLocalContexts (myCurLocalIndex)->MoveTo (theXPix, theYPix, theView, theToRedrawOnUpdate);
7fd59977 69 }
70
7fd59977 71 myAISCurDetected = 0;
72 myAISDetectedSeq.Clear();
7fd59977 73
679ecdee 74 if (theView->Viewer() != myMainVwr)
75 {
7fd59977 76 return AIS_SOD_Error;
679ecdee 77 }
78
79 // preliminaires
80 myLastPicked = myLastinMain;
81 myWasLastMain = Standard_True;
82 AIS_StatusOfDetection aStatus = AIS_SOD_Nothing;
83 Standard_Boolean toUpdateViewer = Standard_False;
84
a272ed94 85 myFilters->SetDisabledObjects (theView->View()->HiddenObjects());
679ecdee 86 myMainSel->Pick (theXPix, theYPix, theView);
87
88 // filling of myAISDetectedSeq sequence storing information about detected AIS objects
89 // (the objects must be AIS_Shapes)
90 const Standard_Integer aDetectedNb = myMainSel->NbPicked();
54a16ee4 91 Standard_Integer aNewDetected = 0;
679ecdee 92 for (Standard_Integer aDetIter = 1; aDetIter <= aDetectedNb; ++aDetIter)
7fd59977 93 {
679ecdee 94 Handle(SelectMgr_EntityOwner) anOwner = myMainSel->Picked (aDetIter);
95 if (anOwner.IsNull()
96 || !myFilters->IsOk (anOwner))
97 {
98 continue;
99 }
100
54a16ee4 101 if (aNewDetected < 1)
102 {
103 aNewDetected = aDetIter;
104 }
679ecdee 105 Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
57ad5cbd 106 if (!anObj.IsNull())
679ecdee 107 {
108 myAISDetectedSeq.Append (anObj);
109 }
7fd59977 110 }
7fd59977 111
54a16ee4 112 if (aNewDetected >= 1)
7fd59977 113 {
679ecdee 114 // does nothing if previously detected object is equal to the current one
54a16ee4 115 Handle(SelectMgr_EntityOwner) aNewPickedOwner = myMainSel->Picked (aNewDetected);
116 if (aNewPickedOwner->Selectable() == myLastPicked)
eafb234b 117 {
8abada55 118 return myLastPicked->State() == 1
119 ? AIS_SOD_Selected
120 : AIS_SOD_OnlyOneDetected;
679ecdee 121 }
81bba717 122
7fd59977 123 // Previously detected object is unhilighted if it is not selected or hilighted
124 // with selection color if it is selected. Such highlighting with selection color
125 // is needed only if myToHilightSelected flag is true. In this case previously detected
126 // object has been already highlighted with myHilightColor during previous MoveTo()
127 // method call. As result it is necessary to rehighligt it with mySelectionColor.
be6e564e 128 if (!myLastPicked.IsNull())
7fd59977 129 {
679ecdee 130 const Standard_Integer aHiMod = myLastPicked->HasHilightMode() ? myLastPicked->HilightMode() : 0;
be6e564e 131 if (myLastPicked->State() != 1)
7fd59977 132 {
679ecdee 133 myMainPM->Unhighlight (myLastPicked, aHiMod);
134 toUpdateViewer = Standard_True;
7fd59977 135 }
be6e564e 136 else if (myToHilightSelected)
7fd59977 137 {
679ecdee 138 myMainPM->Color (myLastPicked, mySelectionColor, aHiMod);
139 toUpdateViewer = Standard_True;
7fd59977 140 }
141 }
be6e564e 142
679ecdee 143 // initialize myLastPicked field with currently detected object
54a16ee4 144 myLastPicked = Handle(AIS_InteractiveObject)::DownCast (aNewPickedOwner->Selectable());
679ecdee 145 myLastinMain = myLastPicked;
be6e564e 146
679ecdee 147 // highlight detected object if it is not selected or myToHilightSelected flag is true
148 if (!myLastPicked.IsNull())
7fd59977 149 {
679ecdee 150 if (myLastPicked->State() != 1 || myToHilightSelected)
151 {
152 const Standard_Integer aHiMod = myLastPicked->HasHilightMode() ? myLastPicked->HilightMode() : 0;
153 myMainPM->Color (myLastPicked, myHilightColor, aHiMod);
154 toUpdateViewer = Standard_True;
155 }
be6e564e 156
8abada55 157 aStatus = myLastPicked->State() == 1
158 ? AIS_SOD_Selected
159 : AIS_SOD_OnlyOneDetected;
be6e564e 160 }
7fd59977 161 }
162 else
163 {
679ecdee 164 // previously detected object is unhilighted if it is not selected or hilighted
165 // with selection color if it is selected
166 aStatus = AIS_SOD_Nothing;
be6e564e 167 if (!myLastPicked.IsNull())
7fd59977 168 {
be6e564e 169 Standard_Integer aHiMod = myLastPicked->HasHilightMode() ? myLastPicked->HilightMode() : 0;
170 if (myLastPicked->State() != 1)
7fd59977 171 {
679ecdee 172 myMainPM->Unhighlight (myLastPicked, aHiMod);
173 toUpdateViewer = Standard_True;
7fd59977 174 }
be6e564e 175 else if (myToHilightSelected)
7fd59977 176 {
679ecdee 177 myMainPM->Color (myLastPicked, mySelectionColor, aHiMod);
178 toUpdateViewer = Standard_True;
7fd59977 179 }
180 }
be6e564e 181
679ecdee 182 myLastinMain.Nullify();
8abada55 183 myLastPicked.Nullify();
7fd59977 184 }
679ecdee 185
186 if (toUpdateViewer)
187 {
188 if (theToRedrawOnUpdate)
189 {
190 theView->Viewer()->Update();
191 }
192 else
193 {
194 theView->Viewer()->Invalidate();
195 }
196 }
197
679ecdee 198 mylastmoveview = theView;
199 return aStatus;
7fd59977 200}
201
202//=======================================================================
203//function : Select
204//purpose :
205//=======================================================================
c398b00e 206AIS_StatusOfPick AIS_InteractiveContext::Select (const Standard_Integer theXPMin,
207 const Standard_Integer theYPMin,
208 const Standard_Integer theXPMax,
209 const Standard_Integer theYPMax,
210 const Handle(V3d_View)& theView,
211 const Standard_Boolean toUpdateViewer)
7fd59977 212{
81bba717 213 // all objects detected by the selector are taken, previous current objects are emptied,
214 // new objects are put...
7fd59977 215
c398b00e 216 if (HasOpenedContext())
217 {
218 return myLocalContexts(myCurLocalIndex)->Select (theXPMin, theYPMin,
219 theXPMax, theYPMax,
220 theView, toUpdateViewer);
221 }
7fd59977 222
c398b00e 223 ClearCurrents (Standard_False);
eb4320f2 224
c398b00e 225 Handle(StdSelect_ViewerSelector3d) aSelector;
7fd59977 226
c398b00e 227 if (theView->Viewer() == myMainVwr)
7fd59977 228 {
c398b00e 229 aSelector = myMainSel;
230 myWasLastMain = Standard_True;
7fd59977 231 }
c398b00e 232
233 aSelector->Pick (theXPMin, theYPMin, theXPMax, theYPMax, theView);
234 AIS_Selection::SetCurrentSelection (myCurrentName.ToCString());
235
236 AIS_MapOfInteractive anObjectsToSelect;
237 for (aSelector->Init(); aSelector->More(); aSelector->Next())
7fd59977 238 {
c398b00e 239 Handle(AIS_InteractiveObject) anObj =
240 Handle(AIS_InteractiveObject)::DownCast (aSelector->Picked()->Selectable());
241 if (!anObj.IsNull())
242 {
243 anObjectsToSelect.Add (anObj);
7fd59977 244 }
245 }
246
c398b00e 247 AIS_MapIteratorOfMapOfInteractive anIt (anObjectsToSelect);
248 for ( ; anIt.More(); anIt.Next())
249 {
250 AIS_Selection::Select (anIt.Key());
251 anIt.Key()->State (1);
252 }
253
254 HilightCurrents (toUpdateViewer);
255
256 Standard_Integer aSelNum = NbCurrents();
257
258 return (aSelNum == 0) ? AIS_SOP_NothingSelected
259 : (aSelNum == 1) ? AIS_SOP_OneSelected
260 : AIS_SOP_SeveralSelected;
7fd59977 261
262}
263
264//=======================================================================
265//function : Select
266//purpose : Selection by polyline
267//=======================================================================
c398b00e 268AIS_StatusOfPick AIS_InteractiveContext::Select (const TColgp_Array1OfPnt2d& thePolyline,
269 const Handle(V3d_View)& theView,
270 const Standard_Boolean toUpdateViewer)
7fd59977 271{
81bba717 272 // all objects detected by the selector are taken, previous current objects are emptied,
273 // new objects are put...
7fd59977 274
c398b00e 275 if (HasOpenedContext())
276 {
277 return myLocalContexts(myCurLocalIndex)->Select (thePolyline, theView, toUpdateViewer);
278 }
eb4320f2 279
c398b00e 280 ClearCurrents (Standard_False);
7fd59977 281
c398b00e 282 Handle(StdSelect_ViewerSelector3d) aSelector;
7fd59977 283
c398b00e 284 if (theView->Viewer() == myMainVwr)
7fd59977 285 {
c398b00e 286 aSelector = myMainSel;
287 myWasLastMain = Standard_True;
7fd59977 288 }
c398b00e 289
290 aSelector->Pick (thePolyline, theView);
291 AIS_Selection::SetCurrentSelection (myCurrentName.ToCString());
292
293 AIS_MapOfInteractive anObjectsToSelect;
294 for (aSelector->Init(); aSelector->More(); aSelector->Next())
7fd59977 295 {
c398b00e 296 Handle(AIS_InteractiveObject) anObj =
297 Handle( AIS_InteractiveObject )::DownCast (aSelector->Picked()->Selectable());
298 if (!anObj.IsNull())
299 {
300 anObjectsToSelect.Add (anObj);
7fd59977 301 }
302 }
c398b00e 303
304 AIS_MapIteratorOfMapOfInteractive anIt (anObjectsToSelect);
305 for ( ; anIt.More(); anIt.Next())
306 {
307 AIS_Selection::Select (anIt.Key());
308 anIt.Key()->State (1);
309 }
310
311 HilightCurrents (toUpdateViewer);
312
313 Standard_Integer aSelNum = NbCurrents();
314
315 return (aSelNum == 0) ? AIS_SOP_NothingSelected
316 : (aSelNum == 1) ? AIS_SOP_OneSelected
317 : AIS_SOP_SeveralSelected;
7fd59977 318
319}
320
321//=======================================================================
322//function : Select
323//purpose :
324//=======================================================================
c398b00e 325AIS_StatusOfPick AIS_InteractiveContext::Select (const Standard_Boolean toUpdateViewer)
7fd59977 326{
c398b00e 327 if (HasOpenedContext())
328 {
7fd59977 329 if(myWasLastMain)
c398b00e 330 {
331 return myLocalContexts(myCurLocalIndex)->Select (toUpdateViewer);
332 }
7fd59977 333 else
c398b00e 334 {
335 myLocalContexts(myCurLocalIndex)->SetSelected (myLastPicked, toUpdateViewer);
336 return AIS_SOP_OneSelected;
337 }
338 }
339
340 if (myWasLastMain && !myLastinMain.IsNull())
341 {
342 if(myLastinMain->State() != 1)
343 {
344 SetCurrentObject (myLastinMain,Standard_False);
345 if(toUpdateViewer)
7fd59977 346 {
c398b00e 347 UpdateCurrentViewer();
7fd59977 348 }
c398b00e 349 }
7fd59977 350 }
c398b00e 351 else
352 {
353 AIS_Selection::SetCurrentSelection (myCurrentName.ToCString());
354 Handle(AIS_Selection) aSelection = AIS_Selection::CurrentSelection();
355 Handle(AIS_InteractiveObject) anObj;
356 for (aSelection->Init(); aSelection->More(); aSelection->Next())
357 {
358 anObj = Handle(AIS_InteractiveObject)::DownCast (aSelection->Value());
359 anObj->State (0);
360 Unhilight (anObj,Standard_False);
361 if (myObjects.IsBound (anObj) && myObjects(anObj)->IsSubIntensityOn())
362 {
363 HilightWithColor (anObj, mySubIntensity, Standard_False);
7fd59977 364 }
365 }
c398b00e 366
7fd59977 367 AIS_Selection::Select();
c398b00e 368 if (toUpdateViewer && myWasLastMain)
369 {
eb4320f2 370 UpdateCurrentViewer();
7fd59977 371 }
372 }
c398b00e 373
374 Standard_Integer aSelNum = NbCurrents();
375
376 return (aSelNum == 0) ? AIS_SOP_NothingSelected
377 : (aSelNum == 1) ? AIS_SOP_OneSelected
378 : AIS_SOP_SeveralSelected;
7fd59977 379}
380
381//=======================================================================
382//function : ShiftSelect
383//purpose :
384//=======================================================================
c398b00e 385AIS_StatusOfPick AIS_InteractiveContext::ShiftSelect (const Standard_Boolean toUpdateViewer)
7fd59977 386{
c398b00e 387 if (HasOpenedContext())
388 {
7fd59977 389 if(myWasLastMain)
c398b00e 390 {
391 return myLocalContexts (myCurLocalIndex)->ShiftSelect (toUpdateViewer);
392 }
393 else
394 {
395 myLocalContexts (myCurLocalIndex)->AddOrRemoveSelected (myLastPicked, toUpdateViewer);
396
397 Standard_Integer aSelNum = NbSelected();
398 return (aSelNum == 0) ? AIS_SOP_NothingSelected
399 : (aSelNum == 1) ? AIS_SOP_OneSelected
400 : AIS_SOP_SeveralSelected;
7fd59977 401 }
402 }
eb4320f2 403
c398b00e 404 if (myWasLastMain && !myLastinMain.IsNull())
405 {
406 AddOrRemoveCurrentObject (myLastinMain, toUpdateViewer);
407 }
7fd59977 408
c398b00e 409 Standard_Integer aCurrentSelNum = NbCurrents();
410
411 return (aCurrentSelNum == 0) ? AIS_SOP_NothingSelected
412 : (aCurrentSelNum == 1) ? AIS_SOP_OneSelected
413 : AIS_SOP_SeveralSelected;
414}
7fd59977 415
416//=======================================================================
417//function : ShiftSelect
418//purpose :
419//=======================================================================
c398b00e 420AIS_StatusOfPick AIS_InteractiveContext::ShiftSelect (const Standard_Integer theXPMin,
421 const Standard_Integer theYPMin,
422 const Standard_Integer theXPMax,
423 const Standard_Integer theYPMax,
424 const Handle(V3d_View)& theView,
425 const Standard_Boolean toUpdateViewer)
7fd59977 426{
c398b00e 427 if (HasOpenedContext())
428 {
429 return myLocalContexts(myCurLocalIndex)->ShiftSelect (theXPMin, theYPMin, theXPMax, theYPMax,
430 theView, toUpdateViewer);
431 }
432
433 UnhilightCurrents (Standard_False);
434
435 Handle(StdSelect_ViewerSelector3d) aSelector;
436 if (theView->Viewer() == myMainVwr)
437 {
438 aSelector = myMainSel;
439 myWasLastMain = Standard_True;
440 }
7fd59977 441 else
c398b00e 442 {
7fd59977 443 return AIS_SOP_NothingSelected;
c398b00e 444 }
445
446 aSelector->Pick (theXPMin, theYPMin, theXPMax, theYPMax, theView);
447 AIS_Selection::SetCurrentSelection (myCurrentName.ToCString());
448 for (aSelector->Init(); aSelector->More(); aSelector->Next())
449 {
450 Handle(AIS_InteractiveObject) anObjToSelect = Handle(AIS_InteractiveObject)::DownCast (aSelector->Picked()->Selectable());
451 if (!anObjToSelect.IsNull())
452 {
453 AIS_SelectStatus aSelStatus = AIS_Selection::Select (anObjToSelect);
454 Standard_Integer aState = (aSelStatus == AIS_SS_Added) ? 1 : 0;
455 anObjToSelect->State (aState);
7fd59977 456 }
457 }
c398b00e 458
459 HilightCurrents (toUpdateViewer);
460
461 Standard_Integer aSelNum = NbCurrents();
462
463 return (aSelNum == 0) ? AIS_SOP_NothingSelected
464 : (aSelNum == 1) ? AIS_SOP_OneSelected
465 : AIS_SOP_SeveralSelected;
466
7fd59977 467}
468
469//=======================================================================
470//function : ShiftSelect
471//purpose :
472//=======================================================================
c398b00e 473AIS_StatusOfPick AIS_InteractiveContext::ShiftSelect (const TColgp_Array1OfPnt2d& thePolyline,
474 const Handle(V3d_View)& theView,
475 const Standard_Boolean toUpdateViewer)
7fd59977 476{
c398b00e 477 if (HasOpenedContext())
478 {
479 return myLocalContexts(myCurLocalIndex)->ShiftSelect (thePolyline, theView, toUpdateViewer);
480 }
7fd59977 481
c398b00e 482 UnhilightCurrents (Standard_False);
483
484 Handle(StdSelect_ViewerSelector3d) aSelector;
485
486 if (theView->Viewer() == myMainVwr)
487 {
488 aSelector= myMainSel;
489 myWasLastMain = Standard_True;
490 }
491 else
492 {
493 return AIS_SOP_NothingSelected;
494 }
495
496 aSelector->Pick (thePolyline, theView);
497
498 AIS_Selection::SetCurrentSelection (myCurrentName.ToCString());
499 for (aSelector->Init(); aSelector->More(); aSelector->Next())
500 {
501 Handle(AIS_InteractiveObject) anObjToSelect = Handle(AIS_InteractiveObject)::DownCast (aSelector->Picked()->Selectable());
502 if (!anObjToSelect.IsNull())
503 {
504 AIS_SelectStatus aSelStatus = AIS_Selection::Select (anObjToSelect);
505 Standard_Integer aState = (aSelStatus == AIS_SS_Added ) ? 1 : 0;
506 anObjToSelect->State (aState);
7fd59977 507 }
c398b00e 508 }
509
510 HilightCurrents (toUpdateViewer);
511
512 Standard_Integer aSelNum = NbCurrents();
513
514 return (aSelNum == 0) ? AIS_SOP_NothingSelected
515 : (aSelNum == 1) ? AIS_SOP_OneSelected
516 : AIS_SOP_SeveralSelected;
7fd59977 517}
518
519//=======================================================================
520//function : SetCurrentObject
521//purpose :
522//=======================================================================
7fd59977 523void AIS_InteractiveContext::SetCurrentObject(const Handle(AIS_InteractiveObject)& anIObj,
524 const Standard_Boolean updateviewer)
525{
81bba717 526 // single case processing...
7fd59977 527 if(NbCurrents()==1 && anIObj->State()==1){
528 Quantity_NameOfColor HiCol;
529 Standard_Boolean HasHiCol;
530 if(IsHilighted(anIObj,HasHiCol,HiCol)){
531 if(HasHiCol && HiCol!= mySelectionColor) {
7fd59977 532 HilightWithColor(anIObj,mySelectionColor,updateviewer);
7fd59977 533 }
534 }
535 return;
536 }
537
538
539 //
540 if(!HasOpenedContext()) {
541 if(anIObj.IsNull()) return;
542 if(!myObjects.IsBound(anIObj))
543 Display(anIObj,Standard_False);
544
545 AIS_Selection::SetCurrentSelection(myCurrentName.ToCString());
546 Handle(AIS_Selection) sel = AIS_Selection::Selection(myCurrentName.ToCString());
547 Handle(Standard_Transient) TR;
548 Handle(AIS_InteractiveObject) IO;
549 sel->Init();
550 while (sel->More()) {
551 TR = sel->Value();
c5f3a425 552 IO = Handle(AIS_InteractiveObject)::DownCast (TR);
7fd59977 553 Unhilight(IO,Standard_False);
554 IO->State(0);
555 sel->Next();
556 }
557
81bba717 558 // added to avoid untimely viewer update...
7fd59977 559 AIS_Selection::ClearAndSelect(anIObj);
560 anIObj->State(1);
561 Quantity_NameOfColor HiCol;
562 Standard_Boolean HasHiCol;
563 if(IsHilighted(anIObj,HasHiCol,HiCol)){
564 if(HasHiCol && HiCol!= mySelectionColor) {
7fd59977 565 HilightWithColor(anIObj,mySelectionColor,Standard_False);
7fd59977 566 }
567 }
568 else{
7fd59977 569 HilightWithColor(anIObj,mySelectionColor,Standard_False);
7fd59977 570 }
571 if (updateviewer)
572 UpdateCurrentViewer();
573 }
574 else{
0797d9d3 575#ifdef OCCT_DEBUG
7fd59977 576 cout<<"Nothing Done : Opened Local Context"<<endl;
577#endif
578 }
579}
580
581//=======================================================================
582//function : AddOrRemoveCurrentObject
583//purpose :
584//=======================================================================
585
586void AIS_InteractiveContext::
587AddOrRemoveCurrentObject(const Handle(AIS_InteractiveObject)& anIObj,
588 const Standard_Boolean updateviewer)
589{
590 if(anIObj.IsNull()) return;
591//OCC5682 to remove an object from neutral point even if Local Context is opened (Remove method)
592 if(!HasOpenedContext() /*OCC5682*/|| myObjects.IsBound(anIObj)) {
593
594 AIS_Selection::SetCurrentSelection(myCurrentName.ToCString());
595 Handle(AIS_Selection) sel = AIS_Selection::Selection(myCurrentName.ToCString());
596
597 AIS_SelectStatus SelStat = AIS_Selection::Select(anIObj);
598
599 Standard_Integer mod = (SelStat==AIS_SS_Added) ? 1 : 0;
600 anIObj->State(mod);
601 if(mod==1)
7fd59977 602 HilightWithColor(anIObj,mySelectionColor,Standard_False);
7fd59977 603 else
604 Unhilight(anIObj,Standard_False);
605
606
607 if(updateviewer)
608 UpdateCurrentViewer();
609 }
610 else{
0797d9d3 611#ifdef OCCT_DEBUG
7fd59977 612 cout<<"Nothing Done : Opened Local Context"<<endl;
613#endif
614 }
615}
616//=======================================================================
617//function : UpdateCurrent
618//purpose :
619//=======================================================================
620
621void AIS_InteractiveContext::UpdateCurrent()
622{
623 HilightCurrents();
624}
625
626//=======================================================================
627//function : IsCurrent
628//purpose :
629//=======================================================================
630
631Standard_Boolean AIS_InteractiveContext::IsCurrent(const Handle(AIS_InteractiveObject)& anIObj) const
632{
633
634 if (anIObj.IsNull()) return Standard_False;
635 return (anIObj->State()==1);
636
637 // Handle(AIS_Selection) sel = AIS_Selection::Selection(myCurrentName.ToCString());
638 // sel->Init();
639 // while (sel->More()) {
640 // if (anIObj == sel->Value()) return Standard_True;
641 // sel->Next();
642 // }
643 // return Standard_False;
644
645}
646
647//=======================================================================
648//function : InitCurrent
649//purpose :
650//=======================================================================
651
652void AIS_InteractiveContext::InitCurrent()
653{
654 AIS_Selection::Selection(myCurrentName.ToCString())->Init();
655}
656
657//=======================================================================
658//function : MoreCurrent
659//purpose :
660//=======================================================================
661
662Standard_Boolean AIS_InteractiveContext::MoreCurrent() const
663{
664 return AIS_Selection::Selection(myCurrentName.ToCString())->More();
665
666}
667
668//=======================================================================
669//function : NextCurrent
670//purpose :
671//=======================================================================
672
673void AIS_InteractiveContext::NextCurrent()
674{
675 AIS_Selection::Selection(myCurrentName.ToCString())->Next();
676}
677
678//=======================================================================
679//function : Current
680//purpose :
681//=======================================================================
682
683Handle(AIS_InteractiveObject) AIS_InteractiveContext::Current() const
684{
685 Handle(Standard_Transient) TR = AIS_Selection::Selection(myCurrentName.ToCString())->Value();
c5f3a425 686 Handle(AIS_InteractiveObject) IO = Handle(AIS_InteractiveObject)::DownCast (TR);
7fd59977 687 return IO;
688}
689
690//=======================================================================
691//function : FirstCurrentObject
692//purpose :
693//=======================================================================
694Handle(AIS_InteractiveObject) AIS_InteractiveContext::FirstCurrentObject()
695{
696 Handle(AIS_InteractiveObject) IO ;
697 InitCurrent();
698 if(MoreCurrent()){
699 return Current();
700 }
701 return IO;
702}
703
704//=======================================================================
705//function : NbCurrents
706//purpose :
707//=======================================================================
708Standard_Integer AIS_InteractiveContext::NbCurrents()
709{
710 Standard_Integer i(0);
711 for(InitCurrent();MoreCurrent();NextCurrent())
712 {i++;}
713 return i;
714}
715
716//=======================================================================
717//function : HilightCurrents
718//purpose :
719//=======================================================================
720void AIS_InteractiveContext::HilightCurrents(const Standard_Boolean updateviewer)
721{
722 AIS_Selection::SetCurrentSelection(myCurrentName.ToCString());
723 Handle(AIS_Selection) sel = AIS_Selection::Selection(myCurrentName.ToCString());
724 Handle(Standard_Transient) TR;
725 Handle(AIS_InteractiveObject) IO;
726 sel->Init();
727 while (sel->More()) {
728 TR = sel->Value();
c5f3a425 729 IO = Handle(AIS_InteractiveObject)::DownCast (TR);
7fd59977 730 HilightWithColor(IO,mySelectionColor,Standard_False);
7fd59977 731 sel->Next();
732 }
733 if(updateviewer)
734 UpdateCurrentViewer();
735}
736
737//=======================================================================
738//function : UnhilightCurrents
739//purpose :
740//=======================================================================
741
742void AIS_InteractiveContext::UnhilightCurrents(const Standard_Boolean updateviewer)
743{
744 AIS_Selection::SetCurrentSelection(myCurrentName.ToCString());
745 Handle(AIS_Selection) sel = AIS_Selection::Selection(myCurrentName.ToCString());
746 Handle(Standard_Transient) TR;
747 Handle(AIS_InteractiveObject) IO;
748 sel->Init();
749 while (sel->More()) {
750 TR = sel->Value();
c5f3a425 751 IO = Handle(AIS_InteractiveObject)::DownCast (TR);
7fd59977 752 Unhilight(IO,Standard_False);
753 sel->Next();
754 }
755 if(updateviewer)
756 UpdateCurrentViewer();
757}
758
759//=======================================================================
760//function : ClearCurrents
761//purpose :
762//=======================================================================
763
764void AIS_InteractiveContext::ClearCurrents(const Standard_Boolean updateviewer)
765{
766 if(NbCurrents()==0) return;
767 AIS_Selection::SetCurrentSelection(myCurrentName.ToCString());
768 Handle(AIS_Selection) S = AIS_Selection::CurrentSelection();
769 Handle(Standard_Transient) Tr;
770 Handle(AIS_InteractiveObject) IO;
771 for(S->Init();S->More();S->Next()){
772 Tr = S->Value();
c5f3a425 773 IO = Handle(AIS_InteractiveObject)::DownCast (Tr);
7fd59977 774 IO->State(0);
775 Unhilight(IO,Standard_False);
776 }
777 AIS_Selection::Select();
778 if(updateviewer)
779 UpdateCurrentViewer();
780}
781
782
783//=======================================================================
784//function : HilightSelected
785//purpose :
786//=======================================================================
787
788void AIS_InteractiveContext::HilightSelected(const Standard_Boolean updateviewer)
789{
790 if(!HasOpenedContext()){
791 AIS_Selection::SetCurrentSelection(mySelectionName.ToCString());
792 Handle(AIS_Selection) sel = AIS_Selection::Selection(myCurrentName.ToCString());
793 Handle(Standard_Transient) TR;
794 Handle(AIS_InteractiveObject) IO;
795 sel->Init();
796 while (sel->More()) {
797 TR = sel->Value();
c5f3a425 798 IO = Handle(AIS_InteractiveObject)::DownCast (TR);
7fd59977 799 HilightWithColor(IO,mySelectionColor,Standard_False);
7fd59977 800 sel->Next();
801 }
802 }
803 else
804 {
805 myLocalContexts(myCurLocalIndex)->HilightPicked(updateviewer);
806 }
807 if(updateviewer)
808 UpdateCurrentViewer();
809}
810
811//=======================================================================
812//function : UnhilightSelected
813//purpose :
814//=======================================================================
815
816void AIS_InteractiveContext::UnhilightSelected(const Standard_Boolean updateviewer)
817{
818 if(!HasOpenedContext()){
819 AIS_Selection::SetCurrentSelection(mySelectionName.ToCString());
820 Handle(AIS_Selection) sel = AIS_Selection::Selection(myCurrentName.ToCString());
821 Handle(Standard_Transient) TR;
822 Handle(AIS_InteractiveObject) IO;
823 sel->Init();
824 while (sel->More()) {
825 TR = sel->Value();
c5f3a425 826 IO = Handle(AIS_InteractiveObject)::DownCast (TR);
7fd59977 827 Unhilight(IO,Standard_False);
828 sel->Next();
829 }
830 if(updateviewer)
831 UpdateCurrentViewer();
832 }
833 else
834 {
835 myLocalContexts(myCurLocalIndex)->UnhilightPicked(updateviewer);
836 }
837}
838
839
840//=======================================================================
841//function : ClearSelected
842//purpose :
843//=======================================================================
844
845void AIS_InteractiveContext::ClearSelected(const Standard_Boolean updateviewer)
846{
847 if(!HasOpenedContext())
848 ClearCurrents(updateviewer);
849 else
850 myLocalContexts(myCurLocalIndex)->ClearSelected(updateviewer);
851
852}
853
854
855//=======================================================================
856//function : SetSelectedCurrent
857//purpose :
858//=======================================================================
859
860void AIS_InteractiveContext::SetSelectedCurrent()
861{
862
863
0797d9d3 864#ifdef OCCT_DEBUG
7fd59977 865 cout<<"Not Yet Implemented"<<endl;
866#endif
867}
868
869//=======================================================================
870//function : UpdateSelection
871//purpose :
872//=======================================================================
873
874void AIS_InteractiveContext::UpdateSelected(const Standard_Boolean updateviewer)
875{
876 if(!HasOpenedContext()) {
877 HilightSelected();
878#ifndef BUG
879 return;
880#endif
881 }
882 myLocalContexts(myCurLocalIndex)->UpdateSelected(updateviewer);
883}
884
885//=======================================================================
886//function : SetCurrentObject
887//purpose :
888//=======================================================================
889void AIS_InteractiveContext::SetSelected(const Handle(AIS_InteractiveObject)& anIObj,const Standard_Boolean updateviewer)
890{
891 if(!HasOpenedContext())
892 SetCurrentObject(anIObj,updateviewer);
893 else
894 myLocalContexts(myCurLocalIndex)->SetSelected(anIObj,updateviewer);
895}
896
897//=======================================================================
898//function : AddOrRemoveSelected
899//purpose :
900//=======================================================================
901
902void AIS_InteractiveContext::AddOrRemoveSelected(const Handle(AIS_InteractiveObject)& anIObj,
903 const Standard_Boolean updateviewer)
904{
905 if(!anIObj->HasInteractiveContext()) anIObj->SetContext(this);
906 if(!HasOpenedContext())
907 AddOrRemoveCurrentObject(anIObj,updateviewer);
908 else
909 myLocalContexts(myCurLocalIndex)->AddOrRemoveSelected(anIObj,updateviewer);
910
911}
912//=======================================================================
913//function : AddOrRemoveSelected
914//purpose :
915//=======================================================================
916
917void AIS_InteractiveContext::AddOrRemoveSelected(const TopoDS_Shape& aShap,
918 const Standard_Boolean updateviewer)
919{
920 if(!HasOpenedContext()) {
0797d9d3 921#ifdef OCCT_DEBUG
7fd59977 922 cout<<" Attempt to remove a selected shape with no opened local context"<<endl;
923#endif
924 return;
925 }
926
927 myLocalContexts(myCurLocalIndex)->AddOrRemoveSelected(aShap,updateviewer);
928 if(updateviewer) UpdateCurrentViewer();
929
930}
931//=======================================================================
932//function : AddOrRemoveSelected
933//purpose :
934//=======================================================================
935
936void AIS_InteractiveContext::AddOrRemoveSelected(const Handle(SelectMgr_EntityOwner)& Own,
937 const Standard_Boolean updateviewer)
938{
939 if(!HasOpenedContext()) {
0797d9d3 940#ifdef OCCT_DEBUG
7fd59977 941 cout<<" Attempt to remove a selected ownr with no opened local context"<<endl;
942#endif
943 return;
944 }
945
946 myLocalContexts(myCurLocalIndex)->AddOrRemoveSelected(Own,Standard_False);
947 if(updateviewer) UpdateCurrentViewer();
948
949}
950
951
952
953//=======================================================================
954//function : IsSelected
955//purpose :
956//=======================================================================
957
958Standard_Boolean AIS_InteractiveContext::
959IsSelected(const Handle(AIS_InteractiveObject)& anIObj) const
960{
961 if (anIObj.IsNull()) return Standard_False;
962
963 if(!HasOpenedContext())
964 return (anIObj->State()==1);
965 else
966 return myLocalContexts(myCurLocalIndex)->IsSelected(anIObj);
967}
968
969
970//=======================================================================
971//function : InitSelected
972//purpose :
973//=======================================================================
974
975void AIS_InteractiveContext::InitSelected()
976{
977 if(!HasOpenedContext())
978 AIS_Selection::Selection(myCurrentName.ToCString())->Init();
979 else
980 myLocalContexts(myCurLocalIndex)->InitSelected();
981}
982
983//=======================================================================
984//function : MoreSelected
985//purpose :
986//=======================================================================
987
988Standard_Boolean AIS_InteractiveContext::MoreSelected() const
989{
990 if(!HasOpenedContext())
991 return AIS_Selection::Selection(myCurrentName.ToCString())->More();
992 return myLocalContexts(myCurLocalIndex)->MoreSelected();
993}
994
995//=======================================================================
996//function : NextSelected
997//purpose :
998//=======================================================================
999
1000void AIS_InteractiveContext::NextSelected()
1001{
1002 if(!HasOpenedContext())
1003 AIS_Selection::Selection(myCurrentName.ToCString())->Next();
1004 else
1005 myLocalContexts(myCurLocalIndex)->NextSelected();
1006}
1007
1008//=======================================================================
1009//function : HasSelectedShape
1010//purpose :
1011//=======================================================================
1012
1013Standard_Boolean AIS_InteractiveContext::HasSelectedShape() const
1014{
1015 if(!HasOpenedContext()) {
7fd59977 1016 Handle(AIS_Shape) shape =
1017 Handle(AIS_Shape)::DownCast(SelectedInteractive());
1018 if( !shape.IsNull() ) return Standard_True;
7fd59977 1019 return Standard_False;
1020 }
51023771 1021 return myLocalContexts(myCurLocalIndex)->HasSelectedShape();
7fd59977 1022}
1023
1024//=======================================================================
1025//function : SelectedShape
1026//purpose :
1027//=======================================================================
1028
1029TopoDS_Shape AIS_InteractiveContext::SelectedShape() const
1030{
0717ddc1 1031 if (!HasOpenedContext())
1032 {
d8110103 1033 TopoDS_Shape aResShape;
1034 Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast (SelectedInteractive());
1035 if (!aShape.IsNull())
1036 {
51023771 1037 TopLoc_Location aLocTrsf = SelectedInteractive()->Transformation().Form() == gp_Identity ?
1038 TopLoc_Location() : TopLoc_Location (SelectedInteractive()->Transformation());
1039 aResShape = aShape->Shape().Located (aLocTrsf * aShape->Shape().Location());
d8110103 1040 }
1041
1042 return aResShape;
0717ddc1 1043 }
1044 else
1045 {
1046 return myLocalContexts (myCurLocalIndex)->SelectedShape();
1047 }
7fd59977 1048}
1049
1050//=======================================================================
1051//function : Interactive
1052//purpose :
1053//=======================================================================
1054
1055Handle(AIS_InteractiveObject) AIS_InteractiveContext::Interactive() const
1056{
1057 return SelectedInteractive();
1058}
1059
1060Handle(AIS_InteractiveObject) AIS_InteractiveContext::SelectedInteractive() const
1061{
1062 if(!HasOpenedContext()){
51023771 1063 if (AIS_Selection::Selection(myCurrentName.ToCString())->Extent() == 0)
1064 return NULL;
7fd59977 1065 Handle(Standard_Transient) TR =AIS_Selection::Selection(myCurrentName.ToCString())->Value();
c5f3a425 1066 Handle(AIS_InteractiveObject) IO = Handle(AIS_InteractiveObject)::DownCast (TR);
7fd59977 1067 return IO;}
1068
1069 return myLocalContexts(myCurLocalIndex)->SelectedInteractive();
1070
1071}
1072//=======================================================================
1073//function : Interactive
1074//purpose :
1075//=======================================================================
1076
1077Handle(SelectMgr_EntityOwner) AIS_InteractiveContext::SelectedOwner() const
1078{
1079 if(!HasOpenedContext()){
1080 Handle(SelectMgr_EntityOwner) Ownr;
1081 return Ownr;
1082 }
1083 return myLocalContexts(myCurLocalIndex)->SelectedOwner();
1084
1085}
1086
1087//=======================================================================
1088//function : EntityOwners
1089//purpose :
1090//=======================================================================
b586500b 1091void AIS_InteractiveContext::EntityOwners(Handle(SelectMgr_IndexedMapOfOwner)& theOwners,
7fd59977 1092 const Handle(AIS_InteractiveObject)& theIObj,
1093 const Standard_Integer theMode) const
1094{
1095 if ( theIObj.IsNull() )
1096 return;
1097
1098 TColStd_ListOfInteger aModes;
1099 if ( theMode == -1 )
1100 ActivatedModes( theIObj, aModes );
1101 else
1102 aModes.Append( theMode );
1103
b586500b 1104 if (theOwners.IsNull())
1105 theOwners = new SelectMgr_IndexedMapOfOwner();
1106
7fd59977 1107 TColStd_ListIteratorOfListOfInteger anItr( aModes );
1108 for (; anItr.More(); anItr.Next() )
1109 {
1110 int aMode = anItr.Value();
1111 if ( !theIObj->HasSelection( aMode ) )
1112 continue;
1113
f751596e 1114 Handle(SelectMgr_Selection) aSel = theIObj->Selection(aMode);
7fd59977 1115
1116 for ( aSel->Init(); aSel->More(); aSel->Next() )
1117 {
f751596e 1118 Handle(SelectBasics_SensitiveEntity) aEntity = aSel->Sensitive()->BaseSensitive();
7fd59977 1119 if ( aEntity.IsNull() )
1120 continue;
1121
1122 Handle(SelectMgr_EntityOwner) aOwner =
1123 Handle(SelectMgr_EntityOwner)::DownCast(aEntity->OwnerId());
1124 if ( !aOwner.IsNull() )
b586500b 1125 theOwners->Add( aOwner );
7fd59977 1126 }
1127 }
1128}
1129
1130Standard_Integer AIS_InteractiveContext::NbSelected()
1131{
1132 Standard_Integer i(0);
1133 for(InitSelected();MoreSelected();NextSelected())
1134 {i++;}
1135 return i;
1136}
1137
1138//=======================================================================
1139//function : HasApplicative
1140//purpose :
1141//=======================================================================
1142
1143 Standard_Boolean AIS_InteractiveContext::HasApplicative() const
1144{
1145 return Interactive()->HasOwner();
1146}
1147
1148//=======================================================================
1149//function : Applicative
1150//purpose :
1151//=======================================================================
1152
1153Handle(Standard_Transient) AIS_InteractiveContext::Applicative() const
1154{
1155 return Interactive()->GetOwner();
1156}
1157
1158
1159
1160//==================================================
1161// Function:
1162// Purpose :
1163//==================================================
1164Standard_Boolean AIS_InteractiveContext::HasDetected() const
1165{
1166 if(HasOpenedContext())
1167 return myLocalContexts(myCurLocalIndex)->HasDetected();
1168 else
1169 return !myLastPicked.IsNull();
1170}
1171
1172//=======================================================================
1173//function : HasDetectedShape
1174//purpose :
1175//=======================================================================
1176
1177Standard_Boolean AIS_InteractiveContext::HasDetectedShape() const
1178{
1179 if(HasOpenedContext())
1180 return myLocalContexts(myCurLocalIndex)->HasDetectedShape();
1181 return Standard_False;
1182}
1183
1184//=======================================================================
1185//function : DetectedShape
1186//purpose :
1187//=======================================================================
1188
1189const TopoDS_Shape&
1190AIS_InteractiveContext::DetectedShape() const
1191{
1192 return myLocalContexts(myCurLocalIndex)->DetectedShape();
1193}
1194
1195//=======================================================================
1196//function : DetectedInteractive
1197//purpose :
1198//=======================================================================
1199
1200Handle(AIS_InteractiveObject)
1201AIS_InteractiveContext::DetectedInteractive() const
1202{
1203 if(HasOpenedContext())
1204 return myLocalContexts(myCurLocalIndex)->DetectedInteractive();
1205 return myLastPicked;
1206}
1207
1208
1209Standard_Boolean AIS_InteractiveContext::HasNextDetected() const
1210{
1211 if(!HasOpenedContext())
1212 return Standard_False; // temporaire
1213 else
1214 return myLocalContexts(myCurLocalIndex)->HasNextDetected();
1215
1216}
1217
1218
1219//=======================================================================
1220//function : DetectedOwner
1221//purpose :
1222//=======================================================================
1223Handle(SelectMgr_EntityOwner) AIS_InteractiveContext::DetectedOwner() const
1224{
1225 if(HasOpenedContext())
1226 return myLocalContexts(myCurLocalIndex)->DetectedOwner();
1227 Handle(SelectMgr_EntityOwner) Ownr;
1228 return Ownr;
1229}
1230
1231
1232//=======================================================================
1233//function : HilightNextDetected
679ecdee 1234//purpose :
7fd59977 1235//=======================================================================
679ecdee 1236Standard_Integer AIS_InteractiveContext::HilightNextDetected (const Handle(V3d_View)& theView,
1237 const Standard_Boolean theToRedrawImmediate)
7fd59977 1238{
679ecdee 1239 return HasOpenedContext()
1240 ? myLocalContexts (myCurLocalIndex)->HilightNextDetected (theView, theToRedrawImmediate)
1241 : 0;
7fd59977 1242
1243}
1244
1245//=======================================================================
1246//function : HilightNextDetected
679ecdee 1247//purpose :
7fd59977 1248//=======================================================================
679ecdee 1249Standard_Integer AIS_InteractiveContext::HilightPreviousDetected (const Handle(V3d_View)& theView,
1250 const Standard_Boolean theToRedrawImmediate)
7fd59977 1251{
679ecdee 1252 return HasOpenedContext()
1253 ? myLocalContexts (myCurLocalIndex)->HilightPreviousDetected (theView, theToRedrawImmediate)
1254 : 0;
7fd59977 1255
1256}
1257
7fd59977 1258//=======================================================================
1259//function : InitDetected
1260//purpose :
1261//=======================================================================
1262void AIS_InteractiveContext::InitDetected()
1263{
57ad5cbd 1264 if (HasOpenedContext())
7fd59977 1265 {
1266 myLocalContexts(myCurLocalIndex)->InitDetected();
1267 return;
1268 }
1269
1270 if(myAISDetectedSeq.Length() != 0)
57ad5cbd 1271 {
7fd59977 1272 myAISCurDetected = 1;
57ad5cbd 1273 }
7fd59977 1274}
1275
1276//=======================================================================
1277//function : MoreDetected
1278//purpose :
1279//=======================================================================
1280Standard_Boolean AIS_InteractiveContext::MoreDetected() const
1281{
57ad5cbd 1282 if (HasOpenedContext())
1283 {
7fd59977 1284 return myLocalContexts(myCurLocalIndex)->MoreDetected();
57ad5cbd 1285 }
7fd59977 1286
57ad5cbd 1287 return (myAISCurDetected > 0 && myAISCurDetected <= myAISDetectedSeq.Length()) ?
7fd59977 1288 Standard_True : Standard_False;
1289}
1290
1291//=======================================================================
1292//function : NextDetected
1293//purpose :
1294//=======================================================================
1295void AIS_InteractiveContext::NextDetected()
1296{
1297 if(HasOpenedContext())
1298 {
1299 myLocalContexts(myCurLocalIndex)->NextDetected();
1300 return;
1301 }
1302
1303 myAISCurDetected++;
1304}
1305
1306//=======================================================================
1307//function : DetectedCurrentShape
1308//purpose :
1309//=======================================================================
7fd59977 1310const TopoDS_Shape& AIS_InteractiveContext::DetectedCurrentShape() const
1311{
57ad5cbd 1312 if (HasOpenedContext())
1313 {
7fd59977 1314 return myLocalContexts(myCurLocalIndex)->DetectedCurrentShape();
57ad5cbd 1315 }
7fd59977 1316
57ad5cbd 1317 static TopoDS_Shape aDummyShape;
1318
1319 Handle(AIS_Shape) aCurrentShape = Handle(AIS_Shape)::DownCast (DetectedCurrentObject());
1320
1321 if (aCurrentShape.IsNull())
1322 {
1323 return aDummyShape;
1324 }
1325
1326 return aCurrentShape->Shape();
7fd59977 1327}
1328
1329//=======================================================================
1330//function : DetectedCurrentObject
1331//purpose :
1332//=======================================================================
57ad5cbd 1333Handle(AIS_InteractiveObject) AIS_InteractiveContext::DetectedCurrentObject() const
1334{
1335 if (HasOpenedContext())
1336 {
7fd59977 1337 return myLocalContexts(myCurLocalIndex)->DetectedCurrentObject();
57ad5cbd 1338 }
7fd59977 1339
57ad5cbd 1340 return MoreDetected() ? myAISDetectedSeq(myAISCurDetected) : NULL;
7fd59977 1341}