Salome HOME
Mantis issue 0021414: There is a difference between vectors and other edges in Geometry.
[modules/geom.git] / src / GEOMImpl / GEOMImpl_BlockDriver.cxx
index 91179748707f608d14bd6f1fb6a4260869edb844..a1b8ad4a4252a2f8319e45dbbdd72d6b39917946 100644 (file)
@@ -1,23 +1,24 @@
-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2011  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
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 //
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
 //
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
 //
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 
 #include <Standard_Stream.hxx>
 
@@ -36,7 +37,7 @@
 
 #include <ShHealOper_Sewing.hxx>
 #include <ShHealOper_ShapeProcess.hxx>
-#include <GEOMAlgo_Gluer.hxx>
+//#include <GEOMAlgo_Gluer.hxx>
 #include <BlockFix_BlockFixAPI.hxx>
 
 #include "utilities.h"
@@ -274,8 +275,8 @@ Standard_Integer GEOMImpl_BlockDriver::Execute(TFunction_Logbook& log) const
 
       // create two edges, linking ends of the given edges
       TopoDS_Vertex V11, V12, V21, V22;
-      TopExp::Vertices(anEdge1, V11, V12, Standard_True);
-      TopExp::Vertices(anEdge2, V21, V22, Standard_True);
+      TopExp::Vertices(anEdge1, V11, V12, Standard_False);
+      TopExp::Vertices(anEdge2, V21, V22, Standard_False);
       if (V11.IsNull() || V12.IsNull() ||
           V21.IsNull() || V22.IsNull()) {
         Standard_NullObject::Raise("Bad edge for face construction: vertex is not defined");
@@ -435,7 +436,6 @@ Standard_Integer GEOMImpl_BlockDriver::Execute(TFunction_Logbook& log) const
       BRepTools_Quilt Glue;
 
       if (aType == BLOCK_SIX_FACES) {
-
         // Make block (hexahedral solid) from six faces
         for (Standard_Integer ind = 1; ind <= nbshapes; ind++) {
           if (anArgs(ind).ShapeType() != TopAbs_FACE) {
@@ -444,8 +444,8 @@ Standard_Integer GEOMImpl_BlockDriver::Execute(TFunction_Logbook& log) const
           Glue.Add(anArgs(ind));
         }
 
-      } else {
-
+      }
+      else {
         // Make block (hexahedral solid) from two opposite faces
         if (anArgs(1).ShapeType() != TopAbs_FACE ||
             anArgs(2).ShapeType() != TopAbs_FACE) {
@@ -529,9 +529,8 @@ Standard_Integer GEOMImpl_BlockDriver::Execute(TFunction_Logbook& log) const
       }
       aShape = Sol;
       BRepLib::SameParameter(aShape, 1.E-5, Standard_True);
-
-    } else if (aType == BLOCK_COMPOUND_GLUE) {
-
+    }
+    else if (aType == BLOCK_COMPOUND_GLUE) {
       // Make blocks compound from a compound
       if (anArgs(1).ShapeType() != TopAbs_COMPOUND &&
           anArgs(2).ShapeType() != TopAbs_COMPSOLID) {
@@ -540,23 +539,15 @@ Standard_Integer GEOMImpl_BlockDriver::Execute(TFunction_Logbook& log) const
 
       TopoDS_Shape aCompound = anArgs(1);
 
-      // Glue coincident faces and edges (with Partition algorithm).
-      //NMTAlgo_Splitter1 PS;
-      //PS.AddShape(aCompound);
-      //PS.Compute();
-      //PS.SetRemoveWebs(Standard_False);
-      //      PS.Build(aCompound.ShapeType());
-      //PS.Build(TopAbs_SOLID);
-      //aShape = PS.Shape();
-
-      GEOMAlgo_Gluer aGluer;
-      aGluer.SetShape(aCompound);
-      aGluer.SetCheckGeometry(Standard_True);
-      aGluer.Perform();
-      aShape = aGluer.Result();
-
-
-    } else {
+      // Glue coincident faces and edges
+      aShape = GEOMImpl_GlueDriver::GlueFaces(aCompound, Precision::Confusion(), Standard_True);
+      //GEOMAlgo_Gluer aGluer;
+      //aGluer.SetShape(aCompound);
+      //aGluer.SetCheckGeometry(Standard_True);
+      //aGluer.Perform();
+      //aShape = aGluer.Result();
+    }
+    else {
     }
 
   } else { // Multi-transformations and compound improving