1 // Copyright (C) 2014-2015 EDF-R&D
2 // This library is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU Lesser General Public
4 // License as published by the Free Software Foundation; either
5 // version 2.1 of the License, or (at your option) any later version.
7 // This library is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 // Lesser General Public License for more details.
12 // You should have received a copy of the GNU Lesser General Public
13 // License along with this library; if not, write to the Free Software
14 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include <HYDROData_Image.h>
23 class HYDROData_Image : public HYDROData_Entity
26 %ConvertToSubClassCode
27 switch ( sipCpp->GetKind() )
30 sipClass = sipClass_HYDROData_Image;
34 // We don't recognise the type.
40 #include <HYDROData_Image.h>
45 enum TransformationMode
57 * \param theImage new image
59 void SetImage( const QImage& theImage );
62 * Load the image from file
63 * \param theFilePath path to image
65 bool LoadImage( const QString& theFilePath );
68 * Returns the kept image
74 * Stores the image file path
75 * \param theFilePath image file path
77 void SetFilePath( const QString& theFilePath );
80 * Returns uploaded image file path
82 QString GetFilePath() const;
86 * Stores the image transformation
87 * \param theTrsf new transformation
89 void SetTrsf( const QTransform& theTrsf );
92 * Returns the kept transformation, or "identity" if not yet stored
94 QTransform Trsf() const;
97 * Updates the matrix of transformation in accordance with reference points.
98 * \param theTrsf new transformation
104 * Returns true if transformation is done by two points only
106 bool IsByTwoPoints() const;
110 * Removes all references from this image.
112 bool HasReferences() const;
115 * Removes all references from this image.
117 void RemoveAllReferences();
121 * Stores the transformation points in local cs of image
122 * \param thePointA point A
123 * \param thePointB point B
124 * \param thePointC point C
126 void SetLocalPoints( const QPoint& thePointA,
127 const QPoint& thePointB,
128 const QPoint& thePointC = QPoint( INT_MIN, INT_MIN ),
129 const bool theIsUpdate = true );
132 * Returns the transformation points in local cs of image
133 * \param thePointA point A
134 * \param thePointB point B
135 * \param thePointC point C
136 * \return true if all parameters has been set before
138 bool GetLocalPoints( QPoint& thePointA /Out/,
139 QPoint& thePointB /Out/,
140 QPoint& thePointC /Out/ ) const;
143 * Returns true if local points has been set before
145 bool HasLocalPoints() const;
149 * Stores the transformation points in global cs
150 * \param theMode transformation mode
151 * \param thePointA point A
152 * \param thePointB point B
153 * \param thePointC point C
155 void SetGlobalPoints( const TransformationMode& theMode,
156 const QPointF& thePointA,
157 const QPointF& thePointB,
158 const QPointF& thePointC = QPoint( INT_MIN, INT_MIN ),
159 const bool theIsUpdate = true );
162 * Returns the transformation points in global cs
163 * \param theMode transformation mode
164 * \param thePointA point A
165 * \param thePointB point B
166 * \param thePointC point C
167 * \return true if all parameters has been set before
169 bool GetGlobalPoints( TransformationMode& theMode,
170 QPointF& thePointA /Out/,
171 QPointF& thePointB /Out/,
172 QPointF& thePointC /Out/ ) const;
175 * Get transformation points from the file and stores them in global cs
176 * \param theFileName the image georeferencement file name
177 * \return true in case of success
179 bool SetGlobalPointsFromFile( const QString& theFileName );
182 * Returns true if global points has been set before
184 bool HasGlobalPoints() const;
188 * Stores the transformation points in reference image local cs
189 * \param theRefImage reference image
190 * \param thePointA point A
191 * \param thePointB point B
192 * \param thePointC point C
194 void SetReferencePoints( HYDROData_Image theRefImage,
195 const QPointF& thePointA,
196 const QPointF& thePointB,
197 const QPointF& thePointC = QPoint( INT_MIN, INT_MIN ),
198 const bool theIsUpdate = true )
199 [void ( const Handle_HYDROData_Image&, const QPointF&, const QPointF&, const QPointF&, const bool )];
201 Handle(HYDROData_Image) aRefImage =
202 Handle(HYDROData_Image)::DownCast( createHandle( a0 ) );
203 if ( !aRefImage.IsNull() )
205 Py_BEGIN_ALLOW_THREADS
206 sipSelfWasArg ? sipCpp->HYDROData_Image::SetReferencePoints( aRefImage, *a1, *a2, *a3, a4 ) :
207 sipCpp->SetReferencePoints( aRefImage, *a1, *a2, *a3, a4 );
213 * Returns the transformation points in reference image local cs
214 * \param theRefImage reference image
215 * \param thePointA point A
216 * \param thePointB point B
217 * \param thePointC point C
218 * \return true if all parameters has been set correctly
220 bool GetReferencePoints( HYDROData_Image theRefImage,
221 QPointF& thePointA /Out/,
222 QPointF& thePointB /Out/,
223 QPointF& thePointC /Out/ ) const
224 [bool ( const Handle_HYDROData_Image&, QPointF&, QPointF&, QPointF& )];
226 Handle(HYDROData_Image) aRefImage =
227 Handle(HYDROData_Image)::DownCast( createHandle( a0 ) );
228 if ( !aRefImage.IsNull() )
230 Py_BEGIN_ALLOW_THREADS
231 sipRes = sipSelfWasArg ? sipCpp->HYDROData_Image::GetReferencePoints( aRefImage, *a1, *a2, *a3 ) :
232 sipCpp->GetReferencePoints( aRefImage, *a1, *a2, *a3 );
238 * Returns true if reference points has been set before
240 bool HasReferencePoints() const;
244 * Stores the reference image for transformation
245 * \param theRefImage reference image
247 void SetTrsfReferenceImage( HYDROData_Image theRefImage ) [void ( const Handle_HYDROData_Image& )];
249 Handle(HYDROData_Image) aRefImage =
250 Handle(HYDROData_Image)::DownCast( createHandle( a0 ) );
251 if ( !aRefImage.IsNull() )
253 Py_BEGIN_ALLOW_THREADS
254 sipSelfWasArg ? sipCpp->HYDROData_Image::SetTrsfReferenceImage( aRefImage ) :
255 sipCpp->SetTrsfReferenceImage( aRefImage );
261 * Returns the reference image for transformation
263 HYDROData_Image GetTrsfReferenceImage() const [Handle_HYDROData_Image ()];
265 Handle(HYDROData_Image) aRefImage;
267 Py_BEGIN_ALLOW_THREADS
268 aRefImage = sipSelfWasArg ? sipCpp->HYDROData_Image::GetTrsfReferenceImage() :
269 sipCpp->GetTrsfReferenceImage();
272 sipRes = (HYDROData_Image*)createPointer( aRefImage );
276 * Removes the reference image for transformation
278 void RemoveTrsfReferenceImage();
282 * Stores the transformation mode
284 void SetTrsfMode( const TransformationMode& theMode );
287 * Returns the transformation mode
289 TransformationMode GetTrsfMode() const;
293 * Returns the number of referenced objects
294 * \return zero if there is no references
296 int NbReferences() const;
299 * Appends reference to other object (image or polyline).
300 * \param theReferenced the object referenced by this
302 void AppendReference( HYDROData_Entity theReferenced ) [void ( const Handle_HYDROData_Entity& )];
304 Handle(HYDROData_Entity) aRef = createHandle( a0 );
305 if ( !aRef.IsNull() )
307 Py_BEGIN_ALLOW_THREADS
308 sipSelfWasArg ? sipCpp->HYDROData_Image::AppendReference( aRef ) :
309 sipCpp->AppendReference( aRef );
315 * Returns reference by index.
316 * \param theIndex number of reference [0; NbReference)
317 * \returns the referenced object, or Null if index is invalid
319 HYDROData_Entity Reference( const int theIndex ) const [Handle_HYDROData_Entity ()];
321 Handle(HYDROData_Entity) aRef;
323 Py_BEGIN_ALLOW_THREADS
324 aRef = sipSelfWasArg ? sipCpp->HYDROData_Image::Reference( a0 ) :
325 sipCpp->Reference( a0 );
328 sipRes = createPointer( aRef );
332 * Updates reference by index. If index is one-bigger than \a NbReferences,
333 * this method appends it to the end (NbReferences is incremented).
334 * \param theIndex number of reference [0; NbReference]
335 * \param theReferenced the object referenced by this
337 void ChangeReference( const int theIndex, HYDROData_Entity theReferenced )
338 [void ( const int, const Handle_HYDROData_Entity& )];
340 Handle(HYDROData_Entity) aRef = createHandle( a1 );
341 if ( !aRef.IsNull() )
343 Py_BEGIN_ALLOW_THREADS
344 sipSelfWasArg ? sipCpp->HYDROData_Image::ChangeReference( a0, aRef ) :
345 sipCpp->ChangeReference( a0, aRef );
351 * Removes reference by index
352 * \param theIndex number of reference [0; NbReference)
354 void RemoveReference( const int theIndex );
357 * Removes all references.
359 void ClearReferences();
363 * Stores the operator name
364 * \param theOpName name of the operator that must be executed for image update
366 void SetOperatorName(const QString theOpName);
369 * Returns the operator name
370 * \returns the name of the operator that must be executed for image update
372 QString OperatorName() const;
375 * Stores the operator arguments
376 * \param theArgs array that stores the operator arguments, needed for execution
378 void SetArgs(const QByteArray& theArgs);
381 * Returns the operator arguments
382 * \returns array that stores the operator arguments, needed for execution
384 QByteArray Args() const;
388 * Marks the image as self-splitted.
389 * \param theFlag is true for self-splitted image
391 void SetIsSelfSplitted(bool theFlag);
394 * Checks that the image is self-splitted.
395 * \returns true if image is self-splitted
397 bool IsSelfSplitted() const;
402 * Creates new object in the internal data structure. Use higher level objects
403 * to create objects with real content.
408 * Destructs properties of the object and object itself, removes it from the document.