mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-16 10:08:36 +03:00
0024430: vviewlist draw command does not added name of viewer created by XShow draw command
Remove ViewerTest_Tool, keep only one unified way to create viewer using ViewerTest - ViewerTest::ViewerInit(). Remove test case bugs/vis/buc60851 and command BUC60851. Added test case bugs/xde/bug24430
This commit is contained in:
parent
63def8e679
commit
0e93d9e5b8
@ -33,18 +33,18 @@
|
|||||||
|
|
||||||
#include <OSD_Path.hxx>
|
#include <OSD_Path.hxx>
|
||||||
#include <TDocStd_PathParser.hxx>
|
#include <TDocStd_PathParser.hxx>
|
||||||
//#include <TPrsStd_AISViewer.hxx>
|
|
||||||
//#include <AIS_InteractiveContext.hxx>
|
|
||||||
|
|
||||||
#ifndef WNT
|
#include <AIS_InteractiveContext.hxx>
|
||||||
|
#include <TPrsStd_AISViewer.hxx>
|
||||||
|
#include <ViewerTest.hxx>
|
||||||
|
#include <V3d_Viewer.hxx>
|
||||||
|
|
||||||
|
#ifndef _WIN32
|
||||||
extern Draw_Viewer dout;
|
extern Draw_Viewer dout;
|
||||||
#else
|
#else
|
||||||
Standard_IMPORT Draw_Viewer dout;
|
Standard_IMPORT Draw_Viewer dout;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern int ViewerMainLoop (Standard_Integer, const char**);
|
|
||||||
#include <ViewerTest_Tool.hxx>
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : ListDocuments
|
//function : ListDocuments
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -120,38 +120,6 @@ static Standard_Integer DDocStd_NewDocument (Draw_Interpretor& di,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : InitViewer
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
// static Standard_Integer DDocStd_InitViewer (Draw_Interpretor& di,
|
|
||||||
// Standard_Integer nb,
|
|
||||||
// const char** arg)
|
|
||||||
// {
|
|
||||||
// if (nb == 2) {
|
|
||||||
// Handle(TDocStd_Application) A;
|
|
||||||
// if (!DDocStd::Find(A)) return 1;
|
|
||||||
// Handle(TDocStd_Document) D;
|
|
||||||
// if (!DDocStd::GetDocument(arg[1],D)) return 1;
|
|
||||||
// Handle(TPrsStd_AISViewer) viewer;
|
|
||||||
// if (!TPrsStd_AISViewer::Find (D->Main(),viewer)) {
|
|
||||||
// TCollection_AsciiString title;
|
|
||||||
// title.Prepend(arg[1]);
|
|
||||||
// title.Prepend("_");
|
|
||||||
// title.Prepend("Document");
|
|
||||||
// Handle(V3d_Viewer) vw = ViewerTest_Tool::MakeViewer (title.ToCString());
|
|
||||||
// Handle(AIS_InteractiveContext) IC = new AIS_InteractiveContext(vw);
|
|
||||||
// A->SetViewer (D,IC);
|
|
||||||
// }
|
|
||||||
// ViewerTest_Tool::InitViewerTest (viewer->GetInteractiveContext());
|
|
||||||
// return 0;
|
|
||||||
// }
|
|
||||||
// cout << "DDocStd_InitViewer : Error" << endl;
|
|
||||||
// return 1;
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Open
|
//function : Open
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -296,25 +264,48 @@ static Standard_Integer DDocStd_SaveAs (Draw_Interpretor& di,
|
|||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
static Standard_Integer DDocStd_Close (Draw_Interpretor& di,
|
static Standard_Integer DDocStd_Close (Draw_Interpretor& /*theDI*/,
|
||||||
Standard_Integer nb,
|
Standard_Integer theArgNb,
|
||||||
const char** a)
|
const char** theArgVec)
|
||||||
{
|
{
|
||||||
if (nb == 2) {
|
if (theArgNb != 2)
|
||||||
Handle(TDocStd_Document) D;
|
{
|
||||||
if (!DDocStd::GetDocument(a[1],D)) return 1;
|
std::cout << "DDocStd_Close : Error\n";
|
||||||
Handle(TDocStd_Application) A;
|
return 1;
|
||||||
if (!DDocStd::Find(A)) return 1;
|
|
||||||
A->Close(D);
|
|
||||||
|
|
||||||
Handle(Draw_Drawable3D) DD = Draw::Get(a[1],Standard_False);
|
|
||||||
dout.RemoveDrawable (DD);
|
|
||||||
Handle(Draw_Drawable3D) aDNull;
|
|
||||||
Draw::Set(a[1], aDNull);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
di << "DDocStd_Close : Error" << "\n";
|
|
||||||
return 1;
|
Handle(TDocStd_Document) aDoc;
|
||||||
|
Standard_CString aDocName = theArgVec[1];
|
||||||
|
if (!DDocStd::GetDocument (aDocName, aDoc))
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
TDF_Label aRoot = aDoc->GetData()->Root();
|
||||||
|
Handle(TPrsStd_AISViewer) aDocViewer;
|
||||||
|
if (TPrsStd_AISViewer::Find (aRoot, aDocViewer)
|
||||||
|
&& !aDocViewer->GetInteractiveContext().IsNull())
|
||||||
|
{
|
||||||
|
Handle(V3d_Viewer) aViewer = aDocViewer->GetInteractiveContext()->CurrentViewer();
|
||||||
|
for (aViewer->InitDefinedViews(); aViewer->MoreDefinedViews(); aViewer->NextDefinedViews())
|
||||||
|
{
|
||||||
|
Handle(V3d_View) aView = aViewer->DefinedView();
|
||||||
|
ViewerTest::RemoveView (aView);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Handle(TDocStd_Application) aDocApp;
|
||||||
|
if (!DDocStd::Find (aDocApp))
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
aDocApp->Close (aDoc);
|
||||||
|
|
||||||
|
Handle(Draw_Drawable3D) aDrawable = Draw::Get (aDocName, Standard_False);
|
||||||
|
dout.RemoveDrawable (aDrawable);
|
||||||
|
Draw::Set (theArgVec[1], Handle(Draw_Drawable3D)());
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -456,8 +447,6 @@ void DDocStd::ApplicationCommands(Draw_Interpretor& theCommands)
|
|||||||
const char* g = "DDocStd application commands";
|
const char* g = "DDocStd application commands";
|
||||||
|
|
||||||
// user application commands
|
// user application commands
|
||||||
|
|
||||||
|
|
||||||
theCommands.Add("ListDocuments",
|
theCommands.Add("ListDocuments",
|
||||||
"ListDocuments",
|
"ListDocuments",
|
||||||
__FILE__, DDocStd_ListDocuments, g);
|
__FILE__, DDocStd_ListDocuments, g);
|
||||||
@ -466,10 +455,6 @@ void DDocStd::ApplicationCommands(Draw_Interpretor& theCommands)
|
|||||||
"NewDocument docname format",
|
"NewDocument docname format",
|
||||||
__FILE__, DDocStd_NewDocument, g);
|
__FILE__, DDocStd_NewDocument, g);
|
||||||
|
|
||||||
//theCommands.Add("InitViewer",
|
|
||||||
// "InitViewer DOC",
|
|
||||||
// __FILE__, DDocStd_InitViewer, g);
|
|
||||||
|
|
||||||
theCommands.Add("Open",
|
theCommands.Add("Open",
|
||||||
"Open path docname",
|
"Open path docname",
|
||||||
__FILE__, DDocStd_Open, g);
|
__FILE__, DDocStd_Open, g);
|
||||||
@ -505,11 +490,4 @@ void DDocStd::ApplicationCommands(Draw_Interpretor& theCommands)
|
|||||||
theCommands.Add("PrintComments",
|
theCommands.Add("PrintComments",
|
||||||
"PrintComments Doc",
|
"PrintComments Doc",
|
||||||
__FILE__, DDocStd_PrintComments, g);
|
__FILE__, DDocStd_PrintComments, g);
|
||||||
|
|
||||||
// active document
|
|
||||||
|
|
||||||
//theCommands.Add("Active",
|
|
||||||
// "Active [D]",
|
|
||||||
// __FILE__, DDocStd_Active, g);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,6 @@
|
|||||||
#include <AIS_InteractiveObject.hxx>
|
#include <AIS_InteractiveObject.hxx>
|
||||||
#include <AIS_Drawer.hxx>
|
#include <AIS_Drawer.hxx>
|
||||||
#include <ViewerTest.hxx>
|
#include <ViewerTest.hxx>
|
||||||
#include <ViewerTest_Tool.hxx>
|
|
||||||
#include <V3d_View.hxx>
|
#include <V3d_View.hxx>
|
||||||
#include <TCollection_ExtendedString.hxx>
|
#include <TCollection_ExtendedString.hxx>
|
||||||
#include <Quantity_NameOfColor.hxx>
|
#include <Quantity_NameOfColor.hxx>
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
#include <DPrsStd.hxx>
|
#include <DPrsStd.hxx>
|
||||||
|
|
||||||
#include <DPrsStd.hxx>
|
|
||||||
#include <Draw.hxx>
|
#include <Draw.hxx>
|
||||||
#include <Draw_Appli.hxx>
|
#include <Draw_Appli.hxx>
|
||||||
#include <Draw_Interpretor.hxx>
|
#include <Draw_Interpretor.hxx>
|
||||||
@ -29,54 +28,44 @@
|
|||||||
#include <TDF_ChildIterator.hxx>
|
#include <TDF_ChildIterator.hxx>
|
||||||
#include <DDF.hxx>
|
#include <DDF.hxx>
|
||||||
#include <DDocStd.hxx>
|
#include <DDocStd.hxx>
|
||||||
#include <TDocStd_Document.hxx>
|
|
||||||
#include <ViewerTest.hxx>
|
#include <ViewerTest.hxx>
|
||||||
|
|
||||||
#include <V3d_View.hxx>
|
#include <V3d_View.hxx>
|
||||||
|
|
||||||
// for AIS
|
|
||||||
|
|
||||||
#include <TPrsStd_AISPresentation.hxx>
|
#include <TPrsStd_AISPresentation.hxx>
|
||||||
#include <TPrsStd_AISViewer.hxx>
|
#include <TPrsStd_AISViewer.hxx>
|
||||||
#include <ViewerTest.hxx>
|
|
||||||
#include <AIS_InteractiveContext.hxx>
|
#include <AIS_InteractiveContext.hxx>
|
||||||
#include <ViewerTest.hxx>
|
|
||||||
#include <ViewerTest_Tool.hxx>
|
|
||||||
#include <V3d_View.hxx>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
extern int ViewerMainLoop (Standard_Integer, const char**);
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : DPrsStd_AISInitViewer
|
//function : DPrsStd_AISInitViewer
|
||||||
//purpose : AISInitViewer (DOC)
|
//purpose : AISInitViewer (DOC)
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
extern void ViewerTest_InitViewerTest (const Handle(AIS_InteractiveContext)&);
|
|
||||||
|
|
||||||
static Standard_Integer DPrsStd_AISInitViewer (Draw_Interpretor& di,
|
static Standard_Integer DPrsStd_AISInitViewer (Draw_Interpretor& theDI,
|
||||||
Standard_Integer nb,
|
Standard_Integer theArgNb,
|
||||||
const char** arg)
|
const char** theArgVec)
|
||||||
{
|
{
|
||||||
if (nb == 2) {
|
if (theArgNb != 2)
|
||||||
Handle(TDocStd_Document) D;
|
{
|
||||||
if (!DDocStd::GetDocument(arg[1],D)) return 1;
|
std::cout << "DPrsStd_AISInitViewer : Error\n";
|
||||||
TDF_Label acces = D->GetData()->Root();
|
return 1;
|
||||||
Handle(TPrsStd_AISViewer) viewer;
|
|
||||||
if (!TPrsStd_AISViewer::Find (acces,viewer)) {
|
|
||||||
TCollection_AsciiString title;
|
|
||||||
title.Prepend(arg[1]);
|
|
||||||
title.Prepend("_");
|
|
||||||
title.Prepend("Document");
|
|
||||||
Handle(V3d_Viewer) vw = ViewerTest_Tool::MakeViewer (title.ToCString());
|
|
||||||
viewer = TPrsStd_AISViewer::New (acces,vw);
|
|
||||||
}
|
|
||||||
ViewerTest_Tool::InitViewerTest (viewer->GetInteractiveContext());
|
|
||||||
DDF::ReturnLabel(di,viewer->Label());
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
di << "DPrsStd_AISInitViewer : Error" << "\n";
|
|
||||||
return 1;
|
Handle(TDocStd_Document) aDoc;
|
||||||
|
if (!DDocStd::GetDocument (theArgVec[1], aDoc))
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
TDF_Label aRoot = aDoc->GetData()->Root();
|
||||||
|
Handle(TPrsStd_AISViewer) aDocViewer;
|
||||||
|
TCollection_AsciiString aViewName = TCollection_AsciiString ("Driver1/Document_") + theArgVec[1] + "/View1";
|
||||||
|
if (!TPrsStd_AISViewer::Find (aRoot, aDocViewer))
|
||||||
|
{
|
||||||
|
ViewerTest::ViewerInit (0, 0, 0, 0, aViewName.ToCString(), "");
|
||||||
|
aDocViewer = TPrsStd_AISViewer::New (aRoot, ViewerTest::GetAISContext());
|
||||||
|
}
|
||||||
|
|
||||||
|
DDF::ReturnLabel (theDI, aDocViewer->Label());
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -67,7 +67,6 @@
|
|||||||
#include <ShapeFix_Wireframe.hxx>
|
#include <ShapeFix_Wireframe.hxx>
|
||||||
#include <ShapeBuild_ReShape.hxx>
|
#include <ShapeBuild_ReShape.hxx>
|
||||||
|
|
||||||
#include <ViewerTest_Tool.hxx>
|
|
||||||
#include <BRepBuilderAPI_MakeEdge.hxx>
|
#include <BRepBuilderAPI_MakeEdge.hxx>
|
||||||
|
|
||||||
//#include <QAModTopOpe_ReShaper.hxx>
|
//#include <QAModTopOpe_ReShaper.hxx>
|
||||||
@ -672,8 +671,6 @@ static Standard_Integer OCC394 (Draw_Interpretor& di, Standard_Integer argc, con
|
|||||||
|
|
||||||
static Standard_Integer OCC301 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
|
static Standard_Integer OCC301 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
|
||||||
{
|
{
|
||||||
//Handle(AIS_InteractiveContext) context= ViewerTest_Tool::MakeContext ("OCC301");
|
|
||||||
//ViewerTest_Tool::InitViewerTest (context);
|
|
||||||
Handle(AIS_InteractiveContext) context = ViewerTest::GetAISContext();
|
Handle(AIS_InteractiveContext) context = ViewerTest::GetAISContext();
|
||||||
if(context.IsNull()) {
|
if(context.IsNull()) {
|
||||||
di << "use 'vinit' command before " << argv[0] << "\n";
|
di << "use 'vinit' command before " << argv[0] << "\n";
|
||||||
|
@ -54,7 +54,6 @@
|
|||||||
#include <AIS_Trihedron.hxx>
|
#include <AIS_Trihedron.hxx>
|
||||||
#include <Geom_Axis2Placement.hxx>
|
#include <Geom_Axis2Placement.hxx>
|
||||||
#include <V3d_View.hxx>
|
#include <V3d_View.hxx>
|
||||||
#include <ViewerTest_Tool.hxx>
|
|
||||||
#include <BRepBuilderAPI_MakeVertex.hxx>
|
#include <BRepBuilderAPI_MakeVertex.hxx>
|
||||||
#include <AIS_LengthDimension.hxx>
|
#include <AIS_LengthDimension.hxx>
|
||||||
#include <AIS_RadiusDimension.hxx>
|
#include <AIS_RadiusDimension.hxx>
|
||||||
|
@ -22,13 +22,7 @@
|
|||||||
#include <AIS_InteractiveContext.hxx>
|
#include <AIS_InteractiveContext.hxx>
|
||||||
#include <ViewerTest.hxx>
|
#include <ViewerTest.hxx>
|
||||||
#include <AIS_Shape.hxx>
|
#include <AIS_Shape.hxx>
|
||||||
#include <TopoDS_Shape.hxx>
|
|
||||||
|
|
||||||
#include <ViewerTest_Tool.hxx>
|
|
||||||
#include <V3d_Viewer.hxx>
|
|
||||||
#include <V3d_View.hxx>
|
|
||||||
|
|
||||||
#include <ViewerTest_Tool.hxx>
|
|
||||||
#include <V3d_Viewer.hxx>
|
#include <V3d_Viewer.hxx>
|
||||||
#include <V3d_View.hxx>
|
#include <V3d_View.hxx>
|
||||||
#include <PCollection_HExtendedString.hxx>
|
#include <PCollection_HExtendedString.hxx>
|
||||||
@ -52,21 +46,6 @@
|
|||||||
|
|
||||||
#define DEFAULT_COLOR Quantity_NOC_GOLDENROD
|
#define DEFAULT_COLOR Quantity_NOC_GOLDENROD
|
||||||
|
|
||||||
static Standard_Integer BUC60851 (Draw_Interpretor& /*di*/, Standard_Integer /*argc*/, const char ** /*argv*/)
|
|
||||||
{
|
|
||||||
Handle(AIS_InteractiveContext) context= ViewerTest_Tool::MakeContext ("buc60851");
|
|
||||||
ViewerTest_Tool::InitViewerTest (context);
|
|
||||||
Handle(V3d_Viewer) aV3dViewer= context->CurrentViewer();
|
|
||||||
Handle(V3d_View) aV3d_View = aV3dViewer->ActiveView();
|
|
||||||
for (Standard_Integer i=0;i<1000;++i) {
|
|
||||||
aV3d_View->TriedronDisplay();
|
|
||||||
aV3d_View->TriedronErase();
|
|
||||||
}
|
|
||||||
aV3d_View->TriedronDisplay();
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Standard_Integer OCC216 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** /*argv*/)
|
static Standard_Integer OCC216 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** /*argv*/)
|
||||||
{
|
{
|
||||||
Handle(PCollection_HExtendedString) HExtendedString = new PCollection_HExtendedString("");
|
Handle(PCollection_HExtendedString) HExtendedString = new PCollection_HExtendedString("");
|
||||||
@ -265,7 +244,6 @@ static Standard_Integer OCC71bug (Draw_Interpretor& di, Standard_Integer /*argc*
|
|||||||
void QABugs::Commands_18(Draw_Interpretor& theCommands) {
|
void QABugs::Commands_18(Draw_Interpretor& theCommands) {
|
||||||
const char *group = "QABugs";
|
const char *group = "QABugs";
|
||||||
|
|
||||||
theCommands.Add("BUC60851", "BUC60851", __FILE__, BUC60851, group);
|
|
||||||
theCommands.Add("OCC216", "OCC216", __FILE__, OCC216, group);
|
theCommands.Add("OCC216", "OCC216", __FILE__, OCC216, group);
|
||||||
theCommands.Add("OCC267", "OCC267 DOC path", __FILE__, OCC267, group);
|
theCommands.Add("OCC267", "OCC267 DOC path", __FILE__, OCC267, group);
|
||||||
theCommands.Add("OCC181", "OCC181 FileName path1 path2 verbose=0/1", __FILE__, OCC181, group);
|
theCommands.Add("OCC181", "OCC181 FileName path1 path2 verbose=0/1", __FILE__, OCC181, group);
|
||||||
|
@ -34,12 +34,6 @@ uses
|
|||||||
|
|
||||||
is
|
is
|
||||||
|
|
||||||
class Tool;
|
|
||||||
---Purpose: to build a context and set a given context as current
|
|
||||||
-- for ViewerTest.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class EventManager;
|
class EventManager;
|
||||||
---Purpose: used to manage mouse event (move,select,shiftselect)
|
---Purpose: used to manage mouse event (move,select,shiftselect)
|
||||||
-- By default the events are transmitted to interactive context.
|
-- By default the events are transmitted to interactive context.
|
||||||
@ -79,8 +73,14 @@ is
|
|||||||
GetCurrentViewName returns AsciiString from TCollection;
|
GetCurrentViewName returns AsciiString from TCollection;
|
||||||
|
|
||||||
---Category: Delete the viewer....
|
---Category: Delete the viewer....
|
||||||
RemoveView (theViewName:AsciiString from TCollection;
|
RemoveView (theViewName : AsciiString from TCollection;
|
||||||
isContextRemoved:Boolean from Standard= Standard_True);
|
theToRemoveContext : Boolean from Standard = Standard_True);
|
||||||
|
---Purpose: Removes view and clear all maps
|
||||||
|
-- with information about its resources if neccessary
|
||||||
|
|
||||||
|
---Category: Delete the viewer....
|
||||||
|
RemoveView (theView : View from V3d;
|
||||||
|
theToRemoveContext : Boolean from Standard = Standard_True);
|
||||||
---Purpose: Removes view and clear all maps
|
---Purpose: Removes view and clear all maps
|
||||||
-- with information about its resources if neccessary
|
-- with information about its resources if neccessary
|
||||||
|
|
||||||
|
@ -2419,7 +2419,6 @@ static int VCircleBuilder(Draw_Interpretor& /*di*/, Standard_Integer argc, const
|
|||||||
#include <Font_NameOfFont.hxx>
|
#include <Font_NameOfFont.hxx>
|
||||||
|
|
||||||
#include <Visual3d_ViewManager.hxx>
|
#include <Visual3d_ViewManager.hxx>
|
||||||
#include <ViewerTest_Tool.ixx>
|
|
||||||
|
|
||||||
#include <Standard_DefineHandle.hxx>
|
#include <Standard_DefineHandle.hxx>
|
||||||
|
|
||||||
|
@ -1,39 +0,0 @@
|
|||||||
-- Created on: 1998-10-15
|
|
||||||
-- Created by: Denis PASCAL
|
|
||||||
-- Copyright (c) 1998-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.
|
|
||||||
|
|
||||||
class Tool from ViewerTest
|
|
||||||
|
|
||||||
---Purpose: to build and initialize ViewerTest static variables.
|
|
||||||
-- ====================================================
|
|
||||||
|
|
||||||
uses Viewer from V3d,
|
|
||||||
InteractiveContext from AIS
|
|
||||||
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
MakeViewer (myclass; title : CString from Standard)
|
|
||||||
---Purpose: create a new <context>. ViewerTest variables are not initialized;
|
|
||||||
returns Viewer from V3d;
|
|
||||||
|
|
||||||
MakeContext (myclass; title : CString from Standard)
|
|
||||||
---Purpose: create a new <context>. ViewerTest variables are not initialized;
|
|
||||||
returns InteractiveContext from AIS;
|
|
||||||
|
|
||||||
InitViewerTest (myclass; current : InteractiveContext from AIS);
|
|
||||||
---Purpose: init variables of ViewerTest with <current>
|
|
||||||
|
|
||||||
end Tool;
|
|
@ -1,141 +0,0 @@
|
|||||||
// Created on: 1998-10-15
|
|
||||||
// Created by: Denis PASCAL
|
|
||||||
// Copyright (c) 1998-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.
|
|
||||||
|
|
||||||
#ifdef WNT
|
|
||||||
#include <windows.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <ViewerTest_Tool.ixx>
|
|
||||||
|
|
||||||
#include <V3d_View.hxx>
|
|
||||||
#include <AIS_InteractiveContext.hxx>
|
|
||||||
#include <ViewerTest.hxx>
|
|
||||||
#include <string.h>
|
|
||||||
#include <Draw_Interpretor.hxx>
|
|
||||||
#include <Draw.hxx>
|
|
||||||
#include <Draw_Appli.hxx>
|
|
||||||
#include <DBRep.hxx>
|
|
||||||
#include <TCollection_AsciiString.hxx>
|
|
||||||
#include <V3d_Viewer.hxx>
|
|
||||||
#include <V3d_View.hxx>
|
|
||||||
#include <V3d.hxx>
|
|
||||||
#include <AIS_DisplayMode.hxx>
|
|
||||||
#include <TColStd_MapOfInteger.hxx>
|
|
||||||
#include <AIS_MapOfInteractive.hxx>
|
|
||||||
#include <ViewerTest_DoubleMapOfInteractiveAndName.hxx>
|
|
||||||
#include <ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName.hxx>
|
|
||||||
#include <ViewerTest_EventManager.hxx>
|
|
||||||
#include <Draw_Window.hxx>
|
|
||||||
#include <AIS_ListIteratorOfListOfInteractive.hxx>
|
|
||||||
#include <AIS_ListOfInteractive.hxx>
|
|
||||||
#include <Aspect_Window.hxx>
|
|
||||||
#include <Aspect_DisplayConnection.hxx>
|
|
||||||
#include <Graphic3d.hxx>
|
|
||||||
#include <Graphic3d_GraphicDriver.hxx>
|
|
||||||
|
|
||||||
#if defined(_WIN32) || defined(__WIN32__)
|
|
||||||
#include <WNT_WClass.hxx>
|
|
||||||
#include <WNT_Window.hxx>
|
|
||||||
#elif defined(__APPLE__) && !defined(MACOSX_USE_GLX)
|
|
||||||
#include <Cocoa_Window.hxx>
|
|
||||||
#else
|
|
||||||
#include <X11/Xlib.h>
|
|
||||||
#include <X11/Xutil.h>
|
|
||||||
#include <Xw_Window.hxx>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//==============================================================================
|
|
||||||
// GLOBAL VARIABLES
|
|
||||||
//==============================================================================
|
|
||||||
#define ZCLIPWIDTH 1.
|
|
||||||
|
|
||||||
static Handle(Aspect_DisplayConnection)& GetDisplayConnection()
|
|
||||||
{
|
|
||||||
static Handle(Aspect_DisplayConnection) aDisplayConnection;
|
|
||||||
static Standard_Boolean isFirst = Standard_True;
|
|
||||||
if (isFirst)
|
|
||||||
{
|
|
||||||
aDisplayConnection = new Aspect_DisplayConnection();
|
|
||||||
isFirst = Standard_False;
|
|
||||||
}
|
|
||||||
return aDisplayConnection;
|
|
||||||
}
|
|
||||||
|
|
||||||
Standard_IMPORT Standard_Boolean Draw_VirtualWindows;
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : MakeViewer
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Handle(V3d_Viewer) ViewerTest_Tool::MakeViewer (const Standard_CString theTitle)
|
|
||||||
{
|
|
||||||
#if defined(_WIN32) || defined(__WIN32__)
|
|
||||||
Handle(Aspect_Window) window = new WNT_Window (theTitle,
|
|
||||||
Handle(WNT_WClass)::DownCast (ViewerTest::WClass()),
|
|
||||||
WS_OVERLAPPEDWINDOW, 0, 460, 409, 409, Quantity_NOC_BLACK);
|
|
||||||
#elif defined(__APPLE__) && !defined(MACOSX_USE_GLX)
|
|
||||||
Handle(Aspect_Window) window = new Cocoa_Window (theTitle, 0, 460, 409, 409);
|
|
||||||
#else
|
|
||||||
Handle(Aspect_Window) window = new Xw_Window (GetDisplayConnection(), theTitle, 0, 460, 409, 409);
|
|
||||||
#endif
|
|
||||||
window->SetVirtual (Draw_VirtualWindows);
|
|
||||||
window->Map();
|
|
||||||
|
|
||||||
// Viewer
|
|
||||||
Handle(Graphic3d_GraphicDriver) aDriver = Graphic3d::InitGraphicDriver (GetDisplayConnection());
|
|
||||||
TCollection_ExtendedString NameOfWindow("Visu3D");
|
|
||||||
Handle(V3d_Viewer) a3DViewer = new V3d_Viewer(aDriver,NameOfWindow.ToExtString());
|
|
||||||
|
|
||||||
a3DViewer->SetDefaultBackgroundColor(Quantity_NOC_BLACK);
|
|
||||||
a3DViewer->SetDefaultLights();
|
|
||||||
a3DViewer->SetLightOn();
|
|
||||||
|
|
||||||
// View
|
|
||||||
Handle (V3d_View) V = a3DViewer->CreateView();
|
|
||||||
V->SetWindow(window);
|
|
||||||
V->SetZClippingDepth(0.5);
|
|
||||||
V->SetZClippingWidth(ZCLIPWIDTH/2.);
|
|
||||||
|
|
||||||
return a3DViewer;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : MakeContext
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Handle(AIS_InteractiveContext) ViewerTest_Tool::MakeContext (const Standard_CString title)
|
|
||||||
{
|
|
||||||
return new AIS_InteractiveContext (MakeViewer(title));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : InitViewerTest
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
// ********* next method is defined in ViewerTest_ViewerCommands.hxx ****
|
|
||||||
extern void ViewerTest_InitViewerTest (const Handle(AIS_InteractiveContext)&);
|
|
||||||
// **********************************************************************
|
|
||||||
|
|
||||||
void ViewerTest_Tool::InitViewerTest (const Handle(AIS_InteractiveContext)& context)
|
|
||||||
{
|
|
||||||
ViewerTest_InitViewerTest (context);
|
|
||||||
}
|
|
||||||
|
|
@ -1010,6 +1010,22 @@ void ActivateView (const TCollection_AsciiString& theViewName)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//==============================================================================
|
||||||
|
//function : RemoveView
|
||||||
|
//purpose :
|
||||||
|
//==============================================================================
|
||||||
|
void ViewerTest::RemoveView (const Handle(V3d_View)& theView,
|
||||||
|
const Standard_Boolean theToRemoveContext)
|
||||||
|
{
|
||||||
|
if (!ViewerTest_myViews.IsBound2 (theView))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const TCollection_AsciiString aViewName = ViewerTest_myViews.Find2 (theView);
|
||||||
|
RemoveView (aViewName, theToRemoveContext);
|
||||||
|
}
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
//function : RemoveView
|
//function : RemoveView
|
||||||
//purpose : Close and remove view from display, clear maps if neccessary
|
//purpose : Close and remove view from display, clear maps if neccessary
|
||||||
@ -2526,38 +2542,6 @@ while (ViewerMainLoop( argc, argv)) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//==============================================================================
|
|
||||||
//function : InitViewerTest
|
|
||||||
//purpose : initialisation de toutes les variables static de ViewerTest (dp)
|
|
||||||
//==============================================================================
|
|
||||||
|
|
||||||
void ViewerTest_InitViewerTest (const Handle(AIS_InteractiveContext)& theContext)
|
|
||||||
{
|
|
||||||
Handle(V3d_Viewer) aViewer = theContext->CurrentViewer();
|
|
||||||
ViewerTest::SetAISContext(theContext);
|
|
||||||
aViewer->InitActiveViews();
|
|
||||||
Handle(V3d_View) aView = aViewer->ActiveView();
|
|
||||||
if (aViewer->MoreActiveViews()) ViewerTest::CurrentView(aView);
|
|
||||||
ViewerTest::ResetEventManager();
|
|
||||||
Handle(Aspect_Window) aWindow = aView->Window();
|
|
||||||
#if !defined(_WIN32) && !defined(__WIN32__) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX))
|
|
||||||
// X11
|
|
||||||
VT_GetWindow() = Handle(Xw_Window)::DownCast(aWindow);
|
|
||||||
OSWindowSetup();
|
|
||||||
static int aFirst = 1;
|
|
||||||
if ( aFirst ) {
|
|
||||||
#if TCL_MAJOR_VERSION < 8
|
|
||||||
Tk_CreateFileHandler((void*)XConnectionNumber(GetDisplayConnection()->GetDisplay()),
|
|
||||||
TK_READABLE, VProcessEvents, (ClientData) 0);
|
|
||||||
#else
|
|
||||||
Tk_CreateFileHandler(XConnectionNumber(GetDisplayConnection()->GetDisplay()),
|
|
||||||
TK_READABLE, VProcessEvents, (ClientData) 0);
|
|
||||||
#endif
|
|
||||||
aFirst = 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
//function : VSetBg
|
//function : VSetBg
|
||||||
//purpose : Load image as background
|
//purpose : Load image as background
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#include <V3d_Viewer.hxx>
|
#include <V3d_Viewer.hxx>
|
||||||
#include <V3d_View.hxx>
|
#include <V3d_View.hxx>
|
||||||
#include <AIS_InteractiveContext.hxx>
|
#include <AIS_InteractiveContext.hxx>
|
||||||
#include <ViewerTest_Tool.hxx>
|
#include <ViewerTest.hxx>
|
||||||
|
|
||||||
#include <DDF_Browser.hxx>
|
#include <DDF_Browser.hxx>
|
||||||
#include <DDocStd.hxx>
|
#include <DDocStd.hxx>
|
||||||
@ -474,37 +474,36 @@ static Standard_Integer show (Draw_Interpretor& di, Standard_Integer argc, const
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle(TDocStd_Document) Doc;
|
Handle(TDocStd_Document) aDoc;
|
||||||
DDocStd::GetDocument(argv[1], Doc);
|
DDocStd::GetDocument (argv[1], aDoc);
|
||||||
if ( Doc.IsNull() ) { di << argv[1] << " is not a document" << "\n"; return 1; }
|
if (aDoc.IsNull())
|
||||||
|
{
|
||||||
|
std::cout << argv[1] << " is not a document\n";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
// init viewer
|
// init viewer
|
||||||
// char string[260];
|
TDF_Label aRoot = aDoc->GetData()->Root();
|
||||||
// Sprintf ( string, "AISInitViewer %s", argv[1] );
|
Handle(TPrsStd_AISViewer) aDocViewer;
|
||||||
// di.Eval ( string );
|
TCollection_AsciiString aViewName = TCollection_AsciiString ("Driver1/Document_") + argv[1] + "/View1";
|
||||||
TDF_Label acces = Doc->GetData()->Root();
|
if (!TPrsStd_AISViewer::Find (aRoot, aDocViewer))
|
||||||
Handle(TPrsStd_AISViewer) viewer;
|
{
|
||||||
if (!TPrsStd_AISViewer::Find (acces,viewer)) {
|
ViewerTest::ViewerInit (0, 0, 0, 0, aViewName.ToCString(), "");
|
||||||
TCollection_AsciiString title;
|
aDocViewer = TPrsStd_AISViewer::New (aRoot, ViewerTest::GetAISContext());
|
||||||
title.Prepend(argv[1]);
|
|
||||||
title.Prepend("_");
|
|
||||||
title.Prepend("Document");
|
|
||||||
Handle(V3d_Viewer) vw=ViewerTest_Tool::MakeViewer (title.ToCString());
|
|
||||||
viewer = TPrsStd_AISViewer::New (acces,vw);
|
|
||||||
}
|
}
|
||||||
ViewerTest_Tool::InitViewerTest (viewer->GetInteractiveContext());
|
|
||||||
|
|
||||||
//szv:CAX-TRJ7 c2-pe-214.stp was clipped
|
//szv:CAX-TRJ7 c2-pe-214.stp was clipped
|
||||||
viewer->GetInteractiveContext()->CurrentViewer()->ActiveView()->SetZSize(ZVIEW_SIZE);
|
aDocViewer->GetInteractiveContext()->CurrentViewer()->InitActiveViews();
|
||||||
|
aDocViewer->GetInteractiveContext()->CurrentViewer()->ActiveView()->SetZSize(ZVIEW_SIZE);
|
||||||
//DDF::ReturnLabel(di,viewer->Label());
|
//DDF::ReturnLabel(di,viewer->Label());
|
||||||
|
|
||||||
// collect sequence of labels to display
|
// collect sequence of labels to display
|
||||||
Handle(XCAFDoc_ShapeTool) shapes = XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
|
Handle(XCAFDoc_ShapeTool) shapes = XCAFDoc_DocumentTool::ShapeTool (aDoc->Main());
|
||||||
TDF_LabelSequence seq;
|
TDF_LabelSequence seq;
|
||||||
if ( argc >2 ) {
|
if ( argc >2 ) {
|
||||||
for ( Standard_Integer i=2; i < argc; i++ ) {
|
for ( Standard_Integer i=2; i < argc; i++ ) {
|
||||||
TDF_Label aLabel;
|
TDF_Label aLabel;
|
||||||
TDF_Tool::Label(Doc->GetData(), argv[i], aLabel);
|
TDF_Tool::Label (aDoc->GetData(), argv[i], aLabel);
|
||||||
if ( aLabel.IsNull() || ! shapes->IsShape ( aLabel ) ) {
|
if ( aLabel.IsNull() || ! shapes->IsShape ( aLabel ) ) {
|
||||||
di << argv[i] << " is not a valid shape label!";
|
di << argv[i] << " is not a valid shape label!";
|
||||||
continue;
|
continue;
|
||||||
@ -531,7 +530,7 @@ static Standard_Integer show (Draw_Interpretor& di, Standard_Integer argc, const
|
|||||||
// prs->SetColor ( Col.Name() );
|
// prs->SetColor ( Col.Name() );
|
||||||
prs->Display(Standard_True);
|
prs->Display(Standard_True);
|
||||||
}
|
}
|
||||||
TPrsStd_AISViewer::Update(Doc->GetData()->Root());
|
TPrsStd_AISViewer::Update (aDoc->GetData()->Root());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1027,9 +1026,10 @@ static Standard_Integer testDoc (Draw_Interpretor&,
|
|||||||
Handle(TDocStd_Document) aD1 = new TDocStd_Document("MDTV-XCAF");
|
Handle(TDocStd_Document) aD1 = new TDocStd_Document("MDTV-XCAF");
|
||||||
aD1->Open(A);
|
aD1->Open(A);
|
||||||
|
|
||||||
Handle(V3d_Viewer) vw = ViewerTest_Tool::MakeViewer ("Test viwer");
|
TCollection_AsciiString aViewName ("Driver1/DummyDocument/View1");
|
||||||
Handle(AIS_InteractiveContext) aContext = new AIS_InteractiveContext(vw);
|
ViewerTest::ViewerInit (0, 0, 0, 0, aViewName.ToCString(), "");
|
||||||
TPrsStd_AISViewer::New (aD1->Main(),aContext);
|
TPrsStd_AISViewer::New (aD1->GetData()->Root(), ViewerTest::GetAISContext());
|
||||||
|
|
||||||
// get shape tool for shape verification
|
// get shape tool for shape verification
|
||||||
Handle(XCAFDoc_ShapeTool) aShapes =
|
Handle(XCAFDoc_ShapeTool) aShapes =
|
||||||
XCAFDoc_DocumentTool::ShapeTool (aD1->Main());
|
XCAFDoc_DocumentTool::ShapeTool (aD1->Main());
|
||||||
@ -1048,11 +1048,11 @@ static Standard_Integer testDoc (Draw_Interpretor&,
|
|||||||
if( aLab.FindAttribute(TPrsStd_AISPresentation::GetID(), prs) )
|
if( aLab.FindAttribute(TPrsStd_AISPresentation::GetID(), prs) )
|
||||||
prs->Display();
|
prs->Display();
|
||||||
|
|
||||||
|
|
||||||
TPrsStd_AISViewer::Update(aLab);
|
TPrsStd_AISViewer::Update(aLab);
|
||||||
aContext->Display(aTriShape, Standard_True);
|
ViewerTest::GetAISContext()->Display (aTriShape, Standard_True);
|
||||||
aD1->BeforeClose();
|
aD1->BeforeClose();
|
||||||
aD1->Close();
|
aD1->Close();
|
||||||
|
ViewerTest::RemoveView (aViewName);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
|
|
||||||
puts "============="
|
|
||||||
puts "BUC60851"
|
|
||||||
puts "============="
|
|
||||||
puts ""
|
|
||||||
##########################################################
|
|
||||||
## After several manipulations with Triedron of V3d_View class it raises an exception
|
|
||||||
## (detected in method Visual3d_View::TriedronDisplay)
|
|
||||||
##########################################################
|
|
||||||
|
|
||||||
BUC60851
|
|
||||||
vfit
|
|
||||||
|
|
||||||
set only_screen 1
|
|
21
tests/bugs/xde/bug24430
Normal file
21
tests/bugs/xde/bug24430
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
puts "============"
|
||||||
|
puts "OCC24430"
|
||||||
|
puts "============"
|
||||||
|
puts ""
|
||||||
|
#######################################################################################
|
||||||
|
# vviewlist draw command does not added name of viewer created by XShow draw command
|
||||||
|
#######################################################################################
|
||||||
|
|
||||||
|
pload DCAF
|
||||||
|
NewDocument D XmlXCAF
|
||||||
|
ReadIges D [locate_data_file bug23921_case2.igs]
|
||||||
|
|
||||||
|
XShow D
|
||||||
|
set info [vviewlist long]
|
||||||
|
if { $info == "" } {
|
||||||
|
puts "Error: viewer name was not added"
|
||||||
|
} else {
|
||||||
|
puts "OK: viewer name was added"
|
||||||
|
}
|
||||||
|
|
||||||
|
set only_screen 1
|
Loading…
x
Reference in New Issue
Block a user