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 opencascade::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 opencascade::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;
243 * Stores the reference image for transformation
244 * \param theRefImage reference image
246 void SetTrsfReferenceImage( HYDROData_Image theRefImage ) [void ( const opencascade::handle<HYDROData_Image>& )];
248 Handle(HYDROData_Image) aRefImage =
249 Handle(HYDROData_Image)::DownCast( createHandle( a0 ) );
250 if ( !aRefImage.IsNull() )
252 Py_BEGIN_ALLOW_THREADS
253 sipSelfWasArg ? sipCpp->HYDROData_Image::SetTrsfReferenceImage( aRefImage ) :
254 sipCpp->SetTrsfReferenceImage( aRefImage );
260 * Returns the reference image for transformation
262 HYDROData_Image GetTrsfReferenceImage() const [opencascade::handle<HYDROData_Image> ()];
264 Handle(HYDROData_Image) aRefImage;
266 Py_BEGIN_ALLOW_THREADS
267 aRefImage = sipSelfWasArg ? sipCpp->HYDROData_Image::GetTrsfReferenceImage() :
268 sipCpp->GetTrsfReferenceImage();
271 sipRes = (HYDROData_Image*)createPointer( aRefImage );
275 * Removes the reference image for transformation
277 void RemoveTrsfReferenceImage();
281 * Stores the transformation mode
283 void SetTrsfMode( const TransformationMode& theMode );
286 * Returns the transformation mode
288 TransformationMode GetTrsfMode() const;
292 * Returns the number of referenced objects
293 * \return zero if there is no references
295 int NbReferences() const;
298 * Appends reference to other object (image or polyline).
299 * \param theReferenced the object referenced by this
301 void AppendReference( HYDROData_Entity theReferenced ) [void ( const opencascade::handle<HYDROData_Entity>& )];
303 Handle(HYDROData_Entity) aRef = createHandle( a0 );
304 if ( !aRef.IsNull() )
306 Py_BEGIN_ALLOW_THREADS
307 sipSelfWasArg ? sipCpp->HYDROData_Image::AppendReference( aRef ) :
308 sipCpp->AppendReference( aRef );
314 * Returns reference by index.
315 * \param theIndex number of reference [0; NbReference)
316 * \returns the referenced object, or Null if index is invalid
318 HYDROData_Entity Reference( const int theIndex ) const [opencascade::handle<HYDROData_Entity> ()];
320 Handle(HYDROData_Entity) aRef;
322 Py_BEGIN_ALLOW_THREADS
323 aRef = sipSelfWasArg ? sipCpp->HYDROData_Image::Reference( a0 ) :
324 sipCpp->Reference( a0 );
327 sipRes = createPointer( aRef );
331 * Updates reference by index. If index is one-bigger than \a NbReferences,
332 * this method appends it to the end (NbReferences is incremented).
333 * \param theIndex number of reference [0; NbReference]
334 * \param theReferenced the object referenced by this
336 void ChangeReference( const int theIndex, HYDROData_Entity theReferenced )
337 [void ( const int, const opencascade::handle<HYDROData_Entity>& )];
339 Handle(HYDROData_Entity) aRef = createHandle( a1 );
340 if ( !aRef.IsNull() )
342 Py_BEGIN_ALLOW_THREADS
343 sipSelfWasArg ? sipCpp->HYDROData_Image::ChangeReference( a0, aRef ) :
344 sipCpp->ChangeReference( a0, aRef );
350 * Removes reference by index
351 * \param theIndex number of reference [0; NbReference)
353 void RemoveReference( const int theIndex );
356 * Removes all references.
358 void ClearReferences();
362 * Stores the operator name
363 * \param theOpName name of the operator that must be executed for image update
365 void SetOperatorName(const QString theOpName);
368 * Returns the operator name
369 * \returns the name of the operator that must be executed for image update
371 QString OperatorName() const;
374 * Stores the operator arguments
375 * \param theArgs array that stores the operator arguments, needed for execution
377 void SetArgs(const QByteArray& theArgs);
380 * Returns the operator arguments
381 * \returns array that stores the operator arguments, needed for execution
383 QByteArray Args() const;
387 * Marks the image as self-split.
388 * \param theFlag is true for self-split image
390 void SetIsSelfSplit(bool theFlag);
393 * Checks that the image is self-split.
394 * \returns true if image is self-split
396 bool IsSelfSplit() const;
401 * Creates new object in the internal data structure. Use higher level objects
402 * to create objects with real content.
407 * Destructs properties of the object and object itself, removes it from the document.