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 <TDataStd_GenericEmpty.hxx>
23 #include <Standard_Boolean.hxx>
24 #include <TDF_LabelSequence.hxx>
25 #include <Standard_Integer.hxx>
31 class XCAFDoc_ViewTool;
32 DEFINE_STANDARD_HANDLE(XCAFDoc_ViewTool, TDataStd_GenericEmpty)
34 //! Provides tools to store and retrieve Views
35 //! in and from TDocStd_Document
36 //! Each View contains parts XCAFDoc_View attribute
37 //! with all information about camera and view window.
38 //! Also each view contain information of displayed shapes and GDTs
39 //! as sets of shape and GDT labels.
40 class XCAFDoc_ViewTool : public TDataStd_GenericEmpty
46 Standard_EXPORT XCAFDoc_ViewTool();
48 //! Creates (if not exist) ViewTool.
49 Standard_EXPORT static Handle(XCAFDoc_ViewTool) Set (const TDF_Label& L);
51 Standard_EXPORT static const Standard_GUID& GetID();
53 //! Returns the label under which Views are stored
54 Standard_EXPORT TDF_Label BaseLabel() const;
56 //! Returns True if label belongs to a View table and
57 //! is a View definition
58 Standard_EXPORT Standard_Boolean IsView (const TDF_Label& theLabel) const;
60 //! Returns a sequence of View labels currently stored
62 Standard_EXPORT void GetViewLabels (TDF_LabelSequence& theLabels) const;
64 //! Sets a link with GUID
65 Standard_EXPORT void SetView(const TDF_LabelSequence& theShapes,
66 const TDF_LabelSequence& theGDTs,
67 const TDF_LabelSequence& theClippingPlanes,
68 const TDF_LabelSequence& theNotes,
69 const TDF_LabelSequence& theAnnotations,
70 const TDF_Label& theViewL) const;
72 //! Sets a link with GUID
73 Standard_EXPORT void SetView (const TDF_LabelSequence& theShapes,
74 const TDF_LabelSequence& theGDTs,
75 const TDF_LabelSequence& theClippingPlanes,
76 const TDF_Label& theViewL) const;
78 //! Sets a link with GUID
79 Standard_EXPORT void SetView(const TDF_LabelSequence& theShapes,
80 const TDF_LabelSequence& theGDTs,
81 const TDF_Label& theViewL) const;
83 //! Set Clipping planes to given View
84 Standard_EXPORT void SetClippingPlanes(const TDF_LabelSequence& theClippingPlaneLabels,
85 const TDF_Label& theViewL) const;
88 Standard_EXPORT void RemoveView(const TDF_Label& theViewL);
90 //! Returns all View labels defined for label ShapeL
91 Standard_EXPORT Standard_Boolean GetViewLabelsForShape (const TDF_Label& theShapeL, TDF_LabelSequence& theViews) const;
93 //! Returns all View labels defined for label GDTL
94 Standard_EXPORT Standard_Boolean GetViewLabelsForGDT (const TDF_Label& theGDTL, TDF_LabelSequence& theViews) const;
96 //! Returns all View labels defined for label ClippingPlaneL
97 Standard_EXPORT Standard_Boolean GetViewLabelsForClippingPlane(const TDF_Label& theClippingPlaneL, TDF_LabelSequence& theViews) const;
99 //! Returns all View labels defined for label NoteL
100 Standard_EXPORT Standard_Boolean GetViewLabelsForNote(const TDF_Label& theNoteL, TDF_LabelSequence& theViews) const;
102 //! Returns all View labels defined for label AnnotationL
103 Standard_EXPORT Standard_Boolean GetViewLabelsForAnnotation(const TDF_Label& theAnnotationL, TDF_LabelSequence& theViews) const;
105 //! Adds a view definition to a View table and returns its label
106 Standard_EXPORT TDF_Label AddView() ;
108 //! Returns shape labels defined for label theViewL
109 //! Returns False if the theViewL is not in View table
110 Standard_EXPORT Standard_Boolean GetRefShapeLabel (const TDF_Label& theViewL, TDF_LabelSequence& theShapeLabels) const;
112 //! Returns GDT labels defined for label theViewL
113 //! Returns False if the theViewL is not in View table
114 Standard_EXPORT Standard_Boolean GetRefGDTLabel (const TDF_Label& theViewL, TDF_LabelSequence& theGDTLabels) const;
116 //! Returns ClippingPlane labels defined for label theViewL
117 //! Returns False if the theViewL is not in View table
118 Standard_EXPORT Standard_Boolean GetRefClippingPlaneLabel(const TDF_Label& theViewL, TDF_LabelSequence& theClippingPlaneLabels) const;
120 //! Returns Notes labels defined for label theViewL
121 //! Returns False if the theViewL is not in View table
122 Standard_EXPORT Standard_Boolean GetRefNoteLabel(const TDF_Label& theViewL, TDF_LabelSequence& theNoteLabels) const;
124 //! Returns Annotation labels defined for label theViewL
125 //! Returns False if the theViewL is not in View table
126 Standard_EXPORT Standard_Boolean GetRefAnnotationLabel(const TDF_Label& theViewL, TDF_LabelSequence& theAnnotationLabels) const;
128 //! Returns true if the given View is marked as locked
129 Standard_EXPORT Standard_Boolean IsLocked(const TDF_Label& theViewL) const;
131 //! Mark the given View as locked
132 Standard_EXPORT void Lock(const TDF_Label& theViewL) const;
134 //! Unlock the given View
135 Standard_EXPORT void Unlock(const TDF_Label& theViewL) const;
137 Standard_EXPORT const Standard_GUID& ID() const Standard_OVERRIDE;
140 DEFINE_DERIVED_ATTRIBUTE(XCAFDoc_ViewTool, TDataStd_GenericEmpty)
142 #endif // _XCAFDoc_ViewTool_HeaderFile