PageRenderTime 40ms CodeModel.GetById 8ms app.highlight 28ms RepoModel.GetById 1ms app.codeStats 1ms

/src/contrib/geom-5.1.2.7/src/GEOMImpl/GEOMImpl_Gen.cpp

http://pythonocc.googlecode.com/
C++ | 389 lines | 231 code | 56 blank | 102 comment | 48 complexity | 1eb5f8986c4672bdf714ab564d0c307e MD5 | raw file
  1// Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
  2// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
  3// 
  4// This library is free software; you can redistribute it and/or
  5// modify it under the terms of the GNU Lesser General Public
  6// License as published by the Free Software Foundation; either 
  7// version 2.1 of the License.
  8// 
  9// This library is distributed in the hope that it will be useful 
 10// but WITHOUT ANY WARRANTY; without even the implied warranty of 
 11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
 12// Lesser General Public License for more details.
 13//
 14// You should have received a copy of the GNU Lesser General Public  
 15// License along with this library; if not, write to the Free Software 
 16// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 17//
 18// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 19//
 20#include "utilities.h"
 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 <TFunction_Driver.hxx>
 31#include <TFunction_DriverTable.hxx>
 32
 33#include <GEOMImpl_PointDriver.hxx>
 34#include <GEOMImpl_VectorDriver.hxx>
 35#include <GEOMImpl_LineDriver.hxx>
 36#include <GEOMImpl_PlaneDriver.hxx>
 37#include <GEOMImpl_MarkerDriver.hxx>
 38#include <GEOMImpl_ArcDriver.hxx>
 39#include <GEOMImpl_CircleDriver.hxx>
 40#include <GEOMImpl_CurveDriver.hxx>
 41#include <GEOMImpl_EllipseDriver.hxx>
 42#include <GEOMImpl_PolylineDriver.hxx>
 43#include <GEOMImpl_SplineDriver.hxx>
 44#include <GEOMImpl_SketcherDriver.hxx>
 45#include <GEOMImpl_3DSketcherDriver.hxx>
 46#include <GEOMImpl_BoxDriver.hxx>
 47#include <GEOMImpl_DiskDriver.hxx>
 48#include <GEOMImpl_ConeDriver.hxx>
 49#include <GEOMImpl_CylinderDriver.hxx>
 50#include <GEOMImpl_PrismDriver.hxx>
 51#include <GEOMImpl_PipeDriver.hxx>
 52#include <GEOMImpl_ThruSectionsDriver.hxx>
 53#include <GEOMImpl_RevolutionDriver.hxx>
 54#include <GEOMImpl_ShapeDriver.hxx>
 55#include <GEOMImpl_BlockDriver.hxx>
 56#include <GEOMImpl_SphereDriver.hxx>
 57#include <GEOMImpl_TorusDriver.hxx>
 58#include <GEOMImpl_BooleanDriver.hxx>
 59#include <GEOMImpl_ChamferDriver.hxx>
 60#include <GEOMImpl_FilletDriver.hxx>
 61#include <GEOMImpl_TranslateDriver.hxx>
 62#include <GEOMImpl_RotateDriver.hxx>
 63#include <GEOMImpl_MirrorDriver.hxx>
 64#include <GEOMImpl_OffsetDriver.hxx>
 65#include <GEOMImpl_ScaleDriver.hxx>
 66#include <GEOMImpl_PositionDriver.hxx>
 67#include <GEOMImpl_PartitionDriver.hxx>
 68#include <GEOMImpl_CopyDriver.hxx>
 69#include <GEOMImpl_ExportDriver.hxx>
 70#include <GEOMImpl_ImportDriver.hxx>
 71#include <GEOMImpl_ArchimedeDriver.hxx>
 72#include <GEOMImpl_HealingDriver.hxx>
 73#include <GEOMImpl_FillingDriver.hxx>
 74#include <GEOMImpl_GlueDriver.hxx>
 75#include <GEOMImpl_MeasureDriver.hxx>
 76#include <GEOMImpl_ThickSolidDriver.hxx>
 77#include <GEOMImpl_VariableFilletDriver.hxx>
 78#include <GEOMImpl_FaceDriver.hxx>
 79#include <GEOMImpl_PlateDriver.hxx>
 80#include <GEOMImpl_DraftDriver.hxx>
 81//=============================================================================
 82/*!
 83 *  default constructor:
 84 */
 85//=============================================================================
 86
 87GEOMImpl_Gen::GEOMImpl_Gen()
 88{
 89   //MESSAGE("GEOMImpl_Gen::GEOMImpl_Gen");
 90
 91   // Basic elements
 92   TFunction_DriverTable::Get()->AddDriver(GEOMImpl_PointDriver::GetID(), new GEOMImpl_PointDriver());
 93   TFunction_DriverTable::Get()->AddDriver(GEOMImpl_VectorDriver::GetID(), new GEOMImpl_VectorDriver());
 94   TFunction_DriverTable::Get()->AddDriver(GEOMImpl_LineDriver::GetID(), new GEOMImpl_LineDriver());
 95   TFunction_DriverTable::Get()->AddDriver(GEOMImpl_PlaneDriver::GetID(), new GEOMImpl_PlaneDriver());
 96   TFunction_DriverTable::Get()->AddDriver(GEOMImpl_MarkerDriver::GetID(), new GEOMImpl_MarkerDriver());
 97   TFunction_DriverTable::Get()->AddDriver(GEOMImpl_FaceDriver::GetID(), new GEOMImpl_FaceDriver());
 98
 99   // Curves
100   TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ArcDriver::GetID(), new GEOMImpl_ArcDriver());
101   TFunction_DriverTable::Get()->AddDriver(GEOMImpl_CircleDriver::GetID(), new GEOMImpl_CircleDriver());
102   TFunction_DriverTable::Get()->AddDriver(GEOMImpl_CurveDriver::GetID(), new GEOMImpl_CurveDriver());
103   TFunction_DriverTable::Get()->AddDriver(GEOMImpl_EllipseDriver::GetID(), new GEOMImpl_EllipseDriver());
104   TFunction_DriverTable::Get()->AddDriver(GEOMImpl_PolylineDriver::GetID(), new GEOMImpl_PolylineDriver());
105   TFunction_DriverTable::Get()->AddDriver(GEOMImpl_SplineDriver::GetID(), new GEOMImpl_SplineDriver());
106   TFunction_DriverTable::Get()->AddDriver(GEOMImpl_SketcherDriver::GetID(), new GEOMImpl_SketcherDriver());
107   TFunction_DriverTable::Get()->AddDriver(GEOMImpl_3DSketcherDriver::GetID(), new GEOMImpl_3DSketcherDriver());
108
109   // 3D Primitives, Plate operations
110   TFunction_DriverTable::Get()->AddDriver(GEOMImpl_BoxDriver::GetID(), new GEOMImpl_BoxDriver());
111   TFunction_DriverTable::Get()->AddDriver(GEOMImpl_DiskDriver::GetID(), new GEOMImpl_DiskDriver());
112   TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ConeDriver::GetID(), new GEOMImpl_ConeDriver());
113   TFunction_DriverTable::Get()->AddDriver(GEOMImpl_CylinderDriver::GetID(), new GEOMImpl_CylinderDriver());
114   TFunction_DriverTable::Get()->AddDriver(GEOMImpl_PrismDriver::GetID(), new GEOMImpl_PrismDriver());
115   TFunction_DriverTable::Get()->AddDriver(GEOMImpl_PipeDriver::GetID(), new GEOMImpl_PipeDriver());
116   TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ThruSectionsDriver::GetID(), new GEOMImpl_ThruSectionsDriver());
117   TFunction_DriverTable::Get()->AddDriver(GEOMImpl_RevolutionDriver::GetID(), new GEOMImpl_RevolutionDriver());
118   TFunction_DriverTable::Get()->AddDriver(GEOMImpl_SphereDriver::GetID(), new GEOMImpl_SphereDriver());
119   TFunction_DriverTable::Get()->AddDriver(GEOMImpl_TorusDriver::GetID(), new GEOMImpl_TorusDriver());
120   TFunction_DriverTable::Get()->AddDriver(GEOMImpl_FillingDriver::GetID(), new GEOMImpl_FillingDriver());
121   TFunction_DriverTable::Get()->AddDriver(GEOMImpl_PlateDriver::GetID(), new GEOMImpl_PlateDriver());
122
123   // Shapes Operations
124   TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ShapeDriver::GetID(), new GEOMImpl_ShapeDriver());
125   TFunction_DriverTable::Get()->AddDriver(GEOMImpl_GlueDriver::GetID(), new GEOMImpl_GlueDriver());
126
127   // Blocks Operations
128   TFunction_DriverTable::Get()->AddDriver(GEOMImpl_BlockDriver::GetID(), new GEOMImpl_BlockDriver());
129
130   // Boolean Operations, Partition
131   TFunction_DriverTable::Get()->AddDriver(GEOMImpl_BooleanDriver::GetID(), new GEOMImpl_BooleanDriver());
132   TFunction_DriverTable::Get()->AddDriver(GEOMImpl_PartitionDriver::GetID(), new GEOMImpl_PartitionDriver());
133
134   // Local Operations
135   TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ChamferDriver::GetID(), new GEOMImpl_ChamferDriver());
136   TFunction_DriverTable::Get()->AddDriver(GEOMImpl_FilletDriver::GetID(), new GEOMImpl_FilletDriver());
137   TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ArchimedeDriver::GetID(), new GEOMImpl_ArchimedeDriver());
138   TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ThickSolidDriver::GetID(), new GEOMImpl_ThickSolidDriver());
139   TFunction_DriverTable::Get()->AddDriver(GEOMImpl_VariableFilletDriver::GetID(), new GEOMImpl_VariableFilletDriver());
140   TFunction_DriverTable::Get()->AddDriver(GEOMImpl_DraftDriver::GetID(), new GEOMImpl_DraftDriver());
141
142   // Geometrical Transformations, Offset, Scale
143   TFunction_DriverTable::Get()->AddDriver(GEOMImpl_TranslateDriver::GetID(), new GEOMImpl_TranslateDriver());
144   TFunction_DriverTable::Get()->AddDriver(GEOMImpl_RotateDriver::GetID(), new GEOMImpl_RotateDriver());
145   TFunction_DriverTable::Get()->AddDriver(GEOMImpl_MirrorDriver::GetID(), new GEOMImpl_MirrorDriver());
146   TFunction_DriverTable::Get()->AddDriver(GEOMImpl_OffsetDriver::GetID(), new GEOMImpl_OffsetDriver());
147   TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ScaleDriver::GetID(), new GEOMImpl_ScaleDriver());
148   TFunction_DriverTable::Get()->AddDriver(GEOMImpl_PositionDriver::GetID(), new GEOMImpl_PositionDriver());
149
150   // Insert Operations (Copy, Import/Export)
151   TFunction_DriverTable::Get()->AddDriver(GEOMImpl_CopyDriver::GetID(), new GEOMImpl_CopyDriver());
152   TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ImportDriver::GetID(), new GEOMImpl_ImportDriver());
153   TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ExportDriver::GetID(), new GEOMImpl_ExportDriver());
154
155   // Shape Healing
156   TFunction_DriverTable::Get()->AddDriver(GEOMImpl_HealingDriver::GetID(), new GEOMImpl_HealingDriver());
157
158   // Measurements
159   TFunction_DriverTable::Get()->AddDriver(GEOMImpl_MeasureDriver::GetID(), new GEOMImpl_MeasureDriver());
160
161   SetEngine(this);
162}
163
164//=============================================================================
165/*!
166 *
167 */
168//=============================================================================
169
170GEOMImpl_Gen::~GEOMImpl_Gen()
171{
172  //MESSAGE("GEOMImpl_Gen::~GEOMImpl_Gen");
173
174  std::map<int, GEOMImpl_IBasicOperations*>::iterator aBasicIter = _mapOfBasicOperations.begin();
175  for (; aBasicIter != _mapOfBasicOperations.end(); aBasicIter++)
176    delete (*aBasicIter).second;
177
178  std::map<int, GEOMImpl_ITransformOperations*>::iterator aTransformIter = _mapOfTransformOperations.begin();
179  for (; aTransformIter != _mapOfTransformOperations.end(); aTransformIter++)
180    delete (*aTransformIter).second;
181
182  std::map<int, GEOMImpl_I3DPrimOperations*>::iterator a3DPrimIter = _mapOf3DPrimOperations.begin();
183  for (; a3DPrimIter != _mapOf3DPrimOperations.end(); a3DPrimIter++)
184    delete (*a3DPrimIter).second;
185
186  std::map<int, GEOMImpl_IShapesOperations*>::iterator aShapesIter = _mapOfShapesOperations.begin();
187  for (; aShapesIter != _mapOfShapesOperations.end(); aShapesIter++)
188    delete (*aShapesIter).second;
189
190  std::map<int, GEOMImpl_IBlocksOperations*>::iterator aBlocksIter = _mapOfBlocksOperations.begin();
191  for (; aBlocksIter != _mapOfBlocksOperations.end(); aBlocksIter++)
192    delete (*aBlocksIter).second;
193
194  std::map<int, GEOMImpl_IBooleanOperations*>::iterator aBooleanIter = _mapOfBooleanOperations.begin();
195  for (; aBooleanIter != _mapOfBooleanOperations.end(); aBooleanIter++)
196    delete (*aBooleanIter).second;
197
198  std::map<int, GEOMImpl_IHealingOperations*>::iterator aHealingIter = _mapOfHealingOperations.begin();
199  for (; aHealingIter != _mapOfHealingOperations.end(); aHealingIter++)
200    delete (*aHealingIter).second;
201
202  std::map<int, GEOMImpl_ICurvesOperations*>::iterator aCurvesIter = _mapOfCurvesOperations.begin();
203  for (; aCurvesIter != _mapOfCurvesOperations.end(); aCurvesIter++)
204    delete (*aCurvesIter).second;
205
206  std::map<int, GEOMImpl_ILocalOperations*>::iterator aLocalIter = _mapOfLocalOperations.begin();
207  for (; aLocalIter != _mapOfLocalOperations.end(); aLocalIter++)
208    delete (*aLocalIter).second;
209
210  std::map<int, GEOMImpl_IInsertOperations*>::iterator aInsertIter = _mapOfInsertOperations.begin();
211  for (; aInsertIter != _mapOfInsertOperations.end(); aInsertIter++)
212    delete (*aInsertIter).second;
213
214  std::map<int, GEOMImpl_IMeasureOperations*>::iterator aMeasureIter = _mapOfMeasureOperations.begin();
215  for (; aMeasureIter != _mapOfMeasureOperations.end(); aMeasureIter++)
216    delete (*aMeasureIter).second;
217
218  std::map<int, GEOMImpl_IGroupOperations*>::iterator aGroupIter = _mapOfGroupOperations.begin();
219  for (; aGroupIter != _mapOfGroupOperations.end(); aGroupIter++)
220    delete (*aGroupIter).second;
221}
222
223//=============================================================================
224/*!
225 * GetIBasicOperations
226 */
227//=============================================================================
228GEOMImpl_IBasicOperations* GEOMImpl_Gen::GetIBasicOperations(int theDocID)
229{
230  if(_mapOfBasicOperations.find(theDocID) == _mapOfBasicOperations.end()) {
231    _mapOfBasicOperations[theDocID] = new GEOMImpl_IBasicOperations(this, theDocID);
232  }
233
234  return _mapOfBasicOperations[theDocID];
235}
236
237//=============================================================================
238/*!
239 * GetITransformOperations
240 */
241//=============================================================================
242GEOMImpl_ITransformOperations* GEOMImpl_Gen::GetITransformOperations(int theDocID)
243{
244  if(_mapOfTransformOperations.find(theDocID) == _mapOfTransformOperations.end()) {
245    _mapOfTransformOperations[theDocID] = new GEOMImpl_ITransformOperations(this, theDocID);
246  }
247
248  return _mapOfTransformOperations[theDocID];
249}
250
251//=============================================================================
252/*!
253 * GetIBooleanOperations
254 */
255//=============================================================================
256GEOMImpl_IBooleanOperations* GEOMImpl_Gen::GetIBooleanOperations(int theDocID)
257{
258  if(_mapOfBooleanOperations.find(theDocID) == _mapOfBooleanOperations.end()) {
259    _mapOfBooleanOperations[theDocID] = new GEOMImpl_IBooleanOperations(this, theDocID);
260  }
261
262  return _mapOfBooleanOperations[theDocID];
263}
264
265//=============================================================================
266/*!
267 * GetIHealingOperations
268 */
269//=============================================================================
270GEOMImpl_IHealingOperations* GEOMImpl_Gen::GetIHealingOperations(int theDocID)
271{
272  if(_mapOfHealingOperations.find(theDocID) == _mapOfHealingOperations.end()) {
273    _mapOfHealingOperations[theDocID] = new GEOMImpl_IHealingOperations(this, theDocID);
274  }
275
276  return _mapOfHealingOperations[theDocID];
277}
278
279//=============================================================================
280/*!
281 * GetI3DPrimOperations
282 */
283//=============================================================================
284GEOMImpl_I3DPrimOperations* GEOMImpl_Gen::GetI3DPrimOperations(int theDocID)
285{
286  if(_mapOf3DPrimOperations.find(theDocID) == _mapOf3DPrimOperations.end()) {
287    _mapOf3DPrimOperations[theDocID] = new GEOMImpl_I3DPrimOperations(this, theDocID);
288  }
289
290  return _mapOf3DPrimOperations[theDocID];
291}
292
293//=============================================================================
294/*!
295 * GetIShapesOperations
296 */
297//=============================================================================
298GEOMImpl_IShapesOperations* GEOMImpl_Gen::GetIShapesOperations(int theDocID)
299{
300  if(_mapOfShapesOperations.find(theDocID) == _mapOfShapesOperations.end()) {
301    _mapOfShapesOperations[theDocID] = new GEOMImpl_IShapesOperations(this, theDocID);
302  }
303
304  return _mapOfShapesOperations[theDocID];
305}
306
307//=============================================================================
308/*!
309 * GetIBlocksOperations
310 */
311//=============================================================================
312GEOMImpl_IBlocksOperations* GEOMImpl_Gen::GetIBlocksOperations(int theDocID)
313{
314  if(_mapOfBlocksOperations.find(theDocID) == _mapOfBlocksOperations.end()) {
315    _mapOfBlocksOperations[theDocID] = new GEOMImpl_IBlocksOperations(this, theDocID);
316  }
317
318  return _mapOfBlocksOperations[theDocID];
319}
320
321//=============================================================================
322/*!
323 * GetICurvesOperations
324 */
325//=============================================================================
326GEOMImpl_ICurvesOperations* GEOMImpl_Gen::GetICurvesOperations(int theDocID)
327{
328  if(_mapOfCurvesOperations.find(theDocID) == _mapOfCurvesOperations.end()) {
329    _mapOfCurvesOperations[theDocID] = new GEOMImpl_ICurvesOperations(this, theDocID);
330  }
331
332  return _mapOfCurvesOperations[theDocID];
333}
334
335//=============================================================================
336/*!
337 * GetILocalOperations
338 */
339//=============================================================================
340GEOMImpl_ILocalOperations* GEOMImpl_Gen::GetILocalOperations(int theDocID)
341{
342  if(_mapOfLocalOperations.find(theDocID) == _mapOfLocalOperations.end()) {
343    _mapOfLocalOperations[theDocID] = new GEOMImpl_ILocalOperations(this, theDocID);
344  }
345
346  return _mapOfLocalOperations[theDocID];
347}
348
349//=============================================================================
350/*!
351 * GetIInsertOperations
352 */
353//=============================================================================
354GEOMImpl_IInsertOperations* GEOMImpl_Gen::GetIInsertOperations(int theDocID)
355{
356  if(_mapOfInsertOperations.find(theDocID) == _mapOfInsertOperations.end()) {
357    _mapOfInsertOperations[theDocID] = new GEOMImpl_IInsertOperations(this, theDocID);
358  }
359
360  return _mapOfInsertOperations[theDocID];
361}
362
363//=============================================================================
364/*!
365 * GetIMeasureOperations
366 */
367//=============================================================================
368GEOMImpl_IMeasureOperations* GEOMImpl_Gen::GetIMeasureOperations(int theDocID)
369{
370  if(_mapOfMeasureOperations.find(theDocID) == _mapOfMeasureOperations.end()) {
371    _mapOfMeasureOperations[theDocID] = new GEOMImpl_IMeasureOperations(this, theDocID);
372  }
373
374  return _mapOfMeasureOperations[theDocID];
375}
376
377//=============================================================================
378/*!
379 * GetIGroupOperations
380 */
381//=============================================================================
382GEOMImpl_IGroupOperations* GEOMImpl_Gen::GetIGroupOperations(int theDocID)
383{
384  if(_mapOfGroupOperations.find(theDocID) == _mapOfGroupOperations.end()) {
385    _mapOfGroupOperations[theDocID] = new GEOMImpl_IGroupOperations(this, theDocID);
386  }
387
388  return _mapOfGroupOperations[theDocID];
389}