Salome HOME
Drawing of zones in OCC view improved.
[modules/hydro.git] / src / HYDROData / HYDROData_Object.h
index 595c6f9a359a89c1f4b370cbd6fcb3ee8a035484..a44ffdb5affa77eee20a992de5b729a8ca50b1f8 100644 (file)
@@ -7,24 +7,35 @@
 #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_CALCULATION = 5;
+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.
  *
@@ -149,13 +160,85 @@ protected:
    */
   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);