]> SALOME platform Git repositories - modules/hydro.git/blob - src/HYDROPy/HYDROData_Image.sip
Salome HOME
The data model has been redesigned to new format.
[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 thePointAIn input point A
80    * \param thePointBIn input point B
81    * \param thePointCIn input point C
82    * \param thePointAOut output point A
83    * \param thePointBOut output point B
84    * \param thePointCOut output point C
85    */
86   void                       SetTrsfPoints( const QPoint&  thePointAIn,
87                                             const QPoint&  thePointBIn,
88                                             const QPoint&  thePointCIn,
89                                             const QPointF& thePointAOut,
90                                             const QPointF& thePointBOut,
91                                             const QPointF& thePointCOut );
92
93   /**
94    * Returns the image transformation points (3 input + 3 output)
95    * \param thePointAIn input point A
96    * \param thePointBIn input point B
97    * \param thePointCIn input point C
98    * \param thePointAOut output point A
99    * \param thePointBOut output point B
100    * \param thePointCOut output point C
101    */
102   void                       TrsfPoints( QPoint&  thePointAIn,
103                                          QPoint&  thePointBIn,
104                                          QPoint&  thePointCIn,
105                                          QPointF& thePointAOut,
106                                          QPointF& thePointBOut,
107                                          QPointF& thePointCOut );
108
109   /**
110    * Returns the number of referenced images
111    * \return zero if there is no references
112    */
113   int                        NbReferences();
114
115   /**
116    * Appends reference to other image.
117    * \param theReferenced the image referenced by this
118    */
119   void AppendReference( HYDROData_Entity theReferenced ) [void (Handle_HYDROData_Entity)];
120   %MethodCode
121
122     Handle(HYDROData_Entity) aRefObj = createHandle( a0 );
123     if ( !aRefObj.IsNull() )
124     {
125       Py_BEGIN_ALLOW_THREADS
126       sipSelfWasArg ? sipCpp->HYDROData_Image::AppendReference( aRefObj ) : 
127                       sipCpp->AppendReference( aRefObj );
128       Py_END_ALLOW_THREADS
129     }
130
131   %End
132
133   /**
134    * Returns reference by index.
135    * \param theIndex number of reference [0; NbReference)
136    * \returns the referenced image, or Null if index is invalid
137    */
138   HYDROData_Entity Reference( const int theIndex ) const [Handle_HYDROData_Entity (const int)];
139   %MethodCode
140
141     Handle(HYDROData_Entity) aRefObj;
142     
143     Py_BEGIN_ALLOW_THREADS
144     aRefObj = sipSelfWasArg ? sipCpp->HYDROData_Image::Reference( a0 ) : 
145                               sipCpp->Reference( a0 );
146     Py_END_ALLOW_THREADS
147     
148     sipRes = createPointer( aRefObj );
149   
150   %End
151
152   /**
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 image referenced by this
157    */
158   void ChangeReference( const int theIndex, HYDROData_Entity theReferenced ) [void (const int, Handle_HYDROData_Entity)];
159   %MethodCode
160
161     Handle(HYDROData_Entity) aRefObj = createHandle( a1 );
162     if ( !aRefObj.IsNull() )
163     {
164       Py_BEGIN_ALLOW_THREADS
165       sipSelfWasArg ? sipCpp->HYDROData_Image::ChangeReference( a0, aRefObj ) : 
166                       sipCpp->ChangeReference( a0, aRefObj );
167       Py_END_ALLOW_THREADS
168     }
169   
170   %End
171
172   /**
173    * Removes reference by index
174    * \param theIndex number of reference [0; NbReference)
175    */
176   void                       RemoveReference( const int theIndex );
177
178   /**
179    * Removes all references.
180    */
181   void                       ClearReferences();
182
183   /**
184    * Stores the operator name
185    * \param theOpName name of the operator that must be executed for image update
186    */
187   void                       SetOperatorName( const QString theOpName );
188
189   /**
190    * Returns the operator name
191    * \returns the name of the operator that must be executed for image update
192    */
193   QString                    OperatorName();
194
195   /**
196    * Stores the operator arguments
197    * \param theArgs array that stores the operator arguments, needed for execution
198    */
199   void                       SetArgs( const QByteArray& theArgs );
200
201   /**
202    * Returns the operator arguments
203    * \returns array that stores the operator arguments, needed for execution
204    */
205   QByteArray                 Args();
206   
207   /**
208    * Sets the "MustBeUpdated" flag: if image is depended on updated features.
209    * \param theFlag is true for images that must be updated, false for up-to-date
210    */
211   void                       MustBeUpdated( bool theFlag );
212
213   /**
214    * Returns the "MustBeUpdated" flag: is image must be recomputed or not
215    * \returns false if image is up to date
216    */
217   bool                       MustBeUpdated();
218
219
220 protected:
221
222   /**
223    * Creates new object in the internal data structure. Use higher level objects 
224    * to create objects with real content.
225    */
226   HYDROData_Image();
227
228   /**
229    * Destructs properties of the object and object itself, removes it from the document.
230    */
231   ~HYDROData_Image();
232 };
233
234