0030480: Visualization - Clear of Select3D_SensitiveGroup does not update internal...
[occt.git] / src / TDataXtd / TDataXtd_Presentation.hxx
CommitLineData
f47afe53 1// Created on: 2009-04-06
2// Created by: Sergey ZARITCHNY
3// Copyright (c) 2009-2014 OPEN CASCADE SAS
4//
5// This file is part of Open CASCADE Technology software library.
6//
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.
12//
13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
15
16#ifndef _TDataXtd_Presentation_HeaderFile
17#define _TDataXtd_Presentation_HeaderFile
18
19#include <Standard.hxx>
20#include <Standard_Type.hxx>
21#include <Standard_GUID.hxx>
22
23#include <gp_Pnt.hxx>
24#include <TDF_Attribute.hxx>
25#include <Quantity_NameOfColor.hxx>
a0d0f96a 26#include <TColStd_ListOfInteger.hxx>
f47afe53 27
28class TDF_Label;
29class gp_Pnt;
30class Standard_GUID;
31class TDF_Attribute;
32class TDF_RelocationTable;
33
34
35class TDataXtd_Presentation;
36DEFINE_STANDARD_HANDLE(TDataXtd_Presentation, TDF_Attribute)
37
38//! Attribute containing parameters of presentation of the shape,
39//! e.g. the shape attached to the same label and displayed using
40//! TPrsStd tools (see TPrsStd_AISPresentation).
41class TDataXtd_Presentation : public TDF_Attribute
42{
43public:
44 //!@name Attribute mechanics
45
46 //! Empty constructor
47 Standard_EXPORT TDataXtd_Presentation();
48
49 //! Create if not found the TDataXtd_Presentation attribute and set its driver GUID
50 Standard_EXPORT static Handle(TDataXtd_Presentation) Set(const TDF_Label& theLabel, const Standard_GUID& theDriverId);
51
52 //! Remove attribute of this type from the label
53 Standard_EXPORT static void Unset(const TDF_Label& theLabel);
54
55 //! Returns the ID of the attribute.
56 Standard_EXPORT const Standard_GUID& ID() const Standard_OVERRIDE;
57
58 //! Returns the ID of the attribute.
59 Standard_EXPORT static const Standard_GUID& GetID();
60
61 //! Restores the contents from <anAttribute> into this
62 //! one. It is used when aborting a transaction.
63 Standard_EXPORT virtual void Restore (const Handle(TDF_Attribute)& anAttribute) Standard_OVERRIDE;
64
65 //! Returns an new empty attribute from the good end
66 //! type. It is used by the copy algorithm.
67 Standard_EXPORT virtual Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
68
69 //! This method is different from the "Copy" one,
70 //! because it is used when copying an attribute from
71 //! a source structure into a target structure. This
72 //! method pastes the current attribute to the label
73 //! corresponding to the insertor. The pasted
74 //! attribute may be a brand new one or a new version
75 //! of the previous one.
76 Standard_EXPORT virtual void Paste (const Handle(TDF_Attribute)& intoAttribute,
77 const Handle(TDF_RelocationTable)& aRelocTationable) const Standard_OVERRIDE;
78
79 Standard_EXPORT Handle(TDF_Attribute) BackupCopy() const Standard_OVERRIDE;
80
81 DEFINE_STANDARD_RTTIEXT(TDataXtd_Presentation,TDF_Attribute)
82
83public:
84 //!@name Access to data
85
86 //! Returns the GUID of the driver managing display of associated AIS object
87 Standard_EXPORT Standard_GUID GetDriverGUID() const;
88
89 //! Sets the GUID of the driver managing display of associated AIS object
90 Standard_EXPORT void SetDriverGUID(const Standard_GUID& theGUID);
91
92 Standard_EXPORT Standard_Boolean IsDisplayed() const;
93
94 Standard_EXPORT Standard_Boolean HasOwnMaterial() const;
95
96 Standard_EXPORT Standard_Boolean HasOwnTransparency() const;
97
98 Standard_EXPORT Standard_Boolean HasOwnColor() const;
99
100 Standard_EXPORT Standard_Boolean HasOwnWidth() const;
101
102 Standard_EXPORT Standard_Boolean HasOwnMode() const;
103
104 Standard_EXPORT Standard_Boolean HasOwnSelectionMode() const;
105
106 Standard_EXPORT void SetDisplayed(const Standard_Boolean theIsDisplayed);
107
108 Standard_EXPORT void SetMaterialIndex(const Standard_Integer theMaterialIndex);
109
110 Standard_EXPORT void SetTransparency(const Standard_Real theValue);
111
112 Standard_EXPORT void SetColor(const Quantity_NameOfColor theColor);
113
114 Standard_EXPORT void SetWidth(const Standard_Real theWidth);
115
116 Standard_EXPORT void SetMode(const Standard_Integer theMode);
117
a0d0f96a 118 //! Returns the number of selection modes of the attribute.
119 //! It starts with 1 .. GetNbSelectionModes().
120 Standard_EXPORT Standard_Integer GetNbSelectionModes() const;
121
31e8d3c1 122 //! Sets selection mode.
123 //! If "theTransaction" flag is OFF, modification of the attribute doesn't influence the transaction mechanism
a0d0f96a 124 //! (the attribute doesn't participate in undo/redo because of this modification).
31e8d3c1 125 //! Certainly, if any other data of the attribute is modified (display mode, color, ...),
a0d0f96a 126 //! the attribute will be included into undo/redo.
31e8d3c1 127 Standard_EXPORT void SetSelectionMode(const Standard_Integer theSelectionMode, const Standard_Boolean theTransaction = Standard_True);
a0d0f96a 128 Standard_EXPORT void AddSelectionMode(const Standard_Integer theSelectionMode, const Standard_Boolean theTransaction = Standard_True);
f47afe53 129
130 Standard_EXPORT Standard_Integer MaterialIndex() const;
131
132 Standard_EXPORT Standard_Real Transparency() const;
133
134 Standard_EXPORT Quantity_NameOfColor Color() const;
135
136 Standard_EXPORT Standard_Real Width() const;
137
138 Standard_EXPORT Standard_Integer Mode() const;
139
a0d0f96a 140 Standard_EXPORT Standard_Integer SelectionMode(const int index = 1) const;
f47afe53 141
142 Standard_EXPORT void UnsetMaterial();
143
144 Standard_EXPORT void UnsetTransparency();
145
146 Standard_EXPORT void UnsetColor();
147
148 Standard_EXPORT void UnsetWidth();
149
150 Standard_EXPORT void UnsetMode();
151
152 Standard_EXPORT void UnsetSelectionMode();
153
154private:
155 Standard_GUID myDriverGUID;
156 Quantity_NameOfColor myColor;
157 Standard_Integer myMaterialIndex;
158 Standard_Integer myMode;
a0d0f96a 159 TColStd_ListOfInteger mySelectionModes;
f47afe53 160 Standard_Real myTransparency;
161 Standard_Real myWidth;
162 Standard_Boolean myIsDisplayed;
163 Standard_Boolean myHasOwnColor;
164 Standard_Boolean myHasOwnMaterial;
165 Standard_Boolean myHasOwnTransparency;
166 Standard_Boolean myHasOwnWidth;
167 Standard_Boolean myHasOwnMode;
168 Standard_Boolean myHasOwnSelectionMode;
a0d0f96a 169
170 //! Checks a list of selection modes.
171 Standard_Boolean HasSelectionMode(const Standard_Integer theSelectionMode) const;
f47afe53 172};
173
174#endif // _TDataXtd_Presentation_HeaderFile