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;
45 * Updates object state.
46 * Reimplemented to update an Image object in the data structure.
47 * Call this method whenever you made changes for operator or reference objects.
48 * If it is changed, sets "MustBeUpdated" flag to other depended images.
50 HYDRODATA_EXPORT virtual void Update();
53 * Returns data of object wrapped to QVariant.
54 * Reimplemented to wrap and return saved image.
55 * Transformation are applied to result image.
57 HYDRODATA_EXPORT virtual QVariant GetDataVariant();
61 * \param theImage new image
63 HYDRODATA_EXPORT void SetImage(const QImage& theImage);
66 * Load the image from file
67 * \param theFilePath path to image
69 HYDRODATA_EXPORT bool LoadImage(const QString& theFilePath);
72 * Returns the kept image
74 HYDRODATA_EXPORT QImage Image();
77 * Stores the image file path
78 * \param theFilePath image file path
80 HYDRODATA_EXPORT void SetFilePath(const QString& theFilePath);
83 * Returns uploaded image file path
85 HYDRODATA_EXPORT QString GetFilePath() const;
88 * Stores the image transformation
89 * \param theTrsf new transformation
91 HYDRODATA_EXPORT void SetTrsf(const QTransform& theTrsf);
94 * Returns the kept transformation, or "identity" if not yet stored
96 HYDRODATA_EXPORT QTransform Trsf() const;
99 * Stores the image transformation points (3 input + 3 output)
100 * \param thePointAIn input point A
101 * \param thePointBIn input point B
102 * \param thePointCIn input point C
103 * \param thePointAOut output point A
104 * \param thePointBOut output point B
105 * \param thePointCOut output point C
107 HYDRODATA_EXPORT void SetTrsfPoints(const QPoint& thePointAIn,
108 const QPoint& thePointBIn,
109 const QPoint& thePointCIn,
110 const QPointF& thePointAOut,
111 const QPointF& thePointBOut,
112 const QPointF& thePointCOut);
115 * Returns the image transformation points (3 input + 3 output)
116 * \param thePointAIn input point A
117 * \param thePointBIn input point B
118 * \param thePointCIn input point C
119 * \param thePointAOut output point A
120 * \param thePointBOut output point B
121 * \param thePointCOut output point C
123 HYDRODATA_EXPORT void TrsfPoints(QPoint& thePointAIn,
126 QPointF& thePointAOut,
127 QPointF& thePointBOut,
128 QPointF& thePointCOut) const;
130 HYDRODATA_EXPORT bool HasTrsfPoints() const;
133 * Appends reference to other object (image or polyline).
134 * \param theReferenced the object referenced by this
136 HYDRODATA_EXPORT void AppendReference(Handle(HYDROData_Object) theReferenced);
139 * Returns the number of referenced objects
140 * \return zero if there is no references
142 HYDRODATA_EXPORT int NbReferences() const;
145 * Returns reference by index.
146 * \param theIndex number of reference [0; NbReference)
147 * \returns the referenced object, or Null if index is invalid
149 HYDRODATA_EXPORT Handle(HYDROData_Object) Reference(const int theIndex) const;
152 * Updates reference by index. If index is one-bigger than \a NbReferences,
153 * this method appends it to the end (NbReferences is incremented).
154 * \param theIndex number of reference [0; NbReference]
155 * \param theReferenced the object referenced by this
157 HYDRODATA_EXPORT void ChangeReference(
158 const int theIndex, Handle(HYDROData_Object) theReferenced);
161 * Removes reference by index
162 * \param theIndex number of reference [0; NbReference)
164 HYDRODATA_EXPORT void RemoveReference(const int theIndex);
167 * Removes all references.
169 HYDRODATA_EXPORT void ClearReferences();
172 * Stores the operator name
173 * \param theOpName name of the operator that must be executed for image update
175 HYDRODATA_EXPORT void SetOperatorName(const QString theOpName);
178 * Returns the operator name
179 * \returns the name of the operator that must be executed for image update
181 HYDRODATA_EXPORT QString OperatorName() const;
184 * Stores the operator arguments
185 * \param theArgs array that stores the operator arguments, needed for execution
187 HYDRODATA_EXPORT void SetArgs(const QByteArray& theArgs);
190 * Returns the operator arguments
191 * \returns array that stores the operator arguments, needed for execution
193 HYDRODATA_EXPORT QByteArray Args() const;
196 * Sets the "MustBeUpdated" flag: if image is depended on updated features.
197 * \param theFlag is true for images that must be updated, false for up-to-date
199 HYDRODATA_EXPORT void MustBeUpdated(bool theFlag);
202 * Returns the "MustBeUpdated" flag: is image must be recomputed or not
203 * \returns false if image is up to date
205 HYDRODATA_EXPORT bool MustBeUpdated() const;
208 * Marks the image as self-splitted.
209 * \param theFlag is true for self-splitted image
211 HYDRODATA_EXPORT void SetIsSelfSplitted(bool theFlag);
214 * Checks that the image is self-splitted.
215 * \returns true if image is self-splitted
217 HYDRODATA_EXPORT bool IsSelfSplitted() const;
221 friend class HYDROData_Iterator;
224 * Creates new object in the internal data structure. Use higher level objects
225 * to create objects with real content.
230 * Destructs properties of the object and object itself, removes it from the document.