1 // Created on: 2017-06-16
2 // Created by: Natalia ERMOLAEVA
3 // Copyright (c) 2017 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
19 #include <Aspect_Window.hxx>
20 #include <AIS_InteractiveContext.hxx>
21 #include <Quantity_Color.hxx>
22 #include <Standard_Macro.hxx>
23 #include <V3d_Viewer.hxx>
24 #include <V3d_View.hxx>
26 //! \class View_Viewer
27 //! \brief It is responsible for context/viewer/view creation and accepting access to:
33 View_Viewer (const Quantity_Color& theColor) : myDefaultColor(theColor) {}
36 virtual ~View_Viewer() {}
38 //! Returns the view default colors
39 static Quantity_Color DefaultColor() { return Quantity_Color(Quantity_NOC_BLACK); }
41 //! Returns the view default colors
42 static Quantity_Color DisabledColor() { return Quantity_Color(195 / 255., 195 / 255., 195 / 255., Quantity_TOC_sRGB); }
45 Standard_EXPORT void CreateView();
47 //! Fills V3d view by the given window
48 //! \param depending on platform it is either WNT_Window or Xw_Window
49 Standard_EXPORT void SetWindow (const Handle(Aspect_Window)& theWindow);
51 //! Creates OCC components on the window
52 //! \param theWindowHandle an id of the application window
53 Standard_EXPORT void InitViewer (const Handle(AIS_InteractiveContext)& theContext);
55 //! Creates OCC components on the window
56 //! \param theWindowHandle an id of the application window
57 Standard_EXPORT static Handle(AIS_InteractiveContext) CreateStandardViewer();
59 //! Returns an OCC viewer
60 const Handle(V3d_Viewer)& GetViewer() { return myViewer; }
62 //! Returns active view
63 const Handle(V3d_View)& GetView() { return myView; }
65 //! Returns OCCT context to provide display and selection mechanism
66 const Handle(AIS_InteractiveContext)& GetContext() const { return myContext; }
70 Handle(V3d_Viewer) myViewer; //!< the OCCT viewer
71 Handle(V3d_View) myView; //!< the OCCT view window
72 Handle(AIS_InteractiveContext) myContext; //!< OCCT context to provide display and selection mechanism
73 Quantity_Color myDefaultColor; //!< the default color of the viewer
76 #endif // View_Viewer_H