0024002: Overall code and build procedure refactoring -- automatic
[occt.git] / src / AIS / AIS_InteractiveContext_2.cxx
old mode 100755 (executable)
new mode 100644 (file)
index c991f9e..4c92373
@@ -1,32 +1,52 @@
-// File:        AIS_InteractiveContext_2.cxx
-// Created:     Wed Jan 29 10:55:05 1997
-// Author:      Robert COUBLANC
-//              <rob@robox.paris1.matra-dtv.fr>
+// Created on: 1997-01-29
+// Created by: Robert COUBLANC
+// Copyright (c) 1997-1999 Matra Datavision
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
 
-#define IMP051001       //GG Adds SetZDetected() and ZDetected() methods
 
-#include <AIS_InteractiveContext.jxx>
-
-#include <AIS_LocalContext.hxx>
-
-#include <AIS_GlobalStatus.hxx>
-#include <TColStd_ListIteratorOfListOfInteger.hxx>
-
-#include <AIS_DataMapIteratorOfDataMapOfIOStatus.hxx>
 #include <AIS_DataMapIteratorOfDataMapOfILC.hxx>
-#include <Graphic3d_StructureManager.hxx>
-#include <Graphic3d_Structure.hxx>
-#include <Graphic3d_MapOfStructure.hxx>
-#include <Graphic3d_MapIteratorOfMapOfStructure.hxx>
+#include <AIS_DataMapIteratorOfDataMapOfIOStatus.hxx>
+#include <AIS_GlobalStatus.hxx>
+#include <AIS_InteractiveContext.hxx>
+#include <AIS_InteractiveObject.hxx>
+#include <AIS_LocalContext.hxx>
 #include <AIS_Selection.hxx>
+#include <Graphic3d_MapIteratorOfMapOfStructure.hxx>
+#include <Graphic3d_MapOfStructure.hxx>
+#include <Graphic3d_Structure.hxx>
+#include <Graphic3d_StructureManager.hxx>
+#include <Prs3d_BasicAspect.hxx>
+#include <Prs3d_LineAspect.hxx>
+#include <Quantity_Color.hxx>
+#include <SelectMgr_EntityOwner.hxx>
+#include <SelectMgr_Filter.hxx>
+#include <SelectMgr_OrFilter.hxx>
+#include <SelectMgr_SelectionManager.hxx>
+#include <Standard_Transient.hxx>
+#include <StdSelect_ViewerSelector3d.hxx>
+#include <TCollection_AsciiString.hxx>
+#include <TCollection_ExtendedString.hxx>
+#include <TColStd_ListIteratorOfListOfInteger.hxx>
+#include <TopLoc_Location.hxx>
+#include <TopoDS_Shape.hxx>
+#include <V3d_View.hxx>
+#include <V3d_Viewer.hxx>
 
-
-static TColStd_ListIteratorOfListOfInteger ItL;
 //=======================================================================
 //function : OpenLocalContext
 //purpose  : 
 //=======================================================================
