Salome HOME
Access to 'Invalid value' of altitude from Bathymetry is added.
[modules/hydro.git] / src / HYDROData / HYDROData_Object.h
index 852c06795d82bbd3ba6b34e9c974ceceda661f4f..a8f999f202b30a4fc460169a4427b68cda47811f 100644 (file)
@@ -3,7 +3,9 @@
 
 #include <HYDROData.h>
 
+#include <NCollection_Sequence.hxx>
 #include <TDF_Label.hxx>
+#include <QMap>
 #include <QString>
 
 ///! Kind of an object in a document
@@ -11,6 +13,9 @@ 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;
 
 DEFINE_STANDARD_HANDLE(HYDROData_Object, MMgt_TShared)
 
@@ -23,6 +28,33 @@ DEFINE_STANDARD_HANDLE(HYDROData_Object, MMgt_TShared)
  */
 class HYDROData_Object : public MMgt_TShared
 {
+protected:
+  /**
+   * Enumeration of tags corresponding to the persistent object parameters.
+   */
+  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 ) {}
+  };
+  typedef QMap        < int, VisualState > ViewId2VisualStateMap;
+  typedef QMapIterator< int, VisualState > ViewId2VisualStateMapIterator;
+
 public:
   DEFINE_STANDARD_RTTI(HYDROData_Object);
 
@@ -41,6 +73,21 @@ public:
    */
   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
+   */
+  HYDRODATA_EXPORT bool IsVisible( const int theViewId ) const;
+
+  /**
+   * Sets the object visibility state for the view with specified id.
+   * \param theViewId view id
+   * \param theVal visibility state
+   */
+  HYDRODATA_EXPORT void SetVisible( const int theViewId,
+                                    const bool theVal );
+
   /**
    * Checks is object exists in the data structure.
    * \returns true is object is not exists in the data model
@@ -64,6 +111,11 @@ public:
    */
   HYDRODATA_EXPORT void CopyTo(Handle_HYDROData_Object theDestination) const;
 
+  /**
+   * Returns the label of this object.
+   */
+  HYDRODATA_EXPORT TDF_Label& Label() {return myLab;}
+
 protected:
 
   friend class HYDROData_Iterator;
@@ -86,15 +138,41 @@ protected:
   HYDRODATA_EXPORT virtual void SetLabel(TDF_Label theLabel);
 
   /**
-   * Returns the label of this object.
+   * Internal method that used to store the byte array attribute
+   * \param theTag tag of a label to store attribute (for 0 this is myLab)
+   * \param theData pointer to bytes array
+   * \param theLen number of bytes in byte array that must be stored
+   */
+  void SaveByteArray(const int theTag, const char* theData, const int theLen);
+
+  /**
+   * Internal method that used to retreive the content of byte array attribute
+   * \param theTag tag of a label that keeps the attribute (for 0 this is myLab)
+   * \param theLen number of bytes in byte array
+   * \returns pointer to the internal data structure wit harray content, 
+   *          or NULL if array size is zero
    */
-  TDF_Label& Label() {return myLab;}
+  const char* ByteArray(const int theTag, int& theLen);
+
+  /**
+   * Returns the map containing the visual states for the specified views.
+   * \param theMap map of visual states
+   */
+  void GetViewId2VisualStateMap( ViewId2VisualStateMap& theMap ) const;
+
+  /**
+   * Sets the map containing the visual states for the specified views.
+   * \param theMap map of visual states
+   */
+  void SetViewId2VisualStateMap( const ViewId2VisualStateMap& theMap );
 
 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);