1 // Created on: 2009-04-06
2 // Created by: Sergey ZARITCHNY
3 // Copyright (c) 2009-2014 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 _TDataXtd_Presentation_HeaderFile
17 #define _TDataXtd_Presentation_HeaderFile
19 #include <Standard.hxx>
20 #include <Standard_Type.hxx>
21 #include <Standard_GUID.hxx>
24 #include <TDF_Attribute.hxx>
25 #include <Quantity_NameOfColor.hxx>
31 class TDF_RelocationTable;
34 class TDataXtd_Presentation;
35 DEFINE_STANDARD_HANDLE(TDataXtd_Presentation, TDF_Attribute)
37 //! Attribute containing parameters of presentation of the shape,
38 //! e.g. the shape attached to the same label and displayed using
39 //! TPrsStd tools (see TPrsStd_AISPresentation).
40 class TDataXtd_Presentation : public TDF_Attribute
43 //!@name Attribute mechanics
46 Standard_EXPORT TDataXtd_Presentation();
48 //! Create if not found the TDataXtd_Presentation attribute and set its driver GUID
49 Standard_EXPORT static Handle(TDataXtd_Presentation) Set(const TDF_Label& theLabel, const Standard_GUID& theDriverId);
51 //! Remove attribute of this type from the label
52 Standard_EXPORT static void Unset(const TDF_Label& theLabel);
54 //! Returns the ID of the attribute.
55 Standard_EXPORT const Standard_GUID& ID() const Standard_OVERRIDE;
57 //! Returns the ID of the attribute.
58 Standard_EXPORT static const Standard_GUID& GetID();
60 //! Restores the contents from <anAttribute> into this
61 //! one. It is used when aborting a transaction.
62 Standard_EXPORT virtual void Restore (const Handle(TDF_Attribute)& anAttribute) Standard_OVERRIDE;
64 //! Returns an new empty attribute from the good end
65 //! type. It is used by the copy algorithm.
66 Standard_EXPORT virtual Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
68 //! This method is different from the "Copy" one,
69 //! because it is used when copying an attribute from
70 //! a source structure into a target structure. This
71 //! method pastes the current attribute to the label
72 //! corresponding to the insertor. The pasted
73 //! attribute may be a brand new one or a new version
74 //! of the previous one.
75 Standard_EXPORT virtual void Paste (const Handle(TDF_Attribute)& intoAttribute,
76 const Handle(TDF_RelocationTable)& aRelocTationable) const Standard_OVERRIDE;
78 Standard_EXPORT Handle(TDF_Attribute) BackupCopy() const Standard_OVERRIDE;
80 DEFINE_STANDARD_RTTIEXT(TDataXtd_Presentation,TDF_Attribute)
83 //!@name Access to data
85 //! Returns the GUID of the driver managing display of associated AIS object
86 Standard_EXPORT Standard_GUID GetDriverGUID() const;
88 //! Sets the GUID of the driver managing display of associated AIS object
89 Standard_EXPORT void SetDriverGUID(const Standard_GUID& theGUID);
91 Standard_EXPORT Standard_Boolean IsDisplayed() const;
93 Standard_EXPORT Standard_Boolean HasOwnMaterial() const;
95 Standard_EXPORT Standard_Boolean HasOwnTransparency() const;
97 Standard_EXPORT Standard_Boolean HasOwnColor() const;
99 Standard_EXPORT Standard_Boolean HasOwnWidth() const;
101 Standard_EXPORT Standard_Boolean HasOwnMode() const;
103 Standard_EXPORT Standard_Boolean HasOwnSelectionMode() const;
105 Standard_EXPORT void SetDisplayed(const Standard_Boolean theIsDisplayed);
107 Standard_EXPORT void SetMaterialIndex(const Standard_Integer theMaterialIndex);
109 Standard_EXPORT void SetTransparency(const Standard_Real theValue);
111 Standard_EXPORT void SetColor(const Quantity_NameOfColor theColor);
113 Standard_EXPORT void SetWidth(const Standard_Real theWidth);
115 Standard_EXPORT void SetMode(const Standard_Integer theMode);
117 //! Sets selection mode.
118 //! If "theTransaction" flag is OFF, modification of the attribute doesn't influence the transaction mechanism
119 //! (the attribute doesn't participate in undo/redo).
120 //! Certainly, if any other data of the attribute is modified (display mode, color, ...),
121 //! the attribute will be included into transaction.
122 //! Obsolete method (may be removed later).
123 Standard_EXPORT void SetSelectionMode(const Standard_Integer theSelectionMode, const Standard_Boolean theTransaction = Standard_True);
125 Standard_EXPORT Standard_Integer MaterialIndex() const;
127 Standard_EXPORT Standard_Real Transparency() const;
129 Standard_EXPORT Quantity_NameOfColor Color() const;
131 Standard_EXPORT Standard_Real Width() const;
133 Standard_EXPORT Standard_Integer Mode() const;
135 Standard_EXPORT Standard_Integer SelectionMode() const;
137 Standard_EXPORT void UnsetMaterial();
139 Standard_EXPORT void UnsetTransparency();
141 Standard_EXPORT void UnsetColor();
143 Standard_EXPORT void UnsetWidth();
145 Standard_EXPORT void UnsetMode();
147 Standard_EXPORT void UnsetSelectionMode();
150 Standard_GUID myDriverGUID;
151 Quantity_NameOfColor myColor;
152 Standard_Integer myMaterialIndex;
153 Standard_Integer myMode;
154 Standard_Integer mySelectionMode;
155 Standard_Real myTransparency;
156 Standard_Real myWidth;
157 Standard_Boolean myIsDisplayed;
158 Standard_Boolean myHasOwnColor;
159 Standard_Boolean myHasOwnMaterial;
160 Standard_Boolean myHasOwnTransparency;
161 Standard_Boolean myHasOwnWidth;
162 Standard_Boolean myHasOwnMode;
163 Standard_Boolean myHasOwnSelectionMode;
166 #endif // _TDataXtd_Presentation_HeaderFile