1 // Created on: 2016-11-29
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_ClippingPlaneTool_HeaderFile
17 #define _XCAFDoc_ClippingPlaneTool_HeaderFile
20 #include <TDF_LabelSequence.hxx>
22 class XCAFDoc_ClippingPlaneTool;
23 DEFINE_STANDARD_HANDLE(XCAFDoc_ClippingPlaneTool, TDF_Attribute)
25 //! Provide tool for management of ClippingPlane section of document.
26 //! Provide tool to store, retrieve, remove and modify clipping planes.
27 //! Each clipping plane consists of gp_Pln and its name.
28 class XCAFDoc_ClippingPlaneTool : public TDF_Attribute
34 Standard_EXPORT XCAFDoc_ClippingPlaneTool();
36 //! Creates (if not exist) ClippingPlaneTool.
37 Standard_EXPORT static Handle(XCAFDoc_ClippingPlaneTool) Set (const TDF_Label& theLabel);
39 Standard_EXPORT static const Standard_GUID& GetID();
41 //! returns the label under which ClippingPlanes are stored
42 Standard_EXPORT TDF_Label BaseLabel() const;
44 //! Returns True if label belongs to a ClippingPlane table and
45 //! is a ClippingPlane definition
46 Standard_EXPORT Standard_Boolean IsClippingPlane (const TDF_Label& theLabel) const;
48 //! Returns ClippingPlane defined by label lab
49 //! Returns False if the label is not in ClippingPlane table
50 //! or does not define a ClippingPlane
51 Standard_EXPORT Standard_Boolean GetClippingPlane(const TDF_Label& theLabel, gp_Pln& thePlane, TCollection_ExtendedString& theName, Standard_Boolean &theCapping) const;
53 //! Returns ClippingPlane defined by label lab
54 //! Returns False if the label is not in ClippingPlane table
55 //! or does not define a ClippingPlane
56 Standard_EXPORT Standard_Boolean GetClippingPlane(const TDF_Label& theLabel, gp_Pln& thePlane, Handle(TCollection_HAsciiString)& theName, Standard_Boolean &theCapping) const;
58 //! Adds a clipping plane definition to a ClippingPlane table and returns
59 //! its label (returns existing label if the same clipping plane
60 //! is already defined)
61 Standard_EXPORT TDF_Label AddClippingPlane(const gp_Pln thePlane, const TCollection_ExtendedString theName, const Standard_Boolean theCapping) const;
63 //! Adds a clipping plane definition to a ClippingPlane table and returns
64 //! its label (returns existing label if the same clipping plane
65 //! is already defined)
66 Standard_EXPORT TDF_Label AddClippingPlane(const gp_Pln thePlane, const Handle(TCollection_HAsciiString)& theName, const Standard_Boolean theCapping) const;
68 //! Adds a clipping plane definition to a ClippingPlane table and returns
69 //! its label (returns existing label if the same clipping plane
70 //! is already defined)
71 Standard_EXPORT TDF_Label AddClippingPlane(const gp_Pln thePlane, const TCollection_ExtendedString theName) const;
73 //! Adds a clipping plane definition to a ClippingPlane table and returns
74 //! its label (returns existing label if the same clipping plane
75 //! is already defined)
76 Standard_EXPORT TDF_Label AddClippingPlane(const gp_Pln thePlane, const Handle(TCollection_HAsciiString)& theName) const;
78 //! Removes clipping plane from the ClippingPlane table
79 //! Return false and do nothing if clipping plane is referenced in at least one View
80 Standard_EXPORT Standard_Boolean RemoveClippingPlane(const TDF_Label& theLabel) const;
82 //! Returns a sequence of clipping planes currently stored
83 //! in the ClippingPlane table
84 Standard_EXPORT void GetClippingPlanes(TDF_LabelSequence& Labels) const;
86 //! Sets new value of plane and name to the given clipping plane label
87 //! or do nothing, if the given label is not a clipping plane label
88 Standard_EXPORT void UpdateClippingPlane(const TDF_Label& theLabelL, const gp_Pln thePlane, const TCollection_ExtendedString theName) const;
90 //! Set new value of capping for given clipping plane label
91 Standard_EXPORT void SetCapping(const TDF_Label& theClippingPlaneL, const Standard_Boolean theCapping);
93 //! Get capping value for given clipping plane label
94 //! Return capping value
95 Standard_EXPORT Standard_Boolean GetCapping(const TDF_Label& theClippingPlaneL) const;
97 //! Get capping value for given clipping plane label
98 //! Return true if Label is valid abd capping is exist.
99 Standard_EXPORT Standard_Boolean GetCapping(const TDF_Label& theClippingPlaneL, Standard_Boolean &theCapping) const;
101 Standard_EXPORT const Standard_GUID& ID() const Standard_OVERRIDE;
103 Standard_EXPORT void Restore (const Handle(TDF_Attribute)& with) Standard_OVERRIDE;
105 Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
107 Standard_EXPORT void Paste (const Handle(TDF_Attribute)& into, const Handle(TDF_RelocationTable)& RT) const Standard_OVERRIDE;
109 //! Dumps the content of me into the stream
110 Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
115 DEFINE_STANDARD_RTTIEXT(XCAFDoc_ClippingPlaneTool, TDF_Attribute)
118 #endif // _XCAFDoc_ClippingPlaneTool_HeaderFile