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