]> SALOME platform Git repositories - modules/geom.git/blob - src/GEOMImpl/GEOMImpl_Gen.cxx
Salome HOME
Correct make file for shared modules script
[modules/geom.git] / src / GEOMImpl / GEOMImpl_Gen.cxx
1 //  Copyright (C) 2007-2008  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 #ifdef WNT
23 #pragma warning( disable:4786 )
24 #endif
25
26 #include <Standard_Stream.hxx>
27
28 #include <GEOMImpl_Gen.hxx>
29
30 #include "utilities.h"
31 #include <OpUtil.hxx>
32 #include <Utils_ExceptHandlers.hxx>
33
34 #include <TFunction_Driver.hxx>
35 #include <TFunction_DriverTable.hxx>
36
37 #include <GEOMImpl_PointDriver.hxx>
38 #include <GEOMImpl_VectorDriver.hxx>
39 #include <GEOMImpl_LineDriver.hxx>
40 #include <GEOMImpl_PlaneDriver.hxx>
41 #include <GEOMImpl_MarkerDriver.hxx>
42 #include <GEOMImpl_ArcDriver.hxx>
43 #include <GEOMImpl_CircleDriver.hxx>
44 #include <GEOMImpl_EllipseDriver.hxx>
45 #include <GEOMImpl_PolylineDriver.hxx>
46 #include <GEOMImpl_SplineDriver.hxx>
47 #include <GEOMImpl_SketcherDriver.hxx>
48 #include <GEOMImpl_BoxDriver.hxx>
49 #include <GEOMImpl_ConeDriver.hxx>
50 #include <GEOMImpl_CylinderDriver.hxx>
51 #include <GEOMImpl_PrismDriver.hxx>
52 #include <GEOMImpl_PipeDriver.hxx>
53 #include <GEOMImpl_ThruSectionsDriver.hxx>
54 #include <GEOMImpl_RevolutionDriver.hxx>
55 #include <GEOMImpl_ShapeDriver.hxx>
56 #include <GEOMImpl_BlockDriver.hxx>
57 #include <GEOMImpl_SphereDriver.hxx>
58 #include <GEOMImpl_TorusDriver.hxx>
59 #include <GEOMImpl_BooleanDriver.hxx>
60 #include <GEOMImpl_ChamferDriver.hxx>
61 #include <GEOMImpl_FilletDriver.hxx>
62 #include <GEOMImpl_TranslateDriver.hxx>
63 #include <GEOMImpl_RotateDriver.hxx>
64 #include <GEOMImpl_MirrorDriver.hxx>
65 #include <GEOMImpl_OffsetDriver.hxx>
66 #include <GEOMImpl_ScaleDriver.hxx>
67 #include <GEOMImpl_PositionDriver.hxx>
68 #include <GEOMImpl_PartitionDriver.hxx>
69 #include <GEOMImpl_CopyDriver.hxx>
70 #include <GEOMImpl_ExportDriver.hxx>
71 #include <GEOMImpl_ImportDriver.hxx>
72 #include <GEOMImpl_ArchimedeDriver.hxx>
73 #include <GEOMImpl_HealingDriver.hxx>
74 #include <GEOMImpl_FillingDriver.hxx>
75 #include <GEOMImpl_GlueDriver.hxx>
76 #include <GEOMImpl_MeasureDriver.hxx>
77
78 //=============================================================================
79 /*!
80  *  default constructor:
81  */
82 //=============================================================================
83
84 GEOMImpl_Gen::GEOMImpl_Gen()
85 {
86    MESSAGE("GEOMImpl_Gen::GEOMImpl_Gen");
87    _mapOfBasicOperations.clear();
88
89    // Basic elements
90    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_PointDriver::GetID(), new GEOMImpl_PointDriver());
91    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_VectorDriver::GetID(), new GEOMImpl_VectorDriver());
92    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_LineDriver::GetID(), new GEOMImpl_LineDriver());
93    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_PlaneDriver::GetID(), new GEOMImpl_PlaneDriver());
94    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_MarkerDriver::GetID(), new GEOMImpl_MarkerDriver());
95
96    // Curves
97    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ArcDriver::GetID(), new GEOMImpl_ArcDriver());
98    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_CircleDriver::GetID(), new GEOMImpl_CircleDriver());
99    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_EllipseDriver::GetID(), new GEOMImpl_EllipseDriver());
100    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_PolylineDriver::GetID(), new GEOMImpl_PolylineDriver());
101    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_SplineDriver::GetID(), new GEOMImpl_SplineDriver());
102    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_SketcherDriver::GetID(), new GEOMImpl_SketcherDriver());
103
104    // 3D Primitives
105    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_BoxDriver::GetID(), new GEOMImpl_BoxDriver());
106    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ConeDriver::GetID(), new GEOMImpl_ConeDriver());
107    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_CylinderDriver::GetID(), new GEOMImpl_CylinderDriver());
108    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_PrismDriver::GetID(), new GEOMImpl_PrismDriver());
109    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_PipeDriver::GetID(), new GEOMImpl_PipeDriver());
110    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ThruSectionsDriver::GetID(), new GEOMImpl_ThruSectionsDriver());
111    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_RevolutionDriver::GetID(), new GEOMImpl_RevolutionDriver());
112    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_SphereDriver::GetID(), new GEOMImpl_SphereDriver());
113    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_TorusDriver::GetID(), new GEOMImpl_TorusDriver());
114    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_FillingDriver::GetID(), new GEOMImpl_FillingDriver());
115
116    // Shapes Operations
117    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ShapeDriver::GetID(), new GEOMImpl_ShapeDriver());
118    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_GlueDriver::GetID(), new GEOMImpl_GlueDriver());
119
120    // Blocks Operations
121    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_BlockDriver::GetID(), new GEOMImpl_BlockDriver());
122
123    // Boolean Operations, Partition
124    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_BooleanDriver::GetID(), new GEOMImpl_BooleanDriver());
125    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_PartitionDriver::GetID(), new GEOMImpl_PartitionDriver());
126
127    // Local Operations
128    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ChamferDriver::GetID(), new GEOMImpl_ChamferDriver());
129    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_FilletDriver::GetID(), new GEOMImpl_FilletDriver());
130    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ArchimedeDriver::GetID(), new GEOMImpl_ArchimedeDriver());
131
132    // Geometrical Transformations, Offset, Scale
133    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_TranslateDriver::GetID(), new GEOMImpl_TranslateDriver());
134    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_RotateDriver::GetID(), new GEOMImpl_RotateDriver());
135    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_MirrorDriver::GetID(), new GEOMImpl_MirrorDriver());
136    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_OffsetDriver::GetID(), new GEOMImpl_OffsetDriver());
137    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ScaleDriver::GetID(), new GEOMImpl_ScaleDriver());
138    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_PositionDriver::GetID(), new GEOMImpl_PositionDriver());
139
140    // Insert Operations (Copy, Import/Export)
141    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_CopyDriver::GetID(), new GEOMImpl_CopyDriver());
142    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ImportDriver::GetID(), new GEOMImpl_ImportDriver());
143    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ExportDriver::GetID(), new GEOMImpl_ExportDriver());
144
145    // Shape Healing
146    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_HealingDriver::GetID(), new GEOMImpl_HealingDriver());
147
148    // Measurements
149    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_MeasureDriver::GetID(), new GEOMImpl_MeasureDriver());
150
151    SetEngine(this);
152 }
153
154 //=============================================================================
155 /*!
156  *
157  */
158 //=============================================================================
159
160 GEOMImpl_Gen::~GEOMImpl_Gen()
161 {
162   MESSAGE("GEOMImpl_Gen::~GEOMImpl_Gen");
163
164   std::map<int, GEOMImpl_IBasicOperations*>::iterator aBasicIter = _mapOfBasicOperations.begin();
165   for (; aBasicIter != _mapOfBasicOperations.end(); aBasicIter++)
166     delete (*aBasicIter).second;
167
168   std::map<int, GEOMImpl_ITransformOperations*>::iterator aTransformIter = _mapOfTransformOperations.begin();
169   for (; aTransformIter != _mapOfTransformOperations.end(); aTransformIter++)
170     delete (*aTransformIter).second;
171
172   std::map<int, GEOMImpl_I3DPrimOperations*>::iterator a3DPrimIter = _mapOf3DPrimOperations.begin();
173   for (; a3DPrimIter != _mapOf3DPrimOperations.end(); a3DPrimIter++)
174     delete (*a3DPrimIter).second;
175
176   std::map<int, GEOMImpl_IShapesOperations*>::iterator aShapesIter = _mapOfShapesOperations.begin();
177   for (; aShapesIter != _mapOfShapesOperations.end(); aShapesIter++)
178     delete (*aShapesIter).second;
179
180   std::map<int, GEOMImpl_IBlocksOperations*>::iterator aBlocksIter = _mapOfBlocksOperations.begin();
181   for (; aBlocksIter != _mapOfBlocksOperations.end(); aBlocksIter++)
182     delete (*aBlocksIter).second;
183
184   std::map<int, GEOMImpl_IBooleanOperations*>::iterator aBooleanIter = _mapOfBooleanOperations.begin();
185   for (; aBooleanIter != _mapOfBooleanOperations.end(); aBooleanIter++)
186     delete (*aBooleanIter).second;
187
188   std::map<int, GEOMImpl_IHealingOperations*>::iterator aHealingIter = _mapOfHealingOperations.begin();
189   for (; aHealingIter != _mapOfHealingOperations.end(); aHealingIter++)
190     delete (*aHealingIter).second;
191
192   std::map<int, GEOMImpl_ICurvesOperations*>::iterator aCurvesIter = _mapOfCurvesOperations.begin();
193   for (; aCurvesIter != _mapOfCurvesOperations.end(); aCurvesIter++)
194     delete (*aCurvesIter).second;
195
196   std::map<int, GEOMImpl_ILocalOperations*>::iterator aLocalIter = _mapOfLocalOperations.begin();
197   for (; aLocalIter != _mapOfLocalOperations.end(); aLocalIter++)
198     delete (*aLocalIter).second;
199
200   std::map<int, GEOMImpl_IInsertOperations*>::iterator aInsertIter = _mapOfInsertOperations.begin();
201   for (; aInsertIter != _mapOfInsertOperations.end(); aInsertIter++)
202     delete (*aInsertIter).second;
203
204   std::map<int, GEOMImpl_IMeasureOperations*>::iterator aMeasureIter = _mapOfMeasureOperations.begin();
205   for (; aMeasureIter != _mapOfMeasureOperations.end(); aMeasureIter++)
206     delete (*aMeasureIter).second;
207
208   std::map<int, GEOMImpl_IGroupOperations*>::iterator aGroupIter = _mapOfGroupOperations.begin();
209   for (; aGroupIter != _mapOfGroupOperations.end(); aGroupIter++)
210     delete (*aGroupIter).second;
211 }
212
213 //=============================================================================
214 /*!
215  * GetIBasicOperations
216  */
217 //=============================================================================
218 GEOMImpl_IBasicOperations* GEOMImpl_Gen::GetIBasicOperations(int theDocID)
219 {
220   if(_mapOfBasicOperations.find(theDocID) == _mapOfBasicOperations.end()) {
221     _mapOfBasicOperations[theDocID] = new GEOMImpl_IBasicOperations(this, theDocID);
222   }
223
224   return _mapOfBasicOperations[theDocID];
225 }
226
227 //=============================================================================
228 /*!
229  * GetITransformOperations
230  */
231 //=============================================================================
232 GEOMImpl_ITransformOperations* GEOMImpl_Gen::GetITransformOperations(int theDocID)
233 {
234   if(_mapOfTransformOperations.find(theDocID) == _mapOfTransformOperations.end()) {
235     _mapOfTransformOperations[theDocID] = new GEOMImpl_ITransformOperations(this, theDocID);
236   }
237
238   return _mapOfTransformOperations[theDocID];
239 }
240
241 //=============================================================================
242 /*!
243  * GetIBooleanOperations
244  */
245 //=============================================================================
246 GEOMImpl_IBooleanOperations* GEOMImpl_Gen::GetIBooleanOperations(int theDocID)
247 {
248   if(_mapOfBooleanOperations.find(theDocID) == _mapOfBooleanOperations.end()) {
249     _mapOfBooleanOperations[theDocID] = new GEOMImpl_IBooleanOperations(this, theDocID);
250   }
251
252   return _mapOfBooleanOperations[theDocID];
253 }
254
255 //=============================================================================
256 /*!
257  * GetIHealingOperations
258  */
259 //=============================================================================
260 GEOMImpl_IHealingOperations* GEOMImpl_Gen::GetIHealingOperations(int theDocID)
261 {
262   if(_mapOfHealingOperations.find(theDocID) == _mapOfHealingOperations.end()) {
263     _mapOfHealingOperations[theDocID] = new GEOMImpl_IHealingOperations(this, theDocID);
264   }
265
266   return _mapOfHealingOperations[theDocID];
267 }
268
269 //=============================================================================
270 /*!
271  * GetI3DPrimOperations
272  */
273 //=============================================================================
274 GEOMImpl_I3DPrimOperations* GEOMImpl_Gen::GetI3DPrimOperations(int theDocID)
275 {
276   if(_mapOf3DPrimOperations.find(theDocID) == _mapOf3DPrimOperations.end()) {
277     _mapOf3DPrimOperations[theDocID] = new GEOMImpl_I3DPrimOperations(this, theDocID);
278   }
279
280   return _mapOf3DPrimOperations[theDocID];
281 }
282
283 //=============================================================================
284 /*!
285  * GetIShapesOperations
286  */
287 //=============================================================================
288 GEOMImpl_IShapesOperations* GEOMImpl_Gen::GetIShapesOperations(int theDocID)
289 {
290   if(_mapOfShapesOperations.find(theDocID) == _mapOfShapesOperations.end()) {
291     _mapOfShapesOperations[theDocID] = new GEOMImpl_IShapesOperations(this, theDocID);
292   }
293
294   return _mapOfShapesOperations[theDocID];
295 }
296
297 //=============================================================================
298 /*!
299  * GetIBlocksOperations
300  */
301 //=============================================================================
302 GEOMImpl_IBlocksOperations* GEOMImpl_Gen::GetIBlocksOperations(int theDocID)
303 {
304   if(_mapOfBlocksOperations.find(theDocID) == _mapOfBlocksOperations.end()) {
305     _mapOfBlocksOperations[theDocID] = new GEOMImpl_IBlocksOperations(this, theDocID);
306   }
307
308   return _mapOfBlocksOperations[theDocID];
309 }
310
311 //=============================================================================
312 /*!
313  * GetICurvesOperations
314  */
315 //=============================================================================
316 GEOMImpl_ICurvesOperations* GEOMImpl_Gen::GetICurvesOperations(int theDocID)
317 {
318   if(_mapOfCurvesOperations.find(theDocID) == _mapOfCurvesOperations.end()) {
319     _mapOfCurvesOperations[theDocID] = new GEOMImpl_ICurvesOperations(this, theDocID);
320   }
321
322   return _mapOfCurvesOperations[theDocID];
323 }
324
325 //=============================================================================
326 /*!
327  * GetILocalOperations
328  */
329 //=============================================================================
330 GEOMImpl_ILocalOperations* GEOMImpl_Gen::GetILocalOperations(int theDocID)
331 {
332   if(_mapOfLocalOperations.find(theDocID) == _mapOfLocalOperations.end()) {
333     _mapOfLocalOperations[theDocID] = new GEOMImpl_ILocalOperations(this, theDocID);
334   }
335
336   return _mapOfLocalOperations[theDocID];
337 }
338
339 //=============================================================================
340 /*!
341  * GetIInsertOperations
342  */
343 //=============================================================================
344 GEOMImpl_IInsertOperations* GEOMImpl_Gen::GetIInsertOperations(int theDocID)
345 {
346   if(_mapOfInsertOperations.find(theDocID) == _mapOfInsertOperations.end()) {
347     _mapOfInsertOperations[theDocID] = new GEOMImpl_IInsertOperations(this, theDocID);
348   }
349
350   return _mapOfInsertOperations[theDocID];
351 }
352
353 //=============================================================================
354 /*!
355  * GetIMeasureOperations
356  */
357 //=============================================================================
358 GEOMImpl_IMeasureOperations* GEOMImpl_Gen::GetIMeasureOperations(int theDocID)
359 {
360   if(_mapOfMeasureOperations.find(theDocID) == _mapOfMeasureOperations.end()) {
361     _mapOfMeasureOperations[theDocID] = new GEOMImpl_IMeasureOperations(this, theDocID);
362   }
363
364   return _mapOfMeasureOperations[theDocID];
365 }
366
367 //=============================================================================
368 /*!
369  * GetIGroupOperations
370  */
371 //=============================================================================
372 GEOMImpl_IGroupOperations* GEOMImpl_Gen::GetIGroupOperations(int theDocID)
373 {
374   if(_mapOfGroupOperations.find(theDocID) == _mapOfGroupOperations.end()) {
375     _mapOfGroupOperations[theDocID] = new GEOMImpl_IGroupOperations(this, theDocID);
376   }
377
378   return _mapOfGroupOperations[theDocID];
379 }