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