1 // Created on: 1998-10-27
2 // Created by: Denis PASCAL
3 // Copyright (c) 1998-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #include <DPrsStd.hxx>
20 #include <Draw_Appli.hxx>
21 #include <Draw_Interpretor.hxx>
22 #include <Draw_ColorKind.hxx>
23 #include <TCollection_AsciiString.hxx>
24 #include <TDocStd_Document.hxx>
25 #include <TDF_Label.hxx>
26 #include <TDF_Data.hxx>
27 #include <TDF_Tool.hxx>
28 #include <TDF_ChildIterator.hxx>
30 #include <DDocStd.hxx>
31 #include <ViewerTest.hxx>
32 #include <V3d_View.hxx>
33 #include <TPrsStd_AISPresentation.hxx>
34 #include <TPrsStd_AISViewer.hxx>
35 #include <AIS_InteractiveContext.hxx>
37 //=======================================================================
38 //function : DPrsStd_AISInitViewer
39 //purpose : AISInitViewer (DOC)
40 //=======================================================================
42 static Standard_Integer DPrsStd_AISInitViewer (Draw_Interpretor& theDI,
43 Standard_Integer theArgNb,
44 const char** theArgVec)
48 std::cout << "DPrsStd_AISInitViewer : Error\n";
52 Handle(TDocStd_Document) aDoc;
53 if (!DDocStd::GetDocument (theArgVec[1], aDoc))
58 TDF_Label aRoot = aDoc->GetData()->Root();
59 Handle(TPrsStd_AISViewer) aDocViewer;
60 TCollection_AsciiString aViewName = TCollection_AsciiString ("Driver1/Document_") + theArgVec[1] + "/View1";
61 if (!TPrsStd_AISViewer::Find (aRoot, aDocViewer))
63 ViewerTest::ViewerInit (0, 0, 0, 0, aViewName.ToCString(), "");
64 aDocViewer = TPrsStd_AISViewer::New (aRoot, ViewerTest::GetAISContext());
67 DDF::ReturnLabel (theDI, aDocViewer->Label());
72 //=======================================================================
73 //function : TPrsStd_AISRepaint
75 //=======================================================================
77 static Standard_Integer DPrsStd_AISRepaint (Draw_Interpretor& di,
82 Handle(TDocStd_Document) D;
83 if (!DDocStd::GetDocument(arg[1],D)) return 1;
84 TDF_Label acces = D->GetData()->Root();
85 TPrsStd_AISViewer::Update(acces);
88 di << "DPrsStd_AISRepaint : Error\n";
92 //=======================================================================
93 //function : AISViewerCommands
95 //=======================================================================
98 void DPrsStd::AISViewerCommands (Draw_Interpretor& theCommands)
101 static Standard_Boolean done = Standard_False;
103 done = Standard_True;
104 const char* g = "DPrsStd : standard presentation commands" ;
106 // standard commands working on AISViewer
108 theCommands.Add ("AISInitViewer",
109 "AISInitViewer (DOC)",
110 __FILE__, DPrsStd_AISInitViewer, g);
112 theCommands.Add ("AISRepaint",
113 "update the AIS viewer",
114 __FILE__, DPrsStd_AISRepaint, g);