OCC22357 Hidden face selection
[occt.git] / src / AIS / AIS_InteractiveContext_2.cxx
index c991f9e..559133b 100755 (executable)
@@ -20,8 +20,6 @@
 #include <Graphic3d_MapIteratorOfMapOfStructure.hxx>
 #include <AIS_Selection.hxx>
 
-
-static TColStd_ListIteratorOfListOfInteger ItL;
 //=======================================================================
 //function : OpenLocalContext
 //purpose  : 
@@ -64,21 +62,13 @@ OpenLocalContext(const Standard_Boolean UseDisplayedObjects,
                                                           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()->Set ((myLocalContexts.Extent() > 0)
+    ? myLocalContexts (untilnow)->MainSelector()->Projector()
+    : myMainSel->Projector());
+
   NewLocal->MainSelector()->UpdateConversion();
-  
-  myLocalContexts.Bind(myCurLocalIndex,NewLocal);
 
+  myLocalContexts.Bind(myCurLocalIndex,NewLocal);
 
 #ifdef DEB
   cout<<"\tOpen Local Context No "<<myCurLocalIndex<<endl;
@@ -93,7 +83,6 @@ OpenLocalContext(const Standard_Boolean UseDisplayedObjects,
     cout<<"\t\tNo Objects Were Loaded "<<endl;
 #endif
   return myCurLocalIndex;
-  
 }
 
 //=======================================================================
@@ -268,6 +257,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 +302,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())
@@ -393,6 +383,7 @@ SubIntensityOn(const Handle(AIS_InteractiveObject)& anIObj,
     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());
     }
@@ -446,6 +437,7 @@ SubIntensityOff(const Handle(AIS_InteractiveObject)& anIObj,
     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 +481,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 +492,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();
 }
 
@@ -877,7 +868,7 @@ void AIS_InteractiveContext::ResetOriginalState(const Standard_Boolean updatevie
 {
   Standard_Boolean upd_main(Standard_False),upd_col(Standard_False);
   TColStd_ListIteratorOfListOfInteger itl;
-  
+
   for (AIS_DataMapIteratorOfDataMapOfIOStatus it(myObjects);it.More();it.Next()){
     const Handle(AIS_InteractiveObject)& iobj = it.Key();
     const Handle(AIS_GlobalStatus)& STAT = it.Value();