0024070: OpenGL capped object-level clipping planes
[occt.git] / src / AIS / AIS_InteractiveContext_2.cxx
index b87b46a..198c5bd 100755 (executable)
@@ -1,7 +1,23 @@
-// 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-2012 OPEN CASCADE SAS
+//
+// The content of this file is subject to the Open CASCADE Technology Public
+// License Version 6.5 (the "License"). You may not use the content of this file
+// except in compliance with the License. Please obtain a copy of the License
+// at http://www.opencascade.org and read it completely before using this file.
+//
+// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+//
+// The Original Code and all software distributed under the License is
+// distributed on an "AS IS" basis, without warranty of any kind, and the
+// Initial Developer hereby disclaims all such warranties, including without
+// limitation, any warranties of merchantability, fitness for a particular
+// purpose or non-infringement. Please see the License for the specific terms
+// and conditions governing the rights and limitations under the License.
+
 
 #define IMP051001       //GG Adds SetZDetected() and ZDetected() methods
 
@@ -61,14 +77,16 @@ OpenLocalContext(const Standard_Boolean UseDisplayedObjects,
                                                           UseDisplayedObjects,
                                                           AllowShapeDecomposition,
                                                           AcceptEraseOfTemporary);
-  NewLocal->MainSelector()->Set ((myLocalContexts.Extent() > 0)
+  // the AIS_LocalContext bind itself to myLocalContexts
+  // because procedures performed in AIS_LocalContext constructor
+  // already may access myLocalContexts(myCurLocalIndex) (like methods AIS_LocalContext::IsSelected()).
+  //myLocalContexts.Bind (myCurLocalIndex, NewLocal);
+  NewLocal->MainSelector()->Set ((myLocalContexts.Extent() > 1)
     ? myLocalContexts (untilnow)->MainSelector()->Projector()
     : myMainSel->Projector());
 
   NewLocal->MainSelector()->UpdateConversion();
 
-  myLocalContexts.Bind(myCurLocalIndex,NewLocal);
-
 #ifdef DEB
   cout<<"\tOpen Local Context No "<<myCurLocalIndex<<endl;
   if(UseDisplayedObjects){
@@ -122,7 +140,6 @@ void AIS_InteractiveContext::CloseLocalContext(const Standard_Integer Index,
    if(updateproj)
      myMainSel->UpdateConversion();
    else{
-     myMainSel->ReactivateProjector();
      myMainSel->UpdateSort();
    }
    if(debugmode)
@@ -138,11 +155,10 @@ void AIS_InteractiveContext::CloseLocalContext(const Standard_Integer Index,
    if(GoodIndex==myCurLocalIndex){
      myCurLocalIndex = HighestIndex();
      const Handle(AIS_LocalContext)& LocCtx = myLocalContexts(myCurLocalIndex);
-     if(LocCtx->HasSameProjector(VS->Projector())){
-       LocCtx->MainSelector()->ReactivateProjector();
-     }
-     else
+     if (!LocCtx->HasSameProjector (VS->Projector()))
+     {
        LocCtx->MainSelector()->UpdateConversion();
+     }
    }
    else if(debugmode)
      cout<<"a No Current Local Context WasClosed"<<endl;