Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:05:20

0001 // Created on: 2009-04-06
0002 // Created by: Sergey ZARITCHNY
0003 // Copyright (c) 2009-2014 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef _TDataXtd_Presentation_HeaderFile
0017 #define _TDataXtd_Presentation_HeaderFile
0018 
0019 #include <Standard.hxx>
0020 #include <Standard_GUID.hxx>
0021 
0022 #include <gp_Pnt.hxx>
0023 #include <TDF_Attribute.hxx>
0024 #include <Quantity_NameOfColor.hxx>
0025 #include <TColStd_ListOfInteger.hxx>
0026 
0027 class TDF_Label;
0028 class TDF_RelocationTable;
0029 
0030 
0031 class TDataXtd_Presentation;
0032 DEFINE_STANDARD_HANDLE(TDataXtd_Presentation, TDF_Attribute)
0033 
0034 //! Attribute containing parameters of presentation of the shape,
0035 //! e.g. the shape attached to the same label and displayed using 
0036 //! TPrsStd tools (see TPrsStd_AISPresentation).
0037 class TDataXtd_Presentation : public TDF_Attribute
0038 {
0039 public:
0040   //!@name Attribute mechanics
0041   
0042   //! Empty constructor
0043   Standard_EXPORT TDataXtd_Presentation();
0044 
0045   //! Create if not found the TDataXtd_Presentation attribute and set its driver GUID
0046   Standard_EXPORT static Handle(TDataXtd_Presentation) Set(const TDF_Label& theLabel, const Standard_GUID& theDriverId);
0047   
0048   //! Remove attribute of this type from the label
0049   Standard_EXPORT static void Unset(const TDF_Label& theLabel);
0050   
0051   //! Returns the ID of the attribute.
0052   Standard_EXPORT const Standard_GUID& ID() const Standard_OVERRIDE;
0053 
0054   //! Returns the ID of the attribute.
0055   Standard_EXPORT static const Standard_GUID& GetID();
0056   
0057   //! Restores the contents from <anAttribute> into this
0058   //! one. It is used when aborting a transaction.
0059   Standard_EXPORT virtual void Restore (const Handle(TDF_Attribute)& anAttribute) Standard_OVERRIDE;
0060   
0061   //! Returns an new empty attribute from the good end
0062   //! type. It is used by the copy algorithm.
0063   Standard_EXPORT virtual Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
0064   
0065   //! This method is different from the "Copy" one,
0066   //! because it is used when copying an attribute from
0067   //! a source structure into a target structure. This
0068   //! method pastes the current attribute to the label
0069   //! corresponding to the insertor. The pasted
0070   //! attribute may be a brand new one or a new version
0071   //! of the previous one.
0072   Standard_EXPORT virtual void Paste (const Handle(TDF_Attribute)& intoAttribute, 
0073                                       const Handle(TDF_RelocationTable)& aRelocTationable) const Standard_OVERRIDE;
0074 
0075   Standard_EXPORT Handle(TDF_Attribute) BackupCopy() const Standard_OVERRIDE;
0076 
0077   DEFINE_STANDARD_RTTIEXT(TDataXtd_Presentation,TDF_Attribute)
0078 
0079 public:
0080   //!@name Access to data
0081 
0082   //! Returns the GUID of the driver managing display of associated AIS object
0083   Standard_EXPORT Standard_GUID GetDriverGUID() const;
0084 
0085   //! Sets the GUID of the driver managing display of associated AIS object
0086   Standard_EXPORT void SetDriverGUID(const Standard_GUID& theGUID);
0087   
0088   Standard_EXPORT Standard_Boolean IsDisplayed() const;
0089 
0090   Standard_EXPORT Standard_Boolean HasOwnMaterial() const;
0091 
0092   Standard_EXPORT Standard_Boolean HasOwnTransparency() const;
0093 
0094   Standard_EXPORT Standard_Boolean HasOwnColor() const;
0095 
0096   Standard_EXPORT Standard_Boolean HasOwnWidth() const;
0097 
0098   Standard_EXPORT Standard_Boolean HasOwnMode() const;
0099 
0100   Standard_EXPORT Standard_Boolean HasOwnSelectionMode() const;
0101 
0102   Standard_EXPORT void SetDisplayed(const Standard_Boolean theIsDisplayed);
0103 
0104   Standard_EXPORT void SetMaterialIndex(const Standard_Integer theMaterialIndex);
0105 
0106   Standard_EXPORT void SetTransparency(const Standard_Real theValue);
0107 
0108   Standard_EXPORT void SetColor(const Quantity_NameOfColor theColor);
0109 
0110   Standard_EXPORT void SetWidth(const Standard_Real theWidth);
0111 
0112   Standard_EXPORT void SetMode(const Standard_Integer theMode);
0113 
0114   //! Returns the number of selection modes of the attribute.
0115   //! It starts with 1 .. GetNbSelectionModes().
0116   Standard_EXPORT Standard_Integer GetNbSelectionModes() const;
0117 
0118   //! Sets selection mode.
0119   //! If "theTransaction" flag is OFF, modification of the attribute doesn't influence the transaction mechanism
0120   //! (the attribute doesn't participate in undo/redo because of this modification).
0121   //! Certainly, if any other data of the attribute is modified (display mode, color, ...),
0122   //! the attribute will be included into undo/redo.
0123   Standard_EXPORT void SetSelectionMode(const Standard_Integer theSelectionMode, const Standard_Boolean theTransaction = Standard_True);
0124   Standard_EXPORT void AddSelectionMode(const Standard_Integer theSelectionMode, const Standard_Boolean theTransaction = Standard_True);
0125 
0126   Standard_EXPORT Standard_Integer MaterialIndex() const;
0127 
0128   Standard_EXPORT Standard_Real Transparency() const;
0129 
0130   Standard_EXPORT Quantity_NameOfColor Color() const;
0131 
0132   Standard_EXPORT Standard_Real Width() const;
0133 
0134   Standard_EXPORT Standard_Integer Mode() const;
0135 
0136   Standard_EXPORT Standard_Integer SelectionMode(const int index = 1) const;
0137 
0138   Standard_EXPORT void UnsetMaterial();
0139 
0140   Standard_EXPORT void UnsetTransparency();
0141 
0142   Standard_EXPORT void UnsetColor();
0143 
0144   Standard_EXPORT void UnsetWidth();
0145 
0146   Standard_EXPORT void UnsetMode();
0147 
0148   Standard_EXPORT void UnsetSelectionMode();
0149 
0150 public:
0151   //! Convert values of old Quantity_NameOfColor to new enumeration for reading old documents
0152   //! after #0030969 (Coding Rules - refactor Quantity_Color.cxx color table definition).
0153   Standard_EXPORT static Quantity_NameOfColor getColorNameFromOldEnum (Standard_Integer theOld);
0154 
0155   //! Convert Quantity_NameOfColor to old enumeration value for writing documents in compatible format.
0156   Standard_EXPORT static Standard_Integer getOldColorNameFromNewEnum (Quantity_NameOfColor theNew);
0157 
0158 private:
0159   Standard_GUID  myDriverGUID;
0160   Quantity_NameOfColor myColor;
0161   Standard_Integer myMaterialIndex;
0162   Standard_Integer myMode;
0163   TColStd_ListOfInteger mySelectionModes;
0164   Standard_Real myTransparency;
0165   Standard_Real myWidth;
0166   Standard_Boolean myIsDisplayed;
0167   Standard_Boolean myHasOwnColor;
0168   Standard_Boolean myHasOwnMaterial;
0169   Standard_Boolean myHasOwnTransparency;
0170   Standard_Boolean myHasOwnWidth;
0171   Standard_Boolean myHasOwnMode;
0172   Standard_Boolean myHasOwnSelectionMode;
0173 
0174   //! Checks a list of selection modes.
0175   Standard_Boolean HasSelectionMode(const Standard_Integer theSelectionMode) const;
0176 };
0177 
0178 #endif // _TDataXtd_Presentation_HeaderFile