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