14bbbdcb |
1 | // Created on: 2017-06-16 |
2 | // Created by: Natalia ERMOLAEVA |
3 | // Copyright (c) 2017 OPEN CASCADE SAS |
4 | // |
5 | // This file is part of Open CASCADE Technology software library. |
6 | // |
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. |
12 | // |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
15 | |
16 | #ifndef View_Viewer_H |
17 | #define View_Viewer_H |
18 | |
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> |
25 | |
26 | //! \class View_Viewer |
27 | //! \brief It is responsible for context/viewer/view creation and accepting access to: |
28 | class View_Viewer |
29 | { |
30 | public: |
31 | |
32 | //! Constructor |
33 | View_Viewer (const Quantity_Color& theColor) : myDefaultColor(theColor) {} |
34 | |
35 | //! Destructor |
36 | virtual ~View_Viewer() {} |
37 | |
38 | //! Returns the view default colors |
39 | static Quantity_Color DefaultColor() { return Quantity_Color(Quantity_NOC_BLACK); } |
40 | |
41 | //! Returns the view default colors |
7e1c1e48 |
42 | static Quantity_Color DisabledColor() { return Quantity_Color(195 / 255., 195 / 255., 195 / 255., Quantity_TOC_sRGB); } |
14bbbdcb |
43 | |
44 | //! Creates V3d view |
45 | Standard_EXPORT void CreateView(); |
46 | |
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); |
50 | |
51 | //! Creates OCC components on the window |
52 | //! \param theWindowHandle an id of the application window |
7e1c1e48 |
53 | Standard_EXPORT void InitViewer (const Handle(AIS_InteractiveContext)& theContext); |
54 | |
55 | //! Creates OCC components on the window |
56 | //! \param theWindowHandle an id of the application window |
57 | Standard_EXPORT static Handle(AIS_InteractiveContext) CreateStandardViewer(); |
14bbbdcb |
58 | |
59 | //! Returns an OCC viewer |
60 | const Handle(V3d_Viewer)& GetViewer() { return myViewer; } |
61 | |
62 | //! Returns active view |
63 | const Handle(V3d_View)& GetView() { return myView; } |
64 | |
65 | //! Returns OCCT context to provide display and selection mechanism |
66 | const Handle(AIS_InteractiveContext)& GetContext() const { return myContext; } |
67 | |
68 | private: |
69 | |
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 |
74 | }; |
75 | |
76 | #endif // View_Viewer_H |