#include <NCollection_Sequence.hxx>
#include <TDF_Label.hxx>
#include <QMap>
-#include <QString>
+
+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_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.
*
*/
enum DataTag
{
- DataTag_First = 0, ///< first tag, to reserve
- DataTag_ViewId, ///< visual state, array of view ids
- DataTag_Visibility, ///< visual state, array of visibility states
- DataTag_Transparency, ///< visual state, array of transparency values
- DataTag_ZValue ///< visual state, array of z-values
- };
-
-public:
- /**
- * Visual state data.
- */
- struct VisualState
- {
- bool Visibility;
- double Transparency;
- double ZValue;
- VisualState() : Visibility( false ), Transparency( 1.0 ), ZValue( 0.0 ) {}
+ DataTag_First = 0 ///< first tag, to reserve
+ // ...
};
- typedef QMap < int, VisualState > ViewId2VisualStateMap;
- typedef QMapIterator< int, VisualState > ViewId2VisualStateMapIterator;
public:
DEFINE_STANDARD_RTTI(HYDROData_Object);
HYDRODATA_EXPORT void SetName(const QString& theName);
/**
- * Returns the object visibility state for the view with specified id.
- * \param theViewId view id
- * \returns visibility state
+ * Dump object to Python script representation.
+ * Base implementation returns empty list,
+ * You should reimplement this function in your derived class if it
+ * has Python API and can be imported/exported from/to Python script.
+ */
+ HYDRODATA_EXPORT virtual QStringList DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const;
+
+ /**
+ * Updates object state.
+ * Base implementation dose nothing.
+ * \param theIsForce force reupdating of data object
*/
- HYDRODATA_EXPORT bool IsVisible( const int theViewId ) const;
+ HYDRODATA_EXPORT virtual void Update( const bool theIsForce = true );
/**
- * Sets the object visibility state for the view with specified id.
- * \param theViewId view id
- * \param theVal visibility state
+ * Returns data of object wrapped to QVariant.
+ * Base implementation returns null value.
*/
- HYDRODATA_EXPORT void SetVisible( const int theViewId,
- const bool theVal );
+ HYDRODATA_EXPORT virtual QVariant GetDataVariant();
/**
* Checks is object exists in the data structure.
* \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;
/**
- * Returns the map containing the visual states for the specified views.
- * \param theMap map of visual states
+ * 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 GetViewId2VisualStateMap( ViewId2VisualStateMap& theMap ) const;
+ void SetReferenceObject( const Handle_HYDROData_Object& theObj,
+ const int theTag = 0,
+ const int theIndex = 0 );
/**
- * Sets the map containing the visual states for the specified views.
- * \param theMap map of visual states
+ * 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
*/
- void SetViewId2VisualStateMap( const ViewId2VisualStateMap& theMap );
+ 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);