Salome HOME
Sorting alphabetically.
[modules/hydro.git] / src / HYDROData / HYDROData_Image.h
index e2df2a4e2465363e8de8c381e593452dd282df4b..16a691a64b23afd3e0ab956a0b8ab69657cf0ef0 100644 (file)
@@ -23,8 +23,9 @@ protected:
   enum DataTag
   {
     DataTag_First = HYDROData_Object::DataTag_First + 100, ///< first tag, to reserve
-    DataTag_Operator,   ///< name of the operator that must be executed for image update
-    DataTag_TrsfPoints  ///< image transformation points (3 input + 3 output)
+    DataTag_Operator,    ///< name of the operator that must be executed for image update
+    DataTag_TrsfPoints,  ///< image transformation points (3 input + 3 output)
+    DataTag_FilePath     ///< image imported file path
   };
 
 public:
@@ -35,17 +36,55 @@ public:
    */
   HYDRODATA_EXPORT virtual const ObjectKind GetKind() const {return KIND_IMAGE;}
 
+  /**
+   * Dump Image object to Python script representation.
+   */
+  HYDRODATA_EXPORT virtual QStringList DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const;
+
+  /**
+   * Updates object state.
+   * Reimplemented to update an Image object in the data structure.
+   * Call this method whenever you made changes for operator or reference objects.
+   * If it is changed, sets "MustBeUpdated" flag to other depended images.
+   * \param theIsForce force reupdating of data object
+   */
+  HYDRODATA_EXPORT virtual void Update( const bool theIsForce = true );
+
+  /**
+   * Returns data of object wrapped to QVariant.
+   * Reimplemented to wrap and return saved image.
+   * Transformation are applied to result image.
+   */
+  HYDRODATA_EXPORT virtual QVariant GetDataVariant();
+
   /**
    * Stores the image
    * \param theImage new image
    */
   HYDRODATA_EXPORT void SetImage(const QImage& theImage);
 
+  /**
+   * Load the image from file
+   * \param theFilePath path to image
+   */
+  HYDRODATA_EXPORT bool LoadImage(const QString& theFilePath);
+
   /**
    * Returns the kept image
    */
   HYDRODATA_EXPORT QImage Image();
 
+  /**
+   * Stores the image file path
+   * \param theFilePath image file path
+   */
+  HYDRODATA_EXPORT void SetFilePath(const QString& theFilePath);
+
+  /**
+   * Returns uploaded image file path
+   */
+  HYDRODATA_EXPORT QString GetFilePath() const;
+
   /**
    * Stores the image transformation
    * \param theTrsf new transformation
@@ -55,7 +94,7 @@ public:
   /**
    * Returns the kept transformation, or "identity" if not yet stored
    */
-  HYDRODATA_EXPORT QTransform Trsf();
+  HYDRODATA_EXPORT QTransform Trsf() const;
 
   /**
    * Stores the image transformation points (3 input + 3 output)
@@ -87,35 +126,37 @@ public:
                                    QPoint& thePointCIn,
                                    QPointF& thePointAOut,
                                    QPointF& thePointBOut,
-                                   QPointF& thePointCOut);
+                                   QPointF& thePointCOut) const;
+
+  HYDRODATA_EXPORT bool HasTrsfPoints() const;
 
   /**
-   * Appends reference to other image.
-   * \param theReferenced the image referenced by this
+   * Appends reference to other object (image or polyline).
+   * \param theReferenced the object referenced by this
    */
-  HYDRODATA_EXPORT void AppendReference(Handle(HYDROData_Image) theReferenced);
+  HYDRODATA_EXPORT void AppendReference( const Handle(HYDROData_Object)& theReferenced );
 
   /**
-   * Returns the number of referenced images
+   * Returns the number of referenced objects
    * \return zero if there is no references
    */
-  HYDRODATA_EXPORT int NbReferences();
+  HYDRODATA_EXPORT int NbReferences() const;
 
   /**
    * Returns reference by index.
    * \param theIndex number of reference [0; NbReference)
-   * \returns the referenced image, or Null if index is invalid
+   * \returns the referenced object, or Null if index is invalid
    */
-  HYDRODATA_EXPORT Handle(HYDROData_Image) Reference(const int theIndex) const;
+  HYDRODATA_EXPORT Handle(HYDROData_Object) Reference(const int theIndex) const;
 
   /**
    * Updates reference by index. If index is one-bigger than \a NbReferences, 
    * this method appends it to the end (NbReferences is incremented).
    * \param theIndex number of reference [0; NbReference]
-   * \param theReferenced the image referenced by this
+   * \param theReferenced the object referenced by this
    */
   HYDRODATA_EXPORT void ChangeReference(
-    const int theIndex, Handle(HYDROData_Image) theReferenced);
+    const int theIndex, Handle(HYDROData_Object) theReferenced);
 
   /**
    * Removes reference by index
@@ -138,7 +179,7 @@ public:
    * Returns the operator name
    * \returns the name of the operator that must be executed for image update
    */
-  HYDRODATA_EXPORT QString OperatorName();
+  HYDRODATA_EXPORT QString OperatorName() const;
 
   /**
    * Stores the operator arguments
@@ -150,7 +191,7 @@ public:
    * Returns the operator arguments
    * \returns array that stores the operator arguments, needed for execution
    */
-  HYDRODATA_EXPORT QByteArray Args();
+  HYDRODATA_EXPORT QByteArray Args() const;
   
   /**
    * Sets the "MustBeUpdated" flag: if image is depended on updated features.
@@ -162,7 +203,19 @@ public:
    * Returns the "MustBeUpdated" flag: is image must be recomputed or not
    * \returns false if image is up to date
    */
-  HYDRODATA_EXPORT bool MustBeUpdated();
+  HYDRODATA_EXPORT bool MustBeUpdated() const;
+
+  /**
+   * Marks the image as self-splitted.
+   * \param theFlag is true for self-splitted image
+   */
+  HYDRODATA_EXPORT void SetIsSelfSplitted(bool theFlag);
+
+  /**
+   * Checks that the image is self-splitted.
+   * \returns true if image is self-splitted
+   */
+  HYDRODATA_EXPORT bool IsSelfSplitted() const;
 
 protected: