Salome HOME
Merge master branch into V9_dev.
[modules/geom.git] / src / AdvancedEngine / AdvancedEngine_IOperations.cxx
index 097a1b265f80a47fb92f6a3d610bd2753a463179..03ef7e463cd2b7c08493eeb834a4bb143709c421 100644 (file)
  *  Constructor
  */
 //=============================================================================
-AdvancedEngine_IOperations::AdvancedEngine_IOperations(GEOM_Engine* theEngine, int theDocID) :
-  GEOM_IOperations(theEngine, theDocID)
+AdvancedEngine_IOperations::AdvancedEngine_IOperations(GEOM_Engine* theEngine) :
+  GEOM_IOperations(theEngine)
 {
   MESSAGE("AdvancedEngine_IOperations::AdvancedEngine_IOperations");
-  myBasicOperations     = new GEOMImpl_IBasicOperations(GetEngine(), GetDocID());
-  myBooleanOperations   = new GEOMImpl_IBooleanOperations(GetEngine(), GetDocID());
-  myShapesOperations    = new GEOMImpl_IShapesOperations(GetEngine(), GetDocID());
-  myTransformOperations = new GEOMImpl_ITransformOperations(GetEngine(), GetDocID());
-  myBlocksOperations    = new GEOMImpl_IBlocksOperations(GetEngine(), GetDocID());
-  my3DPrimOperations    = new GEOMImpl_I3DPrimOperations(GetEngine(), GetDocID());
-  myLocalOperations     = new GEOMImpl_ILocalOperations(GetEngine(), GetDocID());
-  myHealingOperations   = new GEOMImpl_IHealingOperations(GetEngine(), GetDocID());
-  myGroupOperations     = new GEOMImpl_IGroupOperations(GetEngine(), GetDocID());
+  myBasicOperations     = new GEOMImpl_IBasicOperations(GetEngine());
+  myBooleanOperations   = new GEOMImpl_IBooleanOperations(GetEngine());
+  myShapesOperations    = new GEOMImpl_IShapesOperations(GetEngine());
+  myTransformOperations = new GEOMImpl_ITransformOperations(GetEngine());
+  myBlocksOperations    = new GEOMImpl_IBlocksOperations(GetEngine());
+  my3DPrimOperations    = new GEOMImpl_I3DPrimOperations(GetEngine());
+  myLocalOperations     = new GEOMImpl_ILocalOperations(GetEngine());
+  myHealingOperations   = new GEOMImpl_IHealingOperations(GetEngine());
+  myGroupOperations     = new GEOMImpl_IGroupOperations(GetEngine());
 }
 
 //=============================================================================
@@ -284,8 +284,6 @@ bool AdvancedEngine_IOperations::MakeGroups(Handle(GEOM_Object) theShape, int sh
     return false;
   }
 
-  gp_Trsf aTrsfInv = aTrsf.Inverted();
-
 //   int expectedGroups = 0;
 //   if (shapeType == TSHAPE_BASIC)
 //     if (Abs(theR2+theW2-theR1-theW1) <= Precision::Approximation())
@@ -620,6 +618,7 @@ bool AdvancedEngine_IOperations::MakeGroups(Handle(GEOM_Object) theShape, int sh
     if (aGroup.IsNull())
       continue;
 
+    gp_Trsf aTrsfInv = aTrsf.Inverted();
     TopoDS_Shape aGroupShape = aGroup->GetValue();
     BRepBuilderAPI_Transform aTransformationShapeInv (aGroupShape, aTrsfInv, Standard_False);
     TopoDS_Shape aGroupShapeTrsfInv = aTransformationShapeInv.Shape();
@@ -828,7 +827,7 @@ bool AdvancedEngine_IOperations::GetFacesOnSurf
   // Default value=3
   aFinder.SetNbPntsMin(3);
   // Sets the maximal number of inner points for edges or faces.
-  // It is usefull for the cases when this number is very big (e.g =2000) to improve
+  // It is useful for the cases when this number is very big (e.g =2000) to improve
   // the performance. If this value =0, all inner points will be taken into account.
   // Default value=0
   aFinder.SetNbPntsMax(100);
@@ -1074,7 +1073,7 @@ bool AdvancedEngine_IOperations::MakeInternalGroup
   // Get faces that are laying on conical faces.
   if (aConicalFaces.IsEmpty() == Standard_False) {
     Handle(GEOM_Object) aCone =
-      GetEngine()->AddObject(GetDocID(), GEOM_TSHAPE);
+      GetEngine()->AddObject(GEOM_TSHAPE);
     Handle(GEOM_Function) aFunction =
       aCone->AddFunction(AdvancedEngine_PipeTShapeDriver::GetID(), TSHAPE_BASIC);
     TopTools_ListIteratorOfListOfShape aFIter(aConicalFaces);
@@ -1552,9 +1551,8 @@ bool AdvancedEngine_IOperations::MakePipeTShapePartition(Handle(GEOM_Object) the
     TopoDS_Shape aShape = Te3->GetValue();
     theShape->GetLastFunction()->SetValue(aShape);
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return false;
   }
 
@@ -1913,7 +1911,7 @@ Handle(TColStd_HSequenceOfTransient)
   MESSAGE("AdvancedEngine_IOperations::MakePipeTShape");
   SetErrorCode(KO);
   //Add a new object
-  Handle(GEOM_Object) aShape = GetEngine()->AddObject(GetDocID(), GEOM_TSHAPE);
+  Handle(GEOM_Object) aShape = GetEngine()->AddObject(GEOM_TSHAPE);
 
   //Add a new shape function with parameters
   Handle(GEOM_Function) aFunction = aShape->AddFunction(AdvancedEngine_PipeTShapeDriver::GetID(), TSHAPE_BASIC);
@@ -1963,9 +1961,8 @@ Handle(TColStd_HSequenceOfTransient)
       aFunction->SetValue(aResShape);
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -1987,9 +1984,8 @@ Handle(TColStd_HSequenceOfTransient)
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -2068,7 +2064,7 @@ AdvancedEngine_IOperations::MakePipeTShapeWithPosition
 {
   SetErrorCode(KO);
   //Add a new object
-  Handle(GEOM_Object) aShape = GetEngine()->AddObject(GetDocID(), GEOM_TSHAPE);
+  Handle(GEOM_Object) aShape = GetEngine()->AddObject(GEOM_TSHAPE);
   /////////////////
   // TSHAPE CODE
   /////////////////
@@ -2125,9 +2121,8 @@ AdvancedEngine_IOperations::MakePipeTShapeWithPosition
       aFunction->SetValue(aResShape);
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -2158,9 +2153,8 @@ AdvancedEngine_IOperations::MakePipeTShapeWithPosition
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -2236,7 +2230,7 @@ AdvancedEngine_IOperations::MakePipeTShapeChamfer
 {
   SetErrorCode(KO);
   //Add a new object
-  Handle(GEOM_Object) aShape = GetEngine()->AddObject(GetDocID(), GEOM_TSHAPE);
+  Handle(GEOM_Object) aShape = GetEngine()->AddObject(GEOM_TSHAPE);
   //Add a new shape function with parameters
   Handle(GEOM_Function) aFunction = aShape->AddFunction(AdvancedEngine_PipeTShapeDriver::GetID(), TSHAPE_CHAMFER);
   if (aFunction.IsNull()) return NULL;
@@ -2268,9 +2262,8 @@ AdvancedEngine_IOperations::MakePipeTShapeChamfer
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -2321,9 +2314,8 @@ AdvancedEngine_IOperations::MakePipeTShapeChamfer
   try {
     aChamfer = myLocalOperations->MakeChamferEdges(aShape, theW, theH, theEdges);
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
   if (aChamfer.IsNull()) {
@@ -2357,9 +2349,8 @@ AdvancedEngine_IOperations::MakePipeTShapeChamfer
       aFunction->SetValue(aResShape);
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -2381,9 +2372,8 @@ AdvancedEngine_IOperations::MakePipeTShapeChamfer
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -2466,7 +2456,7 @@ AdvancedEngine_IOperations::MakePipeTShapeChamferWithPosition
 {
   SetErrorCode(KO);
   //Add a new object
-  Handle(GEOM_Object) aShape = GetEngine()->AddObject(GetDocID(), GEOM_TSHAPE);
+  Handle(GEOM_Object) aShape = GetEngine()->AddObject(GEOM_TSHAPE);
   //Add a new shape function with parameters
   Handle(GEOM_Function) aFunction = aShape->AddFunction(AdvancedEngine_PipeTShapeDriver::GetID(), TSHAPE_CHAMFER);
   if (aFunction.IsNull()) return NULL;
@@ -2503,9 +2493,8 @@ AdvancedEngine_IOperations::MakePipeTShapeChamferWithPosition
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -2554,9 +2543,8 @@ AdvancedEngine_IOperations::MakePipeTShapeChamferWithPosition
   try {
     aChamfer = myLocalOperations->MakeChamferEdges(aShape, theW, theH, theEdges);
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
   if (aChamfer.IsNull()) {
@@ -2590,9 +2578,8 @@ AdvancedEngine_IOperations::MakePipeTShapeChamferWithPosition
       aFunction->SetValue(aResShape);
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -2620,9 +2607,8 @@ AdvancedEngine_IOperations::MakePipeTShapeChamferWithPosition
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -2697,7 +2683,7 @@ AdvancedEngine_IOperations::MakePipeTShapeFillet
 {
   SetErrorCode(KO);
   //Add a new object
-  Handle(GEOM_Object) aShape = GetEngine()->AddObject(GetDocID(), GEOM_TSHAPE);
+  Handle(GEOM_Object) aShape = GetEngine()->AddObject(GEOM_TSHAPE);
   //Add a new shape function with parameters
   Handle(GEOM_Function) aFunction = aShape->AddFunction(AdvancedEngine_PipeTShapeDriver::GetID(), TSHAPE_FILLET);
   if (aFunction.IsNull()) return NULL;
@@ -2728,9 +2714,8 @@ AdvancedEngine_IOperations::MakePipeTShapeFillet
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -2780,9 +2765,8 @@ AdvancedEngine_IOperations::MakePipeTShapeFillet
   try {
     aFillet = myLocalOperations->MakeFilletEdges(aShape, theRF, theEdges);
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
   if (aFillet.IsNull()) {
@@ -2842,9 +2826,8 @@ AdvancedEngine_IOperations::MakePipeTShapeFillet
       aFunction->SetValue(aResShape);
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -2866,9 +2849,8 @@ AdvancedEngine_IOperations::MakePipeTShapeFillet
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -2949,7 +2931,7 @@ AdvancedEngine_IOperations::MakePipeTShapeFilletWithPosition
 {
   SetErrorCode(KO);
   //Add a new object
-  Handle(GEOM_Object) aShape = GetEngine()->AddObject(GetDocID(), GEOM_TSHAPE);
+  Handle(GEOM_Object) aShape = GetEngine()->AddObject(GEOM_TSHAPE);
   //Add a new shape function with parameters
   Handle(GEOM_Function) aFunction = aShape->AddFunction(AdvancedEngine_PipeTShapeDriver::GetID(), TSHAPE_FILLET);
   if (aFunction.IsNull()) return NULL;
@@ -2985,9 +2967,8 @@ AdvancedEngine_IOperations::MakePipeTShapeFilletWithPosition
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -3037,9 +3018,8 @@ AdvancedEngine_IOperations::MakePipeTShapeFilletWithPosition
   try {
     aFillet = myLocalOperations->MakeFilletEdges(aShape, theRF, theEdges);
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
   if (aFillet.IsNull()) {
@@ -3098,9 +3078,8 @@ AdvancedEngine_IOperations::MakePipeTShapeFilletWithPosition
       aFunction->SetValue(aResShape);
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -3128,9 +3107,8 @@ AdvancedEngine_IOperations::MakePipeTShapeFilletWithPosition
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -3200,7 +3178,7 @@ Handle(GEOM_Object) AdvancedEngine_IOperations::MakeDividedDisk (double theR, do
     return NULL;
   }
   //Add a new object
-  Handle(GEOM_Object) aShape = GetEngine()->AddObject(GetDocID(), GEOM_DIVIDEDDISK);
+  Handle(GEOM_Object) aShape = GetEngine()->AddObject(GEOM_DIVIDEDDISK);
 
   //Add a new shape function with parameters
   Handle(GEOM_Function) aFunction = aShape->AddFunction(AdvancedEngine_DividedDiskDriver::GetID(), DIVIDEDDISK_R_RATIO);
@@ -3224,9 +3202,8 @@ Handle(GEOM_Object) AdvancedEngine_IOperations::MakeDividedDisk (double theR, do
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
   
@@ -3268,7 +3245,7 @@ Handle(GEOM_Object) AdvancedEngine_IOperations::MakeDividedDiskPntVecR (Handle(G
   SetErrorCode(KO);
 
   //Add a new object
-  Handle(GEOM_Object) aShape = GetEngine()->AddObject(GetDocID(), GEOM_DIVIDEDDISK);
+  Handle(GEOM_Object) aShape = GetEngine()->AddObject(GEOM_DIVIDEDDISK);
 
   //Add a new shape function with parameters
   Handle(GEOM_Function) aFunction = aShape->AddFunction(AdvancedEngine_DividedDiskDriver::GetID(), DIVIDEDDISK_R_VECTOR_PNT);
@@ -3299,9 +3276,8 @@ Handle(GEOM_Object) AdvancedEngine_IOperations::MakeDividedDiskPntVecR (Handle(G
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
   
@@ -3341,7 +3317,7 @@ Handle(GEOM_Object) AdvancedEngine_IOperations::MakeDividedCylinder (double theR
   SetErrorCode(KO);
   
   //Add a new object
-  Handle(GEOM_Object) aShape = GetEngine()->AddObject(GetDocID(), GEOM_DIVIDEDCYLINDER);
+  Handle(GEOM_Object) aShape = GetEngine()->AddObject(GEOM_DIVIDEDCYLINDER);
 
   Handle(GEOM_Object) aBaseShape = MakeDividedDisk(theR, 67.0, 1, thePattern);
   aBaseShape->GetLastFunction()->SetDescription("");   // Erase dump of MakeDividedDisk
@@ -3389,7 +3365,7 @@ Handle(GEOM_Object) AdvancedEngine_IOperations::MakeSmoothingSurface (std::list<
   SetErrorCode(KO);
 
   //Add a new object
-  Handle(GEOM_Object) aShape = GetEngine()->AddObject(GetDocID(), GEOM_SMOOTHINGSURFACE);
+  Handle(GEOM_Object) aShape = GetEngine()->AddObject(GEOM_SMOOTHINGSURFACE);
 
   //Add a new shape function with parameters
   Handle(GEOM_Function) aFunction = aShape->AddFunction(AdvancedEngine_SmoothingSurfaceDriver::GetID(), SMOOTHINGSURFACE_LPOINTS);
@@ -3425,9 +3401,8 @@ Handle(GEOM_Object) AdvancedEngine_IOperations::MakeSmoothingSurface (std::list<
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }