Salome HOME
Merge branch 'BR_HYDRO_IMPS_2016' into pre/IMPS_2016
[modules/hydro.git] / src / HYDROData / HYDROData_Image.h
index da11061653ac0ce1bc57058881cca94dcba29538..5a25af9ee633a20ce5e2f760476b7bd1aa2aa770 100644 (file)
@@ -1,12 +1,37 @@
+// Copyright (C) 2014-2015  EDF-R&D
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
 
 #ifndef HYDROData_Image_HeaderFile
 #define HYDROData_Image_HeaderFile
 
 #include <HYDROData_Entity.h>
 
+#ifdef WIN32
+  #pragma warning ( disable: 4251 )
+#endif
+
 #include <QImage>
 #include <QTransform>
 
+#ifdef WIN32
+  #pragma warning ( default: 4251 )
+#endif
+
 DEFINE_STANDARD_HANDLE(HYDROData_Image, HYDROData_Entity)
 
 /**\class HYDROData_Image
@@ -22,8 +47,9 @@ public:
 
   enum TransformationMode
   {
-    ManualLambert = 0,
+    ManualGeodesic = 0,
     ManualCartesian,
+    CartesianFromFile,
     ReferenceImage
   };
 
@@ -52,16 +78,21 @@ public:
   /**
    * Dump Image object to Python script representation.
    */
-  HYDRODATA_EXPORT virtual QStringList DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const;
+  HYDRODATA_EXPORT virtual QStringList DumpToPython( const QString& thePyScriptPath,
+                                                     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 );
+  HYDRODATA_EXPORT virtual void Update();
+
+  /**
+   * Checks that object has 2D presentation. Reimlemented to retun true.
+   */
+  HYDRODATA_EXPORT virtual bool IsHas2dPrs() const;
 
   /**
    * Returns data of object wrapped to QVariant.
@@ -70,6 +101,12 @@ public:
    */
   HYDRODATA_EXPORT virtual QVariant GetDataVariant();
 
+  /**
+   * Returns the list of all reference objects of this object.
+   */
+  HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetAllReferenceObjects() const;
+
+
   /**
    * Stores the image
    * \param theImage new image
@@ -122,6 +159,17 @@ public:
   HYDRODATA_EXPORT bool IsByTwoPoints() const;
 
 
+  /**
+   * Removes all references from this image.
+   */
+  HYDRODATA_EXPORT bool HasReferences() const;
+
+  /**
+   * Removes all references from this image.
+   */
+  HYDRODATA_EXPORT void RemoveAllReferences();
+
+
   /**
    * Stores the transformation points in local cs of image
    * \param thePointA point A
@@ -130,7 +178,8 @@ public:
    */
   HYDRODATA_EXPORT void SetLocalPoints( const QPoint& thePointA,
                                         const QPoint& thePointB,
-                                        const QPoint& thePointC = QPoint( INT_MIN, INT_MIN ) );
+                                        const QPoint& thePointC = QPoint( INT_MIN, INT_MIN ),
+                                        const bool    theIsUpdate = true );
 
   /**
    * Returns the transformation points in local cs of image
@@ -159,7 +208,8 @@ public:
   HYDRODATA_EXPORT void SetGlobalPoints( const TransformationMode& theMode,
                                          const QPointF&            thePointA,
                                          const QPointF&            thePointB,
-                                         const QPointF&            thePointC = QPoint( INT_MIN, INT_MIN ) );
+                                         const QPointF&            thePointC = QPoint( INT_MIN, INT_MIN ),
+                                         const bool                theIsUpdate = true  );
 
   /**
    * Returns the transformation points in global cs
@@ -174,6 +224,13 @@ public:
                                          QPointF&            thePointB,
                                          QPointF&            thePointC ) const;
 
+  /**
+   * Get transformation points from the file and stores them in global cs
+   * \param theFileName the image georeferencement file name
+   * \return true in case of success
+   */
+  HYDRODATA_EXPORT bool SetGlobalPointsFromFile( const QString& theFileName );
+
   /**
    * Returns true if global points has been set before
    */
@@ -190,7 +247,8 @@ public:
   HYDRODATA_EXPORT void SetReferencePoints( const Handle(HYDROData_Image)& theRefImage,
                                             const QPointF&                 thePointA,
                                             const QPointF&                 thePointB,
-                                            const QPointF&                 thePointC = QPoint( INT_MIN, INT_MIN ) );
+                                            const QPointF&                 thePointC = QPoint( INT_MIN, INT_MIN ),
+                                            const bool                     theIsUpdate = true );
 
   /**
    * Returns the transformation points in reference image local cs
@@ -222,6 +280,11 @@ public:
    */
   HYDRODATA_EXPORT Handle(HYDROData_Image) GetTrsfReferenceImage() const;
 
+  /**
+   * Removes the reference image for transformation
+   */
+  HYDRODATA_EXPORT void RemoveTrsfReferenceImage();
+
 
   /**
    * Stores the transformation mode
@@ -273,6 +336,7 @@ public:
    */
   HYDRODATA_EXPORT void ClearReferences();
 
+
   /**
    * Stores the operator name
    * \param theOpName name of the operator that must be executed for image update
@@ -297,29 +361,18 @@ public:
    */
   HYDRODATA_EXPORT QByteArray Args() const;
   
-  /**
-   * Sets the "MustBeUpdated" flag: if image is depended on updated features.
-   * \param theFlag is true for images that must be updated, false for up-to-date
-   */
-  HYDRODATA_EXPORT void MustBeUpdated(bool theFlag);
-
-  /**
-   * Returns the "MustBeUpdated" flag: is image must be recomputed or not
-   * \returns false if image is up to date
-   */
-  HYDRODATA_EXPORT bool MustBeUpdated() const;
 
   /**
-   * Marks the image as self-splitted.
-   * \param theFlag is true for self-splitted image
+   * Marks the image as self-split.
+   * \param theFlag is true for self-plit image
    */
-  HYDRODATA_EXPORT void SetIsSelfSplitted(bool theFlag);
+  HYDRODATA_EXPORT void SetIsSelfSplit(bool theFlag);
 
   /**
-   * Checks that the image is self-splitted.
-   * \returns true if image is self-splitted
+   * Checks that the image is self-split.
+   * \returns true if image is self-split
    */
-  HYDRODATA_EXPORT bool IsSelfSplitted() const;
+  HYDRODATA_EXPORT bool IsSelfSplit() const;
 
 private:
 
@@ -335,12 +388,12 @@ protected:
    * Creates new object in the internal data structure. Use higher level objects 
    * to create objects with real content.
    */
-  HYDROData_Image();
+  HYDRODATA_EXPORT HYDROData_Image();
 
   /**
    * Destructs properties of the object and object itself, removes it from the document.
    */
-  ~HYDROData_Image();
+  HYDRODATA_EXPORT ~HYDROData_Image();
 
 };