|
||||
File indexing completed on 2025-01-18 10:05:33
0001 // Created on: 2017-02-16 0002 // Created by: Sergey NIKONOV 0003 // Copyright (c) 2000-2017 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 _XCAFDoc_AssemblyItemRef_HeaderFile 0017 #define _XCAFDoc_AssemblyItemRef_HeaderFile 0018 0019 #include <Standard.hxx> 0020 #include <TDF_Attribute.hxx> 0021 #include <XCAFDoc_AssemblyItemId.hxx> 0022 0023 class TDF_RelocationTable; 0024 0025 class XCAFDoc_AssemblyItemRef; 0026 DEFINE_STANDARD_HANDLE(XCAFDoc_AssemblyItemRef, TDF_Attribute) 0027 0028 //! An attribute that describes a weak reference to an assembly item 0029 //! or to a subshape or to an assembly label attribute. 0030 class XCAFDoc_AssemblyItemRef : public TDF_Attribute 0031 { 0032 0033 public: 0034 0035 DEFINE_STANDARD_RTTIEXT(XCAFDoc_AssemblyItemRef, TDF_Attribute) 0036 0037 Standard_EXPORT static const Standard_GUID& GetID(); 0038 0039 //! Finds a reference attribute on the given label and returns it, if it is found 0040 Standard_EXPORT static Handle(XCAFDoc_AssemblyItemRef) Get(const TDF_Label& theLabel); 0041 0042 //! @name Set reference attribute functions. 0043 //! @{ 0044 0045 //! Create (if not exist) a reference to an assembly item. 0046 //! \param [in] theLabel - label to add the attribute. 0047 //! \param [in] theItemId - assembly item ID. 0048 //! \return A handle to the attribute instance. 0049 Standard_EXPORT static Handle(XCAFDoc_AssemblyItemRef) Set(const TDF_Label& theLabel, 0050 const XCAFDoc_AssemblyItemId& theItemId); 0051 0052 //! Create (if not exist) a reference to an assembly item's label attribute. 0053 //! \param [in] theLabel - label to add the attribute. 0054 //! \param [in] theItemId - assembly item ID. 0055 //! \param [in] theGUID - assembly item's label attribute ID. 0056 //! \return A handle to the attribute instance. 0057 Standard_EXPORT static Handle(XCAFDoc_AssemblyItemRef) Set(const TDF_Label& theLabel, 0058 const XCAFDoc_AssemblyItemId& theItemId, 0059 const Standard_GUID& theGUID); 0060 0061 //! Create (if not exist) a reference to an assembly item's subshape. 0062 //! \param [in] theLabel - label to add the attribute. 0063 //! \param [in] theItemId - assembly item ID. 0064 //! \param [in] theShapeIndex - assembly item's subshape index. 0065 //! \return A handle to the attribute instance. 0066 Standard_EXPORT static Handle(XCAFDoc_AssemblyItemRef) Set(const TDF_Label& theLabel, 0067 const XCAFDoc_AssemblyItemId& theItemId, 0068 const Standard_Integer theShapeIndex); 0069 0070 //! @} 0071 0072 //! Creates an empty reference attribute. 0073 Standard_EXPORT XCAFDoc_AssemblyItemRef(); 0074 0075 //! Checks if the reference points to a really existing item in XDE document. 0076 Standard_EXPORT Standard_Boolean IsOrphan() const; 0077 0078 //! @name Extra reference functions. 0079 //! @{ 0080 0081 //! Checks if the reference points on an item's shapeindex or attribute. 0082 Standard_EXPORT Standard_Boolean HasExtraRef() const; 0083 0084 //! Checks is the reference points to an item's attribute. 0085 Standard_EXPORT Standard_Boolean IsGUID() const; 0086 0087 //! Checks is the reference points to an item's subshape. 0088 Standard_EXPORT Standard_Boolean IsSubshapeIndex() const; 0089 0090 //! Returns the assembly item's attribute that the reference points to. 0091 //! If the reference doesn't point to an attribute, returns an empty GUID. 0092 Standard_EXPORT Standard_GUID GetGUID() const; 0093 0094 //! Returns the assembly item's subshape that the reference points to. 0095 //! If the reference doesn't point to a subshape, returns 0. 0096 Standard_EXPORT Standard_Integer GetSubshapeIndex() const; 0097 0098 //! @} 0099 0100 //! Returns the assembly item ID that the reference points to. 0101 Standard_EXPORT const XCAFDoc_AssemblyItemId& GetItem() const; 0102 0103 //! @name Set reference data functions. 0104 //! @{ 0105 0106 //! Sets the assembly item ID that the reference points to. 0107 //! Extra reference data (if any) will be cleared. 0108 Standard_EXPORT void SetItem(const XCAFDoc_AssemblyItemId& theItemId); 0109 0110 //! Sets the assembly item ID from a list of label entries 0111 //! that the reference points to. 0112 //! Extra reference data (if any) will be cleared. 0113 Standard_EXPORT void SetItem(const TColStd_ListOfAsciiString& thePath); 0114 0115 //! Sets the assembly item ID from a formatted path 0116 //! that the reference points to. 0117 //! Extra reference data (if any) will be cleared. 0118 Standard_EXPORT void SetItem(const TCollection_AsciiString& theString); 0119 0120 //! Sets the assembly item's label attribute that the reference points to. 0121 //! The base assembly item will not change. 0122 Standard_EXPORT void SetGUID(const Standard_GUID& theAttrGUID); 0123 0124 //! Sets the assembly item's subshape that the reference points to. 0125 //! The base assembly item will not change. 0126 Standard_EXPORT void SetSubshapeIndex(Standard_Integer theShapeIndex); 0127 0128 //! @} 0129 0130 //! Reverts the reference to empty state. 0131 Standard_EXPORT void ClearExtraRef(); 0132 0133 //! Dumps the content of me into the stream 0134 Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE; 0135 0136 public: 0137 0138 // Overrides TDF_Attribute pure virtuals 0139 Standard_EXPORT const Standard_GUID& ID() const Standard_OVERRIDE; 0140 Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE; 0141 Standard_EXPORT void Restore(const Handle(TDF_Attribute)& theAttrFrom) Standard_OVERRIDE; 0142 Standard_EXPORT void Paste(const Handle(TDF_Attribute)& theAttrInto, 0143 const Handle(TDF_RelocationTable)& theRT) const Standard_OVERRIDE; 0144 Standard_EXPORT Standard_OStream& Dump(Standard_OStream& theOS) const Standard_OVERRIDE; 0145 0146 private: 0147 0148 XCAFDoc_AssemblyItemId myItemId; ///< Assembly item ID 0149 Standard_Integer myExtraRef; ///< Type of extra reference: subshape or attribute 0150 TCollection_AsciiString myExtraId; ///< Extra reference data 0151 0152 }; 0153 0154 #endif // _XCAFDoc_AssemblyItemRef_HeaderFile
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |