1 // Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
24 #pragma warning( disable:4786 )
27 #include <Standard_Stream.hxx>
29 #include <GEOMImpl_Gen.hxx>
31 #include "utilities.h"
33 #include <Utils_ExceptHandlers.hxx>
35 #include <TFunction_Driver.hxx>
36 #include <TFunction_DriverTable.hxx>
38 #include <GEOMImpl_PointDriver.hxx>
39 #include <GEOMImpl_VectorDriver.hxx>
40 #include <GEOMImpl_LineDriver.hxx>
41 #include <GEOMImpl_PlaneDriver.hxx>
42 #include <GEOMImpl_MarkerDriver.hxx>
43 #include <GEOMImpl_ArcDriver.hxx>
44 #include <GEOMImpl_CircleDriver.hxx>
45 #include <GEOMImpl_EllipseDriver.hxx>
46 #include <GEOMImpl_PolylineDriver.hxx>
47 #include <GEOMImpl_SplineDriver.hxx>
48 #include <GEOMImpl_SketcherDriver.hxx>
49 #include <GEOMImpl_3DSketcherDriver.hxx>
50 #include <GEOMImpl_BoxDriver.hxx>
51 #include <GEOMImpl_FaceDriver.hxx>
52 #include <GEOMImpl_DiskDriver.hxx>
53 #include <GEOMImpl_ConeDriver.hxx>
54 #include <GEOMImpl_CylinderDriver.hxx>
55 #include <GEOMImpl_PrismDriver.hxx>
56 #include <GEOMImpl_PipeDriver.hxx>
57 #include <GEOMImpl_ThruSectionsDriver.hxx>
58 #include <GEOMImpl_RevolutionDriver.hxx>
59 #include <GEOMImpl_ShapeDriver.hxx>
60 #include <GEOMImpl_BlockDriver.hxx>
61 #include <GEOMImpl_SphereDriver.hxx>
62 #include <GEOMImpl_TorusDriver.hxx>
63 #include <GEOMImpl_BooleanDriver.hxx>
64 #include <GEOMImpl_ChamferDriver.hxx>
65 #include <GEOMImpl_FilletDriver.hxx>
66 #include <GEOMImpl_Fillet1dDriver.hxx>
67 #include <GEOMImpl_Fillet2dDriver.hxx>
68 #include <GEOMImpl_TranslateDriver.hxx>
69 #include <GEOMImpl_RotateDriver.hxx>
70 #include <GEOMImpl_MirrorDriver.hxx>
71 #include <GEOMImpl_OffsetDriver.hxx>
72 #include <GEOMImpl_ScaleDriver.hxx>
73 #include <GEOMImpl_PositionDriver.hxx>
74 #include <GEOMImpl_PartitionDriver.hxx>
75 #include <GEOMImpl_CopyDriver.hxx>
76 #include <GEOMImpl_ExportDriver.hxx>
77 #include <GEOMImpl_ImportDriver.hxx>
78 #include <GEOMImpl_ArchimedeDriver.hxx>
79 #include <GEOMImpl_HealingDriver.hxx>
80 #include <GEOMImpl_FillingDriver.hxx>
81 #include <GEOMImpl_GlueDriver.hxx>
82 #include <GEOMImpl_MeasureDriver.hxx>
83 // Advanced operations
84 #include <GEOMImpl_PipeTShapeDriver.hxx>
85 /*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/
87 //=============================================================================
89 * default constructor:
91 //=============================================================================
93 GEOMImpl_Gen::GEOMImpl_Gen()
95 MESSAGE("GEOMImpl_Gen::GEOMImpl_Gen");
96 _mapOfBasicOperations.clear();
99 TFunction_DriverTable::Get()->AddDriver(GEOMImpl_PointDriver::GetID(), new GEOMImpl_PointDriver());
100 TFunction_DriverTable::Get()->AddDriver(GEOMImpl_VectorDriver::GetID(), new GEOMImpl_VectorDriver());
101 TFunction_DriverTable::Get()->AddDriver(GEOMImpl_LineDriver::GetID(), new GEOMImpl_LineDriver());
102 TFunction_DriverTable::Get()->AddDriver(GEOMImpl_PlaneDriver::GetID(), new GEOMImpl_PlaneDriver());
103 TFunction_DriverTable::Get()->AddDriver(GEOMImpl_MarkerDriver::GetID(), new GEOMImpl_MarkerDriver());
106 TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ArcDriver::GetID(), new GEOMImpl_ArcDriver());
107 TFunction_DriverTable::Get()->AddDriver(GEOMImpl_CircleDriver::GetID(), new GEOMImpl_CircleDriver());
108 TFunction_DriverTable::Get()->AddDriver(GEOMImpl_EllipseDriver::GetID(), new GEOMImpl_EllipseDriver());
109 TFunction_DriverTable::Get()->AddDriver(GEOMImpl_PolylineDriver::GetID(), new GEOMImpl_PolylineDriver());
110 TFunction_DriverTable::Get()->AddDriver(GEOMImpl_SplineDriver::GetID(), new GEOMImpl_SplineDriver());
111 TFunction_DriverTable::Get()->AddDriver(GEOMImpl_SketcherDriver::GetID(), new GEOMImpl_SketcherDriver());
112 TFunction_DriverTable::Get()->AddDriver(GEOMImpl_3DSketcherDriver::GetID(), new GEOMImpl_3DSketcherDriver());
115 TFunction_DriverTable::Get()->AddDriver(GEOMImpl_BoxDriver::GetID(), new GEOMImpl_BoxDriver());
116 TFunction_DriverTable::Get()->AddDriver(GEOMImpl_FaceDriver::GetID(), new GEOMImpl_FaceDriver());
117 TFunction_DriverTable::Get()->AddDriver(GEOMImpl_DiskDriver::GetID(), new GEOMImpl_DiskDriver());
118 TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ConeDriver::GetID(), new GEOMImpl_ConeDriver());
119 TFunction_DriverTable::Get()->AddDriver(GEOMImpl_CylinderDriver::GetID(), new GEOMImpl_CylinderDriver());
120 TFunction_DriverTable::Get()->AddDriver(GEOMImpl_PrismDriver::GetID(), new GEOMImpl_PrismDriver());
121 TFunction_DriverTable::Get()->AddDriver(GEOMImpl_PipeDriver::GetID(), new GEOMImpl_PipeDriver());
122 TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ThruSectionsDriver::GetID(), new GEOMImpl_ThruSectionsDriver());
123 TFunction_DriverTable::Get()->AddDriver(GEOMImpl_RevolutionDriver::GetID(), new GEOMImpl_RevolutionDriver());
124 TFunction_DriverTable::Get()->AddDriver(GEOMImpl_SphereDriver::GetID(), new GEOMImpl_SphereDriver());
125 TFunction_DriverTable::Get()->AddDriver(GEOMImpl_TorusDriver::GetID(), new GEOMImpl_TorusDriver());
126 TFunction_DriverTable::Get()->AddDriver(GEOMImpl_FillingDriver::GetID(), new GEOMImpl_FillingDriver());
129 TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ShapeDriver::GetID(), new GEOMImpl_ShapeDriver());
130 TFunction_DriverTable::Get()->AddDriver(GEOMImpl_GlueDriver::GetID(), new GEOMImpl_GlueDriver());
133 TFunction_DriverTable::Get()->AddDriver(GEOMImpl_BlockDriver::GetID(), new GEOMImpl_BlockDriver());
135 // Boolean Operations, Partition
136 TFunction_DriverTable::Get()->AddDriver(GEOMImpl_BooleanDriver::GetID(), new GEOMImpl_BooleanDriver());
137 TFunction_DriverTable::Get()->AddDriver(GEOMImpl_PartitionDriver::GetID(), new GEOMImpl_PartitionDriver());
140 TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ChamferDriver::GetID(), new GEOMImpl_ChamferDriver());
141 TFunction_DriverTable::Get()->AddDriver(GEOMImpl_FilletDriver::GetID(), new GEOMImpl_FilletDriver());
142 TFunction_DriverTable::Get()->AddDriver(GEOMImpl_Fillet1dDriver::GetID(), new GEOMImpl_Fillet1dDriver());
143 TFunction_DriverTable::Get()->AddDriver(GEOMImpl_Fillet2dDriver::GetID(), new GEOMImpl_Fillet2dDriver());
144 TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ArchimedeDriver::GetID(), new GEOMImpl_ArchimedeDriver());
146 // Geometrical Transformations, Offset, Scale
147 TFunction_DriverTable::Get()->AddDriver(GEOMImpl_TranslateDriver::GetID(), new GEOMImpl_TranslateDriver());
148 TFunction_DriverTable::Get()->AddDriver(GEOMImpl_RotateDriver::GetID(), new GEOMImpl_RotateDriver());
149 TFunction_DriverTable::Get()->AddDriver(GEOMImpl_MirrorDriver::GetID(), new GEOMImpl_MirrorDriver());
150 TFunction_DriverTable::Get()->AddDriver(GEOMImpl_OffsetDriver::GetID(), new GEOMImpl_OffsetDriver());
151 TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ScaleDriver::GetID(), new GEOMImpl_ScaleDriver());
152 TFunction_DriverTable::Get()->AddDriver(GEOMImpl_PositionDriver::GetID(), new GEOMImpl_PositionDriver());
154 // Insert Operations (Copy, Import/Export)
155 TFunction_DriverTable::Get()->AddDriver(GEOMImpl_CopyDriver::GetID(), new GEOMImpl_CopyDriver());
156 TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ImportDriver::GetID(), new GEOMImpl_ImportDriver());
157 TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ExportDriver::GetID(), new GEOMImpl_ExportDriver());
160 TFunction_DriverTable::Get()->AddDriver(GEOMImpl_HealingDriver::GetID(), new GEOMImpl_HealingDriver());
163 TFunction_DriverTable::Get()->AddDriver(GEOMImpl_MeasureDriver::GetID(), new GEOMImpl_MeasureDriver());
165 // Advanced operations
166 TFunction_DriverTable::Get()->AddDriver(GEOMImpl_PipeTShapeDriver::GetID(), new GEOMImpl_PipeTShapeDriver());
167 /*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/
172 //=============================================================================
176 //=============================================================================
178 GEOMImpl_Gen::~GEOMImpl_Gen()
180 MESSAGE("GEOMImpl_Gen::~GEOMImpl_Gen");
182 std::map<int, GEOMImpl_IBasicOperations*>::iterator aBasicIter = _mapOfBasicOperations.begin();
183 for (; aBasicIter != _mapOfBasicOperations.end(); aBasicIter++)
184 delete (*aBasicIter).second;
186 std::map<int, GEOMImpl_ITransformOperations*>::iterator aTransformIter = _mapOfTransformOperations.begin();
187 for (; aTransformIter != _mapOfTransformOperations.end(); aTransformIter++)
188 delete (*aTransformIter).second;
190 std::map<int, GEOMImpl_I3DPrimOperations*>::iterator a3DPrimIter = _mapOf3DPrimOperations.begin();
191 for (; a3DPrimIter != _mapOf3DPrimOperations.end(); a3DPrimIter++)
192 delete (*a3DPrimIter).second;
194 std::map<int, GEOMImpl_IShapesOperations*>::iterator aShapesIter = _mapOfShapesOperations.begin();
195 for (; aShapesIter != _mapOfShapesOperations.end(); aShapesIter++)
196 delete (*aShapesIter).second;
198 std::map<int, GEOMImpl_IBlocksOperations*>::iterator aBlocksIter = _mapOfBlocksOperations.begin();
199 for (; aBlocksIter != _mapOfBlocksOperations.end(); aBlocksIter++)
200 delete (*aBlocksIter).second;
202 std::map<int, GEOMImpl_IBooleanOperations*>::iterator aBooleanIter = _mapOfBooleanOperations.begin();
203 for (; aBooleanIter != _mapOfBooleanOperations.end(); aBooleanIter++)
204 delete (*aBooleanIter).second;
206 std::map<int, GEOMImpl_IHealingOperations*>::iterator aHealingIter = _mapOfHealingOperations.begin();
207 for (; aHealingIter != _mapOfHealingOperations.end(); aHealingIter++)
208 delete (*aHealingIter).second;
210 std::map<int, GEOMImpl_ICurvesOperations*>::iterator aCurvesIter = _mapOfCurvesOperations.begin();
211 for (; aCurvesIter != _mapOfCurvesOperations.end(); aCurvesIter++)
212 delete (*aCurvesIter).second;
214 std::map<int, GEOMImpl_ILocalOperations*>::iterator aLocalIter = _mapOfLocalOperations.begin();
215 for (; aLocalIter != _mapOfLocalOperations.end(); aLocalIter++)
216 delete (*aLocalIter).second;
218 std::map<int, GEOMImpl_IInsertOperations*>::iterator aInsertIter = _mapOfInsertOperations.begin();
219 for (; aInsertIter != _mapOfInsertOperations.end(); aInsertIter++)
220 delete (*aInsertIter).second;
222 std::map<int, GEOMImpl_IMeasureOperations*>::iterator aMeasureIter = _mapOfMeasureOperations.begin();
223 for (; aMeasureIter != _mapOfMeasureOperations.end(); aMeasureIter++)
224 delete (*aMeasureIter).second;
226 std::map<int, GEOMImpl_IGroupOperations*>::iterator aGroupIter = _mapOfGroupOperations.begin();
227 for (; aGroupIter != _mapOfGroupOperations.end(); aGroupIter++)
228 delete (*aGroupIter).second;
231 //=============================================================================
233 * GetIBasicOperations
235 //=============================================================================
236 GEOMImpl_IBasicOperations* GEOMImpl_Gen::GetIBasicOperations(int theDocID)
238 if(_mapOfBasicOperations.find(theDocID) == _mapOfBasicOperations.end()) {
239 _mapOfBasicOperations[theDocID] = new GEOMImpl_IBasicOperations(this, theDocID);
242 return _mapOfBasicOperations[theDocID];
245 //=============================================================================
247 * GetITransformOperations
249 //=============================================================================
250 GEOMImpl_ITransformOperations* GEOMImpl_Gen::GetITransformOperations(int theDocID)
252 if(_mapOfTransformOperations.find(theDocID) == _mapOfTransformOperations.end()) {
253 _mapOfTransformOperations[theDocID] = new GEOMImpl_ITransformOperations(this, theDocID);
256 return _mapOfTransformOperations[theDocID];
259 //=============================================================================
261 * GetIBooleanOperations
263 //=============================================================================
264 GEOMImpl_IBooleanOperations* GEOMImpl_Gen::GetIBooleanOperations(int theDocID)
266 if(_mapOfBooleanOperations.find(theDocID) == _mapOfBooleanOperations.end()) {
267 _mapOfBooleanOperations[theDocID] = new GEOMImpl_IBooleanOperations(this, theDocID);
270 return _mapOfBooleanOperations[theDocID];
273 //=============================================================================
275 * GetIHealingOperations
277 //=============================================================================
278 GEOMImpl_IHealingOperations* GEOMImpl_Gen::GetIHealingOperations(int theDocID)
280 if(_mapOfHealingOperations.find(theDocID) == _mapOfHealingOperations.end()) {
281 _mapOfHealingOperations[theDocID] = new GEOMImpl_IHealingOperations(this, theDocID);
284 return _mapOfHealingOperations[theDocID];
287 //=============================================================================
289 * GetI3DPrimOperations
291 //=============================================================================
292 GEOMImpl_I3DPrimOperations* GEOMImpl_Gen::GetI3DPrimOperations(int theDocID)
294 if(_mapOf3DPrimOperations.find(theDocID) == _mapOf3DPrimOperations.end()) {
295 _mapOf3DPrimOperations[theDocID] = new GEOMImpl_I3DPrimOperations(this, theDocID);
298 return _mapOf3DPrimOperations[theDocID];
301 //=============================================================================
303 * GetIShapesOperations
305 //=============================================================================
306 GEOMImpl_IShapesOperations* GEOMImpl_Gen::GetIShapesOperations(int theDocID)
308 if(_mapOfShapesOperations.find(theDocID) == _mapOfShapesOperations.end()) {
309 _mapOfShapesOperations[theDocID] = new GEOMImpl_IShapesOperations(this, theDocID);
312 return _mapOfShapesOperations[theDocID];
315 //=============================================================================
317 * GetIBlocksOperations
319 //=============================================================================
320 GEOMImpl_IBlocksOperations* GEOMImpl_Gen::GetIBlocksOperations(int theDocID)
322 if(_mapOfBlocksOperations.find(theDocID) == _mapOfBlocksOperations.end()) {
323 _mapOfBlocksOperations[theDocID] = new GEOMImpl_IBlocksOperations(this, theDocID);
326 return _mapOfBlocksOperations[theDocID];
329 //=============================================================================
331 * GetICurvesOperations
333 //=============================================================================
334 GEOMImpl_ICurvesOperations* GEOMImpl_Gen::GetICurvesOperations(int theDocID)
336 if(_mapOfCurvesOperations.find(theDocID) == _mapOfCurvesOperations.end()) {
337 _mapOfCurvesOperations[theDocID] = new GEOMImpl_ICurvesOperations(this, theDocID);
340 return _mapOfCurvesOperations[theDocID];
343 //=============================================================================
345 * GetILocalOperations
347 //=============================================================================
348 GEOMImpl_ILocalOperations* GEOMImpl_Gen::GetILocalOperations(int theDocID)
350 if(_mapOfLocalOperations.find(theDocID) == _mapOfLocalOperations.end()) {
351 _mapOfLocalOperations[theDocID] = new GEOMImpl_ILocalOperations(this, theDocID);
354 return _mapOfLocalOperations[theDocID];
357 //=============================================================================
359 * GetIInsertOperations
361 //=============================================================================
362 GEOMImpl_IInsertOperations* GEOMImpl_Gen::GetIInsertOperations(int theDocID)
364 if(_mapOfInsertOperations.find(theDocID) == _mapOfInsertOperations.end()) {
365 _mapOfInsertOperations[theDocID] = new GEOMImpl_IInsertOperations(this, theDocID);
368 return _mapOfInsertOperations[theDocID];
371 //=============================================================================
373 * GetIMeasureOperations
375 //=============================================================================
376 GEOMImpl_IMeasureOperations* GEOMImpl_Gen::GetIMeasureOperations(int theDocID)
378 if(_mapOfMeasureOperations.find(theDocID) == _mapOfMeasureOperations.end()) {
379 _mapOfMeasureOperations[theDocID] = new GEOMImpl_IMeasureOperations(this, theDocID);
382 return _mapOfMeasureOperations[theDocID];
385 //=============================================================================
387 * GetIGroupOperations
389 //=============================================================================
390 GEOMImpl_IGroupOperations* GEOMImpl_Gen::GetIGroupOperations(int theDocID)
392 if(_mapOfGroupOperations.find(theDocID) == _mapOfGroupOperations.end()) {
393 _mapOfGroupOperations[theDocID] = new GEOMImpl_IGroupOperations(this, theDocID);
396 return _mapOfGroupOperations[theDocID];
399 //=============================================================================
401 * GetIAdvancedOperations
403 //=============================================================================
404 GEOMImpl_IAdvancedOperations* GEOMImpl_Gen::GetIAdvancedOperations(int theDocID)
406 if(_mapOfAdvancedOperations.find(theDocID) == _mapOfAdvancedOperations.end()) {
407 _mapOfAdvancedOperations[theDocID] = new GEOMImpl_IAdvancedOperations(this, theDocID);
410 return _mapOfAdvancedOperations[theDocID];