0033661: Data Exchange, Step Import - Tessellated GDTs are not imported
[occt.git] / src / XCAFDoc / XCAFDoc_ViewTool.hxx
1 // Created on: 2016-10-19
2 // Created by: Irina KRYLOVA
3 // Copyright (c) 2016 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 _XCAFDoc_ViewTool_HeaderFile
17 #define _XCAFDoc_ViewTool_HeaderFile
18
19 #include <Standard.hxx>
20 #include <Standard_Type.hxx>
21
22 #include <TDF_Attribute.hxx>
23 #include <Standard_Boolean.hxx>
24 #include <TDF_LabelSequence.hxx>
25 #include <Standard_Integer.hxx>
26
27 class XCAFDoc_ShapeTool;
28 class XCAFDoc_DimTolTool;
29 class TDF_Label;
30 class Standard_GUID;
31 class TDF_Attribute;
32
33
34 class XCAFDoc_ViewTool;
35 DEFINE_STANDARD_HANDLE(XCAFDoc_ViewTool, TDF_Attribute)
36
37 //! Provides tools to store and retrieve Views
38 //! in and from TDocStd_Document
39 //! Each View contains parts XCAFDoc_View attribute
40 //! with all information about camera and view window.
41 //! Also each view contain information of displayed shapes and GDTs
42 //! as sets of shape and GDT labels.
43 class XCAFDoc_ViewTool : public TDF_Attribute
44 {
45
46 public:
47
48   
49   Standard_EXPORT XCAFDoc_ViewTool();
50   
51   //! Creates (if not exist) ViewTool.
52   Standard_EXPORT static Handle(XCAFDoc_ViewTool) Set (const TDF_Label& L);
53   
54   Standard_EXPORT static const Standard_GUID& GetID();
55   
56   //! Returns the label under which Views are stored
57   Standard_EXPORT TDF_Label BaseLabel() const;
58   
59   //! Returns True if label belongs to a View table and
60   //! is a View definition
61   Standard_EXPORT Standard_Boolean IsView (const TDF_Label& theLabel) const;
62   
63   //! Returns a sequence of View labels currently stored
64   //! in the View table
65   Standard_EXPORT void GetViewLabels (TDF_LabelSequence& theLabels) const;
66
67   //! Sets a link with GUID
68   Standard_EXPORT void SetView(const TDF_LabelSequence& theShapes,
69                                const TDF_LabelSequence& theGDTs,
70                                const TDF_LabelSequence& theClippingPlanes,
71                                const TDF_LabelSequence& theNotes,
72                                const TDF_LabelSequence& theAnnotations,
73                                const TDF_Label& theViewL) const;
74
75   //! Sets a link with GUID
76   Standard_EXPORT void SetView (const TDF_LabelSequence& theShapes,
77                                 const TDF_LabelSequence& theGDTs,
78                                 const TDF_LabelSequence& theClippingPlanes,
79                                 const TDF_Label& theViewL) const;
80
81   //! Sets a link with GUID
82   Standard_EXPORT void SetView(const TDF_LabelSequence& theShapes,
83                                const TDF_LabelSequence& theGDTs,
84                                const TDF_Label& theViewL) const;
85
86   //! Set Clipping planes to  given View
87   Standard_EXPORT void SetClippingPlanes(const TDF_LabelSequence& theClippingPlaneLabels,
88                                          const TDF_Label& theViewL) const;
89
90   //! Remove View
91   Standard_EXPORT void RemoveView(const TDF_Label& theViewL);
92
93   //! Returns all View labels defined for label ShapeL
94   Standard_EXPORT Standard_Boolean GetViewLabelsForShape (const TDF_Label& theShapeL, TDF_LabelSequence& theViews) const;
95
96   //! Returns all View labels defined for label GDTL
97   Standard_EXPORT Standard_Boolean GetViewLabelsForGDT (const TDF_Label& theGDTL, TDF_LabelSequence& theViews) const;
98
99   //! Returns all View labels defined for label ClippingPlaneL
100   Standard_EXPORT Standard_Boolean GetViewLabelsForClippingPlane(const TDF_Label& theClippingPlaneL, TDF_LabelSequence& theViews) const;
101
102   //! Returns all View labels defined for label NoteL
103   Standard_EXPORT Standard_Boolean GetViewLabelsForNote(const TDF_Label& theNoteL, TDF_LabelSequence& theViews) const;
104
105   //! Returns all View labels defined for label AnnotationL
106   Standard_EXPORT Standard_Boolean GetViewLabelsForAnnotation(const TDF_Label& theAnnotationL, TDF_LabelSequence& theViews) const;
107
108   //! Adds a view definition to a View table and returns its label
109   Standard_EXPORT TDF_Label AddView() ;
110   
111   //! Returns shape labels defined for label theViewL
112   //! Returns False if the theViewL is not in View table
113   Standard_EXPORT Standard_Boolean GetRefShapeLabel (const TDF_Label& theViewL, TDF_LabelSequence& theShapeLabels) const;
114   
115   //! Returns GDT labels defined for label theViewL
116   //! Returns False if the theViewL is not in View table
117   Standard_EXPORT Standard_Boolean GetRefGDTLabel (const TDF_Label& theViewL, TDF_LabelSequence& theGDTLabels) const;
118
119   //! Returns ClippingPlane labels defined for label theViewL
120   //! Returns False if the theViewL is not in View table
121   Standard_EXPORT Standard_Boolean GetRefClippingPlaneLabel(const TDF_Label& theViewL, TDF_LabelSequence& theClippingPlaneLabels) const;
122
123   //! Returns Notes labels defined for label theViewL
124   //! Returns False if the theViewL is not in View table
125   Standard_EXPORT Standard_Boolean GetRefNoteLabel(const TDF_Label& theViewL, TDF_LabelSequence& theNoteLabels) const;
126
127   //! Returns Annotation labels defined for label theViewL
128   //! Returns False if the theViewL is not in View table
129   Standard_EXPORT Standard_Boolean GetRefAnnotationLabel(const TDF_Label& theViewL, TDF_LabelSequence& theAnnotationLabels) const;
130
131   //! Returns true if the given View is marked as locked
132   Standard_EXPORT Standard_Boolean IsLocked(const TDF_Label& theViewL) const;
133
134   //! Mark the given View as locked
135   Standard_EXPORT void Lock(const TDF_Label& theViewL) const;
136
137   //! Unlock the given View
138   Standard_EXPORT void Unlock(const TDF_Label& theViewL) const;
139   
140   Standard_EXPORT const Standard_GUID& ID() const Standard_OVERRIDE;
141   
142   Standard_EXPORT void Restore (const Handle(TDF_Attribute)& with) Standard_OVERRIDE;
143   
144   Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
145   
146   Standard_EXPORT void Paste (const Handle(TDF_Attribute)& into, const Handle(TDF_RelocationTable)& RT) const Standard_OVERRIDE;
147
148   DEFINE_STANDARD_RTTIEXT(XCAFDoc_ViewTool, TDF_Attribute)
149
150 };
151 #endif // _XCAFDoc_ViewTool_HeaderFile