1 #ifndef HYDROData_Object_HeaderFile
2 #define HYDROData_Object_HeaderFile
6 #include <NCollection_Sequence.hxx>
7 #include <TDF_Label.hxx>
13 ///! Kind of an object in a document
14 typedef int ObjectKind;
15 ///! Unrecognized object
16 const ObjectKind KIND_UNKNOWN = 0;
17 const ObjectKind KIND_IMAGE = 1;
18 const ObjectKind KIND_POLYLINE = 2;
19 const ObjectKind KIND_VISUAL_STATE = 3;
20 const ObjectKind KIND_BATHYMETRY = 4;
22 DEFINE_STANDARD_HANDLE(HYDROData_Object, MMgt_TShared)
24 /**\class HYDROData_Object
25 * \brief Generic class of any object in the data model.
27 * Interface for getting access to the object that belong to the data model.
28 * Managed by Document. Provides access to the common properties:
29 * kind of an object, name.
31 class HYDROData_Object : public MMgt_TShared
35 * Enumeration of tags corresponding to the persistent object parameters.
39 DataTag_First = 0 ///< first tag, to reserve
44 DEFINE_STANDARD_RTTI(HYDROData_Object);
47 * Returns the kind of this object. Must be redefined in all objects of known type.
49 HYDRODATA_EXPORT virtual const ObjectKind GetKind() const {return KIND_UNKNOWN;}
52 * Returns the name of this object.
54 HYDRODATA_EXPORT QString GetName() const;
57 * Updates the name of this object.
59 HYDRODATA_EXPORT void SetName(const QString& theName);
62 * Dump object to Python script representation.
63 * Base implementation returns empty list,
64 * You should reimplement this function in your derived class if it
65 * has Python API and can be imported/exported from/to Python script.
67 HYDRODATA_EXPORT virtual QStringList DumpToPython() const;
70 * Checks is object exists in the data structure.
71 * \returns true is object is not exists in the data model
73 HYDRODATA_EXPORT bool IsRemoved() const;
76 * Removes object from the data structure.
78 HYDRODATA_EXPORT void Remove();
81 * Returns unique integer identifier of the object (may be used for ordering of objects)
83 HYDRODATA_EXPORT inline int ID() const {return myLab.Tag();}
86 * Copies all properties of this to the destinated object.
87 * Objects must be the same type.
88 * \param theDestination initialized object (from any document) - target of copying
90 HYDRODATA_EXPORT void CopyTo(Handle_HYDROData_Object theDestination) const;
93 * Returns the label of this object.
95 HYDRODATA_EXPORT TDF_Label& Label() {return myLab;}
99 friend class HYDROData_Iterator;
102 * Creates new object in the internal data structure. Use higher level objects
103 * to create objects with real content.
105 HYDRODATA_EXPORT HYDROData_Object();
108 * Destructs properties of the object and object itself, removes it from the document.
110 virtual HYDRODATA_EXPORT ~HYDROData_Object();
113 * Put the object to the label of the document.
114 * \param theLabel new label of the object
116 HYDRODATA_EXPORT virtual void SetLabel(TDF_Label theLabel);
119 * Internal method that used to store the byte array attribute
120 * \param theTag tag of a label to store attribute (for 0 this is myLab)
121 * \param theData pointer to bytes array
122 * \param theLen number of bytes in byte array that must be stored
124 void SaveByteArray(const int theTag, const char* theData, const int theLen);
127 * Internal method that used to retreive the content of byte array attribute
128 * \param theTag tag of a label that keeps the attribute (for 0 this is myLab)
129 * \param theLen number of bytes in byte array
130 * \returns pointer to the internal data structure wit harray content,
131 * or NULL if array size is zero
133 const char* ByteArray(const int theTag, int& theLen);
136 /// Array of pointers to the properties of this object; index in this array is returned by \a AddProperty.
137 TDF_Label myLab; ///< label of this object
140 typedef NCollection_Sequence<Handle_HYDROData_Object> HYDROData_SequenceOfObjects;
142 ///! Is Equal for HYDROData_Object mapping
143 HYDRODATA_EXPORT bool IsEqual(const Handle_HYDROData_Object& theObj1, const Handle_HYDROData_Object& theObj2);