1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
24 #include <HYDROData_Image.h>
27 class HYDROData_Image : public HYDROData_Entity
30 %ConvertToSubClassCode
31 switch ( sipCpp->GetKind() )
34 sipClass = sipClass_HYDROData_Image;
38 // We don't recognise the type.
44 #include <HYDROData_Image.h>
49 enum TransformationMode
61 * \param theImage new image
63 void SetImage( const QImage& theImage );
66 * Load the image from file
67 * \param theFilePath path to image
69 bool LoadImage( const QString& theFilePath );
72 * Returns the kept image
78 * Stores the image file path
79 * \param theFilePath image file path
81 void SetFilePath( const QString& theFilePath );
84 * Returns uploaded image file path
86 QString GetFilePath() const;
90 * Stores the image transformation
91 * \param theTrsf new transformation
93 void SetTrsf( const QTransform& theTrsf );
96 * Returns the kept transformation, or "identity" if not yet stored
98 QTransform Trsf() const;
101 * Updates the matrix of transformation in accordance with reference points.
102 * \param theTrsf new transformation
108 * Returns true if transformation is done by two points only
110 bool IsByTwoPoints() const;
114 * Removes all references from this image.
116 bool HasReferences() const;
119 * Removes all references from this image.
121 void RemoveAllReferences();
125 * Stores the transformation points in local cs of image
126 * \param thePointA point A
127 * \param thePointB point B
128 * \param thePointC point C
130 void SetLocalPoints( const QPoint& thePointA,
131 const QPoint& thePointB,
132 const QPoint& thePointC = QPoint( INT_MIN, INT_MIN ),
133 const bool theIsUpdate = true );
136 * Returns the transformation points in local cs of image
137 * \param thePointA point A
138 * \param thePointB point B
139 * \param thePointC point C
140 * \return true if all parameters has been set before
142 bool GetLocalPoints( QPoint& thePointA /Out/,
143 QPoint& thePointB /Out/,
144 QPoint& thePointC /Out/ ) const;
147 * Returns true if local points has been set before
149 bool HasLocalPoints() const;
153 * Stores the transformation points in global cs
154 * \param theMode transformation mode
155 * \param thePointA point A
156 * \param thePointB point B
157 * \param thePointC point C
159 void SetGlobalPoints( const TransformationMode& theMode,
160 const QPointF& thePointA,
161 const QPointF& thePointB,
162 const QPointF& thePointC = QPoint( INT_MIN, INT_MIN ),
163 const bool theIsUpdate = true );
166 * Returns the transformation points in global cs
167 * \param theMode transformation mode
168 * \param thePointA point A
169 * \param thePointB point B
170 * \param thePointC point C
171 * \return true if all parameters has been set before
173 bool GetGlobalPoints( TransformationMode& theMode,
174 QPointF& thePointA /Out/,
175 QPointF& thePointB /Out/,
176 QPointF& thePointC /Out/ ) const;
179 * Get transformation points from the file and stores them in global cs
180 * \param theFileName the image georeferencement file name
181 * \return true in case of success
183 bool SetGlobalPointsFromFile( const QString& theFileName );
186 * Returns true if global points has been set before
188 bool HasGlobalPoints() const;
192 * Stores the transformation points in reference image local cs
193 * \param theRefImage reference image
194 * \param thePointA point A
195 * \param thePointB point B
196 * \param thePointC point C
198 void SetReferencePoints( HYDROData_Image theRefImage,
199 const QPointF& thePointA,
200 const QPointF& thePointB,
201 const QPointF& thePointC = QPoint( INT_MIN, INT_MIN ),
202 const bool theIsUpdate = true )
203 [void ( const Handle_HYDROData_Image&, const QPointF&, const QPointF&, const QPointF&, const bool )];
205 Handle(HYDROData_Image) aRefImage =
206 Handle(HYDROData_Image)::DownCast( createHandle( a0 ) );
207 if ( !aRefImage.IsNull() )
209 Py_BEGIN_ALLOW_THREADS
210 sipSelfWasArg ? sipCpp->HYDROData_Image::SetReferencePoints( aRefImage, *a1, *a2, *a3, a4 ) :
211 sipCpp->SetReferencePoints( aRefImage, *a1, *a2, *a3, a4 );
217 * Returns the transformation points in reference image local cs
218 * \param theRefImage reference image
219 * \param thePointA point A
220 * \param thePointB point B
221 * \param thePointC point C
222 * \return true if all parameters has been set correctly
224 bool GetReferencePoints( HYDROData_Image theRefImage,
225 QPointF& thePointA /Out/,
226 QPointF& thePointB /Out/,
227 QPointF& thePointC /Out/ ) const
228 [bool ( const Handle_HYDROData_Image&, QPointF&, QPointF&, QPointF& )];
230 Handle(HYDROData_Image) aRefImage =
231 Handle(HYDROData_Image)::DownCast( createHandle( a0 ) );
232 if ( !aRefImage.IsNull() )
234 Py_BEGIN_ALLOW_THREADS
235 sipRes = sipSelfWasArg ? sipCpp->HYDROData_Image::GetReferencePoints( aRefImage, *a1, *a2, *a3 ) :
236 sipCpp->GetReferencePoints( aRefImage, *a1, *a2, *a3 );
242 * Returns true if reference points has been set before
244 bool HasReferencePoints() const;
248 * Stores the reference image for transformation
249 * \param theRefImage reference image
251 void SetTrsfReferenceImage( HYDROData_Image theRefImage ) [void ( const Handle_HYDROData_Image& )];
253 Handle(HYDROData_Image) aRefImage =
254 Handle(HYDROData_Image)::DownCast( createHandle( a0 ) );
255 if ( !aRefImage.IsNull() )
257 Py_BEGIN_ALLOW_THREADS
258 sipSelfWasArg ? sipCpp->HYDROData_Image::SetTrsfReferenceImage( aRefImage ) :
259 sipCpp->SetTrsfReferenceImage( aRefImage );
265 * Returns the reference image for transformation
267 HYDROData_Image GetTrsfReferenceImage() const [Handle_HYDROData_Image ()];
269 Handle(HYDROData_Image) aRefImage;
271 Py_BEGIN_ALLOW_THREADS
272 aRefImage = sipSelfWasArg ? sipCpp->HYDROData_Image::GetTrsfReferenceImage() :
273 sipCpp->GetTrsfReferenceImage();
276 sipRes = (HYDROData_Image*)createPointer( aRefImage );
280 * Removes the reference image for transformation
282 void RemoveTrsfReferenceImage();
286 * Stores the transformation mode
288 void SetTrsfMode( const TransformationMode& theMode );
291 * Returns the transformation mode
293 TransformationMode GetTrsfMode() const;
297 * Returns the number of referenced objects
298 * \return zero if there is no references
300 int NbReferences() const;
303 * Appends reference to other object (image or polyline).
304 * \param theReferenced the object referenced by this
306 void AppendReference( HYDROData_Entity theReferenced ) [void ( const Handle_HYDROData_Entity& )];
308 Handle(HYDROData_Entity) aRef = createHandle( a0 );
309 if ( !aRef.IsNull() )
311 Py_BEGIN_ALLOW_THREADS
312 sipSelfWasArg ? sipCpp->HYDROData_Image::AppendReference( aRef ) :
313 sipCpp->AppendReference( aRef );
319 * Returns reference by index.
320 * \param theIndex number of reference [0; NbReference)
321 * \returns the referenced object, or Null if index is invalid
323 HYDROData_Entity Reference( const int theIndex ) const [Handle_HYDROData_Entity ()];
325 Handle(HYDROData_Entity) aRef;
327 Py_BEGIN_ALLOW_THREADS
328 aRef = sipSelfWasArg ? sipCpp->HYDROData_Image::Reference( a0 ) :
329 sipCpp->Reference( a0 );
332 sipRes = createPointer( aRef );
336 * Updates reference by index. If index is one-bigger than \a NbReferences,
337 * this method appends it to the end (NbReferences is incremented).
338 * \param theIndex number of reference [0; NbReference]
339 * \param theReferenced the object referenced by this
341 void ChangeReference( const int theIndex, HYDROData_Entity theReferenced )
342 [void ( const int, const Handle_HYDROData_Entity& )];
344 Handle(HYDROData_Entity) aRef = createHandle( a1 );
345 if ( !aRef.IsNull() )
347 Py_BEGIN_ALLOW_THREADS
348 sipSelfWasArg ? sipCpp->HYDROData_Image::ChangeReference( a0, aRef ) :
349 sipCpp->ChangeReference( a0, aRef );
355 * Removes reference by index
356 * \param theIndex number of reference [0; NbReference)
358 void RemoveReference( const int theIndex );
361 * Removes all references.
363 void ClearReferences();
367 * Stores the operator name
368 * \param theOpName name of the operator that must be executed for image update
370 void SetOperatorName(const QString theOpName);
373 * Returns the operator name
374 * \returns the name of the operator that must be executed for image update
376 QString OperatorName() const;
379 * Stores the operator arguments
380 * \param theArgs array that stores the operator arguments, needed for execution
382 void SetArgs(const QByteArray& theArgs);
385 * Returns the operator arguments
386 * \returns array that stores the operator arguments, needed for execution
388 QByteArray Args() const;
392 * Marks the image as self-splitted.
393 * \param theFlag is true for self-splitted image
395 void SetIsSelfSplitted(bool theFlag);
398 * Checks that the image is self-splitted.
399 * \returns true if image is self-splitted
401 bool IsSelfSplitted() const;
406 * Creates new object in the internal data structure. Use higher level objects
407 * to create objects with real content.
412 * Destructs properties of the object and object itself, removes it from the document.