Salome HOME
Typo-fix by Kunda
[modules/geom.git] / src / GEOMImpl / GEOMImpl_GlueDriver.cxx
index 3e5ed2b8378a9018425647d6d3c8b3a03a9da331..d014f5503baa5cf5237d7d5a4a71f564f22ea7c4 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2015  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -34,8 +34,6 @@
 #include "GEOMAlgo_CoupleOfShapes.hxx"
 #include "GEOMAlgo_ListOfCoupleOfShapes.hxx"
 
-#include <Basics_OCCTVersion.hxx>
-
 #include "utilities.h"
 
 #include <BRep_Builder.hxx>
@@ -117,7 +115,7 @@ TopoDS_Shape GEOMImpl_GlueDriver::GlueFacesWithWarnings (const TopoDS_Shape& the
       Standard_Failure::Raise(MSG_BAD_ARG_SHAPE);
       break;
     case 200:
-      Standard_Failure::Raise("Error occured during check of geometric coincidence");
+      Standard_Failure::Raise("Error occurred during check of geometric coincidence");
       break;
     default:
       {
@@ -236,7 +234,7 @@ TopoDS_Shape GEOMImpl_GlueDriver::GlueFaces (const TopoDS_Shape& theShape,
       Standard_Failure::Raise("Result shape is Null");
       break;
     case 200:
-      Standard_Failure::Raise("Error occured during check of geometric coincidence");
+      Standard_Failure::Raise("Error occurred during check of geometric coincidence");
       break;
     default:
       {
@@ -323,9 +321,11 @@ TopoDS_Shape GEOMImpl_GlueDriver::GlueFacesByList (const TopoDS_Shape& theShape,
 //function : GlueFaces
 //purpose  :
 //=======================================================================
-TopoDS_Shape GEOMImpl_GlueDriver::GlueFaces (const TopoDS_Shape& theShape,
-                                             const Standard_Real theTolerance,
-                                             const Standard_Boolean doKeepNonSolids)
+TopoDS_Shape GEOMImpl_GlueDriver::GlueFaces
+          (const TopoDS_Shape                       &theShape,
+           const Standard_Real                       theTolerance,
+           const Standard_Boolean                    doKeepNonSolids,
+                 TopTools_DataMapOfShapeListOfShape *pMapModif)
 {
   TopoDS_Shape aRes;
 
@@ -336,7 +336,7 @@ TopoDS_Shape GEOMImpl_GlueDriver::GlueFaces (const TopoDS_Shape& theShape,
   aGA.SetTolerance(theTolerance);
   aGA.SetKeepNonSolids(doKeepNonSolids);
 
-  // 2. Detect interferred shapes
+  // 2. Detect interfered shapes
   aGA.Detect();
 
   //Standard_Integer iWrnDetect = aGA.WarningStatus();
@@ -409,6 +409,26 @@ TopoDS_Shape GEOMImpl_GlueDriver::GlueFaces (const TopoDS_Shape& theShape,
   // 5. Result
   aRes = aGA.Shape();
 
+  if (pMapModif) {
+    // Fill the map of modified shapes.
+    TopTools_IndexedMapOfShape aMapSubShapes;
+
+    TopExp::MapShapes(theShape, aMapSubShapes);
+    pMapModif->Clear();
+
+    const Standard_Integer aNbShapes = aMapSubShapes.Extent();
+    Standard_Integer       i;
+
+    for (i = 1; i <= aNbShapes; ++i) {
+      const TopoDS_Shape         &aSubShape = aMapSubShapes.FindKey(i);
+      const TopTools_ListOfShape &aModif    = aGA.Modified(aSubShape);
+
+      if (!aModif.IsEmpty()) {
+        pMapModif->Bind(aSubShape, aModif);
+      }
+    }
+  }
+
   return aRes;
 }
 
@@ -431,7 +451,7 @@ TopoDS_Shape GEOMImpl_GlueDriver::GlueWithWarnings (const TopoDS_Shape& theShape
   aGA.SetTolerance(theTolerance);
   aGA.SetKeepNonSolids(doKeepNonSolids);
 
-  // 2. Detect interferred shapes
+  // 2. Detect interfered shapes
   aGA.Detect();
 
   //modified by NIZNHY-PKV Tue Mar 13 14:07:12 2012f
@@ -589,7 +609,7 @@ TopoDS_Shape GEOMImpl_GlueDriver::GlueByList (const TopoDS_Shape& theShape,
   aGA.SetTolerance(theTolerance);
   aGA.SetKeepNonSolids(doKeepNonSolids);
 
-  // 2. Detect interferred shapes
+  // 2. Detect interfered shapes
   aGA.Detect();
 
   //modified by NIZNHY-PKV Tue Mar 13 14:07:12 2012f
@@ -717,7 +737,7 @@ TopoDS_Shape GEOMImpl_GlueDriver::GlueByList (const TopoDS_Shape& theShape,
 //function : Execute
 //purpose  :
 //=======================================================================
-Standard_Integer GEOMImpl_GlueDriver::Execute(TFunction_Logbook& log) const
+Standard_Integer GEOMImpl_GlueDriver::Execute(Handle(TFunction_Logbook)& log) const
 {
   if (Label().IsNull()) return 0;
   Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
@@ -802,7 +822,7 @@ Standard_Integer GEOMImpl_GlueDriver::Execute(TFunction_Logbook& log) const
 
   aFunction->SetValue(aShape);
 
-  log.SetTouched(Label());
+  log->SetTouched(Label());
 
   if (!aWrn.IsEmpty()) {
     Standard_Failure::Raise(aWrn.ToCString());
@@ -860,5 +880,4 @@ GetCreationInformation(std::string&             theOperationName,
   return true;
 }
 
-IMPLEMENT_STANDARD_HANDLE (GEOMImpl_GlueDriver,GEOM_BaseDriver);
 IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_GlueDriver,GEOM_BaseDriver);