1 #ifndef HYDROData_Image_HeaderFile
2 #define HYDROData_Image_HeaderFile
4 #include <HYDROData_Object.h>
9 DEFINE_STANDARD_HANDLE(HYDROData_Image, HYDROData_Object)
11 /**\class HYDROData_Image
12 * \brief Class that stores/retreives information about the image.
14 * Keeps image as binary array, transformation and other properties
15 * of image with correspondent API for forkind wit hthese properties.
17 class HYDROData_Image : public HYDROData_Object
21 * Enumeration of tags corresponding to the persistent object parameters.
25 DataTag_First = HYDROData_Object::DataTag_First + 100, ///< first tag, to reserve
26 DataTag_Operator, ///< name of the operator that must be executed for image update
27 DataTag_TrsfPoints, ///< image transformation points (3 input + 3 output)
28 DataTag_FilePath ///< image imported file path
32 DEFINE_STANDARD_RTTI(HYDROData_Image);
35 * Returns the kind of this object. Must be redefined in all objects of known type.
37 HYDRODATA_EXPORT virtual const ObjectKind GetKind() const {return KIND_IMAGE;}
40 * Dump Image object to Python script representation.
42 HYDRODATA_EXPORT virtual QStringList DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const;
46 * \param theImage new image
48 HYDRODATA_EXPORT void SetImage(const QImage& theImage);
51 * Load the image from file
52 * \param theFilePath path to image
54 HYDRODATA_EXPORT bool LoadImage(const QString& theFilePath);
57 * Returns the kept image
59 HYDRODATA_EXPORT QImage Image();
62 * Stores the image file path
63 * \param theFilePath image file path
65 HYDRODATA_EXPORT void SetFilePath(const QString& theFilePath);
68 * Returns uploaded image file path
70 HYDRODATA_EXPORT QString GetFilePath() const;
73 * Stores the image transformation
74 * \param theTrsf new transformation
76 HYDRODATA_EXPORT void SetTrsf(const QTransform& theTrsf);
79 * Returns the kept transformation, or "identity" if not yet stored
81 HYDRODATA_EXPORT QTransform Trsf() const;
84 * Stores the image transformation points (3 input + 3 output)
85 * \param thePointAIn input point A
86 * \param thePointBIn input point B
87 * \param thePointCIn input point C
88 * \param thePointAOut output point A
89 * \param thePointBOut output point B
90 * \param thePointCOut output point C
92 HYDRODATA_EXPORT void SetTrsfPoints(const QPoint& thePointAIn,
93 const QPoint& thePointBIn,
94 const QPoint& thePointCIn,
95 const QPointF& thePointAOut,
96 const QPointF& thePointBOut,
97 const QPointF& thePointCOut);
100 * Returns the image transformation points (3 input + 3 output)
101 * \param thePointAIn input point A
102 * \param thePointBIn input point B
103 * \param thePointCIn input point C
104 * \param thePointAOut output point A
105 * \param thePointBOut output point B
106 * \param thePointCOut output point C
108 HYDRODATA_EXPORT void TrsfPoints(QPoint& thePointAIn,
111 QPointF& thePointAOut,
112 QPointF& thePointBOut,
113 QPointF& thePointCOut) const;
116 * Appends reference to other image.
117 * \param theReferenced the image referenced by this
119 HYDRODATA_EXPORT void AppendReference(Handle(HYDROData_Image) theReferenced);
122 * Returns the number of referenced images
123 * \return zero if there is no references
125 HYDRODATA_EXPORT int NbReferences() const;
128 * Returns reference by index.
129 * \param theIndex number of reference [0; NbReference)
130 * \returns the referenced image, or Null if index is invalid
132 HYDRODATA_EXPORT Handle(HYDROData_Image) Reference(const int theIndex) const;
135 * Updates reference by index. If index is one-bigger than \a NbReferences,
136 * this method appends it to the end (NbReferences is incremented).
137 * \param theIndex number of reference [0; NbReference]
138 * \param theReferenced the image referenced by this
140 HYDRODATA_EXPORT void ChangeReference(
141 const int theIndex, Handle(HYDROData_Image) theReferenced);
144 * Removes reference by index
145 * \param theIndex number of reference [0; NbReference)
147 HYDRODATA_EXPORT void RemoveReference(const int theIndex);
150 * Removes all references.
152 HYDRODATA_EXPORT void ClearReferences();
155 * Stores the operator name
156 * \param theOpName name of the operator that must be executed for image update
158 HYDRODATA_EXPORT void SetOperatorName(const QString theOpName);
161 * Returns the operator name
162 * \returns the name of the operator that must be executed for image update
164 HYDRODATA_EXPORT QString OperatorName() const;
167 * Stores the operator arguments
168 * \param theArgs array that stores the operator arguments, needed for execution
170 HYDRODATA_EXPORT void SetArgs(const QByteArray& theArgs);
173 * Returns the operator arguments
174 * \returns array that stores the operator arguments, needed for execution
176 HYDRODATA_EXPORT QByteArray Args() const;
179 * Sets the "MustBeUpdated" flag: if image is depended on updated features.
180 * \param theFlag is true for images that must be updated, false for up-to-date
182 HYDRODATA_EXPORT void MustBeUpdated(bool theFlag);
185 * Returns the "MustBeUpdated" flag: is image must be recomputed or not
186 * \returns false if image is up to date
188 HYDRODATA_EXPORT bool MustBeUpdated();
192 friend class HYDROData_Iterator;
195 * Creates new object in the internal data structure. Use higher level objects
196 * to create objects with real content.
201 * Destructs properties of the object and object itself, removes it from the document.