42cf5bc1 |
1 | // Created on: 1998-09-30 |
2 | // Created by: Denis PASCAL |
3 | // Copyright (c) 1998-1999 Matra Datavision |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
5 | // |
6 | // This file is part of Open CASCADE Technology software library. |
7 | // |
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. |
13 | // |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
16 | |
17 | #ifndef _TPrsStd_AISViewer_HeaderFile |
18 | #define _TPrsStd_AISViewer_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_Type.hxx> |
22 | |
23 | #include <TDF_Attribute.hxx> |
24 | #include <Standard_Boolean.hxx> |
25 | class AIS_InteractiveContext; |
26 | class Standard_GUID; |
27 | class TDF_Label; |
28 | class V3d_Viewer; |
29 | class TDF_Attribute; |
30 | class TDF_RelocationTable; |
31 | |
32 | |
33 | class TPrsStd_AISViewer; |
34 | DEFINE_STANDARD_HANDLE(TPrsStd_AISViewer, TDF_Attribute) |
35 | |
36 | //! The groundwork to define an interactive viewer attribute. |
37 | //! This attribute stores an interactive context at the root label. |
38 | //! You can only have one instance of this class per data framework. |
39 | class TPrsStd_AISViewer : public TDF_Attribute |
40 | { |
41 | |
42 | public: |
43 | |
44 | |
45 | //! class methods |
46 | //! ============= |
47 | Standard_EXPORT static const Standard_GUID& GetID(); |
48 | |
49 | //! returns True if there is an AISViewer attribute in |
50 | //! <acces> Data Framework. |
51 | Standard_EXPORT static Standard_Boolean Has (const TDF_Label& acces); |
52 | |
53 | //! create and set an AISViewer at. Raise an exception if |
54 | //! Has. |
55 | Standard_EXPORT static Handle(TPrsStd_AISViewer) New (const TDF_Label& access, const Handle(AIS_InteractiveContext)& selector); |
56 | |
57 | //! create and set an AISAttribute at root label. The |
58 | //! interactive context is build. Raise an exception if |
59 | //! Has. |
60 | Standard_EXPORT static Handle(TPrsStd_AISViewer) New (const TDF_Label& acces, const Handle(V3d_Viewer)& viewer); |
61 | |
62 | |
63 | //! Finds the viewer attribute at the label access, the |
64 | //! root of the data framework. Calling this function can be used to initialize an AIS viewer |
65 | Standard_EXPORT static Standard_Boolean Find (const TDF_Label& acces, Handle(TPrsStd_AISViewer)& A); |
66 | |
67 | Standard_EXPORT static Standard_Boolean Find (const TDF_Label& acces, Handle(AIS_InteractiveContext)& IC); |
68 | |
69 | Standard_EXPORT static Standard_Boolean Find (const TDF_Label& acces, Handle(V3d_Viewer)& V); |
70 | |
71 | //! AISViewer methods |
72 | //! ================= |
73 | Standard_EXPORT static void Update (const TDF_Label& acces); |
74 | |
75 | Standard_EXPORT TPrsStd_AISViewer(); |
76 | |
77 | //! Updates the viewer at the label access. |
78 | //! access is the root of the data framework. |
79 | Standard_EXPORT void Update() const; |
80 | |
81 | //! Sets the interactive context ctx for this attribute. |
82 | Standard_EXPORT void SetInteractiveContext (const Handle(AIS_InteractiveContext)& ctx); |
83 | |
84 | //! Returns the interactive context in this attribute. |
85 | Standard_EXPORT Handle(AIS_InteractiveContext) GetInteractiveContext() const; |
86 | |
79104795 |
87 | Standard_EXPORT const Standard_GUID& ID() const Standard_OVERRIDE; |
42cf5bc1 |
88 | |
79104795 |
89 | Standard_EXPORT void Restore (const Handle(TDF_Attribute)& with) Standard_OVERRIDE; |
42cf5bc1 |
90 | |
79104795 |
91 | Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE; |
42cf5bc1 |
92 | |
79104795 |
93 | Standard_EXPORT void Paste (const Handle(TDF_Attribute)& into, const Handle(TDF_RelocationTable)& RT) const Standard_OVERRIDE; |
42cf5bc1 |
94 | |
95 | |
96 | |
97 | |
92efcf78 |
98 | DEFINE_STANDARD_RTTIEXT(TPrsStd_AISViewer,TDF_Attribute) |
42cf5bc1 |
99 | |
100 | protected: |
101 | |
102 | |
103 | |
104 | |
105 | private: |
106 | |
107 | |
108 | Handle(AIS_InteractiveContext) myInteractiveContext; |
109 | |
110 | |
111 | }; |
112 | |
113 | |
114 | |
115 | |
116 | |
117 | |
118 | |
119 | #endif // _TPrsStd_AISViewer_HeaderFile |