-
 Standard_Integer AIS_InteractiveContext::
 OpenLocalContext(const Standard_Boolean UseDisplayedObjects, 
                  const Standard_Boolean AllowShapeDecomposition, 
@@ -34,8 +54,7 @@ OpenLocalContext(const Standard_Boolean UseDisplayedObjects,
                  const Standard_Boolean /*BothViewers*/)
 {
 
-  // on dehilighte les eventuelles entitees detectees juste avant l'ouverture
-  // du contexte...
+  // the entities eventually detected just before the context was opened are unhighlighted...
   if(!IsCurrent(myLastPicked)){
     if(!myLastPicked.IsNull()){
       Standard_Integer HiMod = myLastPicked->HasHilightMode()?myLastPicked->HilightMode():0;
@@ -47,40 +66,23 @@ OpenLocalContext(const Standard_Boolean UseDisplayedObjects,
       myLocalContexts(myCurLocalIndex)->UnhilightLastDetected(mylastmoveview);
   }
   
-  // on met a 0 les entites liees a la selection dynamique au point neutre.
+  // entities connected to dynamic selection at neutral point are set to 0.
   
   myLastinMain.Nullify();
-  myLastinColl.Nullify();
   myLastPicked.Nullify();
   myWasLastMain = Standard_True;
 
-
-
-  Standard_Integer untilnow = myCurLocalIndex;
-  
   myCurLocalIndex = HighestIndex() + 1;
   
   Handle(AIS_LocalContext) NewLocal= new AIS_LocalContext(this,myCurLocalIndex,
                                                           UseDisplayedObjects,
                                                           AllowShapeDecomposition,
                                                           AcceptEraseOfTemporary);
-  
-  // rob 16/04/97 pour les Pbs d'ordres asynchrones
-  if(myLocalContexts.Extent()>0){
-    const Select3D_Projector& Prj = myLocalContexts(untilnow)->MainSelector()->Projector();
-    NewLocal->MainSelector()->Set(Prj);
-  }
-  else{
-    const Select3D_Projector& Prj = myMainSel->Projector();
-    NewLocal->MainSelector()->Set(Prj);
-  }
-  
-  NewLocal->MainSelector()->UpdateConversion();
-  
-  myLocalContexts.Bind(myCurLocalIndex,NewLocal);
-
+  // the AIS_LocalContext bind itself to myLocalContexts
+  // because procedures performed in AIS_LocalContext constructor
+  // already may access myLocalContexts(myCurLocalIndex) (like methods AIS_LocalContext::IsSelected()).
 
-#ifdef DEB
+#ifdef OCCT_DEBUG
   cout<<"\tOpen Local Context No "<<myCurLocalIndex<<endl;
   if(UseDisplayedObjects){
     cout<<"\t\tObjects from Neutral Point loaded"<<endl;
@@ -93,7 +95,6 @@ OpenLocalContext(const Standard_Boolean UseDisplayedObjects,
     cout<<"\t\tNo Objects Were Loaded "<<endl;
 #endif
   return myCurLocalIndex;
-  
 }
 
 //=======================================================================
@@ -106,7 +107,7 @@ void AIS_InteractiveContext::CloseLocalContext(const Standard_Integer Index,
 {
 
  Standard_Boolean debugmode(Standard_False);
-#ifdef DEB 
+#ifdef OCCT_DEBUG
  debugmode = Standard_True;
 #endif
  
@@ -122,39 +123,26 @@ void AIS_InteractiveContext::CloseLocalContext(const Standard_Integer Index,
    return;
  }
  
- // On va fermer le seul contexte local ouvert...
+ // the only open local context is closed...
  if(myLocalContexts.Extent()==1 && GoodIndex == myCurLocalIndex){
    
-   Standard_Boolean updateproj = !(myLocalContexts(myCurLocalIndex)->HasSameProjector(myMainSel->Projector()));
    myLocalContexts(myCurLocalIndex)->Terminate( updateviewer );
    myLocalContexts.UnBind(myCurLocalIndex);
    myCurLocalIndex = 0;
 
    ResetOriginalState(Standard_False);
-   if(updateproj)
-     myMainSel->UpdateConversion();
-   else{
-     myMainSel->ReactivateProjector();
-     myMainSel->UpdateSort();
-   }
    if(debugmode)
      cout<<"No More Opened Local Context "<<endl;
  }
  
- // Sinon on aura encore un contexte local d'ouvert apres la fermeture du courant
+ // Otherwise the local context will be still open after the current is closed
  else{
    Handle(StdSelect_ViewerSelector3d) VS = myLocalContexts(GoodIndex)->MainSelector();
    myLocalContexts(GoodIndex)->Terminate();
    myLocalContexts.UnBind(GoodIndex);
-   // on ferme le courant...
+   // the current is closed...
    if(GoodIndex==myCurLocalIndex){
      myCurLocalIndex = HighestIndex();
-     const Handle(AIS_LocalContext)& LocCtx = myLocalContexts(myCurLocalIndex);
-     if(LocCtx->HasSameProjector(VS->Projector())){
-       LocCtx->MainSelector()->ReactivateProjector();
-     }
-     else
-       LocCtx->MainSelector()->UpdateConversion();
    }
    else if(debugmode)
      cout<<"a No Current Local Context WasClosed"<<endl;
@@ -181,9 +169,6 @@ void AIS_InteractiveContext::CloseAllContexts(const Standard_Boolean updateviewe
   
   ResetOriginalState(Standard_False);
 
-  myMainSel->UpdateSort();
-  if(!myIsCollClosed && !myCollectorSel.IsNull())
-    myCollectorSel->UpdateSort();
   if(updateviewer) myMainVwr->Update();
 }
 
@@ -232,12 +217,13 @@ Standard_Integer AIS_InteractiveContext::HighestIndex() const
 
 void AIS_InteractiveContext::
 Activate(const Handle(AIS_InteractiveObject)& anIObj, 
-         const Standard_Integer aMode)
+         const Standard_Integer aMode,
+         const Standard_Boolean theIsForce)
 {
   if(!HasOpenedContext()){
     if(!myObjects.IsBound(anIObj)) return;
     const Handle(AIS_GlobalStatus)& STAT = myObjects(anIObj);
-    if(STAT->GraphicStatus()==AIS_DS_Displayed)
+    if(STAT->GraphicStatus()==AIS_DS_Displayed || theIsForce)
       mgrSelector->Activate(anIObj,aMode,myMainSel);
     STAT ->AddSelectionMode(aMode);
   }
@@ -268,6 +254,7 @@ Deactivate(const Handle(AIS_InteractiveObject)& anIObj)
 {
   if(!HasOpenedContext()){
     if(!myObjects.IsBound(anIObj)) return;
+    TColStd_ListIteratorOfListOfInteger ItL;
     for(ItL.Initialize(myObjects(anIObj)->SelectionModes());
         ItL.More();
         ItL.Next()){
@@ -312,9 +299,9 @@ void AIS_InteractiveContext::
 ActivatedModes(const Handle(AIS_InteractiveObject)& anIObj, 
                TColStd_ListOfInteger& theList) const 
 {
+  TColStd_ListIteratorOfListOfInteger ItL;
   if(!HasOpenedContext()){
     if(myObjects.IsBound(anIObj)){
-      //ItL est une variable statique... 
       for(ItL.Initialize(myObjects(anIObj)->SelectionModes());
           ItL.More();
           ItL.Next())
@@ -371,28 +358,25 @@ SubIntensityOn(const Handle(AIS_InteractiveObject)& anIObj,
     if(GB->IsSubIntensityOn())
       return;
     GB->SubIntensityOn();
-    Standard_Boolean UpdMain(Standard_False),UpdColl(Standard_False);
+    Standard_Boolean UpdMain(Standard_False);
     
     for(TColStd_ListIteratorOfListOfInteger It(GB->DisplayedModes());It.More();It.Next()){
-      if(GB->GraphicStatus()==AIS_DS_Displayed){
+      if (GB->GraphicStatus()==AIS_DS_Displayed)
+      {
         myMainPM->Color(anIObj,mySubIntensity,It.Value());
-        UpdMain = Standard_True;}
-      else if(GB->GraphicStatus()==AIS_DS_Erased){
-        myCollectorPM->Color(anIObj,mySubIntensity,It.Value());
-        UpdColl=Standard_True;
+        UpdMain = Standard_True;
       }
     }
     if(updateviewer){
       if(UpdMain)
         myMainVwr->Update();
-      if(UpdColl)
-        myCollectorVwr->Update();
     }
   }
   else {
     if(myObjects.IsBound(anIObj)){
       const Handle(AIS_GlobalStatus)& STAT = myObjects(anIObj);
       STAT->SubIntensityOn();
+      TColStd_ListIteratorOfListOfInteger ItL;
       for (ItL.Initialize(STAT->DisplayedModes());ItL.More();ItL.Next())
         myMainPM->Color(anIObj,mySubIntensity,ItL.Value());
     }
@@ -418,15 +402,13 @@ SubIntensityOff(const Handle(AIS_InteractiveObject)& anIObj,
     if(!GB->IsSubIntensityOn())
       return;
     GB->SubIntensityOff();
-    Standard_Boolean UpdMain(Standard_False),UpdColl(Standard_False);
+    Standard_Boolean UpdMain(Standard_False);
     
     for(TColStd_ListIteratorOfListOfInteger It(GB->DisplayedModes());It.More();It.Next()){
-      if(GB->GraphicStatus()!=AIS_DS_Erased){
+      if(GB->GraphicStatus()==AIS_DS_Displayed)
+      {
         myMainPM->Unhighlight(anIObj,It.Value());
-        UpdMain = Standard_True;}
-      else {
-        myCollectorPM->Unhighlight(anIObj,It.Value());
-        UpdColl=Standard_True;
+        UpdMain = Standard_True;
       }
     }
     
@@ -438,14 +420,13 @@ SubIntensityOff(const Handle(AIS_InteractiveObject)& anIObj,
     if(updateviewer){
       if(UpdMain)
         myMainVwr->Update();
-      if(UpdColl)
-        myCollectorVwr->Update();
     }
   }
   else {
     if(myObjects.IsBound(anIObj)){
       const Handle(AIS_GlobalStatus)& STAT = myObjects(anIObj);
       STAT->SubIntensityOff();
+      TColStd_ListIteratorOfListOfInteger ItL;
       for (ItL.Initialize(STAT->DisplayedModes());ItL.More();ItL.Next())
         myMainPM->Unhighlight(anIObj,ItL.Value());
       if(STAT->IsHilighted())
@@ -489,11 +470,10 @@ void AIS_InteractiveContext::SubIntensityOn(const Standard_Boolean updateviewer)
 //=======================================================================
 void AIS_InteractiveContext::SubIntensityOff(const Standard_Boolean updateviewer)
 {
-  
   if(!HasOpenedContext()) return;
-  
+
   AIS_DataMapIteratorOfDataMapOfIOStatus It (myObjects);
-  
+  TColStd_ListIteratorOfListOfInteger ItL;
   for(;It.More();It.Next()){
     const Handle(AIS_GlobalStatus)& STAT = It.Value();
     if(STAT->IsSubIntensityOn())
@@ -501,7 +481,7 @@ void AIS_InteractiveContext::SubIntensityOff(const Standard_Boolean updateviewer
     for(ItL.Initialize(STAT->DisplayedModes());ItL.More();ItL.Next())
       myMainPM->Unhighlight(It.Key());
   }
-  
+
   if(updateviewer) myMainVwr->Update();
 }
 
@@ -582,31 +562,6 @@ const SelectMgr_ListOfFilter& AIS_InteractiveContext::Filters() const
   return myFilters->StoredFilters();
 }
 
-//=======================================================================
-//function : DisplayActiveAreas
-//purpose  : 
-//=======================================================================
-void AIS_InteractiveContext::DisplayActiveAreas(const Handle(V3d_View)& aviou)
-{
-  if(HasOpenedContext())
-    myLocalContexts(myCurLocalIndex)->DisplayAreas(aviou);
-  else
-    myMainSel->DisplayAreas(aviou);
-  
-}
-
-//=======================================================================
-//function : ClearActiveAreas
-//purpose  : 
-//=======================================================================
-void AIS_InteractiveContext::ClearActiveAreas(const Handle(V3d_View)& aviou)
-{
-  if(HasOpenedContext())
-    myLocalContexts(myCurLocalIndex)->ClearAreas(aviou);
-  else
-    myMainSel->ClearAreas(aviou);
-}
-
 //=======================================================================
 //function : DisplayActiveSensitive
 //purpose  : 
@@ -643,41 +598,11 @@ void AIS_InteractiveContext::DisplayActiveSensitive(const Handle(AIS_Interactive
   
   for(;It.More();It.Next()){
     const Handle(SelectMgr_Selection)& Sel = anIObj->Selection(It.Value());
-    VS->DisplaySensitive(Sel,aviou,Standard_False);
+    VS->DisplaySensitive(Sel,anIObj->Transformation(), aviou,Standard_False);
   }  
   
 }
 
-//=======================================================================
-//function : DisplayActiveAreas
-//purpose  : 
-//=======================================================================
-
-void AIS_InteractiveContext::DisplayActiveAreas(const Handle(AIS_InteractiveObject)& anIObj,
-                                                const Handle(V3d_View)& aviou)
-{
-  TColStd_ListIteratorOfListOfInteger It;
-  Handle(StdSelect_ViewerSelector3d) VS;
-  if(HasOpenedContext()){
-    const Handle(AIS_LocalContext)& LC = myLocalContexts(myCurLocalIndex);
-    if(!LC->IsIn(anIObj)) return;
-    It.Initialize(LC->SelectionModes(anIObj));
-    VS = LC->MainSelector();
-  }
-  else{
-    if(!myObjects.IsBound(anIObj)) return;
-    It.Initialize(myObjects(anIObj)->SelectionModes());
-    VS = myMainSel;
-  }
-  
-  
-  for(;It.More();It.Next()){
-    const Handle(SelectMgr_Selection)& Sel = anIObj->Selection(It.Value());
-    VS->DisplayAreas(Sel,aviou,Standard_False);
-  }  
-  
-}
-  
 //=======================================================================
 //function : ClearActiveSensitive
 //purpose  : 
@@ -743,17 +668,11 @@ void AIS_InteractiveContext::NotUseDisplayedObjects()
 //purpose  : 
 //=======================================================================
 
-Standard_Integer AIS_InteractiveContext::PurgeDisplay(const Standard_Boolean CollectorToo)
+Standard_Integer AIS_InteractiveContext::PurgeDisplay()
 {
   if(HasOpenedContext()) return 0;
   
   Standard_Integer NbStr = PurgeViewer(myMainVwr);
-  if(!myCollectorVwr.IsNull())
-    if(CollectorToo){
-      NbStr+=PurgeViewer(myCollectorVwr);
-      if(!IsCollectorClosed())
-        myCollectorVwr->Update();
-    }
   myMainVwr->Update();
   return NbStr;
 
@@ -766,7 +685,7 @@ Standard_Integer AIS_InteractiveContext::PurgeDisplay(const Standard_Boolean Col
 //=======================================================================
 Standard_Integer AIS_InteractiveContext::PurgeViewer(const Handle(V3d_Viewer)& Vwr)
 {
-  const Handle(Graphic3d_StructureManager)& GSM = Vwr->Viewer();
+  Handle(Graphic3d_StructureManager) GSM = Vwr->Viewer();
   Standard_Integer NbCleared(0);
   Graphic3d_MapOfStructure SOS;
   GSM->DisplayedStructures(SOS);
@@ -777,7 +696,7 @@ Standard_Integer AIS_InteractiveContext::PurgeViewer(const Handle(V3d_Viewer)& V
     Standard_Address Add = G->Owner();
     if(Add==NULL){
       G->Erase();
-      G->Clear();// ca veut dire qu'elle n'est pas reference comme une presentation d'un InterfactiveObject...
+      G->Clear();// it means that it is not referenced as a presentation of InterfactiveObject...
       NbCleared++;
     }
     Handle(AIS_InteractiveObject) IO = (AIS_InteractiveObject*)Add;
@@ -789,82 +708,71 @@ Standard_Integer AIS_InteractiveContext::PurgeViewer(const Handle(V3d_Viewer)& V
   return NbCleared;
 }
 
-
 //=======================================================================
 //function : IsImmediateModeOn
-//purpose  : 
+//purpose  :
 //=======================================================================
+
 Standard_Boolean AIS_InteractiveContext::IsImmediateModeOn()  const 
 {
   if(!HasOpenedContext()) return Standard_False;
   return myLocalContexts(myCurLocalIndex)->IsImmediateModeOn();
 }
 
-Standard_Boolean  AIS_InteractiveContext::BeginImmediateDraw()
-{
-  if(HasOpenedContext())
-    return myLocalContexts(myCurLocalIndex)->BeginImmediateDraw();
-  return Standard_False;
-}
-
 //=======================================================================
-//function : ImmediateAdd
-//purpose  : 
+//function : BeginImmediateDraw
+//purpose  :
 //=======================================================================
 
-Standard_Boolean AIS_InteractiveContext::ImmediateAdd(const Handle(AIS_InteractiveObject)& anIObj,
-                                                      const Standard_Integer AMode)
-{ 
-  if(HasOpenedContext()){
-    return myLocalContexts(myCurLocalIndex)->ImmediateAdd(anIObj,AMode);}
-  return Standard_False;
+Standard_Boolean AIS_InteractiveContext::BeginImmediateDraw()
+{
+  return HasOpenedContext()
+      && myLocalContexts (myCurLocalIndex)->BeginImmediateDraw();
 }
 
 //=======================================================================
-//function : ImmediateRemove
-//purpose  : 
+//function : ImmediateAdd
+//purpose  :
 //=======================================================================
 
-Standard_Boolean AIS_InteractiveContext::ImmediateRemove(const Handle(AIS_InteractiveObject)& anIObj,
-                                                         const Standard_Integer aMode)
+Standard_Boolean AIS_InteractiveContext::ImmediateAdd (const Handle(AIS_InteractiveObject)& theObj,
+                                                       const Standard_Integer               theMode)
 {
-  if(HasOpenedContext())
-    return myLocalContexts(myCurLocalIndex)->ImmediateRemove(anIObj,aMode);
-  return Standard_False;
+  return HasOpenedContext()
+      && myLocalContexts (myCurLocalIndex)->ImmediateAdd (theObj, theMode);
 }
 
 //=======================================================================
 //function : EndImmediateDraw
-//purpose  : 
+//purpose  :
 //=======================================================================
 
-Standard_Boolean AIS_InteractiveContext::EndImmediateDraw(const Handle(V3d_View)& aView,
-                                                          const Standard_Boolean DoubleBuf)
+Standard_Boolean AIS_InteractiveContext::EndImmediateDraw (const Handle(V3d_View)& theView)
 {
-  if(HasOpenedContext())
-    return myLocalContexts(myCurLocalIndex)->EndImmediateDraw(aView,DoubleBuf);
-  return Standard_False;
-  
+  return HasOpenedContext()
+      && myLocalContexts (myCurLocalIndex)->EndImmediateDraw (theView);
 }
 
 //=======================================================================
 //function : EndImmediateDraw
-//purpose  : 
+//purpose  :
 //=======================================================================
 
-Standard_Boolean AIS_InteractiveContext::EndImmediateDraw(const Standard_Boolean DoubleBuf)
+Standard_Boolean AIS_InteractiveContext::EndImmediateDraw()
 {
-  if(HasOpenedContext()){
-    Handle(V3d_View) V ;
-    myMainVwr->InitActiveViews();
-    if(myMainVwr->MoreActiveViews()){
-      V = myMainVwr->ActiveView();
-      
-      return myLocalContexts(myCurLocalIndex)->EndImmediateDraw(V,DoubleBuf);
-    }
+  if (!HasOpenedContext())
+  {
+    return Standard_False;
   }
-  return Standard_False;
-  
+
+  myMainVwr->InitActiveViews();
+  if (!myMainVwr->MoreActiveViews())
+  {
+    return Standard_False;
+  }
+
+  Handle(V3d_View) aView = myMainVwr->ActiveView();
+  return myLocalContexts (myCurLocalIndex)->EndImmediateDraw (aView);
 }
 
 
@@ -875,9 +783,10 @@ Standard_Boolean AIS_InteractiveContext::EndImmediateDraw(const Standard_Boolean
 
 void AIS_InteractiveContext::ResetOriginalState(const Standard_Boolean updateviewer)
 {
-  Standard_Boolean upd_main(Standard_False),upd_col(Standard_False);
+  Standard_Boolean upd_main(Standard_False);
   TColStd_ListIteratorOfListOfInteger itl;
-  
+  myMainSel->ResetSelectionActivationStatus();
+
   for (AIS_DataMapIteratorOfDataMapOfIOStatus it(myObjects);it.More();it.Next()){
     const Handle(AIS_InteractiveObject)& iobj = it.Key();
     const Handle(AIS_GlobalStatus)& STAT = it.Value();
@@ -885,7 +794,7 @@ void AIS_InteractiveContext::ResetOriginalState(const Standard_Boolean updatevie
     case AIS_DS_Displayed:{
       upd_main = Standard_True;
       
-      // partie display...
+      // part display...
       for(itl.Initialize(STAT->DisplayedModes());itl.More();itl.Next())
         myMainPM->Display(iobj,itl.Value());
       if(STAT->IsHilighted()){
@@ -894,7 +803,7 @@ void AIS_InteractiveContext::ResetOriginalState(const Standard_Boolean updatevie
         else
           Hilight(iobj,Standard_False);
       }
-      //partie selection
+      //part selection
       for(itl.Initialize(STAT->SelectionModes());itl.More();itl.Next()){
         if(itl.Value()!=-1)
           mgrSelector->Activate(iobj,itl.Value(),myMainSel);
@@ -902,12 +811,7 @@ void AIS_InteractiveContext::ResetOriginalState(const Standard_Boolean updatevie
       break; 
     }
     case AIS_DS_Erased:{
-      upd_col = Standard_True;
-      EraseGlobal(iobj,Standard_False,Standard_True);
-      break;
-    }
-    case AIS_DS_FullErased:{
-      EraseGlobal(iobj,Standard_False,Standard_False);
+      EraseGlobal(iobj,Standard_False);
       break;
     }
     default:
@@ -917,12 +821,9 @@ void AIS_InteractiveContext::ResetOriginalState(const Standard_Boolean updatevie
   if(updateviewer){
     if(upd_main) 
       myMainVwr->Update();
-    if(upd_col)
-      myCollectorVwr->Update();
   }
 }
 
-#ifdef IMP051001
 //=======================================================================
 //function : SetZDetection
 //purpose  : 
@@ -940,4 +841,3 @@ Standard_Boolean AIS_InteractiveContext::ZDetection() const
 {
   return myZDetectionFlag;
 }
-#endif