Salome HOME
- Merge type combo box in Calculation case dialog is filled and connected to get...
[modules/hydro.git] / src / HYDROPy / HYDROData_Image.sip
1 // Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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.
10 //
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.
15 //
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
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 %ExportedHeaderCode
24 #include <HYDROData_Image.h>
25 %End
26
27 class HYDROData_Image : HYDROData_Entity
28 {
29
30 %ConvertToSubClassCode
31     switch ( sipCpp->GetKind() )
32     {
33       case KIND_IMAGE:
34         sipClass = sipClass_HYDROData_Image;
35         break;
36
37       default:
38         // We don't recognise the type.
39         sipClass = NULL;
40     }
41 %End
42
43 %TypeHeaderCode
44 #include <HYDROData_Image.h>
45 %End
46
47 public:      
48
49   /**
50    * Stores the image
51    * \param theImage new image
52    */
53   void                       SetImage( const QImage& theImage );
54
55   /**
56    * Load the image from file
57    * \param theFilePath path to image
58    */
59   bool                       LoadImage( const QString& theFilePath );
60
61   /**
62    * Returns the kept image
63    */
64   QImage                     Image();
65
66   /**
67    * Stores the image transformation
68    * \param theTrsf new transformation
69    */
70   void                       SetTrsf( const QTransform& theTrsf );
71
72   /**
73    * Returns the kept transformation, or "identity" if not yet stored
74    */
75   QTransform                 Trsf();
76
77   /**
78    * Stores the image transformation points (3 input + 3 output)
79    * \param thePointA input point A
80    * \param thePointB input point B
81    * \param thePointC input point C
82    * \param theLambertPointA output point A in Lambert93 coordinates
83    * \param theLambertPointB output point B in Lambert93 coordinates
84    * \param theLambertPointC output point C in Lambert93 coordinates
85    * \param theCartesianPointA output point A in Cartesian coordinates
86    * \param theCartesianPointB output point B in Cartesian coordinates
87    * \param theCartesianPointC output point C in Cartesian coordinates
88    */
89   void                       SetTrsfPoints( const QPoint& thePointA,
90                                             const QPoint& thePointB,
91                                             const QPoint& thePointC,
92                                             const QPointF& theLambertPointA,
93                                             const QPointF& theLambertPointB,
94                                             const QPointF& theLambertPointC,
95                                             const QPointF& theCartesianPointA,
96                                             const QPointF& theCartesianPointB,
97                                             const QPointF& theCartesianPointC );
98
99   /**
100    * Returns the image transformation points (3 input + 3 output)
101    * \param thePointA input point A
102    * \param thePointB input point B
103    * \param thePointC input point C
104    * \param theLambertPointA output point A in Lambert93 coordinates
105    * \param theLambertPointB output point B in Lambert93 coordinates
106    * \param theLambertPointC output point C in Lambert93 coordinates
107    * \param theCartesianPointA output point A in Cartesian coordinates
108    * \param theCartesianPointB output point B in Cartesian coordinates
109    * \param theCartesianPointC output point C in Cartesian coordinates
110    */
111   void                       TrsfPoints( QPoint& thePointA,
112                                          QPoint& thePointB,
113                                          QPoint& thePointC,
114                                          QPointF& theLambertPointA,
115                                          QPointF& theLambertPointB,
116                                          QPointF& theLambertPointC,
117                                          QPointF& theCartesianPointA,
118                                          QPointF& theCartesianPointB,
119                                          QPointF& theCartesianPointC ) const;
120
121   /**
122    * Returns true if the image has stored transformation points
123    */
124   bool                       HasTrsfPoints() const;
125
126   /**
127    * Stores the transformation mode (0 - Lambert93, 1 - Cartesian)
128    */
129   void                       SetTrsfMode(const int theMode);
130
131   /**
132    * Returns the transformation mode (0 - Lambert93, 1 - Cartesian)
133    */
134   int                        TrsfMode() const;
135
136
137   /**
138    * Returns the number of referenced images
139    * \return zero if there is no references
140    */
141   int                        NbReferences();
142
143   /**
144    * Appends reference to other image.
145    * \param theReferenced the image referenced by this
146    */
147   void AppendReference( HYDROData_Entity theReferenced ) [void (Handle_HYDROData_Entity)];
148   %MethodCode
149
150     Handle(HYDROData_Entity) aRefObj = createHandle( a0 );
151     if ( !aRefObj.IsNull() )
152     {
153       Py_BEGIN_ALLOW_THREADS
154       sipSelfWasArg ? sipCpp->HYDROData_Image::AppendReference( aRefObj ) : 
155                       sipCpp->AppendReference( aRefObj );
156       Py_END_ALLOW_THREADS
157     }
158
159   %End
160
161   /**
162    * Returns reference by index.
163    * \param theIndex number of reference [0; NbReference)
164    * \returns the referenced image, or Null if index is invalid
165    */
166   HYDROData_Entity Reference( const int theIndex ) const [Handle_HYDROData_Entity (const int)];
167   %MethodCode
168
169     Handle(HYDROData_Entity) aRefObj;
170     
171     Py_BEGIN_ALLOW_THREADS
172     aRefObj = sipSelfWasArg ? sipCpp->HYDROData_Image::Reference( a0 ) : 
173                               sipCpp->Reference( a0 );
174     Py_END_ALLOW_THREADS
175     
176     sipRes = createPointer( aRefObj );
177   
178   %End
179
180   /**
181    * Updates reference by index. If index is one-bigger than \a NbReferences, 
182    * this method appends it to the end (NbReferences is incremented).
183    * \param theIndex number of reference [0; NbReference]
184    * \param theReferenced the image referenced by this
185    */
186   void ChangeReference( const int theIndex, HYDROData_Entity theReferenced ) [void (const int, Handle_HYDROData_Entity)];
187   %MethodCode
188
189     Handle(HYDROData_Entity) aRefObj = createHandle( a1 );
190     if ( !aRefObj.IsNull() )
191     {
192       Py_BEGIN_ALLOW_THREADS
193       sipSelfWasArg ? sipCpp->HYDROData_Image::ChangeReference( a0, aRefObj ) : 
194                       sipCpp->ChangeReference( a0, aRefObj );
195       Py_END_ALLOW_THREADS
196     }
197   
198   %End
199
200   /**
201    * Removes reference by index
202    * \param theIndex number of reference [0; NbReference)
203    */
204   void                       RemoveReference( const int theIndex );
205
206   /**
207    * Removes all references.
208    */
209   void                       ClearReferences();
210
211   /**
212    * Stores the operator name
213    * \param theOpName name of the operator that must be executed for image update
214    */
215   void                       SetOperatorName( const QString theOpName );
216
217   /**
218    * Returns the operator name
219    * \returns the name of the operator that must be executed for image update
220    */
221   QString                    OperatorName();
222
223   /**
224    * Stores the operator arguments
225    * \param theArgs array that stores the operator arguments, needed for execution
226    */
227   void                       SetArgs( const QByteArray& theArgs );
228
229   /**
230    * Returns the operator arguments
231    * \returns array that stores the operator arguments, needed for execution
232    */
233   QByteArray                 Args();
234   
235   /**
236    * Sets the "MustBeUpdated" flag: if image is depended on updated features.
237    * \param theFlag is true for images that must be updated, false for up-to-date
238    */
239   void                       MustBeUpdated( bool theFlag );
240
241   /**
242    * Returns the "MustBeUpdated" flag: is image must be recomputed or not
243    * \returns false if image is up to date
244    */
245   bool                       MustBeUpdated();
246
247
248 protected:
249
250   /**
251    * Creates new object in the internal data structure. Use higher level objects 
252    * to create objects with real content.
253    */
254   HYDROData_Image();
255
256   /**
257    * Destructs properties of the object and object itself, removes it from the document.
258    */
259   ~HYDROData_Image();
260 };
261
262