]> SALOME platform Git repositories - modules/shaper.git/blob - src/XGUI/XGUI_Displayer.cpp
Salome HOME
17f52eb5f9d01d15f23be14a58cd1c1862a1cb74
[modules/shaper.git] / src / XGUI / XGUI_Displayer.cpp
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
2
3 // File:        XGUI_Displayer.cpp
4 // Created:     20 Apr 2014
5 // Author:      Natalia ERMOLAEVA
6
7 #include "XGUI_Displayer.h"
8 #include "XGUI_Workshop.h"
9 #include "XGUI_ViewerProxy.h"
10
11 #include <AppElements_Viewer.h>
12
13 #include <ModelAPI_Document.h>
14 #include <ModelAPI_Data.h>
15 #include <ModelAPI_Object.h>
16 #include <ModelAPI_Tools.h>
17
18 #include <ModuleBase_ResultPrs.h>
19
20 #include <GeomAPI_Shape.h>
21 #include <GeomAPI_IPresentable.h>
22 #include <GeomAPI_ICustomPrs.h>
23
24 #include <AIS_InteractiveContext.hxx>
25 #include <AIS_LocalContext.hxx>
26 #include <AIS_ListOfInteractive.hxx>
27 #include <AIS_ListIteratorOfListOfInteractive.hxx>
28 #include <AIS_DimensionSelectionMode.hxx>
29 #include <AIS_Shape.hxx>
30 #include <AIS_Dimension.hxx>
31 #include <TColStd_ListIteratorOfListOfInteger.hxx>
32 #include <SelectMgr_ListOfFilter.hxx>
33 #include <SelectMgr_ListIteratorOfListOfFilter.hxx>
34
35 #include <set>
36
37 const int MOUSE_SENSITIVITY_IN_PIXEL = 10;  ///< defines the local context mouse selection sensitivity
38
39 XGUI_Displayer::XGUI_Displayer(XGUI_Workshop* theWorkshop)
40   : myUseExternalObjects(false), myWorkshop(theWorkshop)
41 {
42 }
43
44 XGUI_Displayer::~XGUI_Displayer()
45 {
46 }
47
48 bool XGUI_Displayer::isVisible(ObjectPtr theObject) const
49 {
50   return myResult2AISObjectMap.contains(theObject);
51 }
52
53 void XGUI_Displayer::display(ObjectPtr theObject, bool isUpdateViewer)
54 {
55   if (isVisible(theObject)) {
56     redisplay(theObject, isUpdateViewer);
57   } else {
58     AISObjectPtr anAIS;
59
60     GeomPresentablePtr aPrs = std::dynamic_pointer_cast<GeomAPI_IPresentable>(theObject);
61     bool isShading = false;
62     if (aPrs.get() != NULL) {
63       anAIS = aPrs->getAISObject(AISObjectPtr());
64     } else {
65       ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
66       if (aResult.get() != NULL) {
67         std::shared_ptr<GeomAPI_Shape> aShapePtr = ModelAPI_Tools::shape(aResult);
68         if (aShapePtr.get() != NULL) {
69           anAIS = AISObjectPtr(new GeomAPI_AISObject());
70           anAIS->setImpl(new Handle(AIS_InteractiveObject)(new ModuleBase_ResultPrs(aResult)));
71           //anAIS->createShape(aShapePtr);
72           isShading = true;
73         }
74       }
75     }
76     if (anAIS)
77       display(theObject, anAIS, isShading, isUpdateViewer);
78   }
79 }
80
81 void XGUI_Displayer::display(ObjectPtr theObject, AISObjectPtr theAIS, 
82                              bool isShading, bool isUpdateViewer)
83 {
84   Handle(AIS_InteractiveContext) aContext = AISContext();
85   if (aContext.IsNull())
86     return;
87
88   Handle(AIS_InteractiveObject) anAISIO = theAIS->impl<Handle(AIS_InteractiveObject)>();
89   if (!anAISIO.IsNull()) {
90     myResult2AISObjectMap[theObject] = theAIS;
91     aContext->Display(anAISIO, false);
92     aContext->SetDisplayMode(anAISIO, isShading? Shading : Wireframe, false);
93
94     FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
95     if (aFeature.get() != NULL) {
96       GeomCustomPrsPtr aCustPrs = std::dynamic_pointer_cast<GeomAPI_ICustomPrs>(aFeature);
97       if (aCustPrs.get() != NULL)
98         aCustPrs->customisePresentation(theAIS);
99     }
100     if (aContext->HasOpenedContext()) {
101       if (myUseExternalObjects) {
102         if (myActiveSelectionModes.size() == 0)
103           aContext->Activate(anAISIO);
104         else {
105           foreach(int aMode, myActiveSelectionModes) {
106             aContext->Activate(anAISIO, aMode);
107           }
108         }
109       }
110     }
111   }
112   if (isUpdateViewer)
113     updateViewer();
114 }
115
116 void XGUI_Displayer::erase(ObjectPtr theObject, const bool isUpdateViewer)
117 {
118   if (!isVisible(theObject))
119     return;
120
121   Handle(AIS_InteractiveContext) aContext = AISContext();
122   if (aContext.IsNull())
123     return;
124   AISObjectPtr anObject = myResult2AISObjectMap[theObject];
125   if (anObject) {
126     Handle(AIS_InteractiveObject) anAIS = anObject->impl<Handle(AIS_InteractiveObject)>();
127     if (!anAIS.IsNull()) {
128       aContext->Remove(anAIS, isUpdateViewer);
129     }
130   }
131   myResult2AISObjectMap.remove(theObject);
132 }
133
134 void XGUI_Displayer::redisplay(ObjectPtr theObject, bool isUpdateViewer)
135 {
136   if (!isVisible(theObject))
137     return;
138
139   AISObjectPtr aAISObj = getAISObject(theObject);
140   Handle(AIS_InteractiveObject) aAISIO = aAISObj->impl<Handle(AIS_InteractiveObject)>();
141
142   GeomPresentablePtr aPrs = std::dynamic_pointer_cast<GeomAPI_IPresentable>(theObject);
143   if (aPrs) {
144     AISObjectPtr aAIS_Obj = aPrs->getAISObject(aAISObj);
145     if (!aAIS_Obj) {
146       erase(theObject, isUpdateViewer);
147       return;
148     }
149     if (aAIS_Obj != aAISObj) {
150       myResult2AISObjectMap[theObject] = aAIS_Obj;
151     }
152     aAISIO = aAIS_Obj->impl<Handle(AIS_InteractiveObject)>();
153   }
154
155   if (!aAISIO.IsNull()) {
156     Handle(AIS_InteractiveContext) aContext = AISContext();
157     if (aContext.IsNull())
158       return;
159     aContext->Redisplay(aAISIO, isUpdateViewer);
160   }
161 }
162
163 void XGUI_Displayer::deactivate(ObjectPtr theObject)
164 {
165   if (isVisible(theObject)) {
166     Handle(AIS_InteractiveContext) aContext = AISContext();
167     if (aContext.IsNull())
168       return;
169
170     AISObjectPtr anObj = myResult2AISObjectMap[theObject];
171     Handle(AIS_InteractiveObject) anAIS = anObj->impl<Handle(AIS_InteractiveObject)>();
172     aContext->Deactivate(anAIS);
173   }
174 }
175
176 void XGUI_Displayer::activate(ObjectPtr theFeature)
177 {
178   QIntList aModes;
179   activate(theFeature, aModes);
180 }
181
182 void XGUI_Displayer::activate(ObjectPtr theObject, const QIntList& theModes)
183 {
184   if (isVisible(theObject)) {
185     Handle(AIS_InteractiveContext) aContext = AISContext();
186     if (aContext.IsNull())
187       return;
188
189     AISObjectPtr anObj = myResult2AISObjectMap[theObject];
190     Handle(AIS_InteractiveObject) anAIS = anObj->impl<Handle(AIS_InteractiveObject)>();
191     if (aContext->HasOpenedContext()) {
192       aContext->Load(anAIS, -1, true);
193     }
194     if (theModes.size() > 0) {
195       foreach(int aMode, theModes) {
196         aContext->Activate(anAIS, aMode);
197       }
198     } else 
199       aContext->Activate(anAIS);
200   }
201 }
202
203 bool XGUI_Displayer::isActive(ObjectPtr theObject) const
204 {
205   Handle(AIS_InteractiveContext) aContext = AISContext();
206   if (aContext.IsNull())
207     return false;
208   if (!isVisible(theObject))
209     return false;
210     
211   AISObjectPtr anObj = myResult2AISObjectMap[theObject];
212   Handle(AIS_InteractiveObject) anAIS = anObj->impl<Handle(AIS_InteractiveObject)>();
213
214   TColStd_ListOfInteger aModes;
215   aContext->ActivatedModes(anAIS, aModes);
216   return aModes.Extent() > 0;
217 }
218
219 void XGUI_Displayer::stopSelection(const QObjectPtrList& theResults, const bool isStop,
220                                    const bool isUpdateViewer)
221 {
222   Handle(AIS_InteractiveContext) aContext = AISContext();
223   if (aContext.IsNull())
224     return;
225
226   Handle(AIS_Shape) anAIS;
227   QObjectPtrList::const_iterator anIt = theResults.begin(), aLast = theResults.end();
228   ObjectPtr aFeature;
229   for (; anIt != aLast; anIt++) {
230     aFeature = *anIt;
231     if (isVisible(aFeature))
232       anAIS = Handle(AIS_Shape)::DownCast(
233           myResult2AISObjectMap[aFeature]->impl<Handle(AIS_InteractiveObject)>());
234     if (anAIS.IsNull())
235       continue;
236
237     if (isStop) {
238       QColor aColor(Qt::white);
239       anAIS->SetColor(
240           Quantity_Color(aColor.red() / 255., aColor.green() / 255., aColor.blue() / 255.,
241                          Quantity_TOC_RGB));
242       anAIS->Redisplay();
243     } else {
244       QColor aColor(Qt::red);
245       anAIS->SetColor(
246           Quantity_Color(aColor.red() / 255., aColor.green() / 255., aColor.blue() / 255.,
247                          Quantity_TOC_RGB));
248       anAIS->Redisplay();
249     }
250   }
251   if (isUpdateViewer)
252     updateViewer();
253 }
254
255 void XGUI_Displayer::setSelected(const QObjectPtrList& theResults, const bool isUpdateViewer)
256 {
257   Handle(AIS_InteractiveContext) aContext = AISContext();
258   if (aContext.IsNull())
259     return;
260   if (aContext->HasOpenedContext()) {
261     aContext->UnhilightSelected();
262     aContext->ClearSelected();
263     foreach(ObjectPtr aResult, theResults) {
264       if (isVisible(aResult)) {
265         AISObjectPtr anObj = myResult2AISObjectMap[aResult];
266         Handle(AIS_InteractiveObject) anAIS = anObj->impl<Handle(AIS_InteractiveObject)>();
267         if (!anAIS.IsNull())
268           aContext->SetSelected(anAIS, false);
269       }
270     }
271   } else {
272     aContext->UnhilightCurrents();
273     aContext->ClearCurrents();
274     foreach(ObjectPtr aResult, theResults) {
275       if (isVisible(aResult)) {
276         AISObjectPtr anObj = myResult2AISObjectMap[aResult];
277         Handle(AIS_InteractiveObject) anAIS = anObj->impl<Handle(AIS_InteractiveObject)>();
278         if (!anAIS.IsNull())
279           aContext->SetCurrentObject(anAIS, false);
280       }
281     }
282   }
283   if (isUpdateViewer)
284     updateViewer();
285 }
286
287
288 void XGUI_Displayer::clearSelected()
289 {
290   Handle(AIS_InteractiveContext) aContext = AISContext();
291   if (aContext) {
292     aContext->UnhilightCurrents(false);
293     aContext->ClearSelected();
294   }
295 }
296
297 void XGUI_Displayer::eraseAll(const bool isUpdateViewer)
298 {
299   Handle(AIS_InteractiveContext) aContext = AISContext();
300   if (aContext.IsNull())
301     return;
302
303    foreach (AISObjectPtr aAISObj, myResult2AISObjectMap) {
304      // erase an object
305      Handle(AIS_InteractiveObject) anIO = aAISObj->impl<Handle(AIS_InteractiveObject)>();
306      if (!anIO.IsNull())
307        aContext->Remove(anIO, false);
308    }
309    myResult2AISObjectMap.clear();
310    if (isUpdateViewer)
311      updateViewer();
312  }
313
314 void XGUI_Displayer::eraseDeletedResults(const bool isUpdateViewer)
315 {
316   Handle(AIS_InteractiveContext) aContext = AISContext();
317   if (aContext.IsNull())
318     return;
319
320   QObjectPtrList aRemoved;
321   foreach (ObjectPtr aFeature, myResult2AISObjectMap.keys()) {
322     if (!aFeature || !aFeature->data() || !aFeature->data()->isValid()) {
323       AISObjectPtr anObj = myResult2AISObjectMap[aFeature];
324       if (!anObj)
325         continue;
326       Handle(AIS_InteractiveObject) anAIS = anObj->impl<Handle(AIS_InteractiveObject)>();
327       if (!anAIS.IsNull()) {
328         aContext->Remove(anAIS, false);
329         aRemoved.append(aFeature);
330       }
331     }
332   }
333   foreach(ObjectPtr aObj, aRemoved) {
334     myResult2AISObjectMap.remove(aObj);
335   }
336
337   if (isUpdateViewer)
338     updateViewer();
339 }
340
341 void XGUI_Displayer::openLocalContext()
342 {
343   Handle(AIS_InteractiveContext) aContext = AISContext();
344   if (aContext.IsNull())
345     return;
346   // Open local context if there is no one
347   if (!aContext->HasOpenedContext()) {
348     // Preserve selected objects
349     //AIS_ListOfInteractive aAisList;
350     //for (aContext->InitCurrent(); aContext->MoreCurrent(); aContext->NextCurrent())
351     //  aAisList.Append(aContext->Current());
352
353     // get the filters from the global context and append them to the local context
354     // a list of filters in the global context is not cleared and should be cleared here
355     SelectMgr_ListOfFilter aFilters;
356     aFilters.Assign(aContext->Filters());
357     // it is important to remove the filters in the global context, because there is a code
358     // in the closeLocalContex, which restore the global context filters
359     aContext->RemoveFilters();
360
361     aContext->ClearCurrents();
362     aContext->OpenLocalContext();
363     aContext->NotUseDisplayedObjects();
364
365     myUseExternalObjects = false;
366     myActiveSelectionModes.clear();
367
368     SelectMgr_ListIteratorOfListOfFilter aIt(aFilters);
369     for (;aIt.More(); aIt.Next()) {
370       aContext->AddFilter(aIt.Value());
371     }
372     // Restore selection
373     //AIS_ListIteratorOfListOfInteractive aIt2(aAisList);
374     //for(; aIt2.More(); aIt2.Next()) {
375     //  aContext->SetSelected(aIt2.Value(), false);
376     //}
377   }
378 }
379
380 void XGUI_Displayer::closeLocalContexts(const bool isUpdateViewer)
381 {
382   Handle(AIS_InteractiveContext) aContext = AISContext();
383   if ( (!aContext.IsNull()) && (aContext->HasOpenedContext()) ) {
384     // Preserve selected objects
385     //AIS_ListOfInteractive aAisList;
386     //for (aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected())
387     //  aAisList.Append(aContext->SelectedInteractive());
388
389     // get the filters from the local context and append them to the global context
390     // a list of filters in the local context is cleared
391     SelectMgr_ListOfFilter aFilters;
392     aFilters.Assign(aContext->Filters());
393
394     aContext->ClearSelected();
395     aContext->CloseAllContexts(false);
396
397     // Redisplay all object if they were displayed in localContext
398     Handle(AIS_InteractiveObject) aAISIO;
399     foreach (AISObjectPtr aAIS, myResult2AISObjectMap) {
400       aAISIO = aAIS->impl<Handle(AIS_InteractiveObject)>();
401       if (aContext->DisplayStatus(aAISIO) != AIS_DS_Displayed) {
402         aContext->Display(aAISIO, false);
403         aContext->SetDisplayMode(aAISIO, Shading, false);
404       }
405     }
406
407     // Append the filters from the local selection in the global selection context
408     SelectMgr_ListIteratorOfListOfFilter aIt(aFilters);
409     for (;aIt.More(); aIt.Next()) {
410       Handle(SelectMgr_Filter) aFilter = aIt.Value();
411       aContext->AddFilter(aFilter);
412     }
413
414     if (isUpdateViewer)
415       updateViewer();
416     myUseExternalObjects = false;
417     myActiveSelectionModes.clear();
418
419     // Restore selection
420     //AIS_ListIteratorOfListOfInteractive aIt2(aAisList);
421     //for(; aIt2.More(); aIt2.Next()) {
422     //  if (aContext->IsDisplayed(aIt2.Value()))
423     //    aContext->SetCurrentObject(aIt2.Value(), false);
424     //}
425   }
426 }
427
428 AISObjectPtr XGUI_Displayer::getAISObject(ObjectPtr theObject) const
429 {
430   AISObjectPtr anIO;
431   if (myResult2AISObjectMap.contains(theObject))
432     anIO = myResult2AISObjectMap[theObject];
433   return anIO;
434 }
435
436 ObjectPtr XGUI_Displayer::getObject(const AISObjectPtr& theIO) const
437 {
438   Handle(AIS_InteractiveObject) aRefAIS = theIO->impl<Handle(AIS_InteractiveObject)>();
439   return getObject(aRefAIS);
440 }
441
442 ObjectPtr XGUI_Displayer::getObject(const Handle(AIS_InteractiveObject)& theIO) const
443 {
444   ObjectPtr aFeature;
445   foreach (ObjectPtr anObj, myResult2AISObjectMap.keys()) {
446     AISObjectPtr aAIS = myResult2AISObjectMap[anObj];
447     Handle(AIS_InteractiveObject) anAIS = aAIS->impl<Handle(AIS_InteractiveObject)>();
448     if (anAIS == theIO)
449       return anObj;
450   }
451   return aFeature;
452 }
453
454 void XGUI_Displayer::updateViewer()
455 {
456   Handle(AIS_InteractiveContext) aContext = AISContext();
457   if (!aContext.IsNull())
458     aContext->UpdateCurrentViewer();
459 }
460
461 Handle(AIS_InteractiveContext) XGUI_Displayer::AISContext() const
462 {
463   return myWorkshop->viewer()->AISContext();
464 }
465
466 Handle(SelectMgr_AndFilter) XGUI_Displayer::GetFilter()
467 {
468   Handle(AIS_InteractiveContext) aContext = AISContext();
469   if (myAndFilter.IsNull() && !aContext.IsNull()) {
470     myAndFilter = new SelectMgr_AndFilter();
471     aContext->AddFilter(myAndFilter);
472   }
473   return myAndFilter;
474 }
475
476 void XGUI_Displayer::displayAIS(AISObjectPtr theAIS, bool isUpdate)
477 {
478   Handle(AIS_InteractiveContext) aContext = AISContext();
479   Handle(AIS_InteractiveObject) anAISIO = theAIS->impl<Handle(AIS_InteractiveObject)>();
480   if (!anAISIO.IsNull()) {
481     aContext->Display(anAISIO, isUpdate);
482     if (aContext->HasOpenedContext()) {
483       if (myUseExternalObjects) {
484         if (myActiveSelectionModes.size() == 0)
485           aContext->Activate(anAISIO);
486         else {
487           foreach(int aMode, myActiveSelectionModes) {
488             aContext->Activate(anAISIO, aMode);
489           }
490         }
491       }
492     }
493   }
494 }
495
496 void XGUI_Displayer::eraseAIS(AISObjectPtr theAIS, const bool isUpdate)
497 {
498   Handle(AIS_InteractiveContext) aContext = AISContext();
499   Handle(AIS_InteractiveObject) anAISIO = theAIS->impl<Handle(AIS_InteractiveObject)>();
500   if (!anAISIO.IsNull()) {
501     aContext->Remove(anAISIO, isUpdate);
502   }
503 }
504
505 void XGUI_Displayer::activateObjects(const QIntList& theModes)
506 {
507   Handle(AIS_InteractiveContext) aContext = AISContext();
508   // Open local context if there is no one
509   if (!aContext->HasOpenedContext()) 
510     return;
511
512   aContext->UseDisplayedObjects();
513   myUseExternalObjects = true;
514   myActiveSelectionModes = theModes;
515
516   //Deactivate trihedron which can be activated in local selector
517   AIS_ListOfInteractive aPrsList;
518   aContext->DisplayedObjects(aPrsList, true);
519
520   Handle(AIS_Trihedron) aTrihedron;
521   AIS_ListIteratorOfListOfInteractive aLIt(aPrsList);
522   for(; aLIt.More(); aLIt.Next()){
523     aTrihedron = Handle(AIS_Trihedron)::DownCast(aLIt.Value());
524     if (!aTrihedron.IsNull()) {
525       aContext->Deactivate(aTrihedron);
526       break;
527     }
528   }
529
530   //Activate all displayed objects with the module modes
531   //AIS_ListOfInteractive aPrsList;
532   //aContext->DisplayedObjects(aPrsList, true);
533
534   //AIS_ListIteratorOfListOfInteractive aLIt(aPrsList);
535   Handle(AIS_InteractiveObject) anAISIO;
536   for(aLIt.Initialize(aPrsList); aLIt.More(); aLIt.Next()){
537     anAISIO = aLIt.Value();
538     aTrihedron = Handle(AIS_Trihedron)::DownCast(anAISIO);
539     if (!aTrihedron.IsNull())
540       continue;
541
542     aContext->Load(anAISIO, -1, true);
543     if (theModes.size() == 0)
544       aContext->Activate(anAISIO);
545     else {
546       foreach(int aMode, theModes) {
547         aContext->Activate(anAISIO, aMode);
548       }
549     }
550   }
551 }
552
553
554 void XGUI_Displayer::deactivateObjects()
555 {
556   Handle(AIS_InteractiveContext) aContext = AISContext();
557   // Open local context if there is no one
558   if (!aContext->HasOpenedContext()) 
559     return;
560
561   aContext->NotUseDisplayedObjects();
562 }
563
564
565 void XGUI_Displayer::setDisplayMode(ObjectPtr theObject, DisplayMode theMode, bool toUpdate)
566 {
567   if (theMode == NoMode)
568     return;
569
570   Handle(AIS_InteractiveContext) aContext = AISContext();
571   if (aContext.IsNull())
572     return;
573
574   AISObjectPtr aAISObj = getAISObject(theObject);
575   if (!aAISObj)
576     return;
577
578   Handle(AIS_InteractiveObject) aAISIO = aAISObj->impl<Handle(AIS_InteractiveObject)>();
579   aContext->SetDisplayMode(aAISIO, theMode, toUpdate);
580 }
581
582 XGUI_Displayer::DisplayMode XGUI_Displayer::displayMode(ObjectPtr theObject) const
583 {
584   Handle(AIS_InteractiveContext) aContext = AISContext();
585   if (aContext.IsNull())
586     return NoMode;
587
588   AISObjectPtr aAISObj = getAISObject(theObject);
589   if (!aAISObj)
590     return NoMode;
591
592   Handle(AIS_InteractiveObject) aAISIO = aAISObj->impl<Handle(AIS_InteractiveObject)>();
593   return (XGUI_Displayer::DisplayMode) aAISIO->DisplayMode();
594 }
595
596 void XGUI_Displayer::addSelectionFilter(const Handle(SelectMgr_Filter)& theFilter)
597 {
598   Handle(AIS_InteractiveContext) aContext = AISContext();
599   if (aContext.IsNull())
600     return;
601   const SelectMgr_ListOfFilter& aFilters = aContext->Filters();
602   SelectMgr_ListIteratorOfListOfFilter aIt(aFilters);
603   for (; aIt.More(); aIt.Next()) {
604     if (theFilter.Access() == aIt.Value().Access())
605       return;
606   }
607   GetFilter()->Add(theFilter);
608 }
609
610 void XGUI_Displayer::removeSelectionFilter(const Handle(SelectMgr_Filter)& theFilter)
611 {
612   Handle(AIS_InteractiveContext) aContext = AISContext();
613   if (aContext.IsNull())
614     return;
615   GetFilter()->Remove(theFilter);
616 }
617
618 void XGUI_Displayer::removeFilters()
619 {
620   Handle(AIS_InteractiveContext) aContext = AISContext();
621   if (aContext.IsNull())
622     return;
623   GetFilter()->Clear();
624 }
625
626 void XGUI_Displayer::showOnly(const QObjectPtrList& theList)
627 {
628   QObjectPtrList aDispList = myResult2AISObjectMap.keys();
629   foreach(ObjectPtr aObj, aDispList) {
630     if (!theList.contains(aObj))
631       erase(aObj, false);
632   }
633   foreach(ObjectPtr aObj, theList) {
634     if (!isVisible(aObj))
635       display(aObj, false);
636   }
637   updateViewer();
638 }