1 #ifndef HYDROData_Object_HeaderFile
2 #define HYDROData_Object_HeaderFile
6 #include <NCollection_Sequence.hxx>
7 #include <TDF_Label.hxx>
11 ///! Kind of an object in a document
12 typedef int ObjectKind;
13 ///! Unrecognized object
14 const ObjectKind KIND_UNKNOWN = 0;
15 const ObjectKind KIND_IMAGE = 1;
16 const ObjectKind KIND_POLYLINE = 2;
17 const ObjectKind KIND_VISUAL_STATE = 3;
18 const ObjectKind KIND_BATHYMETRY = 4;
20 DEFINE_STANDARD_HANDLE(HYDROData_Object, MMgt_TShared)
22 /**\class HYDROData_Object
23 * \brief Generic class of any object in the data model.
25 * Interface for getting access to the object that belong to the data model.
26 * Managed by Document. Provides access to the common properties:
27 * kind of an object, name.
29 class HYDROData_Object : public MMgt_TShared
33 * Enumeration of tags corresponding to the persistent object parameters.
37 DataTag_First = 0 ///< first tag, to reserve
42 DEFINE_STANDARD_RTTI(HYDROData_Object);
45 * Returns the kind of this object. Must be redefined in all objects of known type.
47 HYDRODATA_EXPORT virtual const ObjectKind GetKind() const {return KIND_UNKNOWN;}
50 * Returns the name of this object.
52 HYDRODATA_EXPORT QString GetName() const;
55 * Updates the name of this object.
57 HYDRODATA_EXPORT void SetName(const QString& theName);
60 * Checks is object exists in the data structure.
61 * \returns true is object is not exists in the data model
63 HYDRODATA_EXPORT bool IsRemoved() const;
66 * Removes object from the data structure.
68 HYDRODATA_EXPORT void Remove();
71 * Returns unique integer identifier of the object (may be used for ordering of objects)
73 HYDRODATA_EXPORT inline int ID() const {return myLab.Tag();}
76 * Copies all properties of this to the destinated object.
77 * Objects must be the same type.
78 * \param theDestination initialized object (from any document) - target of copying
80 HYDRODATA_EXPORT void CopyTo(Handle_HYDROData_Object theDestination) const;
83 * Returns the label of this object.
85 HYDRODATA_EXPORT TDF_Label& Label() {return myLab;}
89 friend class HYDROData_Iterator;
92 * Creates new object in the internal data structure. Use higher level objects
93 * to create objects with real content.
95 HYDRODATA_EXPORT HYDROData_Object();
98 * Destructs properties of the object and object itself, removes it from the document.
100 virtual HYDRODATA_EXPORT ~HYDROData_Object();
103 * Put the object to the label of the document.
104 * \param theLabel new label of the object
106 HYDRODATA_EXPORT virtual void SetLabel(TDF_Label theLabel);
109 * Internal method that used to store the byte array attribute
110 * \param theTag tag of a label to store attribute (for 0 this is myLab)
111 * \param theData pointer to bytes array
112 * \param theLen number of bytes in byte array that must be stored
114 void SaveByteArray(const int theTag, const char* theData, const int theLen);
117 * Internal method that used to retreive the content of byte array attribute
118 * \param theTag tag of a label that keeps the attribute (for 0 this is myLab)
119 * \param theLen number of bytes in byte array
120 * \returns pointer to the internal data structure wit harray content,
121 * or NULL if array size is zero
123 const char* ByteArray(const int theTag, int& theLen);
126 /// Array of pointers to the properties of this object; index in this array is returned by \a AddProperty.
127 TDF_Label myLab; ///< label of this object
130 typedef NCollection_Sequence<Handle_HYDROData_Object> HYDROData_SequenceOfObjects;
132 ///! Is Equal for HYDROData_Object mapping
133 HYDRODATA_EXPORT bool IsEqual(const Handle_HYDROData_Object& theObj1, const Handle_HYDROData_Object& theObj2);