Salome HOME
Undo/Redo operation.
[modules/hydro.git] / src / HYDROData / HYDROData_Image.h
1 #ifndef HYDROData_Image_HeaderFile
2 #define HYDROData_Image_HeaderFile
3
4 #include <HYDROData_Object.h>
5
6 #include <QImage>
7 #include <QTransform>
8
9 DEFINE_STANDARD_HANDLE(HYDROData_Image, HYDROData_Object)
10
11 /**\class HYDROData_Image
12  * \brief Class that stores/retreives information about the image.
13  *
14  * Keeps image as binary array, transformation and other properties
15  * of image with correspondent API for forkind wit hthese properties.
16  */
17 class HYDROData_Image : public HYDROData_Object
18 {
19 public:
20   DEFINE_STANDARD_RTTI(HYDROData_Image);
21
22   /**
23    * Returns the kind of this object. Must be redefined in all objects of known type.
24    */
25   HYDRODATA_EXPORT virtual const ObjectKind GetKind() const {return KIND_IMAGE;}
26
27   /**
28    * Stores the image
29    * \param theImage new image
30    */
31   HYDRODATA_EXPORT void SetImage(const QImage& theImage);
32
33   /**
34    * Returns the kept image
35    */
36   HYDRODATA_EXPORT QImage Image();
37
38   /**
39    * Stores the image transformation
40    * \param theTrsf new transformation
41    */
42   HYDRODATA_EXPORT void SetTrsf(const QTransform& theTrsf);
43
44   /**
45    * Returns the kept transformation, or "identity" if not yet stored
46    */
47   HYDRODATA_EXPORT QTransform Trsf();
48
49   /**
50    * Appends reference to other image.
51    * \param theReferenced the image referenced by this
52    */
53   HYDRODATA_EXPORT void AppendReference(Handle(HYDROData_Image) theReferenced);
54
55   /**
56    * Returns the number of referenced images
57    * \return zero if there is no references
58    */
59   HYDRODATA_EXPORT int NbReferences();
60
61   /**
62    * Returns reference by index.
63    * \param theIndex number of reference [0; NbReference)
64    * \returns the referenced image, or Null if index is invalid
65    */
66   HYDRODATA_EXPORT Handle(HYDROData_Image) Reference(const int theIndex) const;
67
68   /**
69    * Updates reference by index. If index is one-bigger than \a NbReferences, 
70    * this method appends it to the end (NbReferences is incremented).
71    * \param theIndex number of reference [0; NbReference]
72    * \param theReferenced the image referenced by this
73    */
74   HYDRODATA_EXPORT void ChangeReference(
75     const int theIndex, Handle(HYDROData_Image) theReferenced);
76
77   /**
78    * Removes reference by index
79    * \param theIndex number of reference [0; NbReference)
80    */
81   HYDRODATA_EXPORT void RemoveReference(const int theIndex);
82
83   /**
84    * Removes all references.
85    */
86   HYDRODATA_EXPORT void ClearReferences();
87
88   /**
89    * Stores the operator name
90    * \param theOpName name of the operator that must be executed for image update
91    */
92   HYDRODATA_EXPORT void SetOperatorName(const QString theOpName);
93
94   /**
95    * Returns the operator name
96    * \returns the name of the operator that must be executed for image update
97    */
98   HYDRODATA_EXPORT QString OperatorName();
99
100   /**
101    * Stores the operator arguments
102    * \param theArgs array that stores the operator arguments, needed for execution
103    */
104   HYDRODATA_EXPORT void SetArgs(const QByteArray& theArgs);
105
106   /**
107    * Returns the operator arguments
108    * \returns array that stores the operator arguments, needed for execution
109    */
110   HYDRODATA_EXPORT QByteArray Args();
111   
112   /**
113    * Sets the "MustBeUpdated" flag: if image is depended on updated features.
114    * \param theFlag is true for images that must be updated, false for up-to-date
115    */
116   HYDRODATA_EXPORT void MustBeUpdated(bool theFlag);
117
118   /**
119    * Returns the "MustBeUpdated" flag: is image must be recomputed or not
120    * \returns false if image is up to date
121    */
122   HYDRODATA_EXPORT bool MustBeUpdated();
123
124 protected:
125
126   friend class HYDROData_Iterator;
127
128   /**
129    * Creates new object in the internal data structure. Use higher level objects 
130    * to create objects with real content.
131    */
132   HYDROData_Image();
133
134   /**
135    * Destructs properties of the object and object itself, removes it from the document.
136    */
137   ~HYDROData_Image();
138
139 };
140
141 #endif