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 <TCollection_HAsciiString.hxx>
21 #include <TDF_LabelSequence.hxx>
22 #include <TDataStd_GenericEmpty.hxx>
24 class XCAFDoc_ClippingPlaneTool;
25 DEFINE_STANDARD_HANDLE(XCAFDoc_ClippingPlaneTool, TDataStd_GenericEmpty)
27 //! Provide tool for management of ClippingPlane section of document.
28 //! Provide tool to store, retrieve, remove and modify clipping planes.
29 //! Each clipping plane consists of gp_Pln and its name.
30 class XCAFDoc_ClippingPlaneTool : public TDataStd_GenericEmpty
36 Standard_EXPORT XCAFDoc_ClippingPlaneTool();
38 //! Creates (if not exist) ClippingPlaneTool.
39 Standard_EXPORT static Handle(XCAFDoc_ClippingPlaneTool) Set (const TDF_Label& theLabel);
41 Standard_EXPORT static const Standard_GUID& GetID();
43 //! returns the label under which ClippingPlanes are stored
44 Standard_EXPORT TDF_Label BaseLabel() const;
46 //! Returns True if label belongs to a ClippingPlane table and
47 //! is a ClippingPlane definition
48 Standard_EXPORT Standard_Boolean IsClippingPlane (const TDF_Label& theLabel) const;
50 //! Returns ClippingPlane defined by label lab
51 //! Returns False if the label is not in ClippingPlane table
52 //! or does not define a ClippingPlane
53 Standard_EXPORT Standard_Boolean GetClippingPlane(const TDF_Label& theLabel, gp_Pln& thePlane, TCollection_ExtendedString& theName, Standard_Boolean &theCapping) const;
55 //! Returns ClippingPlane defined by label lab
56 //! Returns False if the label is not in ClippingPlane table
57 //! or does not define a ClippingPlane
58 Standard_EXPORT Standard_Boolean GetClippingPlane(const TDF_Label& theLabel, gp_Pln& thePlane, Handle(TCollection_HAsciiString)& theName, Standard_Boolean &theCapping) const;
60 //! Adds a clipping plane definition to a ClippingPlane table and returns
61 //! its label (returns existing label if the same clipping plane
62 //! is already defined)
63 Standard_EXPORT TDF_Label AddClippingPlane(const gp_Pln& thePlane, const TCollection_ExtendedString theName, const Standard_Boolean theCapping) const;
65 //! Adds a clipping plane definition to a ClippingPlane table and returns
66 //! its label (returns existing label if the same clipping plane
67 //! is already defined)
68 Standard_EXPORT TDF_Label AddClippingPlane(const gp_Pln& thePlane, const Handle(TCollection_HAsciiString)& theName, const Standard_Boolean theCapping) const;
70 //! Adds a clipping plane definition to a ClippingPlane table and returns
71 //! its label (returns existing label if the same clipping plane
72 //! is already defined)
73 Standard_EXPORT TDF_Label AddClippingPlane(const gp_Pln& thePlane, const TCollection_ExtendedString theName) const;
75 //! Adds a clipping plane definition to a ClippingPlane table and returns
76 //! its label (returns existing label if the same clipping plane
77 //! is already defined)
78 Standard_EXPORT TDF_Label AddClippingPlane(const gp_Pln& thePlane, const Handle(TCollection_HAsciiString)& theName) const;
80 //! Removes clipping plane from the ClippingPlane table
81 //! Return false and do nothing if clipping plane is referenced in at least one View
82 Standard_EXPORT Standard_Boolean RemoveClippingPlane(const TDF_Label& theLabel) const;
84 //! Returns a sequence of clipping planes currently stored
85 //! in the ClippingPlane table
86 Standard_EXPORT void GetClippingPlanes(TDF_LabelSequence& Labels) const;
88 //! Sets new value of plane and name to the given clipping plane label
89 //! or do nothing, if the given label is not a clipping plane label
90 Standard_EXPORT void UpdateClippingPlane(const TDF_Label& theLabelL, const gp_Pln& thePlane, const TCollection_ExtendedString theName) const;
92 //! Set new value of capping for given clipping plane label
93 Standard_EXPORT void SetCapping(const TDF_Label& theClippingPlaneL, const Standard_Boolean theCapping);
95 //! Get capping value for given clipping plane label
96 //! Return capping value
97 Standard_EXPORT Standard_Boolean GetCapping(const TDF_Label& theClippingPlaneL) const;
99 //! Get capping value for given clipping plane label
100 //! Return true if Label is valid abd capping is exist.
101 Standard_EXPORT Standard_Boolean GetCapping(const TDF_Label& theClippingPlaneL, Standard_Boolean &theCapping) const;
103 Standard_EXPORT const Standard_GUID& ID() const Standard_OVERRIDE;
107 DEFINE_DERIVED_ATTRIBUTE(XCAFDoc_ClippingPlaneTool, TDataStd_GenericEmpty)
110 #endif // _XCAFDoc_ClippingPlaneTool_HeaderFile