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;
115 HYDRODATA_EXPORT bool HasTrsfPoints() const;
118 * Appends reference to other object (image or polyline).
119 * \param theReferenced the object referenced by this
121 HYDRODATA_EXPORT void AppendReference(Handle(HYDROData_Object) theReferenced);
124 * Returns the number of referenced objects
125 * \return zero if there is no references
127 HYDRODATA_EXPORT int NbReferences() const;
130 * Returns reference by index.
131 * \param theIndex number of reference [0; NbReference)
132 * \returns the referenced object, or Null if index is invalid
134 HYDRODATA_EXPORT Handle(HYDROData_Object) Reference(const int theIndex) const;
137 * Updates reference by index. If index is one-bigger than \a NbReferences,
138 * this method appends it to the end (NbReferences is incremented).
139 * \param theIndex number of reference [0; NbReference]
140 * \param theReferenced the object referenced by this
142 HYDRODATA_EXPORT void ChangeReference(
143 const int theIndex, Handle(HYDROData_Object) theReferenced);
146 * Removes reference by index
147 * \param theIndex number of reference [0; NbReference)
149 HYDRODATA_EXPORT void RemoveReference(const int theIndex);
152 * Removes all references.
154 HYDRODATA_EXPORT void ClearReferences();
157 * Stores the operator name
158 * \param theOpName name of the operator that must be executed for image update
160 HYDRODATA_EXPORT void SetOperatorName(const QString theOpName);
163 * Returns the operator name
164 * \returns the name of the operator that must be executed for image update
166 HYDRODATA_EXPORT QString OperatorName() const;
169 * Stores the operator arguments
170 * \param theArgs array that stores the operator arguments, needed for execution
172 HYDRODATA_EXPORT void SetArgs(const QByteArray& theArgs);
175 * Returns the operator arguments
176 * \returns array that stores the operator arguments, needed for execution
178 HYDRODATA_EXPORT QByteArray Args() const;
181 * Sets the "MustBeUpdated" flag: if image is depended on updated features.
182 * \param theFlag is true for images that must be updated, false for up-to-date
184 HYDRODATA_EXPORT void MustBeUpdated(bool theFlag);
187 * Returns the "MustBeUpdated" flag: is image must be recomputed or not
188 * \returns false if image is up to date
190 HYDRODATA_EXPORT bool MustBeUpdated() const;
193 * Marks the image as self-splitted.
194 * \param theFlag is true for self-splitted image
196 HYDRODATA_EXPORT void SetIsSelfSplitted(bool theFlag);
199 * Checks that the image is self-splitted.
200 * \returns true if image is self-splitted
202 HYDRODATA_EXPORT bool IsSelfSplitted() const;
206 friend class HYDROData_Iterator;
209 * Creates new object in the internal data structure. Use higher level objects
210 * to create objects with real content.
215 * Destructs properties of the object and object itself, removes it from the document.