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.
49 * \param theIsForce force reupdating of data object
51 HYDRODATA_EXPORT virtual void Update( const bool theIsForce = true );
54 * Returns data of object wrapped to QVariant.
55 * Reimplemented to wrap and return saved image.
56 * Transformation are applied to result image.
58 HYDRODATA_EXPORT virtual QVariant GetDataVariant();
62 * \param theImage new image
64 HYDRODATA_EXPORT void SetImage(const QImage& theImage);
67 * Load the image from file
68 * \param theFilePath path to image
70 HYDRODATA_EXPORT bool LoadImage(const QString& theFilePath);
73 * Returns the kept image
75 HYDRODATA_EXPORT QImage Image();
78 * Stores the image file path
79 * \param theFilePath image file path
81 HYDRODATA_EXPORT void SetFilePath(const QString& theFilePath);
84 * Returns uploaded image file path
86 HYDRODATA_EXPORT QString GetFilePath() const;
89 * Stores the image transformation
90 * \param theTrsf new transformation
92 HYDRODATA_EXPORT void SetTrsf(const QTransform& theTrsf);
95 * Returns the kept transformation, or "identity" if not yet stored
97 HYDRODATA_EXPORT QTransform Trsf() const;
100 * Stores 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 SetTrsfPoints(const QPoint& thePointAIn,
109 const QPoint& thePointBIn,
110 const QPoint& thePointCIn,
111 const QPointF& thePointAOut,
112 const QPointF& thePointBOut,
113 const QPointF& thePointCOut);
116 * Returns the image transformation points (3 input + 3 output)
117 * \param thePointAIn input point A
118 * \param thePointBIn input point B
119 * \param thePointCIn input point C
120 * \param thePointAOut output point A
121 * \param thePointBOut output point B
122 * \param thePointCOut output point C
124 HYDRODATA_EXPORT void TrsfPoints(QPoint& thePointAIn,
127 QPointF& thePointAOut,
128 QPointF& thePointBOut,
129 QPointF& thePointCOut) const;
131 HYDRODATA_EXPORT bool HasTrsfPoints() const;
134 * Appends reference to other object (image or polyline).
135 * \param theReferenced the object referenced by this
137 HYDRODATA_EXPORT void AppendReference( const Handle(HYDROData_Object)& theReferenced );
140 * Returns the number of referenced objects
141 * \return zero if there is no references
143 HYDRODATA_EXPORT int NbReferences() const;
146 * Returns reference by index.
147 * \param theIndex number of reference [0; NbReference)
148 * \returns the referenced object, or Null if index is invalid
150 HYDRODATA_EXPORT Handle(HYDROData_Object) Reference(const int theIndex) const;
153 * Updates reference by index. If index is one-bigger than \a NbReferences,
154 * this method appends it to the end (NbReferences is incremented).
155 * \param theIndex number of reference [0; NbReference]
156 * \param theReferenced the object referenced by this
158 HYDRODATA_EXPORT void ChangeReference(
159 const int theIndex, Handle(HYDROData_Object) theReferenced);
162 * Removes reference by index
163 * \param theIndex number of reference [0; NbReference)
165 HYDRODATA_EXPORT void RemoveReference(const int theIndex);
168 * Removes all references.
170 HYDRODATA_EXPORT void ClearReferences();
173 * Stores the operator name
174 * \param theOpName name of the operator that must be executed for image update
176 HYDRODATA_EXPORT void SetOperatorName(const QString theOpName);
179 * Returns the operator name
180 * \returns the name of the operator that must be executed for image update
182 HYDRODATA_EXPORT QString OperatorName() const;
185 * Stores the operator arguments
186 * \param theArgs array that stores the operator arguments, needed for execution
188 HYDRODATA_EXPORT void SetArgs(const QByteArray& theArgs);
191 * Returns the operator arguments
192 * \returns array that stores the operator arguments, needed for execution
194 HYDRODATA_EXPORT QByteArray Args() const;
197 * Sets the "MustBeUpdated" flag: if image is depended on updated features.
198 * \param theFlag is true for images that must be updated, false for up-to-date
200 HYDRODATA_EXPORT void MustBeUpdated(bool theFlag);
203 * Returns the "MustBeUpdated" flag: is image must be recomputed or not
204 * \returns false if image is up to date
206 HYDRODATA_EXPORT bool MustBeUpdated() const;
209 * Marks the image as self-splitted.
210 * \param theFlag is true for self-splitted image
212 HYDRODATA_EXPORT void SetIsSelfSplitted(bool theFlag);
215 * Checks that the image is self-splitted.
216 * \returns true if image is self-splitted
218 HYDRODATA_EXPORT bool IsSelfSplitted() const;
222 friend class HYDROData_Iterator;
225 * Creates new object in the internal data structure. Use higher level objects
226 * to create objects with real content.
231 * Destructs properties of the object and object itself, removes it from the document.