1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0030493: Draw, ViewerTest - minor improvement of vdisplay command

vdisplay no longer opens BREP file in case if Draw variable is not found.

Draw::Get() unused Complain argument has been removed from method definition.
Added Draw::GetExisting() and DBRep::GetExisting() commands never performing picking.
This commit is contained in:
kgv
2019-02-12 12:22:26 +03:00
committed by apn
parent d95f5ce102
commit 1c8fc6bee2
18 changed files with 234 additions and 282 deletions

View File

@@ -71,10 +71,7 @@ Standard_Boolean DDocStd::GetDocument (Standard_CString& Name,
Handle(TDocStd_Document)& DOC,
const Standard_Boolean Complain)
{
Handle(Draw_Drawable3D) D = Draw::Get(Name,Standard_False);
Handle(DDocStd_DrawDocument) DD = Handle(DDocStd_DrawDocument)::DownCast (D);
Handle(DDocStd_DrawDocument) DD = Handle(DDocStd_DrawDocument)::DownCast (Draw::GetExisting (Name));
if (DD.IsNull()) {
if (Complain) cout << Name << " is not a Document" << endl;
return Standard_False;

View File

@@ -348,8 +348,10 @@ static Standard_Integer DDocStd_Close (Draw_Interpretor& /*theDI*/,
aDocApp->Close (aDoc);
Handle(Draw_Drawable3D) aDrawable = Draw::Get (aDocName, Standard_False);
dout.RemoveDrawable (aDrawable);
if (Handle(Draw_Drawable3D) aDrawable = Draw::GetExisting (aDocName))
{
dout.RemoveDrawable (aDrawable);
}
Draw::Set (theArgVec[1], Handle(Draw_Drawable3D)());
return 0;
}

View File

@@ -206,20 +206,19 @@ static int mtmNestedMode (Draw_Interpretor& di, int n, const char** a)
static Standard_Integer XAttributeValue (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
{
if ( argc <4 ) { di << "ERROR: Too few args\n"; return 0; }
Handle(DDF_Browser) browser =
Handle(DDF_Browser)::DownCast (Draw::Get(argv[1], Standard_True));
if ( browser.IsNull() ) { di << "ERROR: Not a browser: " << argv[1] << "\n"; return 0; }
if ( argc < 4 ) { di << "ERROR: Too few args\n"; return 1; }
Handle(DDF_Browser) browser = Handle(DDF_Browser)::DownCast (Draw::GetExisting (argv[1]));
if ( browser.IsNull() ) { std::cout << "Syntax error: Not a browser: " << argv[1] << "\n"; return 1; }
TDF_Label lab;
TDF_Tool::Label(browser->Data(),argv[2],lab);
if ( lab.IsNull() ) { di << "ERROR: label is Null: " << argv[2] << "\n"; return 0; }
if ( lab.IsNull() ) { di << "Syntax error: label is Null: " << argv[2] << "\n"; return 1; }
Standard_Integer num = Draw::Atoi ( argv[3] );
TDF_AttributeIterator itr(lab,Standard_False);
for (Standard_Integer i=1; itr.More() && i < num; i++) itr.Next();
if ( ! itr.More() ) { di << "ERROR: Attribute #" << num << " not found\n"; return 0; }
if ( ! itr.More() ) { di << "Syntax error: Attribute #" << num << " not found\n"; return 1; }
const Handle(TDF_Attribute)& att = itr.Value();
if ( att->IsKind(STANDARD_TYPE(TDataStd_TreeNode)) )