1 #ifndef HYDROData_Object_HeaderFile
2 #define HYDROData_Object_HeaderFile
6 #include <NCollection_Sequence.hxx>
7 #include <TDF_Label.hxx>
10 ///! Kind of an object in a document
11 typedef int ObjectKind;
12 ///! Unrecognized object
13 const ObjectKind KIND_UNKNOWN = 0;
14 const ObjectKind KIND_IMAGE = 1;
15 const ObjectKind KIND_POLYLINE = 2;
17 DEFINE_STANDARD_HANDLE(HYDROData_Object, MMgt_TShared)
19 /**\class HYDROData_Object
20 * \brief Generic class of any object in the data model.
22 * Interface for getting access to the object that belong to the data model.
23 * Managed by Document. Provides access to the common properties:
24 * kind of an object, name.
26 class HYDROData_Object : public MMgt_TShared
29 DEFINE_STANDARD_RTTI(HYDROData_Object);
32 * Returns the kind of this object. Must be redefined in all objects of known type.
34 HYDRODATA_EXPORT virtual const ObjectKind GetKind() const {return KIND_UNKNOWN;}
37 * Returns the name of this object.
39 HYDRODATA_EXPORT QString GetName() const;
42 * Updates the name of this object.
44 HYDRODATA_EXPORT void SetName(const QString& theName);
47 * Returns the object visibility state.
48 * \returns visibility state
50 HYDRODATA_EXPORT bool GetVisibility() const;
53 * Sets the object visibility state.
54 * \param theState visibility state
56 HYDRODATA_EXPORT void SetVisibility(bool theState);
59 * Checks is object exists in the data structure.
60 * \returns true is object is not exists in the data model
62 HYDRODATA_EXPORT bool IsRemoved() const;
65 * Removes object from the data structure.
67 HYDRODATA_EXPORT void Remove();
70 * Returns unique integer identifier of the object (may be used for ordering of objects)
72 HYDRODATA_EXPORT inline int ID() const {return myLab.Tag();}
75 * Copies all properties of this to the destinated object.
76 * Objects must be the same type.
77 * \param theDestination initialized object (from any document) - target of copying
79 HYDRODATA_EXPORT void CopyTo(Handle_HYDROData_Object theDestination) const;
82 * Returns the label of this object.
84 HYDRODATA_EXPORT TDF_Label& Label() {return myLab;}
88 friend class HYDROData_Iterator;
91 * Creates new object in the internal data structure. Use higher level objects
92 * to create objects with real content.
94 HYDRODATA_EXPORT HYDROData_Object();
97 * Destructs properties of the object and object itself, removes it from the document.
99 virtual HYDRODATA_EXPORT ~HYDROData_Object();
102 * Put the object to the label of the document.
103 * \param theLabel new label of the object
105 HYDRODATA_EXPORT virtual void SetLabel(TDF_Label theLabel);
108 * Internal method that used to store the byte array attribute
109 * \param theTag tag of a label to store attribute (for 0 this is myLab)
110 * \param theData pointer to bytes array
111 * \param theLen number of bytes in byte array that must be stored
113 void SaveByteArray(const int theTag, const char* theData, const int theLen);
116 * Internal method that used to retreive the content of byte array attribute
117 * \param theTag tag of a label that keeps the attribute (for 0 this is myLab)
118 * \param theLen number of bytes in byte array
119 * \returns pointer to the internal data structure wit harray content,
120 * or NULL if array size is zero
122 const char* ByteArray(const int theTag, int& theLen);
125 /// Array of pointers to the properties of this object; index in this array is returned by \a AddProperty.
126 TDF_Label myLab; ///< label of this object
129 typedef NCollection_Sequence<Handle_HYDROData_Object> HYDROData_SequenceOfObjects;
131 ///! Is Equal for HYDROData_Object mapping
132 HYDRODATA_EXPORT bool IsEqual(const Handle_HYDROData_Object& theObj1, const Handle_HYDROData_Object& theObj2);