0024047: Exception in TPrsStd_AISPresentation during destruction of TDocStd_Document
[occt.git] / src / AIS / AIS_Trihedron.cxx
index 5b0ad1b..421830c 100755 (executable)
@@ -1,10 +1,25 @@
-// File:       AIS_Trihedron.cxx
-// Created:    Mon Oct  9 16:24:53 1995
-// Author:     Arnaud BOUZY/Odile Olivier
-//             <adn>
-
-#define GER61351               //GG_171199     Enable to set an object RGB color
-//                                               instead a restricted object NameOfColor.
+// Created on: 1995-10-09
+// Created by: Arnaud BOUZY/Odile Olivier
+// Copyright (c) 1995-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.
+
+
+//GER61351             //GG_171199     Enable to set an object RGB color instead a restricted object NameOfColor.
 
 #define IMP120100      // GG Add SetTextColor() and SetArrowColor() methods
 
@@ -414,13 +429,11 @@ void AIS_Trihedron::ComputeSelection(const Handle(SelectMgr_Selection)& aSelecti
 //=======================================================================
 
 void AIS_Trihedron::SetColor(const Quantity_NameOfColor aCol)
-#ifdef GER61351
 {
   SetColor(Quantity_Color(aCol));
 }
 
 void AIS_Trihedron::SetColor(const Quantity_Color &aCol)
-#endif
 {
   hasOwnColor=Standard_True;
   myOwnColor = aCol;
@@ -506,15 +519,6 @@ Quantity_NameOfColor AIS_Trihedron::ArrowColor() const {
 }
 #endif
 
-//=======================================================================
-//function : Compute
-//purpose  : to avoid warning
-//=======================================================================
-void AIS_Trihedron::Compute(const Handle(PrsMgr_PresentationManager2d)&, 
-                              const Handle(Graphic2d_GraphicObject)&,
-                              const Standard_Integer)
-{
-}
 
 //=======================================================================
 //function : Compute
@@ -634,9 +638,20 @@ void AIS_Trihedron::LoadSubObjects()
 void AIS_Trihedron::SetContext(const Handle(AIS_InteractiveContext)& Ctx)
 {
 //  Standard_Boolean same_DA = myDrawer->Link() == Ctx->DefaultDrawer();
-
+   
+   if( Ctx.IsNull())
+   {
+      Standard_Integer anIdx;
+      for (anIdx = 0; anIdx < 7; anIdx++)
+      {
+        myShapes[anIdx]->SetContext(Ctx);
+      }
+     AIS_InteractiveObject::SetContext (Ctx);
+     return;
+   }
   // Remove subobjects from current context
   Handle(AIS_InteractiveContext) anAISContext = GetContext();
+  
   Standard_Boolean hasContext = (anAISContext.IsNull() == Standard_False);
   Standard_Integer anIdx;
   for (anIdx = 0; anIdx < 7; anIdx++)
@@ -651,9 +666,8 @@ void AIS_Trihedron::SetContext(const Handle(AIS_InteractiveContext)& Ctx)
        }
       myShapes[anIdx].Nullify();
     }
-
   AIS_InteractiveObject::SetContext (Ctx);
-  
   LoadSubObjects();
   for(Standard_Integer i= 0;i<=6;i++)
     myShapes[i]->SetContext (Ctx);