Back to index

salome-geom  6.5.0
GEOMImpl_Gen.cxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 #ifdef WNT
00024 #pragma warning( disable:4786 )
00025 #endif
00026 
00027 #include <Standard_Stream.hxx>
00028 
00029 #include <GEOMImpl_Gen.hxx>
00030 
00031 #include "utilities.h"
00032 #include <OpUtil.hxx>
00033 #include <Utils_ExceptHandlers.hxx>
00034 
00035 #include <TFunction_Driver.hxx>
00036 #include <TFunction_DriverTable.hxx>
00037 
00038 #include <GEOMImpl_PointDriver.hxx>
00039 #include <GEOMImpl_VectorDriver.hxx>
00040 #include <GEOMImpl_LineDriver.hxx>
00041 #include <GEOMImpl_PlaneDriver.hxx>
00042 #include <GEOMImpl_MarkerDriver.hxx>
00043 #include <GEOMImpl_ArcDriver.hxx>
00044 #include <GEOMImpl_CircleDriver.hxx>
00045 #include <GEOMImpl_EllipseDriver.hxx>
00046 #include <GEOMImpl_PolylineDriver.hxx>
00047 #include <GEOMImpl_SplineDriver.hxx>
00048 #include <GEOMImpl_SketcherDriver.hxx>
00049 #include <GEOMImpl_3DSketcherDriver.hxx>
00050 #include <GEOMImpl_BoxDriver.hxx>
00051 #include <GEOMImpl_FaceDriver.hxx>
00052 #include <GEOMImpl_DiskDriver.hxx>
00053 #include <GEOMImpl_ConeDriver.hxx>
00054 #include <GEOMImpl_CylinderDriver.hxx>
00055 #include <GEOMImpl_PrismDriver.hxx>
00056 #include <GEOMImpl_PipeDriver.hxx>
00057 #include <GEOMImpl_ThruSectionsDriver.hxx>
00058 #include <GEOMImpl_RevolutionDriver.hxx>
00059 #include <GEOMImpl_ShapeDriver.hxx>
00060 #include <GEOMImpl_BlockDriver.hxx>
00061 #include <GEOMImpl_SphereDriver.hxx>
00062 #include <GEOMImpl_TorusDriver.hxx>
00063 #include <GEOMImpl_BooleanDriver.hxx>
00064 #include <GEOMImpl_ChamferDriver.hxx>
00065 #include <GEOMImpl_FilletDriver.hxx>
00066 #include <GEOMImpl_Fillet1dDriver.hxx>
00067 #include <GEOMImpl_Fillet2dDriver.hxx>
00068 #include <GEOMImpl_TranslateDriver.hxx>
00069 #include <GEOMImpl_RotateDriver.hxx>
00070 #include <GEOMImpl_MirrorDriver.hxx>
00071 #include <GEOMImpl_ProjectionDriver.hxx>
00072 #include <GEOMImpl_OffsetDriver.hxx>
00073 #include <GEOMImpl_ScaleDriver.hxx>
00074 #include <GEOMImpl_PositionDriver.hxx>
00075 #include <GEOMImpl_PartitionDriver.hxx>
00076 #include <GEOMImpl_CopyDriver.hxx>
00077 #include <GEOMImpl_ExportDriver.hxx>
00078 #include <GEOMImpl_ImportDriver.hxx>
00079 #include <GEOMImpl_ArchimedeDriver.hxx>
00080 #include <GEOMImpl_HealingDriver.hxx>
00081 #include <GEOMImpl_FillingDriver.hxx>
00082 #include <GEOMImpl_GlueDriver.hxx>
00083 #include <GEOMImpl_MeasureDriver.hxx>
00084 // Advanced operations
00085 #include <GEOMImpl_PipeTShapeDriver.hxx>
00086 /*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/
00087 
00088 //=============================================================================
00092 //=============================================================================
00093 
00094 GEOMImpl_Gen::GEOMImpl_Gen()
00095 {
00096    MESSAGE("GEOMImpl_Gen::GEOMImpl_Gen");
00097    _mapOfBasicOperations.clear();
00098 
00099    // Basic elements
00100    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_PointDriver::GetID(), new GEOMImpl_PointDriver());
00101    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_VectorDriver::GetID(), new GEOMImpl_VectorDriver());
00102    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_LineDriver::GetID(), new GEOMImpl_LineDriver());
00103    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_PlaneDriver::GetID(), new GEOMImpl_PlaneDriver());
00104    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_MarkerDriver::GetID(), new GEOMImpl_MarkerDriver());
00105 
00106    // Curves
00107    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ArcDriver::GetID(), new GEOMImpl_ArcDriver());
00108    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_CircleDriver::GetID(), new GEOMImpl_CircleDriver());
00109    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_EllipseDriver::GetID(), new GEOMImpl_EllipseDriver());
00110    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_PolylineDriver::GetID(), new GEOMImpl_PolylineDriver());
00111    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_SplineDriver::GetID(), new GEOMImpl_SplineDriver());
00112    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_SketcherDriver::GetID(), new GEOMImpl_SketcherDriver());
00113    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_3DSketcherDriver::GetID(), new GEOMImpl_3DSketcherDriver());
00114 
00115    // 3D Primitives
00116    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_BoxDriver::GetID(), new GEOMImpl_BoxDriver());
00117    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_FaceDriver::GetID(), new GEOMImpl_FaceDriver());
00118    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_DiskDriver::GetID(), new GEOMImpl_DiskDriver());
00119    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ConeDriver::GetID(), new GEOMImpl_ConeDriver());
00120    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_CylinderDriver::GetID(), new GEOMImpl_CylinderDriver());
00121    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_PrismDriver::GetID(), new GEOMImpl_PrismDriver());
00122    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_PipeDriver::GetID(), new GEOMImpl_PipeDriver());
00123    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ThruSectionsDriver::GetID(), new GEOMImpl_ThruSectionsDriver());
00124    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_RevolutionDriver::GetID(), new GEOMImpl_RevolutionDriver());
00125    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_SphereDriver::GetID(), new GEOMImpl_SphereDriver());
00126    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_TorusDriver::GetID(), new GEOMImpl_TorusDriver());
00127    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_FillingDriver::GetID(), new GEOMImpl_FillingDriver());
00128 
00129    // Shapes Operations
00130    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ShapeDriver::GetID(), new GEOMImpl_ShapeDriver());
00131    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_GlueDriver::GetID(), new GEOMImpl_GlueDriver());
00132 
00133    // Blocks Operations
00134    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_BlockDriver::GetID(), new GEOMImpl_BlockDriver());
00135 
00136    // Boolean Operations, Partition
00137    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_BooleanDriver::GetID(), new GEOMImpl_BooleanDriver());
00138    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_PartitionDriver::GetID(), new GEOMImpl_PartitionDriver());
00139 
00140    // Local Operations
00141    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ChamferDriver::GetID(), new GEOMImpl_ChamferDriver());
00142    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_FilletDriver::GetID(), new GEOMImpl_FilletDriver());
00143    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_Fillet1dDriver::GetID(), new GEOMImpl_Fillet1dDriver());
00144    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_Fillet2dDriver::GetID(), new GEOMImpl_Fillet2dDriver());
00145    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ArchimedeDriver::GetID(), new GEOMImpl_ArchimedeDriver());
00146 
00147    // Geometrical Transformations, Offset, Scale
00148    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_TranslateDriver::GetID(), new GEOMImpl_TranslateDriver());
00149    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_RotateDriver::GetID(), new GEOMImpl_RotateDriver());
00150    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_MirrorDriver::GetID(), new GEOMImpl_MirrorDriver());
00151    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ProjectionDriver::GetID(), new GEOMImpl_ProjectionDriver());
00152    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_OffsetDriver::GetID(), new GEOMImpl_OffsetDriver());
00153    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ScaleDriver::GetID(), new GEOMImpl_ScaleDriver());
00154    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_PositionDriver::GetID(), new GEOMImpl_PositionDriver());
00155 
00156    // Insert Operations (Copy, Import/Export)
00157    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_CopyDriver::GetID(), new GEOMImpl_CopyDriver());
00158    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ImportDriver::GetID(), new GEOMImpl_ImportDriver());
00159    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ExportDriver::GetID(), new GEOMImpl_ExportDriver());
00160 
00161    // Shape Healing
00162    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_HealingDriver::GetID(), new GEOMImpl_HealingDriver());
00163 
00164    // Measurements
00165    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_MeasureDriver::GetID(), new GEOMImpl_MeasureDriver());
00166 
00167    // Advanced operations
00168    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_PipeTShapeDriver::GetID(), new GEOMImpl_PipeTShapeDriver());
00169    /*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/
00170 
00171    SetEngine(this);
00172 }
00173 
00174 //=============================================================================
00178 //=============================================================================
00179 
00180 GEOMImpl_Gen::~GEOMImpl_Gen()
00181 {
00182   MESSAGE("GEOMImpl_Gen::~GEOMImpl_Gen");
00183 
00184   std::map<int, GEOMImpl_IBasicOperations*>::iterator aBasicIter = _mapOfBasicOperations.begin();
00185   for (; aBasicIter != _mapOfBasicOperations.end(); aBasicIter++)
00186     delete (*aBasicIter).second;
00187 
00188   std::map<int, GEOMImpl_ITransformOperations*>::iterator aTransformIter = _mapOfTransformOperations.begin();
00189   for (; aTransformIter != _mapOfTransformOperations.end(); aTransformIter++)
00190     delete (*aTransformIter).second;
00191 
00192   std::map<int, GEOMImpl_I3DPrimOperations*>::iterator a3DPrimIter = _mapOf3DPrimOperations.begin();
00193   for (; a3DPrimIter != _mapOf3DPrimOperations.end(); a3DPrimIter++)
00194     delete (*a3DPrimIter).second;
00195 
00196   std::map<int, GEOMImpl_IShapesOperations*>::iterator aShapesIter = _mapOfShapesOperations.begin();
00197   for (; aShapesIter != _mapOfShapesOperations.end(); aShapesIter++)
00198     delete (*aShapesIter).second;
00199 
00200   std::map<int, GEOMImpl_IBlocksOperations*>::iterator aBlocksIter = _mapOfBlocksOperations.begin();
00201   for (; aBlocksIter != _mapOfBlocksOperations.end(); aBlocksIter++)
00202     delete (*aBlocksIter).second;
00203 
00204   std::map<int, GEOMImpl_IBooleanOperations*>::iterator aBooleanIter = _mapOfBooleanOperations.begin();
00205   for (; aBooleanIter != _mapOfBooleanOperations.end(); aBooleanIter++)
00206     delete (*aBooleanIter).second;
00207 
00208   std::map<int, GEOMImpl_IHealingOperations*>::iterator aHealingIter = _mapOfHealingOperations.begin();
00209   for (; aHealingIter != _mapOfHealingOperations.end(); aHealingIter++)
00210     delete (*aHealingIter).second;
00211 
00212   std::map<int, GEOMImpl_ICurvesOperations*>::iterator aCurvesIter = _mapOfCurvesOperations.begin();
00213   for (; aCurvesIter != _mapOfCurvesOperations.end(); aCurvesIter++)
00214     delete (*aCurvesIter).second;
00215 
00216   std::map<int, GEOMImpl_ILocalOperations*>::iterator aLocalIter = _mapOfLocalOperations.begin();
00217   for (; aLocalIter != _mapOfLocalOperations.end(); aLocalIter++)
00218     delete (*aLocalIter).second;
00219 
00220   std::map<int, GEOMImpl_IInsertOperations*>::iterator aInsertIter = _mapOfInsertOperations.begin();
00221   for (; aInsertIter != _mapOfInsertOperations.end(); aInsertIter++)
00222     delete (*aInsertIter).second;
00223 
00224   std::map<int, GEOMImpl_IMeasureOperations*>::iterator aMeasureIter = _mapOfMeasureOperations.begin();
00225   for (; aMeasureIter != _mapOfMeasureOperations.end(); aMeasureIter++)
00226     delete (*aMeasureIter).second;
00227 
00228   std::map<int, GEOMImpl_IGroupOperations*>::iterator aGroupIter = _mapOfGroupOperations.begin();
00229   for (; aGroupIter != _mapOfGroupOperations.end(); aGroupIter++)
00230     delete (*aGroupIter).second;
00231 }
00232 
00233 //=============================================================================
00237 //=============================================================================
00238 GEOMImpl_IBasicOperations* GEOMImpl_Gen::GetIBasicOperations(int theDocID)
00239 {
00240   if(_mapOfBasicOperations.find(theDocID) == _mapOfBasicOperations.end()) {
00241     _mapOfBasicOperations[theDocID] = new GEOMImpl_IBasicOperations(this, theDocID);
00242   }
00243 
00244   return _mapOfBasicOperations[theDocID];
00245 }
00246 
00247 //=============================================================================
00251 //=============================================================================
00252 GEOMImpl_ITransformOperations* GEOMImpl_Gen::GetITransformOperations(int theDocID)
00253 {
00254   if(_mapOfTransformOperations.find(theDocID) == _mapOfTransformOperations.end()) {
00255     _mapOfTransformOperations[theDocID] = new GEOMImpl_ITransformOperations(this, theDocID);
00256   }
00257 
00258   return _mapOfTransformOperations[theDocID];
00259 }
00260 
00261 //=============================================================================
00265 //=============================================================================
00266 GEOMImpl_IBooleanOperations* GEOMImpl_Gen::GetIBooleanOperations(int theDocID)
00267 {
00268   if(_mapOfBooleanOperations.find(theDocID) == _mapOfBooleanOperations.end()) {
00269     _mapOfBooleanOperations[theDocID] = new GEOMImpl_IBooleanOperations(this, theDocID);
00270   }
00271 
00272   return _mapOfBooleanOperations[theDocID];
00273 }
00274 
00275 //=============================================================================
00279 //=============================================================================
00280 GEOMImpl_IHealingOperations* GEOMImpl_Gen::GetIHealingOperations(int theDocID)
00281 {
00282   if(_mapOfHealingOperations.find(theDocID) == _mapOfHealingOperations.end()) {
00283     _mapOfHealingOperations[theDocID] = new GEOMImpl_IHealingOperations(this, theDocID);
00284   }
00285 
00286   return _mapOfHealingOperations[theDocID];
00287 }
00288 
00289 //=============================================================================
00293 //=============================================================================
00294 GEOMImpl_I3DPrimOperations* GEOMImpl_Gen::GetI3DPrimOperations(int theDocID)
00295 {
00296   if(_mapOf3DPrimOperations.find(theDocID) == _mapOf3DPrimOperations.end()) {
00297     _mapOf3DPrimOperations[theDocID] = new GEOMImpl_I3DPrimOperations(this, theDocID);
00298   }
00299 
00300   return _mapOf3DPrimOperations[theDocID];
00301 }
00302 
00303 //=============================================================================
00307 //=============================================================================
00308 GEOMImpl_IShapesOperations* GEOMImpl_Gen::GetIShapesOperations(int theDocID)
00309 {
00310   if(_mapOfShapesOperations.find(theDocID) == _mapOfShapesOperations.end()) {
00311     _mapOfShapesOperations[theDocID] = new GEOMImpl_IShapesOperations(this, theDocID);
00312   }
00313 
00314   return _mapOfShapesOperations[theDocID];
00315 }
00316 
00317 //=============================================================================
00321 //=============================================================================
00322 GEOMImpl_IBlocksOperations* GEOMImpl_Gen::GetIBlocksOperations(int theDocID)
00323 {
00324   if(_mapOfBlocksOperations.find(theDocID) == _mapOfBlocksOperations.end()) {
00325     _mapOfBlocksOperations[theDocID] = new GEOMImpl_IBlocksOperations(this, theDocID);
00326   }
00327 
00328   return _mapOfBlocksOperations[theDocID];
00329 }
00330 
00331 //=============================================================================
00335 //=============================================================================
00336 GEOMImpl_ICurvesOperations* GEOMImpl_Gen::GetICurvesOperations(int theDocID)
00337 {
00338   if(_mapOfCurvesOperations.find(theDocID) == _mapOfCurvesOperations.end()) {
00339     _mapOfCurvesOperations[theDocID] = new GEOMImpl_ICurvesOperations(this, theDocID);
00340   }
00341 
00342   return _mapOfCurvesOperations[theDocID];
00343 }
00344 
00345 //=============================================================================
00349 //=============================================================================
00350 GEOMImpl_ILocalOperations* GEOMImpl_Gen::GetILocalOperations(int theDocID)
00351 {
00352   if(_mapOfLocalOperations.find(theDocID) == _mapOfLocalOperations.end()) {
00353     _mapOfLocalOperations[theDocID] = new GEOMImpl_ILocalOperations(this, theDocID);
00354   }
00355 
00356   return _mapOfLocalOperations[theDocID];
00357 }
00358 
00359 //=============================================================================
00363 //=============================================================================
00364 GEOMImpl_IInsertOperations* GEOMImpl_Gen::GetIInsertOperations(int theDocID)
00365 {
00366   if(_mapOfInsertOperations.find(theDocID) == _mapOfInsertOperations.end()) {
00367     _mapOfInsertOperations[theDocID] = new GEOMImpl_IInsertOperations(this, theDocID);
00368   }
00369 
00370   return _mapOfInsertOperations[theDocID];
00371 }
00372 
00373 //=============================================================================
00377 //=============================================================================
00378 GEOMImpl_IMeasureOperations* GEOMImpl_Gen::GetIMeasureOperations(int theDocID)
00379 {
00380   if(_mapOfMeasureOperations.find(theDocID) == _mapOfMeasureOperations.end()) {
00381     _mapOfMeasureOperations[theDocID] = new GEOMImpl_IMeasureOperations(this, theDocID);
00382   }
00383 
00384   return _mapOfMeasureOperations[theDocID];
00385 }
00386 
00387 //=============================================================================
00391 //=============================================================================
00392 GEOMImpl_IGroupOperations* GEOMImpl_Gen::GetIGroupOperations(int theDocID)
00393 {
00394   if(_mapOfGroupOperations.find(theDocID) == _mapOfGroupOperations.end()) {
00395     _mapOfGroupOperations[theDocID] = new GEOMImpl_IGroupOperations(this, theDocID);
00396   }
00397 
00398   return _mapOfGroupOperations[theDocID];
00399 }
00400 
00401 //=============================================================================
00405 //=============================================================================
00406 GEOMImpl_IAdvancedOperations* GEOMImpl_Gen::GetIAdvancedOperations(int theDocID)
00407 {
00408   if(_mapOfAdvancedOperations.find(theDocID) == _mapOfAdvancedOperations.end()) {
00409     _mapOfAdvancedOperations[theDocID] = new GEOMImpl_IAdvancedOperations(this, theDocID);
00410   }
00411 
00412   return _mapOfAdvancedOperations[theDocID];
00413 }
00414