1 // Created on: 2016-10-19
2 // Created by: Irina KRYLOVA
3 // Copyright (c) 2016 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.
16 #ifndef _XCAFDoc_ViewTool_HeaderFile
17 #define _XCAFDoc_ViewTool_HeaderFile
19 #include <Standard.hxx>
20 #include <Standard_Type.hxx>
22 #include <TDF_Attribute.hxx>
23 #include <Standard_Boolean.hxx>
24 #include <TDF_LabelSequence.hxx>
25 #include <Standard_Integer.hxx>
27 class XCAFDoc_ShapeTool;
28 class XCAFDoc_DimTolTool;
34 class XCAFDoc_ViewTool;
35 DEFINE_STANDARD_HANDLE(XCAFDoc_ViewTool, TDF_Attribute)
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
49 Standard_EXPORT XCAFDoc_ViewTool();
51 //! Creates (if not exist) ViewTool.
52 Standard_EXPORT static Handle(XCAFDoc_ViewTool) Set (const TDF_Label& L);
54 Standard_EXPORT static const Standard_GUID& GetID();
56 //! Returns the label under which Views are stored
57 Standard_EXPORT TDF_Label BaseLabel() const;
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;
63 //! Returns a sequence of View labels currently stored
65 Standard_EXPORT void GetViewLabels (TDF_LabelSequence& theLabels) const;
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;
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;
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;
86 //! Set Clipping planes to given View
87 Standard_EXPORT void SetClippingPlanes(const TDF_LabelSequence& theClippingPlaneLabels,
88 const TDF_Label& theViewL) const;
91 Standard_EXPORT void RemoveView(const TDF_Label& theViewL);
93 //! Returns all View labels defined for label ShapeL
94 Standard_EXPORT Standard_Boolean GetViewLabelsForShape (const TDF_Label& theShapeL, TDF_LabelSequence& theViews) const;
96 //! Returns all View labels defined for label GDTL
97 Standard_EXPORT Standard_Boolean GetViewLabelsForGDT (const TDF_Label& theGDTL, TDF_LabelSequence& theViews) const;
99 //! Returns all View labels defined for label ClippingPlaneL
100 Standard_EXPORT Standard_Boolean GetViewLabelsForClippingPlane(const TDF_Label& theClippingPlaneL, TDF_LabelSequence& theViews) const;
102 //! Returns all View labels defined for label NoteL
103 Standard_EXPORT Standard_Boolean GetViewLabelsForNote(const TDF_Label& theNoteL, TDF_LabelSequence& theViews) const;
105 //! Returns all View labels defined for label AnnotationL
106 Standard_EXPORT Standard_Boolean GetViewLabelsForAnnotation(const TDF_Label& theAnnotationL, TDF_LabelSequence& theViews) const;
108 //! Adds a view definition to a View table and returns its label
109 Standard_EXPORT TDF_Label AddView() ;
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;
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;
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;
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;
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;
131 //! Returns true if the given View is marked as locked
132 Standard_EXPORT Standard_Boolean IsLocked(const TDF_Label& theViewL) const;
134 //! Mark the given View as locked
135 Standard_EXPORT void Lock(const TDF_Label& theViewL) const;
137 //! Unlock the given View
138 Standard_EXPORT void Unlock(const TDF_Label& theViewL) const;
140 Standard_EXPORT const Standard_GUID& ID() const Standard_OVERRIDE;
142 Standard_EXPORT void Restore (const Handle(TDF_Attribute)& with) Standard_OVERRIDE;
144 Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
146 Standard_EXPORT void Paste (const Handle(TDF_Attribute)& into, const Handle(TDF_RelocationTable)& RT) const Standard_OVERRIDE;
148 DEFINE_STANDARD_RTTIEXT(XCAFDoc_ViewTool, TDF_Attribute)
151 #endif // _XCAFDoc_ViewTool_HeaderFile