// be performed when mgrSelector will be destroyed but anyway...
mgrSelector->Remove( myMainSel );
#endif
+ AIS_ListOfInteractive aList;
+
+ AIS_DataMapIteratorOfDataMapOfIOStatus anIt(myObjects);
+ Handle(AIS_InteractiveContext) aNullContext;
+ for(; anIt.More() ; anIt.Next())
+ {
+ Handle(AIS_InteractiveObject) anObj = anIt.Key();
+ anObj->SetContext(aNullContext);
+
+ }
MMgt_TShared::Delete();
}
void AIS_InteractiveObject::SetContext(const Handle(AIS_InteractiveContext)& aCtx)
{
myCTXPtr = aCtx.operator->();
+ if( aCtx.IsNull())
+ return;
if (myDrawer.IsNull()) {
myDrawer = new AIS_Drawer;
#ifdef DEB
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++)
}
myShapes[anIdx].Nullify();
}
-
+
AIS_InteractiveObject::SetContext (Ctx);
-
LoadSubObjects();
for(Standard_Integer i= 0;i<=6;i++)
myShapes[i]->SetContext (Ctx);
myIntShadingMethod(TEL_SM_GOURAUD),
myAntiAliasing(Standard_False),
myTransPers(&myDefaultTransPers),
- myIsTransPers(Standard_False)
+ myIsTransPers(Standard_False),
+ myTrihedron(NULL),
+ myGraduatedTrihedron(NULL)
{
// Initialize matrices
memcpy(myOrientationMatrix,myDefaultMatrix,sizeof(Tmatrix3));
{
OpenGl_Element::Destroy (theCtx, myTrihedron);
OpenGl_Element::Destroy (theCtx, myGraduatedTrihedron);
+
if (!myTextureEnv.IsNull())
{
theCtx->DelayedRelease (myTextureEnv);
myTextureEnv = new OpenGl_Texture (theTexture->GetParams());
Handle(Image_PixMap) anImage = theTexture->GetImage();
- myTextureEnv->Init (theCtx, *anImage.operator->(), theTexture->Type());
+ if( !anImage.IsNull())
+ myTextureEnv->Init (theCtx, *anImage.operator->(), theTexture->Type());
}
/*----------------------------------------------------------------------*/
Handle(AIS_InteractiveContext) ctx, ownctx;
if ( !myAIS.IsNull() ) {
- ownctx = myAIS->GetContext();
+
if ( !Label().IsNull()) {
Handle(TPrsStd_AISViewer) viewer;
- if( !TPrsStd_AISViewer::Find(Label(), viewer) ) return;
+ if( !TPrsStd_AISViewer::Find(Label(), viewer) ) return;
+ ownctx = myAIS->GetContext();
ctx = viewer->GetInteractiveContext();
if( remove ) {
if( !ctx.IsNull() ) ctx->Remove (myAIS,Standard_False);
#include <AIS_Drawer.hxx>
#include <Aspect_TypeOfLine.hxx>
#include <Prs3d_LineAspect.hxx>
+#include <TDocStd_Owner.hxx>
+#include <Geom_Axis2Placement.hxx>
+#include <AIS_Trihedron.hxx>
#define ZVIEW_SIZE 1000000.0
// avoid warnings on 'extern "C"' functions returning C++ classes
return 0;
}
+//=======================================================================
+//function : testDoc
+//purpose : Method to test destruction of document
+//=======================================================================
+static Standard_Integer testDoc (Draw_Interpretor& di,
+ Standard_Integer argc,
+ const char ** argv)
+{
+ if( argc < 2 )
+ {
+ cout<<"Invalid numbers of arguments should be: XTestDoc shape"<<endl;
+ return 1;
+ }
+ TopoDS_Shape shape = DBRep::Get(argv[1]);
+ if( shape.IsNull())
+ return 1;
+
+ Handle(XCAFApp_Application) A = XCAFApp_Application::GetApplication();
+
+ Handle(TDocStd_Document) aD1 = new TDocStd_Document("MDTV-XCAF");
+ aD1->Open(A);
+
+ Handle(V3d_Viewer) vw = ViewerTest_Tool::MakeViewer ("Test viwer");
+ Handle(AIS_InteractiveContext) aContext = new AIS_InteractiveContext(vw);
+ TPrsStd_AISViewer::New (aD1->Main(),aContext);
+ // get shape tool for shape verification
+ Handle(XCAFDoc_ShapeTool) aShapes =
+ XCAFDoc_DocumentTool::ShapeTool (aD1->Main());
+ TDF_Label aLab = aShapes->AddShape(shape);
+
+ Handle(Geom_Axis2Placement) aPlacement =
+ new Geom_Axis2Placement (gp::Origin(), gp::DZ(),gp::DX());
+ Handle(AIS_Trihedron) aTriShape = new AIS_Trihedron (aPlacement);
+
+ Handle(TNaming_NamedShape) NS;
+ Handle(TPrsStd_AISPresentation) prs;
+ if( aLab.FindAttribute( TNaming_NamedShape::GetID(), NS) ) {
+ prs = TPrsStd_AISPresentation::Set( NS );
+ }
+
+ if( aLab.FindAttribute(TPrsStd_AISPresentation::GetID(), prs) )
+ prs->Display();
+
+
+ TPrsStd_AISViewer::Update(aLab);
+ aContext->Display(aTriShape, Standard_True);
+ Handle(TDocStd_Owner) owner;
+ if (aD1->Main().Root().FindAttribute(TDocStd_Owner::GetID(), owner))
+ {
+ Handle_TDocStd_Document empty;
+ owner->SetDocument(empty);
+ }
+ aContext.Nullify();
+ aD1->Close();
+ aD1.Nullify();
+ return 0;
+}
+
+
//=======================================================================
//function : Init
//purpose :
"Doc Label IsOn [R G B [LineWidth [LineStyle]]]:"
"- turns on/off drawing of face boundaries and defines boundary line style",
__FILE__, XShowFaceBoundary, g);
+ di.Add ("XTestDoc", "XTestDoc shape", __FILE__, testDoc, g);
// Specialized commands
XDEDRAW_Shapes::InitCommands ( di );
--- /dev/null
+puts "============"
+puts "OCC24047"
+puts "============"
+puts ""
+#######################################################################
+# Exception in TPrsStd_AISPresentation during destruction of TDocStd_Document
+#######################################################################
+
+pload XDEDRAW
+
+box a 0 0 0 10 10 10
+XTestDoc a