1 // Created on: 1998-10-15
2 // Created by: Denis PASCAL
3 // Copyright (c) 1998-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
6 // The content of this file is subject to the Open CASCADE Technology Public
7 // License Version 6.5 (the "License"). You may not use the content of this file
8 // except in compliance with the License. Please obtain a copy of the License
9 // at http://www.opencascade.org and read it completely before using this file.
11 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 // The Original Code and all software distributed under the License is
15 // distributed on an "AS IS" basis, without warranty of any kind, and the
16 // Initial Developer hereby disclaims all such warranties, including without
17 // limitation, any warranties of merchantability, fitness for a particular
18 // purpose or non-infringement. Please see the License for the specific terms
19 // and conditions governing the rights and limitations under the License.
26 #include <ViewerTest_Tool.ixx>
28 #include <V3d_View.hxx>
29 #include <AIS_InteractiveContext.hxx>
30 #include <ViewerTest.hxx>
32 #include <Draw_Interpretor.hxx>
34 #include <Draw_Appli.hxx>
36 #include <Graphic3d_GraphicDevice.hxx>
37 #include <Xw_GraphicDevice.hxx>
38 #include <Xw_WindowQuality.hxx>
39 #include <Xw_Window.hxx>
40 #include <Graphic3d_GraphicDevice.hxx>
41 #include <Xw_GraphicDevice.hxx>
42 #include <Xw_WindowQuality.hxx>
43 #include <Xw_Window.hxx>
44 #include <TCollection_AsciiString.hxx>
45 #include <V3d_Viewer.hxx>
46 #include <V3d_View.hxx>
48 #include <AIS_DisplayMode.hxx>
49 #include <TColStd_MapOfInteger.hxx>
50 #include <AIS_MapOfInteractive.hxx>
51 #include <ViewerTest_DoubleMapOfInteractiveAndName.hxx>
52 #include <ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName.hxx>
53 #include <ViewerTest_EventManager.hxx>
54 #include <Draw_Window.hxx>
55 #include <AIS_ListIteratorOfListOfInteractive.hxx>
56 #include <AIS_ListOfInteractive.hxx>
57 #include <Aspect_Window.hxx>
62 #include <X11/Xutil.h>
64 #include <WNT_WClass.hxx>
65 #include <WNT_Window.hxx>
66 #include <Graphic3d_WNTGraphicDevice.hxx>
73 //==============================================================================
75 //==============================================================================
80 static Handle(Graphic3d_WNTGraphicDevice) GetDevice() {
81 static Handle(Graphic3d_WNTGraphicDevice) myDevice;
83 if ( first ) myDevice = new Graphic3d_WNTGraphicDevice();
90 static Handle(Graphic3d_GraphicDevice)& GetDevice() {
91 static Handle(Graphic3d_GraphicDevice) myDevice;
93 if ( first ) myDevice = new Graphic3d_GraphicDevice (getenv("DISPLAY"),Xw_TOM_READONLY);
98 //static Display *display;
103 Standard_IMPORT Standard_Boolean Draw_VirtualWindows;
105 //=======================================================================
106 //function : MakeViewer
108 //=======================================================================
110 Handle(V3d_Viewer) ViewerTest_Tool::MakeViewer (const Standard_CString title)
113 Handle(Aspect_Window) window;
117 window = new WNT_Window (GetDevice(),
119 Handle(WNT_WClass)::DownCast (ViewerTest::WClass()),
126 window = new Xw_Window(GetDevice(),
132 window->SetVirtual (Draw_VirtualWindows);
136 Handle(Aspect_GraphicDevice) theDevice = GetDevice();
137 TCollection_ExtendedString NameOfWindow("Visu3D");
138 Handle(V3d_Viewer) a3DViewer = new V3d_Viewer(theDevice,NameOfWindow.ToExtString());
141 a3DViewer->SetDefaultBackgroundColor(Quantity_NOC_BLACK);
142 a3DViewer->SetDefaultLights();
143 a3DViewer->SetLightOn();
146 Handle (V3d_View) V = a3DViewer->CreateView();
147 V->SetDegenerateModeOn();
148 V->SetWindow(window);
149 V->SetZClippingDepth(0.5);
150 V->SetZClippingWidth(ZCLIPWIDTH/2.);
155 //=======================================================================
156 //function : MakeContext
158 //=======================================================================
160 Handle(AIS_InteractiveContext) ViewerTest_Tool::MakeContext (const Standard_CString title)
162 return new AIS_InteractiveContext (MakeViewer(title));
167 //=======================================================================
168 //function : InitViewerTest
170 //=======================================================================
172 // ********* next method is defined in ViewerTest_ViewerCommands.hxx ****
173 extern void ViewerTest_InitViewerTest (const Handle(AIS_InteractiveContext)&);
174 // **********************************************************************
176 void ViewerTest_Tool::InitViewerTest (const Handle(AIS_InteractiveContext)& context)
178 ViewerTest_InitViewerTest (context);