]> SALOME platform Git repositories - modules/hydro.git/blob - src/HYDROData/HYDROData_Image.h
Salome HOME
1) Edit Image 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    * Stores the image transformation points (3 input + 3 output)
51    * \param thePointAIn input point A
52    * \param thePointBIn input point B
53    * \param thePointCIn input point C
54    * \param thePointAOut output point A
55    * \param thePointBOut output point B
56    * \param thePointCOut output point C
57    */
58   HYDRODATA_EXPORT void SetTrsfPoints(const QPoint& thePointAIn,
59                                       const QPoint& thePointBIn,
60                                       const QPoint& thePointCIn,
61                                       const QPointF& thePointAOut,
62                                       const QPointF& thePointBOut,
63                                       const QPointF& thePointCOut);
64
65   /**
66    * Returns the image transformation points (3 input + 3 output)
67    * \param thePointAIn input point A
68    * \param thePointBIn input point B
69    * \param thePointCIn input point C
70    * \param thePointAOut output point A
71    * \param thePointBOut output point B
72    * \param thePointCOut output point C
73    */
74   HYDRODATA_EXPORT void TrsfPoints(QPoint& thePointAIn,
75                                    QPoint& thePointBIn,
76                                    QPoint& thePointCIn,
77                                    QPointF& thePointAOut,
78                                    QPointF& thePointBOut,
79                                    QPointF& thePointCOut);
80
81   /**
82    * Appends reference to other image.
83    * \param theReferenced the image referenced by this
84    */
85   HYDRODATA_EXPORT void AppendReference(Handle(HYDROData_Image) theReferenced);
86
87   /**
88    * Returns the number of referenced images
89    * \return zero if there is no references
90    */
91   HYDRODATA_EXPORT int NbReferences();
92
93   /**
94    * Returns reference by index.
95    * \param theIndex number of reference [0; NbReference)
96    * \returns the referenced image, or Null if index is invalid
97    */
98   HYDRODATA_EXPORT Handle(HYDROData_Image) Reference(const int theIndex) const;
99
100   /**
101    * Updates reference by index. If index is one-bigger than \a NbReferences, 
102    * this method appends it to the end (NbReferences is incremented).
103    * \param theIndex number of reference [0; NbReference]
104    * \param theReferenced the image referenced by this
105    */
106   HYDRODATA_EXPORT void ChangeReference(
107     const int theIndex, Handle(HYDROData_Image) theReferenced);
108
109   /**
110    * Removes reference by index
111    * \param theIndex number of reference [0; NbReference)
112    */
113   HYDRODATA_EXPORT void RemoveReference(const int theIndex);
114
115   /**
116    * Removes all references.
117    */
118   HYDRODATA_EXPORT void ClearReferences();
119
120   /**
121    * Stores the operator name
122    * \param theOpName name of the operator that must be executed for image update
123    */
124   HYDRODATA_EXPORT void SetOperatorName(const QString theOpName);
125
126   /**
127    * Returns the operator name
128    * \returns the name of the operator that must be executed for image update
129    */
130   HYDRODATA_EXPORT QString OperatorName();
131
132   /**
133    * Stores the operator arguments
134    * \param theArgs array that stores the operator arguments, needed for execution
135    */
136   HYDRODATA_EXPORT void SetArgs(const QByteArray& theArgs);
137
138   /**
139    * Returns the operator arguments
140    * \returns array that stores the operator arguments, needed for execution
141    */
142   HYDRODATA_EXPORT QByteArray Args();
143   
144   /**
145    * Sets the "MustBeUpdated" flag: if image is depended on updated features.
146    * \param theFlag is true for images that must be updated, false for up-to-date
147    */
148   HYDRODATA_EXPORT void MustBeUpdated(bool theFlag);
149
150   /**
151    * Returns the "MustBeUpdated" flag: is image must be recomputed or not
152    * \returns false if image is up to date
153    */
154   HYDRODATA_EXPORT bool MustBeUpdated();
155
156 protected:
157
158   friend class HYDROData_Iterator;
159
160   /**
161    * Creates new object in the internal data structure. Use higher level objects 
162    * to create objects with real content.
163    */
164   HYDROData_Image();
165
166   /**
167    * Destructs properties of the object and object itself, removes it from the document.
168    */
169   ~HYDROData_Image();
170
171 };
172
173 #endif