#include <TDF_Label.hxx>
#include <QMap>
+class QColor;
class QString;
+class QVariant;
class QStringList;
+class Handle(TDataStd_ReferenceList);
+class Handle_HYDROData_Object;
///! Kind of an object in a document
typedef int ObjectKind;
///! Unrecognized object
-const ObjectKind KIND_UNKNOWN = 0;
-const ObjectKind KIND_IMAGE = 1;
-const ObjectKind KIND_POLYLINE = 2;
-const ObjectKind KIND_VISUAL_STATE = 3;
-const ObjectKind KIND_BATHYMETRY = 4;
+const ObjectKind KIND_UNKNOWN = 0;
+const ObjectKind KIND_IMAGE = 1;
+const ObjectKind KIND_POLYLINE = 2;
+const ObjectKind KIND_VISUAL_STATE = 3;
+const ObjectKind KIND_BATHYMETRY = 4;
+const ObjectKind KIND_CALCULATION = 5;
+const ObjectKind KIND_PROFILE = 6;
+const ObjectKind KIND_PROFILES_GROUP = 7;
+const ObjectKind KIND_GUIDE_LINE = 8;
+const ObjectKind KIND_ZONE = 9;
+const ObjectKind KIND_LAST = KIND_ZONE;
DEFINE_STANDARD_HANDLE(HYDROData_Object, MMgt_TShared)
typedef QMap<QString,Handle(Standard_Transient)> MapOfTreatedObjects;
+typedef NCollection_Sequence<Handle_HYDROData_Object> HYDROData_SequenceOfObjects;
+
+
/**\class HYDROData_Object
* \brief Generic class of any object in the data model.
*
*/
HYDRODATA_EXPORT virtual QStringList DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const;
+ /**
+ * Updates object state.
+ * Base implementation dose nothing.
+ * \param theIsForce force reupdating of data object
+ */
+ HYDRODATA_EXPORT virtual void Update( const bool theIsForce = true );
+
+ /**
+ * Returns data of object wrapped to QVariant.
+ * Base implementation returns null value.
+ */
+ HYDRODATA_EXPORT virtual QVariant GetDataVariant();
+
/**
* Checks is object exists in the data structure.
* \returns true is object is not exists in the data model
* \returns pointer to the internal data structure wit harray content,
* or NULL if array size is zero
*/
- const char* ByteArray(const int theTag, int& theLen);
+ const char* ByteArray(const int theTag, int& theLen) const;
+
+ /**
+ * Internal method that used to store the reference object label attribute
+ * \param theObj pointer to reference object
+ * \param theTag tag of a label to store attribute (for 0 this is myLab)
+ */
+ int NbReferenceObjects( const int theTag = 0 ) const;
+
+ /**
+ * Internal method that used to store the reference object label attribute
+ * \param theObj pointer to reference object
+ * \param theTag tag of a label to store attribute (for 0 this is myLab)
+ */
+ void AddReferenceObject( const Handle_HYDROData_Object& theObj,
+ const int theTag = 0 );
+
+ /**
+ * Internal method that used to store the reference object label attribute
+ * \param theObj pointer to reference object
+ * \param theTag tag of a label to store attribute (for 0 this is myLab)
+ * \param theIndex index in the list of references
+ - if more that len then just append it to the end of list
+ - if less than zero then prepend to the list
+ - indexing starts from 0
+ */
+ void SetReferenceObject( const Handle_HYDROData_Object& theObj,
+ const int theTag = 0,
+ const int theIndex = 0 );
+
+ /**
+ * Internal method that used to retreive the reference object(s) attribute
+ * \param theTag tag of a label that keeps the attribute (for 0 this is myLab)
+ * \param theIndex index in the list of references
+ * - indexing starts from 0
+ * \returns pointer to reference object or NULL if label is not set
+ */
+ Handle_HYDROData_Object GetReferenceObject( const int theTag = 0,
+ const int theIndex = 0 ) const;
+
+ HYDROData_SequenceOfObjects GetReferenceObjects( const int theTag = 0 ) const;
+
+ /**
+ * Internal method that used to remove the reference object attribute
+ * \param theTag tag of a label that keeps the attribute (for 0 this is myLab)
+ * \param theIndex index in the list of references
+ * - indexing starts from 0
+ */
+ void RemoveReferenceObject( const int theTag = 0, const int theIndex = 0 );
+
+ /**
+ * Internal method that used to clear list of the reference objects attribute
+ * \param theTag tag of a label that keeps the attribute (for 0 this is myLab)
+ */
+ void ClearReferenceObjects( const int theTag = 0 );
+
+ /**
+ * Internal method that used to store the color attribute
+ * \param theTag tag of a label that keeps the attribute (for 0 this is myLab)
+ * \param theColor color to save
+ */
+ void SetColor( const QColor& theColor, const int theTag = 0 );
+
+ /**
+ * Internal method that used to retreive the color attribute
+ * \param theTag tag of a label that keeps the attribute (for 0 this is myLab)
+ * \param theDefColor default color to return if attribute has not been set before
+ */
+ QColor GetColor( const QColor& theDefColor, const int theTag = 0 ) const;
+
+protected:
+
+ Handle(TDataStd_ReferenceList) getReferenceList( const int theTag,
+ const bool theIsCreate ) const;
+
protected:
/// Array of pointers to the properties of this object; index in this array is returned by \a AddProperty.
TDF_Label myLab; ///< label of this object
};
-typedef NCollection_Sequence<Handle_HYDROData_Object> HYDROData_SequenceOfObjects;
-
///! Is Equal for HYDROData_Object mapping
HYDRODATA_EXPORT bool IsEqual(const Handle_HYDROData_Object& theObj1, const Handle_HYDROData_Object& theObj2);