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 * Checks is object exists in the data structure.
48 * \returns true is object is not exists in the data model
50 HYDRODATA_EXPORT bool IsRemoved() const;
53 * Removes object from the data structure.
55 HYDRODATA_EXPORT void Remove();
58 * Returns unique integer identifier of the object (may be used for ordering of objects)
60 HYDRODATA_EXPORT inline int ID() const {return myLab.Tag();}
63 * Copies all properties of this to the destinated object.
64 * Objects must be the same type.
65 * \param theDestination initialized object (from any document) - target of copying
67 HYDRODATA_EXPORT void CopyTo(Handle_HYDROData_Object theDestination) const;
70 * Returns the label of this object.
72 HYDRODATA_EXPORT TDF_Label& Label() {return myLab;}
76 friend class HYDROData_Iterator;
79 * Creates new object in the internal data structure. Use higher level objects
80 * to create objects with real content.
82 HYDRODATA_EXPORT HYDROData_Object();
85 * Destructs properties of the object and object itself, removes it from the document.
87 virtual HYDRODATA_EXPORT ~HYDROData_Object();
90 * Put the object to the label of the document.
91 * \param theLabel new label of the object
93 HYDRODATA_EXPORT virtual void SetLabel(TDF_Label theLabel);
96 * Internal method that used to store the byte array attribute
97 * \param theTag tag of a label to store attribute (for 0 this is myLab)
98 * \param theData pointer to bytes array
99 * \param theLen number of bytes in byte array that must be stored
101 void SaveByteArray(const int theTag, const char* theData, const int theLen);
104 * Internal method that used to retreive the content of byte array attribute
105 * \param theTag tag of a label that keeps the attribute (for 0 this is myLab)
106 * \param theLen number of bytes in byte array
107 * \returns pointer to the internal data structure wit harray content,
108 * or NULL if array size is zero
110 const char* ByteArray(const int theTag, int& theLen);
113 /// Array of pointers to the properties of this object; index in this array is returned by \a AddProperty.
114 TDF_Label myLab; ///< label of this object
117 typedef NCollection_Sequence<Handle_HYDROData_Object> HYDROData_SequenceOfObjects;
119 ///! Is Equal for HYDROData_Object mapping
120 HYDRODATA_EXPORT bool IsEqual(const Handle_HYDROData_Object& theObj1, const Handle_HYDROData_Object& theObj2);