| 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> |
| 26 | |
| 27 | class TDF_Label; |
| 28 | class gp_Pnt; |
| 29 | class Standard_GUID; |
| 30 | class TDF_Attribute; |
| 31 | class TDF_RelocationTable; |
| 32 | |
| 33 | |
| 34 | class TDataXtd_Presentation; |
| 35 | DEFINE_STANDARD_HANDLE(TDataXtd_Presentation, TDF_Attribute) |
| 36 | |
| 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 |
| 41 | { |
| 42 | public: |
| 43 | //!@name Attribute mechanics |
| 44 | |
| 45 | //! Empty constructor |
| 46 | Standard_EXPORT TDataXtd_Presentation(); |
| 47 | |
| 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); |
| 50 | |
| 51 | //! Remove attribute of this type from the label |
| 52 | Standard_EXPORT static void Unset(const TDF_Label& theLabel); |
| 53 | |
| 54 | //! Returns the ID of the attribute. |
| 55 | Standard_EXPORT const Standard_GUID& ID() const Standard_OVERRIDE; |
| 56 | |
| 57 | //! Returns the ID of the attribute. |
| 58 | Standard_EXPORT static const Standard_GUID& GetID(); |
| 59 | |
| 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; |
| 63 | |
| 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; |
| 67 | |
| 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; |
| 77 | |
| 78 | Standard_EXPORT Handle(TDF_Attribute) BackupCopy() const Standard_OVERRIDE; |
| 79 | |
| 80 | DEFINE_STANDARD_RTTIEXT(TDataXtd_Presentation,TDF_Attribute) |
| 81 | |
| 82 | public: |
| 83 | //!@name Access to data |
| 84 | |
| 85 | //! Returns the GUID of the driver managing display of associated AIS object |
| 86 | Standard_EXPORT Standard_GUID GetDriverGUID() const; |
| 87 | |
| 88 | //! Sets the GUID of the driver managing display of associated AIS object |
| 89 | Standard_EXPORT void SetDriverGUID(const Standard_GUID& theGUID); |
| 90 | |
| 91 | Standard_EXPORT Standard_Boolean IsDisplayed() const; |
| 92 | |
| 93 | Standard_EXPORT Standard_Boolean HasOwnMaterial() const; |
| 94 | |
| 95 | Standard_EXPORT Standard_Boolean HasOwnTransparency() const; |
| 96 | |
| 97 | Standard_EXPORT Standard_Boolean HasOwnColor() const; |
| 98 | |
| 99 | Standard_EXPORT Standard_Boolean HasOwnWidth() const; |
| 100 | |
| 101 | Standard_EXPORT Standard_Boolean HasOwnMode() const; |
| 102 | |
| 103 | Standard_EXPORT Standard_Boolean HasOwnSelectionMode() const; |
| 104 | |
| 105 | Standard_EXPORT void SetDisplayed(const Standard_Boolean theIsDisplayed); |
| 106 | |
| 107 | Standard_EXPORT void SetMaterialIndex(const Standard_Integer theMaterialIndex); |
| 108 | |
| 109 | Standard_EXPORT void SetTransparency(const Standard_Real theValue); |
| 110 | |
| 111 | Standard_EXPORT void SetColor(const Quantity_NameOfColor theColor); |
| 112 | |
| 113 | Standard_EXPORT void SetWidth(const Standard_Real theWidth); |
| 114 | |
| 115 | Standard_EXPORT void SetMode(const Standard_Integer theMode); |
| 116 | |
| 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); |
| 124 | |
| 125 | Standard_EXPORT Standard_Integer MaterialIndex() const; |
| 126 | |
| 127 | Standard_EXPORT Standard_Real Transparency() const; |
| 128 | |
| 129 | Standard_EXPORT Quantity_NameOfColor Color() const; |
| 130 | |
| 131 | Standard_EXPORT Standard_Real Width() const; |
| 132 | |
| 133 | Standard_EXPORT Standard_Integer Mode() const; |
| 134 | |
| 135 | Standard_EXPORT Standard_Integer SelectionMode() const; |
| 136 | |
| 137 | Standard_EXPORT void UnsetMaterial(); |
| 138 | |
| 139 | Standard_EXPORT void UnsetTransparency(); |
| 140 | |
| 141 | Standard_EXPORT void UnsetColor(); |
| 142 | |
| 143 | Standard_EXPORT void UnsetWidth(); |
| 144 | |
| 145 | Standard_EXPORT void UnsetMode(); |
| 146 | |
| 147 | Standard_EXPORT void UnsetSelectionMode(); |
| 148 | |
| 149 | private: |
| 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; |
| 164 | }; |
| 165 | |
| 166 | #endif // _TDataXtd_Presentation_HeaderFile |