Salome HOME
Small correction for writing of data to file.
[modules/hydro.git] / src / HYDROData / HYDROData_Object.h
index a8f999f202b30a4fc460169a4427b68cda47811f..84d601560fd18e115f06b38d1bb6c3cbfe396bb6 100644 (file)
@@ -6,7 +6,9 @@
 #include <NCollection_Sequence.hxx>
 #include <TDF_Label.hxx>
 #include <QMap>
-#include <QString>
+
+class QString;
+class QStringList;
 
 ///! Kind of an object in a document
 typedef int ObjectKind;
@@ -19,6 +21,8 @@ const ObjectKind KIND_BATHYMETRY = 4;
 
 DEFINE_STANDARD_HANDLE(HYDROData_Object, MMgt_TShared)
 
+typedef QMap<QString,Handle(Standard_Transient)> MapOfTreatedObjects;
+
 /**\class HYDROData_Object
  * \brief Generic class of any object in the data model.
  *
@@ -34,27 +38,10 @@ protected:
    */
   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
+    DataTag_First = 0     ///< first tag, to reserve
+    // ...
   };
 
-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);
 
@@ -74,19 +61,12 @@ 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
+   * 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 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 );
+  HYDRODATA_EXPORT virtual QStringList DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const;
 
   /**
    * Checks is object exists in the data structure.
@@ -154,18 +134,6 @@ protected:
    */
   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