Salome HOME
Merge branch 'BR_v14_rc' of ssh://git.salome-platform.org/modules/hydro into BR_v14_rc
[modules/hydro.git] / src / HYDROPy / HYDROData_Entity.sip
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.
6 //
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.
11 //
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
15 //
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
17 //
18
19 %ExportedHeaderCode
20 #include <HYDROData_Entity.h>
21 %End
22
23 typedef int ObjectKind;
24
25 const ObjectKind KIND_UNKNOWN;
26 const ObjectKind KIND_IMAGE;
27 const ObjectKind KIND_POLYLINE;
28 const ObjectKind KIND_BATHYMETRY;
29 const ObjectKind KIND_ALTITUDE;
30 const ObjectKind KIND_IMMERSIBLE_ZONE;
31 const ObjectKind KIND_RIVER;
32 const ObjectKind KIND_STREAM;
33 const ObjectKind KIND_CONFLUENCE;
34 const ObjectKind KIND_CHANNEL;
35 const ObjectKind KIND_OBSTACLE;
36 const ObjectKind KIND_DIGUE;
37 const ObjectKind KIND_PROFILE;
38 const ObjectKind KIND_PROFILEUZ;
39 const ObjectKind KIND_POLYLINEXY;
40 const ObjectKind KIND_CALCULATION;
41 const ObjectKind KIND_ZONE;
42 const ObjectKind KIND_REGION;
43 const ObjectKind KIND_SHAPES_GROUP;
44 const ObjectKind KIND_SPLITTED_GROUP;
45 const ObjectKind KIND_OBSTACLE_ALTITUDE;
46 const ObjectKind KIND_STRICKLER_TABLE;
47
48 class HYDROData_Entity
49 {
50 %TypeHeaderCode
51 #include <HYDROData_Entity.h>
52 %End
53
54 %ConvertToSubClassCode
55     // HYDROData_Entity sub-classes provide a unique kind ID.
56     switch ( sipCpp->GetKind() )
57     {
58       case KIND_IMAGE:
59         sipClass = sipClass_HYDROData_Image;
60         break;
61
62       case KIND_POLYLINE:
63         sipClass = sipClass_HYDROData_Polyline3D;
64         break;
65
66       case KIND_BATHYMETRY:
67         sipClass = sipClass_HYDROData_Bathymetry;
68         break;
69
70       case KIND_ALTITUDE:
71         sipClass = sipClass_HYDROData_AltitudeObject;
72         break;
73
74       case KIND_IMMERSIBLE_ZONE:
75         sipClass = sipClass_HYDROData_ImmersibleZone;
76         break;
77
78       case KIND_RIVER:
79         sipClass = sipClass_HYDROData_River;
80         break;
81
82       case KIND_STREAM:
83         sipClass = sipClass_HYDROData_Stream;
84         break;
85
86       case KIND_CONFLUENCE:
87         sipClass = sipClass_HYDROData_Confluence;
88         break;
89
90       case KIND_CHANNEL:
91         sipClass = sipClass_HYDROData_Channel;
92         break;
93
94       case KIND_OBSTACLE:
95         sipClass = sipClass_HYDROData_Obstacle;
96         break;
97
98       case KIND_DIGUE:
99         sipClass = sipClass_HYDROData_Digue;
100         break;
101
102       case KIND_PROFILE:
103         sipClass = sipClass_HYDROData_Profile;
104         break;
105
106       case KIND_PROFILEUZ:
107         sipClass = sipClass_HYDROData_ProfileUZ;
108         break;
109
110       case KIND_POLYLINEXY:
111         sipClass = sipClass_HYDROData_PolylineXY;
112         break;
113
114       case KIND_CALCULATION:
115         sipClass = sipClass_HYDROData_CalculationCase;
116         break;
117
118       case KIND_ZONE:
119         sipClass = sipClass_HYDROData_Zone;
120         break;
121
122       case KIND_REGION:
123         sipClass = sipClass_HYDROData_Region;
124         break;
125
126       case KIND_SHAPES_GROUP:
127         sipClass = sipClass_HYDROData_ShapesGroup;
128         break;
129         
130       case KIND_SPLITTED_GROUP:
131         sipClass = sipClass_HYDROData_SplittedShapesGroup;
132         break;
133
134       case KIND_STREAM_ALTITUDE:
135         sipClass = sipClass_HYDROData_StreamAltitude;
136         break;
137
138       case KIND_OBSTACLE_ALTITUDE:
139         sipClass = sipClass_HYDROData_ObstacleAltitude;
140         break;
141
142       case KIND_STRICKLER_TABLE:
143         sipClass = sipClass_HYDROData_StricklerTable;
144         break;
145
146       case KIND_UNKNOWN:
147         sipClass = sipClass_HYDROData_Entity;
148         break;
149
150       default:
151         // We don't recognise the type.
152         sipClass = NULL;
153     }
154 %End
155
156 public:
157
158   /**
159    * Returns the kind of this object. Must be redefined in all objects of known type.
160    */
161   virtual const ObjectKind GetKind() const;
162
163   /**
164    * Returns the name of this object.
165    */
166   virtual QString GetName() const;
167
168   /**
169    * Updates the name of this object.
170    */
171   virtual void SetName(const QString& theName);
172
173   /**
174    * Updates object state.
175    */
176   virtual void Update();
177
178   /**
179    * Checks that object has 2D presentation. Base implementation returns false.
180    */
181   virtual bool IsHas2dPrs() const;
182
183   /**
184    * Returns data of object wrapped to QVariant.
185    * Base implementation returns null value.
186    */
187   virtual QVariant GetDataVariant();
188
189
190   /**
191    * Sets the "MustBeUpdated" flag: if object is depended on updated features.
192    * \param theFlag is true for objects that must be updated, false for up-to-date
193    */
194   virtual void SetToUpdate( bool theFlag );
195
196   /**
197    * Returns the "MustBeUpdated" flag: is object data must be updated or not
198    * \returns false if object is up to date
199    */
200   virtual bool IsMustBeUpdated() const;
201
202   /**
203    * Returns flag indicating that object is updateble or not.
204    */
205   virtual bool CanBeUpdated() const;
206
207   
208   /**
209    * Checks is object exists in the data structure.
210    * \returns true is object is not exists in the data model
211    */
212   bool IsRemoved() const;
213
214   /**
215    * Removes object from the data structure.
216    */
217   virtual void Remove();
218
219
220   /**
221    * Copies all properties of this to the destinated object.
222    * Objects must be the same type.
223    * \param theDestination initialized object (from any document) - target of copying
224    */
225   void CopyTo( HYDROData_Entity theDestination ) const [void ( const Handle_HYDROData_Entity& )];
226   %MethodCode
227     Handle(HYDROData_Entity) aCopyTo = createHandle( a0 );
228     if ( !aCopyTo.IsNull() )
229     {
230       Py_BEGIN_ALLOW_THREADS
231       sipSelfWasArg ? sipCpp->HYDROData_Entity::CopyTo( aCopyTo ):
232                       sipCpp->CopyTo( aCopyTo );
233       Py_END_ALLOW_THREADS
234     }
235   %End
236
237   /**
238    * Returns father object. For object created under root document label
239    * this method always return NULL object.
240    */
241   HYDROData_Entity GetFatherObject() const [Handle_HYDROData_Entity ()];
242   %MethodCode
243     Handle(HYDROData_Entity) aFather;
244     
245     Py_BEGIN_ALLOW_THREADS
246     aFather = sipSelfWasArg ? sipCpp->HYDROData_Entity::GetFatherObject() : 
247                               sipCpp->GetFatherObject();
248     Py_END_ALLOW_THREADS
249     
250     sipRes = createPointer( aFather );
251   %End
252
253   /**
254    * Returns the list of all reference objects of this object.
255    * Base implementation always return empty list.
256    */
257   virtual HYDROData_SequenceOfObjects GetAllReferenceObjects() const;
258
259
260   /**
261    * Returns the z-level for object presentation, -1 if no z-level.
262    */
263   virtual bool GetZLevel( int& theLevel ) const [Standard_Boolean ( Standard_Integer& )];
264
265   /**
266    * Set the z-level for object presentation.
267    */
268   virtual void SetZLevel( const int& theLevel ) [void ( const Standard_Integer& )];
269
270   /**
271    * Remove the z-level of object presentation.
272    */
273   virtual void RemoveZLevel();
274
275
276 protected:
277
278   /**
279    * Creates new object in the internal data structure. Use higher level objects 
280    * to create objects with real content.
281    */
282   HYDROData_Entity();
283
284   /**
285    * Destructs properties of the object and object itself, removes it from the document.
286    */
287   virtual ~HYDROData_Entity();
288   
289 };