Salome HOME
Porting to OCCT 7.8.0 OCCT780
authorjfa <jfa@opencascade.com>
Mon, 15 Jan 2024 13:37:48 +0000 (13:37 +0000)
committermbs <martin.bernhard@opencascade.com>
Thu, 16 May 2024 07:30:45 +0000 (08:30 +0100)
32 files changed:
src/BlockFix/BlockFix_SphereSpaceModifier.cxx
src/GEOMAlgo/CMakeLists.txt
src/GEOMAlgo/GEOMAlgo_AlgoTools.cxx
src/GEOMAlgo/GEOMAlgo_AlgoTools.hxx
src/GEOMAlgo/GEOMAlgo_ClsfSolid.hxx
src/GEOMAlgo/GEOMAlgo_DataMapOfPassKeyInteger.hxx
src/GEOMAlgo/GEOMAlgo_FinderShapeOn.cxx [deleted file]
src/GEOMAlgo/GEOMAlgo_FinderShapeOn.hxx [deleted file]
src/GEOMAlgo/GEOMAlgo_FinderShapeOn1.cxx [deleted file]
src/GEOMAlgo/GEOMAlgo_FinderShapeOn1.hxx [deleted file]
src/GEOMAlgo/GEOMAlgo_FinderShapeOn2.cxx
src/GEOMAlgo/GEOMAlgo_FinderShapeOn2.hxx
src/GEOMAlgo/GEOMAlgo_FinderShapeOnQuad.cxx [deleted file]
src/GEOMAlgo/GEOMAlgo_FinderShapeOnQuad.hxx [deleted file]
src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfIntegerShape.hxx
src/GEOMAlgo/GEOMAlgo_PassKey.cxx
src/GEOMAlgo/GEOMAlgo_PassKey.hxx
src/GEOMAlgo/GEOMAlgo_PassKeyMapHasher.cxx
src/GEOMAlgo/GEOMAlgo_PassKeyMapHasher.hxx
src/GEOMAlgo/GEOMAlgo_PassKeyShape.cxx
src/GEOMAlgo/GEOMAlgo_PassKeyShape.hxx
src/GEOMAlgo/GEOMAlgo_PassKeyShapeMapHasher.cxx
src/GEOMAlgo/GEOMAlgo_PassKeyShapeMapHasher.hxx
src/GEOMGUI/GeometryGUI.cxx
src/GEOMImpl/GEOMImpl_ICurvesOperations.cxx
src/GEOMImpl/GEOMImpl_ITestOperations.cxx
src/GEOMImpl/GEOMImpl_ShapeProximityDriver.cxx
src/GEOMUtils/GEOMUtils.cxx
src/GEOMUtils/GEOMUtils.hxx
src/OCC2VTK/OCC2VTK_Tools.cxx
src/STEPPlugin/STEPPlugin_ExportDriver.cxx
src/STLPlugin/STLPlugin_ExportDriver.cxx

index 50c67b212e27840cb994dd1c521296ebfc7cfd59..c52d2a92f4cd3d0e547ffc78873cdbcb8859cc78 100644 (file)
@@ -138,6 +138,9 @@ static Standard_Boolean ModifySurface(const TopoDS_Face&          theFace,
         gp_Ax3 ax3 = sp.Position();
         if (Abs(Vmax-Vmin) < PI2) {
           gp_Ax3 axnew3 (ax3.Axis().Location(), ax3.Direction()^ax3.XDirection(), ax3.XDirection());
+          if (!ax3.Direct()) {
+            axnew3.YReverse();
+          }
           sp.SetPosition(axnew3);
           Handle(Geom_SphericalSurface) aNewSphere = new Geom_SphericalSurface(sp);
           theNewSurface = aNewSphere;
@@ -157,6 +160,9 @@ static Standard_Boolean ModifySurface(const TopoDS_Face&          theFace,
           gp_Dir newNorm(gp_Vec(PC,PN));
           gp_Dir newDirX(gp_Vec(PC,PX));
           gp_Ax3 axnew3(ax3.Axis().Location(), newNorm, newDirX);
+          if (!ax3.Direct()) {
+            axnew3.YReverse();
+          }
           sp.SetPosition(axnew3);
 
           // check if both new poles are outside theFace
@@ -276,6 +282,10 @@ static Standard_Boolean ModifySurface(const TopoDS_Face&          theFace,
       }
 
       gp_Ax3 anAxisOfNewSphere (aCentre, anUp, XDirOfCircle);
+      gp_Ax3 ax3 = sp.Position();
+      if (!ax3.Direct()) {
+        anAxisOfNewSphere.YReverse();
+      }
       theNewSurface = new Geom_SphericalSurface (anAxisOfNewSphere, Radius);
       break;
     } //for (; itw.More(); itw.Next()) (iteration on outer wire)
index 8a75aa7305e5e3ce2e1f2715fd9d5887695a0aea..39585b77155219eae632e333fc6fe0ba52c2e1b2 100644 (file)
@@ -60,10 +60,7 @@ SET(GEOMAlgo_HEADERS
   GEOMAlgo_DataMapOfShapeMapOfShape.hxx
   GEOMAlgo_DataMapOfShapePnt.hxx
   GEOMAlgo_Extractor.hxx
-  GEOMAlgo_FinderShapeOn.hxx
-  GEOMAlgo_FinderShapeOn1.hxx
   GEOMAlgo_FinderShapeOn2.hxx
-  GEOMAlgo_FinderShapeOnQuad.hxx
   GEOMAlgo_GetInPlace.hxx
   GEOMAlgo_GetInPlaceAPI.hxx
   GEOMAlgo_GlueAnalyser.hxx
index 82401d0c973945ac2d80e263fbfa7c7477b6a348..7e9cc0b1b5a65eeb69b14724d56e7c91d4b1d1d2 100644 (file)
@@ -80,7 +80,6 @@
 #include <BRepTools.hxx>
 #include <BRepTools_WireExplorer.hxx>
 #include <BRepBndLib.hxx>
-#include <BRepMesh_IncrementalMesh.hxx>
 #include <BRepGProp.hxx>
 
 #include <IntTools_Tools.hxx>
@@ -834,57 +833,6 @@ Standard_Integer GEOMAlgo_AlgoTools::RefineSDShapes
   //
   return 0;
 }
-//=======================================================================
-//function : BuildTriangulation
-//purpose  :
-//=======================================================================
-Standard_Boolean 
-  GEOMAlgo_AlgoTools::BuildTriangulation (const TopoDS_Shape& theShape)
-{
-  // calculate deflection
-  Standard_Real aDeviationCoefficient = 0.001;
-
-  Bnd_Box B;
-  BRepBndLib::Add(theShape, B);
-  Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax;
-  B.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
-
-  Standard_Real dx = aXmax - aXmin, dy = aYmax - aYmin, dz = aZmax - aZmin;
-  Standard_Real aDeflection = Max(Max(dx, dy), dz) * aDeviationCoefficient * 4;
-  Standard_Real aHLRAngle = 0.349066;
-
-  // build triangulation
-  BRepMesh_IncrementalMesh Inc (theShape, aDeflection, Standard_False, aHLRAngle);
-
-  // check triangulation
-  bool isTriangulation = true;
-
-  TopExp_Explorer exp (theShape, TopAbs_FACE);
-  if (exp.More())
-  {
-    TopLoc_Location aTopLoc;
-    Handle(Poly_Triangulation) aTRF;
-    aTRF = BRep_Tool::Triangulation(TopoDS::Face(exp.Current()), aTopLoc);
-    if (aTRF.IsNull()) {
-      isTriangulation = false;
-    }
-  }
-  else // no faces, try edges
-  {
-    TopExp_Explorer expe (theShape, TopAbs_EDGE);
-    if (!expe.More()) {
-      isTriangulation = false;
-    }
-    else {
-      TopLoc_Location aLoc;
-      Handle(Poly_Polygon3D) aPE = BRep_Tool::Polygon3D(TopoDS::Edge(expe.Current()), aLoc);
-      if (aPE.IsNull()) {
-        isTriangulation = false;
-      }
-    }
-  }
-  return isTriangulation;
-}
 
 //=======================================================================
 //function : IsCompositeShape
index 793373fc0845b76c038e34fd94fd63abaf48f62d..2d318a1dc40987b374cb64f7951c5b8ed355a3ff 100644 (file)
@@ -87,9 +87,6 @@ class GEOMAlgo_AlgoTools  {
     static  Standard_Boolean IsCompositeShape(const TopoDS_Shape& aS) ;
 
 
-  Standard_EXPORT
-    static  Standard_Boolean BuildTriangulation(const TopoDS_Shape& aS) ;
-
   Standard_EXPORT
     static  Standard_Integer RefineSDShapes
       (GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape& aMSD,
index 20a6e6033bef498be95c8d85fe2df0ba92956e56..039486cbe5f70b81884eddd3c20909904f3dfdb2 100644 (file)
 #ifndef _GEOMAlgo_ClsfSolid_HeaderFile
 #define _GEOMAlgo_ClsfSolid_HeaderFile
 
+#include <Basics_OCCTVersion.hxx>
+
 #include <Standard.hxx>
 #include <Standard_DefineHandle.hxx>
 #include <TopoDS_Shape.hxx>
+#if OCC_VERSION_LARGE < 0x07080000
 #include <Standard_Address.hxx>
+#else
+#include <Standard_TypeDef.hxx>
+#endif
 #include <GEOMAlgo_Clsf.hxx>
 
 DEFINE_STANDARD_HANDLE(GEOMAlgo_ClsfSolid, GEOMAlgo_Clsf)
index 2dbddd3536f6539bd7238b0782b14be298150e45..973834342d27367d50843ab3f08bd380fab4d1cd 100644 (file)
 #ifndef GEOMAlgo_DataMapOfPassKeyInteger_HeaderFile
 #define GEOMAlgo_DataMapOfPassKeyInteger_HeaderFile
 
+#include <Basics_OCCTVersion.hxx>
+
 #include <GEOMAlgo_PassKey.hxx>
 #include <Standard_Integer.hxx>
+
+#if OCC_VERSION_LARGE < 0x07080000
 #include <GEOMAlgo_PassKeyMapHasher.hxx>
 
 #define _NCollection_MapHasher
 #include <NCollection_DataMap.hxx>
 
 typedef NCollection_DataMap<GEOMAlgo_PassKey, Standard_Integer, GEOMAlgo_PassKeyMapHasher> GEOMAlgo_DataMapOfPassKeyInteger;
+
+#else
+
+#include <NCollection_DataMap.hxx>
+
+typedef NCollection_DataMap<GEOMAlgo_PassKey, Standard_Integer> GEOMAlgo_DataMapOfPassKeyInteger;
+
+#endif // OCC_VERSION_LARGE < 0x07080000
+
+
 typedef GEOMAlgo_DataMapOfPassKeyInteger::Iterator GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyInteger;
 
 #undef _NCollection_MapHasher
diff --git a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn.cxx b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn.cxx
deleted file mode 100644 (file)
index bf84c45..0000000
+++ /dev/null
@@ -1,611 +0,0 @@
-// Copyright (C) 2007-2024  CEA, EDF, OPEN CASCADE
-//
-// 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, or (at your option) any later version.
-//
-// 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
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-// File:        GEOMAlgo_FinderShapeOn.cxx
-// Created:     Tue Jan 11 14:44:31 2005
-// Author:      Peter KURNEV
-
-#include <GEOMAlgo_FinderShapeOn.hxx>
-
-#include <Precision.hxx>
-
-#include <gp_Pnt.hxx>
-
-#include <TopAbs_ShapeEnum.hxx>
-#include <TopAbs_Orientation.hxx>
-
-#include <TopoDS.hxx>
-#include <TopoDS_Face.hxx>
-#include <TopoDS_Shape.hxx>
-#include <TopoDS_Compound.hxx>
-#include <TopoDS_Shell.hxx>
-#include <TopoDS_Solid.hxx>
-#include <TopoDS_Vertex.hxx>
-#include <TopoDS_Edge.hxx>
-#include <TopoDS_Iterator.hxx>
-
-#include <TopTools_ListIteratorOfListOfShape.hxx>
-#include <TopTools_IndexedMapOfShape.hxx>
-#include <TopTools_DataMapOfShapeShape.hxx>
-
-#include <Bnd_Box.hxx>
-#include <BRepBndLib.hxx>
-#include <BRepMesh_IncrementalMesh.hxx>
-
-#include <BRep_Builder.hxx>
-#include <BRep_Tool.hxx>
-
-#include <TopExp.hxx>
-#include <TopExp_Explorer.hxx>
-
-#include <BRepLib_MakeFace.hxx>
-#include <BRepLib_FaceError.hxx>
-
-
-#include <GEOMAlgo_WireSolid.hxx>
-#include <GEOMAlgo_ShellSolid.hxx>
-#include <GEOMAlgo_VertexSolid.hxx>
-#include <GEOMAlgo_ShapeSolid.hxx>
-#include <GEOMAlgo_SolidSolid.hxx>
-#include <GEOMAlgo_SurfaceTools.hxx>
-#include <GEOMAlgo_AlgoTools.hxx>
-
-#include <BOPAlgo_PaveFiller.hxx>
-#include <BOPCol_ListOfShape.hxx>
-
-//=======================================================================
-//function : GEOMAlgo_FinderShapeOn
-//purpose  :
-//=======================================================================
-GEOMAlgo_FinderShapeOn::GEOMAlgo_FinderShapeOn()
-:
-  GEOMAlgo_ShapeAlgo()
-{
-  myTolerance=0.0001;
-  myShapeType=TopAbs_VERTEX;
-  myState=GEOMAlgo_ST_UNKNOWN;
-  myIsAnalytic=Standard_True;
-}
-//=======================================================================
-//function : ~
-//purpose  :
-//=======================================================================
-GEOMAlgo_FinderShapeOn::~GEOMAlgo_FinderShapeOn()
-{
-}
-//=======================================================================
-//function : SetSurface
-//purpose  :
-//=======================================================================
-void GEOMAlgo_FinderShapeOn::SetSurface(const Handle(Geom_Surface)& aS)
-{
-  mySurface=aS;
-}
-//=======================================================================
-//function : Surface
-//purpose  :
-//=======================================================================
-const Handle(Geom_Surface)& GEOMAlgo_FinderShapeOn::Surface() const
-{
-  return mySurface;
-}
-//=======================================================================
-//function : SetShapeType
-//purpose  :
-//=======================================================================
-void GEOMAlgo_FinderShapeOn::SetShapeType(const TopAbs_ShapeEnum aType)
-{
-  myShapeType=aType;
-}
-//=======================================================================
-//function : ShapeType
-//purpose  :
-//=======================================================================
-TopAbs_ShapeEnum GEOMAlgo_FinderShapeOn::ShapeType()const
-{
-  return myShapeType;
-}
-//=======================================================================
-//function : SetState
-//purpose  :
-//=======================================================================
-void GEOMAlgo_FinderShapeOn::SetState(const GEOMAlgo_State aState)
-{
-  myState=aState;
-}
-//=======================================================================
-//function : State
-//purpose  :
-//=======================================================================
-GEOMAlgo_State GEOMAlgo_FinderShapeOn::State() const
-{
-  return myState;
-}
-//=======================================================================
-// function: Shapes
-// purpose:
-//=======================================================================
-const TopTools_ListOfShape& GEOMAlgo_FinderShapeOn::Shapes() const
-{
-  Standard_Boolean bIsConformState;
-  Standard_Integer i, aNb;
-  TopAbs_State aSt;
-  TopTools_ListOfShape* pL;
-  //
-  pL=(TopTools_ListOfShape*) &myLS;
-  pL->Clear();
-  //
-  aNb=myMSS.Extent();
-  for (i=1; i<=aNb; ++i) {
-    const TopoDS_Shape& aS=myMSS.FindKey(i);
-    aSt=myMSS.FindFromIndex(i);
-    //
-    bIsConformState=GEOMAlgo_SurfaceTools::IsConformState(aSt, myState);
-    if (bIsConformState) {
-      pL->Append(aS);
-    }
-  }
-  return myLS;
-}
-//=======================================================================
-//function : Perform
-//purpose  :
-//=======================================================================
-void GEOMAlgo_FinderShapeOn::Perform()
-{
-  myErrorStatus=0;
-  myWarningStatus=0;
-  myLS.Clear();
-  myMSS.Clear();
-  //
-  if (!myResult.IsNull()){
-    myResult.Nullify();
-  }
-  //
-  CheckData();
-  if(myErrorStatus) {
-    return;
-  }
-  //
-  // Initialize the context
-  GEOMAlgo_ShapeAlgo::Perform();
-  //
-  myIsAnalytic=GEOMAlgo_SurfaceTools::IsAnalytic(mySurface);
-  //
-  MakeArgument1();
-  if(myErrorStatus) {
-    return;
-  }
-  //
-  if (myIsAnalytic && myShapeType==TopAbs_VERTEX) {
-    FindVertices();
-    return;
-  }
-  //
-  MakeArgument2();
-  if(myErrorStatus) {
-    return;
-  }
-  //
-  Find();
-  if(myErrorStatus || myWarningStatus) {
-    return;
-  }
-  //
-}
-//=======================================================================
-//function : FindVertices
-//purpose  :
-//=======================================================================
-void GEOMAlgo_FinderShapeOn::FindVertices()
-{
-  Standard_Integer i, aNb, iErr;
-  TopAbs_State aSt;
-  TopAbs_Orientation aOr;
-  gp_Pnt aP;
-  TopTools_IndexedMapOfShape aM;
-  //
-  TopExp::MapShapes(myArg1, TopAbs_FACE, aM);
-  const TopoDS_Face& aF=TopoDS::Face(aM(1));
-  aOr=aF.Orientation();
-  //
-  aM.Clear();
-  TopExp::MapShapes(myShape, myShapeType, aM);
-  aNb=aM.Extent();
-  if (!aNb) {
-    myWarningStatus=10; // No found sub-shapes of type myShapeType
-    return;
-  }
-  //
-  for (i=1; i<=aNb; ++i) {
-    const TopoDS_Shape& aS=aM(i);
-    const TopoDS_Vertex& aV=TopoDS::Vertex(aS);
-    aP=BRep_Tool::Pnt(aV);
-    iErr=GEOMAlgo_SurfaceTools::GetState(aP, mySurface, myTolerance, aSt);
-    if (aOr==TopAbs_REVERSED) {
-      aSt=GEOMAlgo_SurfaceTools::ReverseState(aSt);
-    }
-    myMSS.Add(aS, aSt);
-  }
-}
-//=======================================================================
-//function : Find
-//purpose  :
-//=======================================================================
-void GEOMAlgo_FinderShapeOn::Find()
-{
-  Standard_Integer i, aNb;
-  Standard_Boolean bICS;
-  TopTools_IndexedMapOfShape aM;
-  //
-  TopExp::MapShapes(myArg2, myShapeType, aM);
-  //
-  aNb=aM.Extent();
-  if (!aNb) {
-    myWarningStatus=10; // No found sub-shapes of type myShapeType
-    return;
-  }
-  //
-  bICS=GEOMAlgo_AlgoTools::IsCompositeShape(myArg2);
-  if (!bICS || myIsAnalytic) {
-    TopoDS_Compound aCmp;
-    BRep_Builder aBB;
-    //
-    aBB.MakeCompound(aCmp);
-    for (i=1; i<=aNb; ++i) {
-      const TopoDS_Shape& aSi=aM(i);
-      aBB.Add(aCmp, aSi);
-    }
-    //
-    aM.Clear();
-    aM.Add(aCmp);
-    aNb=1;
-  }
-  //
-  for (i=1; i<=aNb; ++i) {
-    const TopoDS_Shape& aS=aM(i);
-    Find(aS);
-    if (myErrorStatus) {
-      return;
-    }
-  }
-}
-//=======================================================================
-//function : Find
-//purpose  :
-//=======================================================================
-void GEOMAlgo_FinderShapeOn::Find(const TopoDS_Shape& aS)
-{
-  myErrorStatus=0;
-  //
-  Standard_Integer i, iErr;
-  TopAbs_State aSts[]={TopAbs_IN, TopAbs_OUT, TopAbs_ON};
-  TopTools_ListIteratorOfListOfShape aIt;
-  BOPCol_ListOfShape aLS;
-  BOPAlgo_PaveFiller aPF;
-  //
-  // 1. Prepare DSFiller
-  aLS.Append(myArg1);
-  aLS.Append(aS);
-  aPF.SetArguments(aLS);
-  //
-  aPF.Perform();
-  iErr=aPF.ErrorStatus();
-  if (iErr) {
-    myErrorStatus=31; //  PaveFiller is failed
-    return;
-  }
-  //
-  // 2. Find shapes
-  GEOMAlgo_ShapeSolid* pSS;
-  GEOMAlgo_VertexSolid aVXS;
-  GEOMAlgo_WireSolid aWRS;
-  GEOMAlgo_ShellSolid aSHS;
-  GEOMAlgo_SolidSolid aSLS;
-  //
-  pSS=NULL;
-  //
-  switch (myShapeType) {
-    case TopAbs_VERTEX:
-      pSS=&aVXS;
-      break;
-    case TopAbs_EDGE:
-      pSS=&aWRS;
-      break;
-    case TopAbs_FACE:
-      pSS=&aSHS;
-      break;
-    case TopAbs_SOLID:
-      aSLS.SetShape2(myArg2);
-      pSS=&aSLS;
-      break;
-    default:
-      myErrorStatus=12; // unallowed sub-shape type
-      return;
-  }
-  //
-  pSS->SetFiller(aPF);
-  pSS->Perform();
-  iErr=pSS->ErrorStatus();
-  if (iErr) {
-    myErrorStatus=32; // builder ShapeSolid failed
-    return;
-  }
-  //
-  for (i=0; i<3; ++i) {
-    const TopTools_ListOfShape& aLS=pSS->Shapes(aSts[i]);
-    aIt.Initialize(aLS);
-    for (; aIt.More(); aIt.Next()) {
-      const TopoDS_Shape& aSImage=aIt.Value();
-      if (myImages.IsBound(aSImage)) {
-        const TopoDS_Shape& aSx=myImages.Find(aSImage);
-        myMSS.Add(aSx, aSts[i]);
-      }
-      else {
-        myErrorStatus=33;// can not find original shape
-        return;
-      }
-    }
-  }
-}
-//=======================================================================
-//function : MakeArgument1
-//purpose  :
-//=======================================================================
-void GEOMAlgo_FinderShapeOn::MakeArgument1()
-{
-  myErrorStatus=0;
-  //
-  Standard_Integer i, aNb;
-  TopAbs_ShapeEnum aType;
-  BRepLib_FaceError aFErr;
-  BRepLib_MakeFace aMF;
-  TopTools_IndexedMapOfShape aM;
-  BRep_Builder aBB;
-  TopoDS_Face aFace;
-  TopoDS_Shell aSh;
-  TopoDS_Solid aSd;
-  //
-  // Argument 1
-  if (!myIsAnalytic) {
-    aMF.Init(mySurface, Standard_True, Precision::Confusion());
-
-    aFErr=aMF.Error();
-    if (aFErr!=BRepLib_FaceDone) {
-      myErrorStatus=20; // can not build the face
-      return;
-    }
-    //
-    const TopoDS_Shape& aF=aMF.Shape();
-    aFace=TopoDS::Face(aF);
-    //
-    // update tolerances
-    aM.Add(aF);
-    TopExp::MapShapes(aF, TopAbs_VERTEX, aM);
-    TopExp::MapShapes(aF, TopAbs_EDGE, aM);
-
-    aNb=aM.Extent();
-    for (i=1; i<=aNb; ++i) {
-      const TopoDS_Shape& aS=aM(i);
-      aType=aS.ShapeType();
-      switch (aType) {
-      case TopAbs_VERTEX: {
-        const TopoDS_Vertex& aVx=TopoDS::Vertex(aS);
-        aBB.UpdateVertex(aVx, myTolerance);
-      }
-        break;
-      case TopAbs_EDGE: {
-        const TopoDS_Edge& aEx=TopoDS::Edge(aS);
-        aBB.UpdateEdge(aEx, myTolerance);
-      }
-        break;
-      case TopAbs_FACE: {
-        const TopoDS_Face& aFx=TopoDS::Face(aS);
-        aBB.UpdateFace(aFx, myTolerance);
-      }
-        break;
-      default:
-        break;
-      }
-    }
-  } //
-  else {
-    aBB.MakeFace(aFace, mySurface, myTolerance);
-  }
-  //
-  // make solid
-  aBB.MakeShell(aSh);
-  aBB.Add(aSh, aFace);
-  aBB.MakeSolid(aSd);
-  aBB.Add(aSd, aSh);
-  myArg1=aSd;
-}
-//=======================================================================
-//function : MakeArgument2
-//purpose  :
-//=======================================================================
-void GEOMAlgo_FinderShapeOn::MakeArgument2()
-{
-  myErrorStatus=0;
-  //
-  TopoDS_Shape aSC;
-  TopTools_DataMapOfShapeShape aOriginals;
-  //
-  myImages.Clear();
-  //
-  GEOMAlgo_FinderShapeOn::CopySource(myShape, myImages, aOriginals, aSC);
-  //
-  myArg2=aSC;
-}
-//=======================================================================
-//function : CheckData
-//purpose  :
-//=======================================================================
-void GEOMAlgo_FinderShapeOn::CheckData()
-{
-  myErrorStatus=0;
-  //
-  if(mySurface.IsNull()) {
-    myErrorStatus=10; // mySurface=NULL
-    return;
-  }
-  //
-  if (myShape.IsNull()) {
-    myErrorStatus=11; // myShape=NULL
-    return;
-  }
-  //
-  if (!(myShapeType==TopAbs_VERTEX ||
-        myShapeType==TopAbs_EDGE ||
-        myShapeType==TopAbs_FACE ||
-        myShapeType==TopAbs_SOLID)) {
-    myErrorStatus=12; // unallowed sub-shape type
-    return;
-  }
-  //
-  if (myState==GEOMAlgo_ST_UNKNOWN ||
-      myState==GEOMAlgo_ST_INOUT) {
-    myErrorStatus=13; // unallowed state type
-    return;
-  }
-}
-//
-//=======================================================================
-//function : CopySource
-//purpose  :
-//=======================================================================
-void GEOMAlgo_FinderShapeOn::CopySource(const TopoDS_Shape& aE,
-                                        TopTools_DataMapOfShapeShape& aImages,
-                                        TopTools_DataMapOfShapeShape& aOriginals,
-                                        TopoDS_Shape& aEx)
-{
-  Standard_Boolean bFree;
-  TopAbs_ShapeEnum aType;
-  Standard_Integer aR;
-  BRep_Builder BB;
-  TopoDS_Iterator aIt;
-  //
-  aType=aE.ShapeType();
-  //
-  if (aOriginals.IsBound(aE)) {
-    aEx=aOriginals.ChangeFind(aE);
-    return;
-  }
-  else {
-    aEx=aE.EmptyCopied();
-    aOriginals.Bind(aE, aEx);
-    aImages.Bind(aEx, aE);
-  }
-  //
-  aR=(Standard_Integer)aType+1;
-  if (aR>TopAbs_VERTEX) {
-    return;
-  }
-  //
-  bFree=aEx.Free();
-  aEx.Free(Standard_True);
-  //
-  aType=(TopAbs_ShapeEnum) aR;
-  //
-  aIt.Initialize(aE);//, Standard_False);
-  for (; aIt.More();  aIt.Next()) {
-    const TopoDS_Shape& aV=aIt.Value();
-    TopoDS_Shape aVx;
-    //
-    CopySource (aV, aImages, aOriginals, aVx);
-    //
-    aVx.Orientation(aV.Orientation());
-    BB.Add(aEx, aVx);
-  }
-  //
-  aEx.Free(bFree);
-}
-//
-//=======================================================================
-//function : BuildTriangulation
-//purpose  :
-//=======================================================================
-Standard_Boolean
-  GEOMAlgo_FinderShapeOn::BuildTriangulation (const TopoDS_Shape& theShape)
-{
-  // calculate deflection
-  Standard_Real aDeviationCoefficient = 0.001;
-
-  Bnd_Box B;
-  BRepBndLib::Add(theShape, B);
-  Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax;
-  B.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
-
-  Standard_Real dx = aXmax - aXmin, dy = aYmax - aYmin, dz = aZmax - aZmin;
-  Standard_Real aDeflection = Max(Max(dx, dy), dz) * aDeviationCoefficient * 4;
-  Standard_Real aHLRAngle = 0.349066;
-
-  // build triangulation
-  BRepMesh_IncrementalMesh Inc (theShape, aDeflection, Standard_False, aHLRAngle);
-
-  // check triangulation
-  bool isTriangulation = true;
-
-  TopExp_Explorer exp (theShape, TopAbs_FACE);
-  if (exp.More())
-  {
-    TopLoc_Location aTopLoc;
-    Handle(Poly_Triangulation) aTRF;
-    aTRF = BRep_Tool::Triangulation(TopoDS::Face(exp.Current()), aTopLoc);
-    if (aTRF.IsNull()) {
-      isTriangulation = false;
-    }
-  }
-  else // no faces, try edges
-  {
-    TopExp_Explorer expe (theShape, TopAbs_EDGE);
-    if (!expe.More()) {
-      isTriangulation = false;
-    }
-    else {
-      TopLoc_Location aLoc;
-      Handle(Poly_Polygon3D) aPE = BRep_Tool::Polygon3D(TopoDS::Edge(expe.Current()), aLoc);
-      if (aPE.IsNull()) {
-        isTriangulation = false;
-      }
-    }
-  }
-
-  return isTriangulation;
-}
-
-//
-// myErrorStatus :
-//
-// 10 -mySurface=NULL
-// 11 -myShape=NULL
-// 12 -unallowed type of sub-shapes
-// 13 -unallowed state
-// 20 -can not build the face
-// 30 -wrong args are used for DSFiller
-// 31 -DSFiller failed
-// 32 -builder ShapeSolid failed
-// 33 -can not find original shape
-//
-// myWarningStatus
-//
-// 10 - sub-shapes of type myShapeType can not be fond in myShape
diff --git a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn.hxx b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn.hxx
deleted file mode 100644 (file)
index cde1a3d..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-
-// Copyright (C) 2007-2024  CEA, EDF, OPEN CASCADE
-//
-// 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, or (at your option) any later version.
-//
-// 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
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-// File:        GEOMAlgo_FinderShapeOn.hxx
-// Created:     Tue Jan 11 14:44:31 2005
-// Author:      Peter KURNEV
-
-#ifndef _GEOMAlgo_FinderShapeOn_HeaderFile
-#define _GEOMAlgo_FinderShapeOn_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Macro.hxx>
-#include <Standard_Boolean.hxx>
-
-#include <Geom_Surface.hxx>
-
-#include <TopAbs_ShapeEnum.hxx>
-
-#include <TopoDS_Shape.hxx>
-
-#include <TopTools_ListOfShape.hxx>
-#include <TopTools_DataMapOfShapeShape.hxx>
-
-
-#include <GEOMAlgo_State.hxx>
-#include <GEOMAlgo_ShapeAlgo.hxx>
-#include <GEOMAlgo_IndexedDataMapOfShapeState.hxx>
-
-//=======================================================================
-//function : GEOMAlgo_FinderShapeOn
-//purpose  :
-//=======================================================================
-class GEOMAlgo_FinderShapeOn  : public GEOMAlgo_ShapeAlgo
-{
- public:
-  Standard_EXPORT
-    GEOMAlgo_FinderShapeOn();
-
-  Standard_EXPORT
-    virtual ~GEOMAlgo_FinderShapeOn();
-
-  Standard_EXPORT
-    virtual  void Perform() ;
-
-  Standard_EXPORT
-    void SetSurface(const Handle(Geom_Surface)& aS) ;
-
-  Standard_EXPORT
-    void SetShapeType(const TopAbs_ShapeEnum aST) ;
-
-  Standard_EXPORT
-    void SetState(const GEOMAlgo_State aSF) ;
-
-  Standard_EXPORT
-    const Handle(Geom_Surface)& Surface() const;
-
-  Standard_EXPORT
-    TopAbs_ShapeEnum ShapeType() const;
-
-  Standard_EXPORT
-    GEOMAlgo_State State() const;
-
-  Standard_EXPORT
-    const TopTools_ListOfShape& Shapes() const;
-
-  Standard_EXPORT
-    static  void CopySource(const TopoDS_Shape& aS,
-                            TopTools_DataMapOfShapeShape& aImages,
-                            TopTools_DataMapOfShapeShape& aOriginals,
-                            TopoDS_Shape& aSC) ;
-
-  Standard_EXPORT
-    static  Standard_Boolean BuildTriangulation(const TopoDS_Shape& aS) ;
-
-protected:
-  Standard_EXPORT
-    virtual  void CheckData() ;
-
-  Standard_EXPORT
-    void MakeArgument1() ;
-
-  Standard_EXPORT
-    void MakeArgument2() ;
-
-  Standard_EXPORT
-    void Find() ;
-
-  Standard_EXPORT
-    void Find(const TopoDS_Shape& aS) ;
-
-  Standard_EXPORT
-    void FindVertices() ;
-
-
-  Handle(Geom_Surface) mySurface;
-  TopAbs_ShapeEnum myShapeType;
-  GEOMAlgo_State myState;
-  TopoDS_Shape myArg1;
-  TopoDS_Shape myArg2;
-  TopTools_ListOfShape myLS;
-  TopTools_DataMapOfShapeShape myImages;
-  GEOMAlgo_IndexedDataMapOfShapeState myMSS;
-  Standard_Boolean myIsAnalytic;
-};
-#endif
diff --git a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn1.cxx b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn1.cxx
deleted file mode 100644 (file)
index 64d5024..0000000
+++ /dev/null
@@ -1,787 +0,0 @@
-// Copyright (C) 2007-2024  CEA, EDF, OPEN CASCADE
-//
-// 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, or (at your option) any later version.
-//
-// 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
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-// File:        GEOMAlgo_FinderShapeOn1.cxx
-// Created:     Fri Mar  4 10:31:06 2005
-// Author:      Peter KURNEV
-
-#include <GEOMAlgo_FinderShapeOn1.hxx>
-
-#include <math.h>
-
-#include <Precision.hxx>
-#include <TColStd_Array1OfInteger.hxx>
-#include <TColStd_MapOfInteger.hxx>
-
-#include <gp_Trsf.hxx>
-#include <gp_Cylinder.hxx>
-#include <gp_Pnt.hxx>
-
-#include <TColgp_Array1OfPnt.hxx>
-
-#include <Poly_Array1OfTriangle.hxx>
-#include <Poly_Triangle.hxx>
-#include <Poly_PolygonOnTriangulation.hxx>
-#include <Poly_Triangulation.hxx>
-#include <Poly_Polygon3D.hxx>
-
-#include <Geom_Curve.hxx>
-#include <Geom_Surface.hxx>
-#include <GeomAdaptor_Surface.hxx>
-#include <GeomAbs_SurfaceType.hxx>
-#include <GeomAdaptor_Curve.hxx>
-#include <GeomAbs_CurveType.hxx>
-
-#include <TopAbs_State.hxx>
-
-#include <TopLoc_Location.hxx>
-#include <TopoDS.hxx>
-#include <TopoDS_Shape.hxx>
-#include <TopoDS_Vertex.hxx>
-#include <TopoDS_Face.hxx>
-#include <TopoDS_Edge.hxx>
-
-#include <TopExp.hxx>
-#include <TopExp_Explorer.hxx>
-
-#include <TopTools_IndexedMapOfShape.hxx>
-
-#include <BRep_Tool.hxx>
-#include <BRepLib_MakeEdge.hxx>
-
-#include <GEOMAlgo_ListIteratorOfListOfPnt.hxx>
-#include <GEOMAlgo_SurfaceTools.hxx>
-#include <GEOMAlgo_StateCollector.hxx>
-#include <GEOMAlgo_AlgoTools.hxx>
-#include <GEOMAlgo_PassKey.hxx>
-#include <GEOMAlgo_DataMapOfPassKeyInteger.hxx>
-#include <GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyInteger.hxx>
-
-
-//=======================================================================
-//function : GEOMAlgo_FinderShapeOn1
-//purpose  :
-//=======================================================================
-GEOMAlgo_FinderShapeOn1::GEOMAlgo_FinderShapeOn1()
-:
-  GEOMAlgo_ShapeAlgo()
-{
-  myTolerance=0.0001;
-  myShapeType=TopAbs_VERTEX;
-  myState=GEOMAlgo_ST_UNKNOWN;
-  myNbPntsMin=3;
-  myNbPntsMax=0;
-}
-//=======================================================================
-//function : ~
-//purpose  :
-//=======================================================================
-GEOMAlgo_FinderShapeOn1::~GEOMAlgo_FinderShapeOn1()
-{
-}
-//=======================================================================
-//function : SetSurface
-//purpose  :
-//=======================================================================
-void GEOMAlgo_FinderShapeOn1::SetSurface(const Handle(Geom_Surface)& aS)
-{
-  mySurface=aS;
-}
-//=======================================================================
-//function : Surface
-//purpose  :
-//=======================================================================
-const Handle(Geom_Surface)& GEOMAlgo_FinderShapeOn1::Surface() const
-{
-  return mySurface;
-}
-//=======================================================================
-//function : SetShapeType
-//purpose  :
-//=======================================================================
-void GEOMAlgo_FinderShapeOn1::SetShapeType(const TopAbs_ShapeEnum aType)
-{
-  myShapeType=aType;
-}
-//=======================================================================
-//function : ShapeType
-//purpose  :
-//=======================================================================
-TopAbs_ShapeEnum GEOMAlgo_FinderShapeOn1::ShapeType()const
-{
-  return myShapeType;
-}
-//=======================================================================
-//function : SetState
-//purpose  :
-//=======================================================================
-void GEOMAlgo_FinderShapeOn1::SetState(const GEOMAlgo_State aState)
-{
-  myState=aState;
-}
-//=======================================================================
-//function : State
-//purpose  :
-//=======================================================================
-GEOMAlgo_State GEOMAlgo_FinderShapeOn1::State() const
-{
-  return myState;
-}
-//=======================================================================
-//function : SetNbPntsMin
-//purpose  :
-//=======================================================================
-void GEOMAlgo_FinderShapeOn1::SetNbPntsMin(const Standard_Integer aNb)
-{
-  myNbPntsMin=aNb;
-}
-//=======================================================================
-//function : NbPntsMin
-//purpose  :
-//=======================================================================
-Standard_Integer GEOMAlgo_FinderShapeOn1::NbPntsMin()const
-{
-  return myNbPntsMin;
-}
-//=======================================================================
-//function : SetNbPntsMax
-//purpose  :
-//=======================================================================
-void GEOMAlgo_FinderShapeOn1::SetNbPntsMax(const Standard_Integer aNb)
-{
-  myNbPntsMax=aNb;
-}
-//=======================================================================
-//function : NbPntsMax
-//purpose  :
-//=======================================================================
-Standard_Integer GEOMAlgo_FinderShapeOn1::NbPntsMax()const
-{
-  return myNbPntsMax;
-}
-//=======================================================================
-// function: MSS
-// purpose:
-//=======================================================================
-const GEOMAlgo_IndexedDataMapOfShapeState& GEOMAlgo_FinderShapeOn1::MSS() const
-{
-  return myMSS;
-}
-//=======================================================================
-// function: Shapes
-// purpose:
-//=======================================================================
-const TopTools_ListOfShape& GEOMAlgo_FinderShapeOn1::Shapes() const
-{
-  Standard_Integer i, aNb;
-  TopTools_ListOfShape* pL;
-  //
-  pL=(TopTools_ListOfShape*) &myLS;
-  pL->Clear();
-  //
-  aNb=myMSS.Extent();
-  for (i=1; i<=aNb; ++i) {
-    const TopoDS_Shape& aS=myMSS.FindKey(i);
-    if (aS.ShapeType()==myShapeType) {
-      pL->Append(aS);
-    }
-  }
-  return myLS;
-}
-//=======================================================================
-//function : Perform
-//purpose  :
-//=======================================================================
-void GEOMAlgo_FinderShapeOn1::Perform()
-{
-  myErrorStatus=0;
-  myWarningStatus=0;
-  myLS.Clear();
-  myMSS.Clear();
-  //
-  CheckData();
-  if(myErrorStatus) {
-    return;
-  }
-  //
-  // Initialize the context
-  GEOMAlgo_ShapeAlgo::Perform();
-  //
-  // 1
-  ProcessVertices();
-  if(myErrorStatus) {
-    return;
-  }
-  if (myShapeType==TopAbs_VERTEX) {
-    return;
-  }
-  //
-  // 2
-  ProcessEdges();
-  if(myErrorStatus) {
-    return;
-  }
-  if (myShapeType==TopAbs_EDGE) {
-    return;
-  }
-  //
-  // 3
-  ProcessFaces();
-  if(myErrorStatus) {
-    return;
-  }
-  if (myShapeType==TopAbs_FACE) {
-    return;
-  }
-  //
-  // 4
-  ProcessSolids();
-  //
-}
-//=======================================================================
-//function : ProcessVertices
-//purpose  :
-//=======================================================================
-void GEOMAlgo_FinderShapeOn1::ProcessVertices()
-{
-  myErrorStatus=0;
-  //
-  Standard_Boolean bIsConformState;
-  Standard_Integer i, aNb;
-  gp_Pnt aP;
-  TopTools_IndexedMapOfShape aM;
-  TopAbs_State aSt;
-  //
-  TopExp::MapShapes(myShape, TopAbs_VERTEX, aM);
-  aNb=aM.Extent();
-  for (i=1; i<=aNb; ++i) {
-    const TopoDS_Vertex& aV=TopoDS::Vertex(aM(i));
-    aP=BRep_Tool::Pnt(aV);
-    //
-    aSt = GetPointState( aP );
-    bIsConformState=GEOMAlgo_SurfaceTools::IsConformState(aSt, myState);
-    //
-    if (myShapeType==TopAbs_VERTEX){
-      if (bIsConformState) {
-        myMSS.Add(aV, aSt);
-      }
-    }
-    else if (bIsConformState || aSt==TopAbs_ON) {
-      myMSS.Add(aV, aSt);
-    }
-  }
-}
-//=======================================================================
-//function : ProcessEdges
-//purpose  :
-//=======================================================================
-void GEOMAlgo_FinderShapeOn1::ProcessEdges()
-{
-  myErrorStatus=0;
-  //
-  Standard_Boolean bIsConformState, bIsToBreak;
-  Standard_Integer i, aNb, iCnt;
-  TopAbs_State aSt;
-  TopTools_IndexedMapOfShape aM;
-  TopExp_Explorer aExp;
-  GEOMAlgo_ListIteratorOfListOfPnt aIt;
-  GeomAbs_SurfaceType aType1;
-  //
-  aType1=myGAS.GetType();
-  //
-  TopExp::MapShapes(myShape, TopAbs_EDGE, aM);
-  //
-  bIsConformState=Standard_False;
-  //
-  aNb=aM.Extent();
-  for (i=1; i<=aNb; ++i) {
-    GEOMAlgo_ListOfPnt aLP;
-    GEOMAlgo_StateCollector aSC;
-    //
-    const TopoDS_Edge& aE=TopoDS::Edge(aM(i));
-    //
-    aExp.Init(aE, TopAbs_VERTEX);
-    for (; aExp.More(); aExp.Next()) {
-      const TopoDS_Shape& aV=aExp.Current();
-      //
-      bIsConformState=myMSS.Contains(aV);
-      if (!bIsConformState) {
-        break;// vertex has non-conformed state
-      }
-      else {
-        aSt=myMSS.FindFromKey(aV);
-        aSC.AppendState(aSt);
-      }
-    }
-    //
-    if (!bIsConformState) {
-      continue; // vertex has non-conformed state,skip edge
-    }
-    //
-    if (BRep_Tool::Degenerated(aE)) {
-      myMSS.Add(aE, aSt);
-      continue;
-    }
-    //
-    if (myState==GEOMAlgo_ST_ON && aType1==GeomAbs_Sphere) {
-      Standard_Real aT1, aT2;
-      Handle(Geom_Curve) aC;
-      GeomAdaptor_Curve aGAC;
-      GeomAbs_CurveType aType2;
-      //
-      aC=BRep_Tool::Curve(aE, aT1, aT2);
-      aGAC.Load(aC);
-      //
-      aType2=aGAC.GetType();
-      if (aType2==GeomAbs_Line) {
-        continue;
-      }
-    }
-    //
-    InnerPoints(aE, aLP);
-    if (myErrorStatus) {
-      return;
-    }
-    //
-    bIsConformState=Standard_True;
-    aIt.Initialize(aLP);
-    for (iCnt=0; aIt.More(); aIt.Next(), ++iCnt) {
-      if (myNbPntsMax) {
-        if (iCnt > myNbPntsMax) {
-          break;
-        }
-      }
-      //
-      const gp_Pnt& aP=aIt.Value();
-      aSt = GetPointState( aP );
-      bIsToBreak=aSC.AppendState(aSt);
-      if (bIsToBreak) {
-        break;
-      }
-    }
-    //
-    aSt=aSC.State();
-    //
-    bIsConformState=GEOMAlgo_SurfaceTools::IsConformState(aSt, myState);
-    if (myShapeType==TopAbs_EDGE) {
-      if (bIsConformState) {
-        myMSS.Add(aE, aSt);
-      }
-    }
-    else if (bIsConformState || aSt==TopAbs_ON) {
-      myMSS.Add(aE, aSt);
-    }
-  } //  for (i=1; i<=aNb; ++i) next edge
-}
-//=======================================================================
-//function : ProcessFaces
-//purpose  :
-//=======================================================================
-void GEOMAlgo_FinderShapeOn1::ProcessFaces()
-{
-  myErrorStatus=0;
-  //
-  Standard_Boolean bIsConformState, bIsToBreak;
-  Standard_Integer i, aNbF, iCnt;
-  TopAbs_State aSt;
-  TopTools_IndexedMapOfShape aM;
-  TopExp_Explorer aExp;
-  GEOMAlgo_ListIteratorOfListOfPnt aIt;
-  GeomAbs_SurfaceType aType1, aType2;
-  //
-  aType1=myGAS.GetType();
-  //
-  TopExp::MapShapes(myShape, TopAbs_FACE, aM);
-  aNbF=aM.Extent();
-  for (i=1; i<=aNbF; ++i) {
-    GEOMAlgo_StateCollector aSC;
-    GEOMAlgo_ListOfPnt aLP;
-    //
-    const TopoDS_Face& aF=TopoDS::Face(aM(i));
-    //
-    if (myState==GEOMAlgo_ST_ON) {
-      Handle(Geom_Surface) aS;
-      GeomAdaptor_Surface aGAS;
-      //
-      aS=BRep_Tool::Surface(aF);
-      aGAS.Load(aS);
-      aType2=aGAS.GetType();
-      if (aType2!=aType1) {
-        continue;
-      }
-    }
-    //
-    bIsConformState=Standard_False;
-    //
-    aExp.Init(aF, TopAbs_EDGE);
-    for (; aExp.More(); aExp.Next()) {
-      const TopoDS_Shape& aE=aExp.Current();
-      bIsConformState=myMSS.Contains(aE);
-      if (!bIsConformState) {
-        break;// edge has non-conformed state
-      }
-      else {
-        aSt=myMSS.FindFromKey(aE);
-        aSC.AppendState(aSt);
-      }
-    }
-    //
-    if (!bIsConformState) {
-      continue; // edge has non-conformed state,skip face
-    }
-    //
-    InnerPoints(aF, aLP);
-    if (myErrorStatus) {
-      return;
-    }
-    //
-    bIsConformState=Standard_True;
-    aIt.Initialize(aLP);
-    for (iCnt=0; aIt.More(); aIt.Next(), ++iCnt) {
-      if (myNbPntsMax) {
-        if (iCnt > myNbPntsMax) {
-          break;
-        }
-      }
-      //
-      const gp_Pnt& aP=aIt.Value();
-      aSt = GetPointState( aP );
-      bIsToBreak=aSC.AppendState(aSt);
-      if (bIsToBreak) {
-        break;
-      }
-    }
-    //
-    aSt=aSC.State();
-    //
-    bIsConformState=GEOMAlgo_SurfaceTools::IsConformState(aSt, myState);
-    if (myShapeType==TopAbs_FACE) {
-      if (bIsConformState) {
-        myMSS.Add(aF, aSt);
-      }
-    }
-    else if (bIsConformState || aSt==TopAbs_ON) {
-      myMSS.Add(aF, aSt);
-    }
-  }//  for (i=1; i<=aNb; ++i) next face
-}
-//=======================================================================
-//function : ProcessSolids
-//purpose  :
-//=======================================================================
-void GEOMAlgo_FinderShapeOn1::ProcessSolids()
-{
-  myErrorStatus=0;
-  //
-  Standard_Boolean bIsConformState;
-  Standard_Integer i, aNbS, j, aNbF;
-  TopTools_IndexedMapOfShape aM, aMF;
-  TopAbs_State aSt;
-  //
-  TopExp::MapShapes(myShape, TopAbs_SOLID, aM);
-  aNbS=aM.Extent();
-  for (i=1; i<=aNbS; ++i) {
-    GEOMAlgo_StateCollector aSC;
-    //
-    const TopoDS_Shape& aSd=aM(i);
-    aMF.Clear();
-    TopExp::MapShapes(aSd, TopAbs_FACE, aMF);
-    //
-    bIsConformState=Standard_False;
-    //
-    aNbF=aMF.Extent();
-    for (j=1; j<=aNbF; ++j) {
-      const TopoDS_Shape& aF=aMF(j);
-      bIsConformState=myMSS.Contains(aF);
-      if (!bIsConformState) {
-        break;// face has non-conformed state
-      }
-      else {
-        aSt=myMSS.FindFromKey(aF);
-        aSC.AppendState(aSt);
-      }
-    }
-    //
-    if (!bIsConformState) {
-      continue; // face has non-conformed state,skip solid
-    }
-    //
-    aSt=aSC.State();
-    //
-    bIsConformState=GEOMAlgo_SurfaceTools::IsConformState(aSt, myState);
-    if (bIsConformState) {
-      myMSS.Add(aSd, aSt);
-    }
-  }
-}
-//
-//=======================================================================
-//function : InnerPoints
-//purpose  :
-//=======================================================================
-void GEOMAlgo_FinderShapeOn1::InnerPoints(const TopoDS_Face& aF,
-                                          GEOMAlgo_ListOfPnt& aLP)
-{
-  myErrorStatus=0;
-  //
-  Standard_Integer j, j1, j2, k, n[4], aNbLinks, aNx, aNb, iCnt;//, aNbMax, *pIds;
-  TopLoc_Location aLoc;
-  Handle(Poly_Triangulation) aTRF;
-  TColStd_MapOfInteger aMBN;
-  GEOMAlgo_DataMapOfPassKeyInteger aMPKI;
-  GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyInteger aIt;
-  gp_Pnt aP, aP1, aP2;
-  //
-  aLP.Clear();
-  //
-  aTRF=BRep_Tool::Triangulation(aF, aLoc);
-  if (aTRF.IsNull()) {
-    if (!GEOMAlgo_AlgoTools::BuildTriangulation(aF)) {
-      myWarningStatus=20; // no triangulation found
-      return;
-    }
-    aTRF=BRep_Tool::Triangulation(aF, aLoc);
-  }
-  //
-  const gp_Trsf& aTrsf=aLoc.Transformation();
-  const Poly_Array1OfTriangle& aTrs=aTRF->Triangles();
-  const TColgp_Array1OfPnt& aNodes=aTRF->Nodes();
-  //
-  // map link/nbtriangles
-  j1=aTrs.Lower();
-  j2=aTrs.Upper();
-  for (j=j1; j<=j2; ++j) {
-    const Poly_Triangle& aTr=aTrs(j);
-    aTr.Get(n[0], n[1], n[2]);
-    n[3]=n[0];
-    for (k=0; k<3; ++k) {
-      GEOMAlgo_PassKey aPK;
-      //
-      aPK.SetIds(n[k], n[k+1]);
-      if (aMPKI.IsBound(aPK)) {
-        Standard_Integer& iCntX=aMPKI.ChangeFind(aPK);
-        ++iCntX;
-      }
-      else {
-        aMPKI.Bind(aPK, 1);
-      }
-    }
-  }
-  //
-  // boundary nodes aMBN
-  aNbLinks=aMPKI.Extent();
-  aIt.Initialize(aMPKI);
-  for (; aIt.More(); aIt.Next()) {
-    iCnt=aIt.Value();
-    if (iCnt==1) {
-      const GEOMAlgo_PassKey& aPK=aIt.Key();
-      //
-      aNx=(Standard_Integer)aPK.Id(1);
-      aMBN.Add(aNx);
-      aNx=(Standard_Integer)aPK.Id(2);
-      aMBN.Add(aNx);
-    }
-  }
-  //
-  // inner nodes=all_nodes - boundary_nodes
-  j1=aNodes.Lower();
-  j2=aNodes.Upper();
-  for (j=j1; j<=j2; ++j) {
-    if (!aMBN.Contains(j)) {
-      aP=aNodes(j).Transformed(aTrsf);
-      aLP.Append(aP);
-    }
-  }
-  //
-  aNb=aLP.Extent();
-  //
-  if (!aNb && myNbPntsMin) {
-    // try to fill it yourself
-    Standard_Boolean bIsDone;
-    Standard_Integer aN1, aN2;
-    Handle(Geom_Surface) aS;
-    GeomAdaptor_Surface aGAS;
-    GeomAbs_SurfaceType aType;
-    //
-    aS=BRep_Tool::Surface(aF);
-    aGAS.Load(aS);
-    aType=aGAS.GetType();
-    if (aType==GeomAbs_Plane || aType==GeomAbs_Cylinder) {
-      // inner links
-      aNbLinks=aMPKI.Extent();
-      aIt.Initialize(aMPKI);
-      for (; aIt.More(); aIt.Next()) {
-        iCnt=aIt.Value();
-        if (iCnt>1) {
-          // take the first having occurred inner link
-          // and discretize it
-          const GEOMAlgo_PassKey& aPK=aIt.Key();
-          //
-          aN1=(Standard_Integer)aPK.Id(1);
-          aN2=(Standard_Integer)aPK.Id(2);
-          //
-          aP1=aNodes(aN1).Transformed(aTrsf);
-          aP2=aNodes(aN2).Transformed(aTrsf);
-          //
-          if (aType==GeomAbs_Cylinder) {
-            gp_Cylinder aCyl;
-            //
-            aCyl=aGAS.Cylinder();
-            if (!GEOMAlgo_SurfaceTools::IsCoaxial(aP1, aP2, aCyl, myTolerance)) {
-              continue;
-            }
-          }
-          //
-          BRepLib_MakeEdge aBME(aP1, aP2);
-          bIsDone=aBME.IsDone();
-          if (!bIsDone) {
-            myErrorStatus=30; //can not obtain the line from the link
-            return;
-          }
-          //
-          const TopoDS_Shape& aSx=aBME.Shape();
-          const TopoDS_Edge& aE=TopoDS::Edge(aSx);
-          //
-          InnerPoints(aE, myNbPntsMin, aLP);
-          break;
-        }// if (iCnt>1)
-      }// for (; aIt.More(); aIt.Next())
-    }// if (aType==GeomAbs_Plane || aType==GeomAbs_Cylinder)
-  }// if (!aNb && myNbPntsMin) {
-}
-//=======================================================================
-//function : InnerPoints
-//purpose  :
-//=======================================================================
-void GEOMAlgo_FinderShapeOn1::InnerPoints(const TopoDS_Edge& aE,
-                                          GEOMAlgo_ListOfPnt& aLP)
-{
-  Standard_Integer aNbPntsMin;
-  //
-  myErrorStatus=0;
-  aNbPntsMin=21;
-  //
-  aLP.Clear();
-  InnerPoints(aE, aNbPntsMin, aLP);
-}
-//=======================================================================
-//function : InnerPoints
-//purpose  :
-//=======================================================================
-void GEOMAlgo_FinderShapeOn1::InnerPoints(const TopoDS_Edge& aE,
-                                          const Standard_Integer aNbPntsMin,
-                                          GEOMAlgo_ListOfPnt& aLP)
-{
-  Standard_Boolean bInf1, bInf2;
-  Standard_Integer j, aNbT;
-  Standard_Real dT, aT, aT1, aT2;
-  gp_Pnt aP;
-  Handle(Geom_Curve) aC3D;
-  //
-  aC3D=BRep_Tool::Curve(aE, aT1, aT2);
-  if (aC3D.IsNull()) {
-    return;
-  }
-  //
-  bInf1=Precision::IsNegativeInfinite(aT1);
-  bInf2=Precision::IsPositiveInfinite(aT2);
-  if (bInf1 || bInf2) {
-    return;
-  }
-  //
-  aNbT=aNbPntsMin+1;
-  dT=(aT2-aT1)/aNbT;
-  for (j=1; j<aNbT; ++j) {
-    aT=aT1+j*dT;
-    aC3D->D0(aT, aP);
-    aLP.Append(aP);
-  }
-}
-
-//=======================================================================
-//function : CheckData
-//purpose  :
-//=======================================================================
-void GEOMAlgo_FinderShapeOn1::CheckData()
-{
-  myErrorStatus=0;
-  //
-  if(mySurface.IsNull()) {
-    myErrorStatus=10; // mySurface=NULL
-    return;
-  }
-  //
-  if (myShape.IsNull()) {
-    myErrorStatus=11; // myShape=NULL
-    return;
-  }
-  //
-  if (!(myShapeType==TopAbs_VERTEX ||
-        myShapeType==TopAbs_EDGE ||
-        myShapeType==TopAbs_FACE ||
-        myShapeType==TopAbs_SOLID)) {
-    myErrorStatus=12; // unallowed subshape type
-    return;
-  }
-  //
-  if (myState==GEOMAlgo_ST_UNKNOWN ||
-      myState==GEOMAlgo_ST_INOUT) {
-    myErrorStatus=13; // unallowed state type
-    return;
-  }
-  //
-  GeomAbs_SurfaceType aType;
-  //
-  myGAS.Load(mySurface);
-  aType=myGAS.GetType();
-  if (!(aType==GeomAbs_Plane ||
-        aType==GeomAbs_Cylinder ||
-        aType==GeomAbs_Sphere)) {
-    myErrorStatus=14; // unallowed surface type
-  }
-}
-
-//=======================================================================
-//function : GetPointState
-//purpose  :
-//=======================================================================
-
-TopAbs_State GEOMAlgo_FinderShapeOn1::GetPointState(const gp_Pnt& aP)
-{
-  TopAbs_State aSt;
-  GEOMAlgo_SurfaceTools::GetState(aP, myGAS, myTolerance, aSt);
-  return aSt;
-}
-
-
-//
-// myErrorStatus :
-//
-// 10 -mySurface=NULL
-// 11 -myShape=NULL
-// 12 -unallowed type of subshapes
-// 13 -unallowed state
-// 14 -unallowed surface type
-// 15 -unallowed surface type
-// 20- no triangulation found
-// 30- can not obtain the line from the link
-
diff --git a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn1.hxx b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn1.hxx
deleted file mode 100644 (file)
index 5f67b10..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-// Copyright (C) 2007-2024  CEA, EDF, OPEN CASCADE
-//
-// 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, or (at your option) any later version.
-//
-// 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
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-// File:        GEOMAlgo_FinderShapeOn1.hxx
-// Created:     Fri Mar  4 10:31:06 2005
-// Author:      Peter KURNEV
-
-#ifndef _GEOMAlgo_FinderShapeOn1_HeaderFile
-#define _GEOMAlgo_FinderShapeOn1_HeaderFile
-
-#include <GEOMAlgo_State.hxx>
-#include <GEOMAlgo_IndexedDataMapOfShapeState.hxx>
-#include <GEOMAlgo_ShapeAlgo.hxx>
-#include <GEOMAlgo_ListOfPnt.hxx>
-
-#include <TopAbs_State.hxx>
-#include <TopAbs_ShapeEnum.hxx>
-#include <TopoDS_Face.hxx>
-#include <TopoDS_Edge.hxx>
-#include <TopTools_ListOfShape.hxx>
-
-#include <Geom_Surface.hxx>
-#include <GeomAdaptor_Surface.hxx>
-
-#include <gp_Pnt.hxx>
-
-#include <Standard.hxx>
-#include <Standard_Macro.hxx>
-#include <Standard_Integer.hxx>
-
-//=======================================================================
-//function : GEOMAlgo_FinderShapeOn1
-//purpose  :
-//=======================================================================
-class GEOMAlgo_FinderShapeOn1  : public GEOMAlgo_ShapeAlgo
-{
- public:
-  Standard_EXPORT
-    GEOMAlgo_FinderShapeOn1();
-
-  Standard_EXPORT
-    virtual ~GEOMAlgo_FinderShapeOn1();
-
-  Standard_EXPORT
-    void SetSurface(const Handle(Geom_Surface)& aS) ;
-
-  Standard_EXPORT
-    void SetShapeType(const TopAbs_ShapeEnum aST) ;
-
-  Standard_EXPORT
-    void SetState(const GEOMAlgo_State aSF) ;
-
-  Standard_EXPORT
-    void SetNbPntsMin(const Standard_Integer aNb) ;
-
-  Standard_EXPORT
-    Standard_Integer NbPntsMin() const;
-
-  Standard_EXPORT
-    void SetNbPntsMax(const Standard_Integer aNb) ;
-
-  Standard_EXPORT
-    Standard_Integer NbPntsMax() const;
-
-  Standard_EXPORT
-    const Handle(Geom_Surface)& Surface() const;
-
-  Standard_EXPORT
-    TopAbs_ShapeEnum ShapeType() const;
-
-  Standard_EXPORT
-    GEOMAlgo_State State() const;
-
-  Standard_EXPORT
-    virtual  void Perform() ;
-
-  Standard_EXPORT
-    const TopTools_ListOfShape& Shapes() const;
-
-  Standard_EXPORT
-    const GEOMAlgo_IndexedDataMapOfShapeState& MSS() const;
-
- protected:
-  Standard_EXPORT
-    virtual  void CheckData() ;
-
-  Standard_EXPORT
-    void ProcessVertices() ;
-
-  Standard_EXPORT
-    void ProcessEdges() ;
-
-  Standard_EXPORT
-    void ProcessFaces() ;
-
-  Standard_EXPORT
-    void ProcessSolids() ;
-
-  Standard_EXPORT
-    void InnerPoints(const TopoDS_Face& aF,
-                     GEOMAlgo_ListOfPnt& aLP) ;
-
-  Standard_EXPORT
-    void InnerPoints(const TopoDS_Edge& aE,
-                     GEOMAlgo_ListOfPnt& aLP) ;
-
-  Standard_EXPORT
-    void InnerPoints(const TopoDS_Edge& aE,
-                     const Standard_Integer aNbPnts,
-                     GEOMAlgo_ListOfPnt& aLP) ;
-
-  Standard_EXPORT
-    virtual  TopAbs_State GetPointState(const gp_Pnt& aP) ;
-
-
-  Handle(Geom_Surface) mySurface;
-  TopAbs_ShapeEnum myShapeType;
-  GEOMAlgo_State myState;
-  Standard_Integer myNbPntsMin;
-  Standard_Integer myNbPntsMax;
-  GeomAdaptor_Surface myGAS;
-  TopTools_ListOfShape myLS;
-  GEOMAlgo_IndexedDataMapOfShapeState myMSS;
-};
-
-#endif
index 5fd59d517e174d8bab26644947b930b9fee2372b..34509300b603865b87b9ecfdb93be0e51a797463 100644 (file)
@@ -33,6 +33,8 @@
 #include <GEOMAlgo_StateCollector.hxx>
 #include <GEOMAlgo_SurfaceTools.hxx>
 
+#include <GEOMUtils.hxx>
+
 #include <Bnd_Box.hxx>
 #include <BRep_Tool.hxx>
 #include <BRepBndLib.hxx>
@@ -606,14 +608,13 @@ void GEOMAlgo_FinderShapeOn2::InnerPoints(const TopoDS_Face& aF,
   //
   aLP.Clear();
   //
-  aTRF=BRep_Tool::Triangulation(aF, aLoc);
-  if (aTRF.IsNull()) {
-    if (!BuildTriangulation(aF)) {
-      myWarningStatus=20; // no triangulation found
-      return;
-    }
-    aTRF=BRep_Tool::Triangulation(aF, aLoc);
+  if (!GEOMUtils::MeshShape(aF, /*deflection*/0.001, /*forced*/false,
+                            /*angle deflection*/0.349066, /*isRelative*/true,
+                            /*doPostCheck*/true)) {
+    myWarningStatus=20; // no triangulation found
+    return;
   }
+  aTRF=BRep_Tool::Triangulation(aF, aLoc);
   //
   const gp_Trsf& aTrsf=aLoc.Transformation();
   //
@@ -745,16 +746,15 @@ void GEOMAlgo_FinderShapeOn2::InnerPoints(const TopoDS_Edge& aE,
   gp_Pnt aP;
   //
   aLP.Clear();
+  if (!GEOMUtils::MeshShape(aE, /*deflection*/0.001, /*forced*/false,
+                            /*angle deflection*/0.349066, /*isRelative*/true,
+                            /*doPostCheck*/true)) {
+    myErrorStatus=20; // no triangulation found
+    return;
+  }
   BRep_Tool::PolygonOnTriangulation(aE, aPTE, aTRE, aLoc);
   if (aTRE.IsNull() || aPTE.IsNull()) {
     Handle(Poly_Polygon3D) aPE = BRep_Tool::Polygon3D(aE, aLoc);
-    if (aPE.IsNull()) {
-      if (!BuildTriangulation(aE)) {
-        myErrorStatus=20; // no triangulation found
-        return;
-      }
-      aPE = BRep_Tool::Polygon3D(aE, aLoc);
-    }
     const gp_Trsf& aTrsf=aLoc.Transformation();
     const TColgp_Array1OfPnt& aNodes=aPE->Nodes();
     //
@@ -819,59 +819,6 @@ void GEOMAlgo_FinderShapeOn2::InnerPoints(const TopoDS_Edge& aE,
   }
 }
 
-//=======================================================================
-//function : BuildTriangulation
-//purpose  :
-//=======================================================================
-Standard_Boolean
-  GEOMAlgo_FinderShapeOn2::BuildTriangulation (const TopoDS_Shape& theShape)
-{
-  // calculate deflection
-  Standard_Real aDeviationCoefficient = 0.001;
-
-  Bnd_Box B;
-  BRepBndLib::Add(theShape, B);
-  Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax;
-  B.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
-
-  Standard_Real dx = aXmax - aXmin, dy = aYmax - aYmin, dz = aZmax - aZmin;
-  Standard_Real aDeflection = Max(Max(dx, dy), dz) * aDeviationCoefficient * 4;
-  Standard_Real aHLRAngle = 0.349066;
-
-  // build triangulation
-  BRepMesh_IncrementalMesh Inc (theShape, aDeflection, Standard_False, aHLRAngle);
-
-  // check triangulation
-  bool isTriangulation = true;
-
-  TopExp_Explorer exp (theShape, TopAbs_FACE);
-  if (exp.More())
-  {
-    TopLoc_Location aTopLoc;
-    Handle(Poly_Triangulation) aTRF;
-    aTRF = BRep_Tool::Triangulation(TopoDS::Face(exp.Current()), aTopLoc);
-    if (aTRF.IsNull()) {
-      isTriangulation = false;
-    }
-  }
-  else // no faces, try edges
-  {
-    TopExp_Explorer expe (theShape, TopAbs_EDGE);
-    if (!expe.More()) {
-      isTriangulation = false;
-    }
-    else {
-      TopLoc_Location aLoc;
-      Handle(Poly_Polygon3D) aPE = BRep_Tool::Polygon3D(TopoDS::Edge(expe.Current()), aLoc);
-      if (aPE.IsNull()) {
-        isTriangulation = false;
-      }
-    }
-  }
-
-  return isTriangulation;
-}
-
 //
 // myErrorStatus :
 //
index 8f999f3933f8447ac393496acad3df269c51f1fc..6824e3c593aad415ac7fca6b55e4e7ed872daa06 100644 (file)
@@ -126,9 +126,6 @@ protected:
                      const Standard_Integer aNbPnts,
                      GEOMAlgo_ListOfPnt& aLP) ;
 
-  Standard_EXPORT
-    Standard_Boolean BuildTriangulation(const TopoDS_Shape& aS) ;
-
 
   TopAbs_ShapeEnum myShapeType;
   GEOMAlgo_State myState;
diff --git a/src/GEOMAlgo/GEOMAlgo_FinderShapeOnQuad.cxx b/src/GEOMAlgo/GEOMAlgo_FinderShapeOnQuad.cxx
deleted file mode 100644 (file)
index 908cb47..0000000
+++ /dev/null
@@ -1,144 +0,0 @@
-// Copyright (C) 2007-2024  CEA, EDF, OPEN CASCADE
-//
-// 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, or (at your option) any later version.
-//
-// 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
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-// File      : GEOMAlgo_FinderShapeOnQuad.cxx
-// Created   : Mon Oct 17 17:31:45 2005
-// Author    : Edward AGAPOV (eap)
-//
-#include "GEOMAlgo_FinderShapeOnQuad.hxx"
-#include "GEOMAlgo_SurfaceTools.hxx"
-
-#include <gp_Pnt.hxx>
-#include <gp_Vec.hxx>
-#include <Geom_Plane.hxx>
-
-
-GEOMAlgo_FinderShapeOnQuad::GEOMAlgo_FinderShapeOnQuad(const gp_Pnt & theTopLeftPoint,
-                                                       const gp_Pnt & theTopRightPoint,
-                                                       const gp_Pnt & theBottomLeftPoint,
-                                                       const gp_Pnt & theBottomRightPoint)
-{
-  myPoints.resize(6);
-  myPoints[0] = theTopLeftPoint    ;
-  myPoints[1] = theTopRightPoint   ;
-  myPoints[2] = theBottomRightPoint;
-  myPoints[3] = theBottomLeftPoint ;
-  myPoints[4] = myPoints[0];
-  myPoints[5] = myPoints[1];
-
-  // Find plane normal defined by corner points, it will be used to define a plane
-  // for each quadrangle side.
-  myQuadNormal.SetCoord (0,0,0);
-  for ( int i = 1; i <= 4; ++i )
-    myQuadNormal += gp_Vec( myPoints[i], myPoints[i+1] ) ^ gp_Vec( myPoints[i], myPoints[i-1] );
-  //std::cout<<std::endl<<" X Vec : "<<myQuadNormal.X()<<" "<<myQuadNormal.Y()<<" "<<myQuadNormal.Z()<<" "<<endl;
-
-  if ( myQuadNormal.SquareMagnitude() <= DBL_MIN ) {
-    myErrorStatus = 101;
-    return;
-  }
-
-  // detect concave quadrangle sides
-  myConcaveQuad = false;
-  myConcaveSide.resize (4, false);
-  for ( int i = 1; i <= 4; ++i ) {
-    gp_Vec localQN = gp_Vec( myPoints[i], myPoints[i+1] ) ^ gp_Vec( myPoints[i], myPoints[i-1] );
-    if ( myQuadNormal * localQN < 0 )
-      myConcaveSide[i-1] = myConcaveSide[i] = myConcaveQuad = true;
-  }
-
-  // loop on quadrangle sides
-  myPlanes.reserve( 4 );
-  for ( int i = 0; i < 4; ++i )
-  {
-    // point1 -> point2 vector
-    gp_Vec aSideVec( myPoints[ i ], myPoints[ i + 1 ]);
-    //std::cout<<" Y Vec : "<<aSideVec.X()<<" "<<aSideVec.Y()<<" "<<aSideVec.Z()<<" "<<endl;
-
-    // plane normal
-    gp_Vec aSideNorm = aSideVec ^ myQuadNormal;
-    if ( aSideNorm.SquareMagnitude() <= DBL_MIN )
-      continue;
-    //std::cout<<" Z Vec : "<<aSideNorm.X()<<" "<<aSideNorm.Y()<<" "<<aSideNorm.Z()<<" "<<endl;
-
-    // make plane
-    Handle(Geom_Plane) aPlane = new Geom_Plane( myPoints[ i ], aSideNorm );
-    myPlanes.push_back( GeomAdaptor_Surface() );
-    myPlanes.back().Load( aPlane );
-  }
-}
-
-//=======================================================================
-//function : CheckData
-//purpose  :
-//=======================================================================
-
-void GEOMAlgo_FinderShapeOnQuad::CheckData()
-{
-  if ( !myPlanes.empty() )
-    mySurface = myPlanes[0].Surface();
-  GEOMAlgo_FinderShapeOn1::CheckData();
-}
-
-//=======================================================================
-//function : GetPointState
-//purpose  :
-//=======================================================================
-
-TopAbs_State GEOMAlgo_FinderShapeOnQuad::GetPointState(const gp_Pnt& aP)
-{
-  // Return IN if aP has TopAbs_IN with all sides.
-  // In the case of concave quadrangle, return IN if
-  // aP is OUT of only one concave side
-  double nbIn = 0.;
-  for ( size_t i = 0; i < myPlanes.size(); ++i )
-  {
-    TopAbs_State aSt;
-    GEOMAlgo_SurfaceTools::GetState(aP, myPlanes[i], myTolerance, aSt);
-    if ( aSt == TopAbs_IN )
-    {
-      nbIn += myConcaveSide[i] ? 0.5 : 1.0;
-    }
-    else if ( aSt == TopAbs_ON )
-    {
-      // check that aP is between quadrangle corners
-      Handle(Geom_Plane) aSidePlane = Handle(Geom_Plane)::DownCast( myPlanes[i].Surface() );
-      gp_Vec aSideNorm = aSidePlane->Axis().Direction();
-      gp_Vec aSideVec = myQuadNormal ^ aSideNorm;
-      gp_Vec c1p ( myPoints[i], aP );
-      gp_Vec pc2 ( aP, myPoints[i+1] );
-      if ( aSideVec * c1p >= 0. && aSideVec * pc2 >= 0. )
-        return TopAbs_ON;
-      // consider to be IN (???????????)
-      //nbIn += myConcaveSide[i] ? 0.5 : 1.0;
-    }
-  }
-  Standard_Real inThreshold = myPlanes.size(); // usually 4.0
-  if ( myConcaveQuad )
-    inThreshold = 2.5; // 1.0 + 1.0 + 0.5
-
-  if ( nbIn >= inThreshold )
-    return TopAbs_IN;
-
-  return TopAbs_OUT;
-}
-
diff --git a/src/GEOMAlgo/GEOMAlgo_FinderShapeOnQuad.hxx b/src/GEOMAlgo/GEOMAlgo_FinderShapeOnQuad.hxx
deleted file mode 100644 (file)
index 84b6fc0..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright (C) 2007-2024  CEA, EDF, OPEN CASCADE
-//
-// 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, or (at your option) any later version.
-//
-// 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
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-// File      : GEOMAlgo_FinderShapeOnQuad.hxx
-// Created   : Mon Oct 17 17:15:59 2005
-// Author    : Edward AGAPOV (eap)
-//
-#ifndef GEOMAlgo_FinderShapeOnQuad_HeaderFile
-#define GEOMAlgo_FinderShapeOnQuad_HeaderFile
-
-#include "GEOMAlgo_FinderShapeOn1.hxx"
-
-#include <gp_Vec.hxx>
-
-#include <vector>
-
-
-class GEOMAlgo_FinderShapeOnQuad: public GEOMAlgo_FinderShapeOn1
-{
-public:
-
-  Standard_EXPORT
-  GEOMAlgo_FinderShapeOnQuad(const gp_Pnt & theTopLeftPoint,
-                             const gp_Pnt & theTopRightPoint,
-                             const gp_Pnt & theBottomLeftPoint,
-                             const gp_Pnt & theBottomRightPoint);
-
-protected:
-
-  virtual  void CheckData() ;
-
-  virtual TopAbs_State GetPointState(const gp_Pnt& aP) ;
-
-private:
-
-  bool                              myConcaveQuad;
-  std::vector<bool>                 myConcaveSide;
-  std::vector<gp_Pnt>               myPoints;
-  std::vector<GeomAdaptor_Surface>  myPlanes;
-  gp_Vec                            myQuadNormal;
-};
-#endif
index c848ff86c53b51fcfe404d62b6d8c07acfa20903..68ad864de4c364eed7ccb98e16feef7b69029f98 100644 (file)
 
 #include <TopoDS_Shape.hxx>
 #include <Standard_Integer.hxx>
+
+#include <Basics_OCCTVersion.hxx>
+
+#if OCC_VERSION_LARGE < 0x07080000
+
 #include <TColStd_MapIntegerHasher.hxx>
 
 #define _NCollection_MapHasher
@@ -39,6 +44,13 @@ typedef NCollection_IndexedDataMap<Standard_Integer, TopoDS_Shape, TColStd_MapIn
 
 #undef _NCollection_MapHasher
 
+#else
+
+#include <NCollection_IndexedDataMap.hxx>
+
+typedef NCollection_IndexedDataMap<Standard_Integer, TopoDS_Shape> GEOMAlgo_IndexedDataMapOfIntegerShape;
+
+#endif // OCC_VERSION_LARGE < 0x07080000
 
 
 #endif
index 9f052c40f280987dc96a69e6d1b105a1c8d24704..2a031c2b062919fcb5ca1ce145a4e33cb8ab1b5e 100644 (file)
@@ -206,6 +206,7 @@ static
   }
   return !bRet;
 }
+#if OCC_VERSION_LARGE < 0x07080000
 //=======================================================================
 //function : HashCode
 //purpose  :
@@ -214,6 +215,7 @@ static
 {
   return ::HashCode(mySum, aUpper);
 }
+#endif
 //=======================================================================
 //function : Dump
 //purpose  :
index 77a74f073f0392fc4ae5f1b5eb1e48056a4b10e5..bb5185689ac5bbbfdf671f5b9f2505e6b28c56bc 100644 (file)
@@ -28,6 +28,8 @@
 #ifndef _GEOMAlgo_PassKey_HeaderFile
 #define _GEOMAlgo_PassKey_HeaderFile
 
+#include <Basics_OCCTVersion.hxx>
+
 #include <Standard.hxx>
 #include <Standard_Macro.hxx>
 #include <Standard_Integer.hxx>
@@ -88,8 +90,19 @@ class GEOMAlgo_PassKey  {
   Standard_EXPORT
     Standard_Boolean IsEqual(const GEOMAlgo_PassKey& aOther) const;
 
+#if OCC_VERSION_LARGE < 0x07080000
   Standard_EXPORT
     Standard_Integer HashCode(const Standard_Integer Upper) const;
+#endif
+
+  Standard_EXPORT
+  bool operator==(const GEOMAlgo_PassKey& theOther) const
+  {
+    return IsEqual(theOther);
+  }
+
+  Standard_EXPORT
+  size_t GetSum() const { return (size_t)mySum; }
 
   Standard_EXPORT
     Standard_Integer Id(const Standard_Integer aIndex) const;
@@ -102,4 +115,16 @@ class GEOMAlgo_PassKey  {
   Standard_Integer mySum;
   TColStd_IndexedMapOfInteger myMap;
 };
+
+namespace std
+{
+  template <>
+  struct hash<GEOMAlgo_PassKey>
+  {
+    size_t operator()(const GEOMAlgo_PassKey& thePK) const noexcept
+    {
+      return thePK.GetSum();
+    }
+  };
+}
 #endif
index 79d55846ebeefbe45cf7419f83a122fae91acdc6..9918596b4ee44331c6778adbe982a92e60852b0a 100644 (file)
@@ -27,6 +27,8 @@
 //
 #include <GEOMAlgo_PassKeyMapHasher.hxx>
 
+#if OCC_VERSION_LARGE < 0x07080000
+
 //=======================================================================
 //function : HashCode
 //purpose  :
 {
   return aPK1.IsEqual(aPK2);
 }
+
+#else
+
+size_t GEOMAlgo_PassKeyMapHasher::operator()(const GEOMAlgo_PassKey& aPKey) const
+{
+  return aPKey.GetSum();
+}
+
+bool GEOMAlgo_PassKeyMapHasher::operator()(const GEOMAlgo_PassKey& aPKey1,
+                                           const GEOMAlgo_PassKey& aPKey2) const
+{
+  return aPKey1.IsEqual(aPKey2);
+}
+
+#endif // OCC_VERSION_LARGE < 0x07080000
index a6ce772afa9233be320fd5bf629b56b2d9e1024a..144d5d14c311650cd023ecbb66e5ebd9008d93be 100644 (file)
 #include <Standard_Boolean.hxx>
 #include <GEOMAlgo_PassKey.hxx>
 
+#include <Basics_OCCTVersion.hxx>
+
 //=======================================================================
 //class : GEOMAlgo_PassKeyMapHasher
 //purpose  :
 //=======================================================================
 class GEOMAlgo_PassKeyMapHasher  {
  public:
+#if OCC_VERSION_LARGE < 0x07080000
   Standard_EXPORT
     static  Standard_Integer HashCode(const GEOMAlgo_PassKey& aPKey,
                                       const Standard_Integer Upper) ;
@@ -47,5 +50,13 @@ class GEOMAlgo_PassKeyMapHasher  {
   Standard_EXPORT
     static  Standard_Boolean IsEqual(const GEOMAlgo_PassKey& aPKey1,
                                      const GEOMAlgo_PassKey& aPKey2) ;
+#else
+  Standard_EXPORT
+  size_t operator()(const GEOMAlgo_PassKey& aPKey) const;
+
+  Standard_EXPORT
+  bool operator()(const GEOMAlgo_PassKey& aPKey1,
+                  const GEOMAlgo_PassKey& aPKey2) const;
+#endif // OCC_VERSION_LARGE < 0x07080000
 };
 #endif
index fa0c73ee7370b87a2a671ec4a12528ec9001eaf2..e4ceeb154231de212fe12cbae9f49f7c509fe350 100644 (file)
@@ -27,6 +27,8 @@
 //
 #include <GEOMAlgo_PassKeyShape.hxx>
 
+#include <Basics_OCCTVersion.hxx>
+
 #include <TopTools_ListOfShape.hxx>
 #include <TopTools_ListIteratorOfListOfShape.hxx>
 
@@ -94,7 +96,11 @@ static
   Clear();
   myNbIds=1;
   myMap.Add(aS1);
+#if OCC_VERSION_LARGE < 0x07080000
   aHC=aS1.HashCode(myUpper);
+#else
+  aHC = std::hash<TopoDS_Shape>{}(aS1);
+#endif
   mySum=NormalizedId(aHC, myNbIds);
 }
 //=======================================================================
@@ -160,7 +166,11 @@ static
   myNbIds=myMap.Extent();
   for(i=1; i<=myNbIds; ++i) {
     const TopoDS_Shape& aS=myMap(i);
+#if OCC_VERSION_LARGE < 0x07080000
     aId=aS.HashCode(myUpper);
+#else
+    aId = std::hash<TopoDS_Shape>{}(aS);
+#endif
     aIdN=NormalizedId(aId, myNbIds);
     mySum+=aIdN;
   }
@@ -195,6 +205,7 @@ static
   }
   return !bRet;
 }
+#if OCC_VERSION_LARGE < 0x07080000
 //=======================================================================
 //function : HashCode
 //purpose  :
@@ -203,6 +214,7 @@ static
 {
   return ::HashCode(mySum, aUpper);
 }
+#endif
 //=======================================================================
 //function : Dump
 //purpose  :
index f846bfbf76a5e9c76f8f903e4c70d66be4817c3c..4ea5803177cae02b81a9992a22e300fadee5287f 100644 (file)
@@ -29,6 +29,8 @@
 #ifndef _GEOMAlgo_PassKeyShape_HeaderFile
 #define _GEOMAlgo_PassKeyShape_HeaderFile
 
+#include <Basics_OCCTVersion.hxx>
+
 #include <Standard.hxx>
 #include <Standard_Macro.hxx>
 #include <Standard_Integer.hxx>
@@ -90,8 +92,19 @@ class GEOMAlgo_PassKeyShape  {
   Standard_EXPORT
     Standard_Boolean IsEqual(const GEOMAlgo_PassKeyShape& aOther) const;
 
+#if OCC_VERSION_LARGE < 0x07080000
   Standard_EXPORT
     Standard_Integer HashCode(const Standard_Integer Upper) const;
+#endif
+
+  Standard_EXPORT
+  bool operator==(const GEOMAlgo_PassKeyShape& theOther) const
+  {
+    return IsEqual(theOther);
+  }
+
+  Standard_EXPORT
+    size_t GetSum() const { return (size_t)mySum; }
 
   Standard_EXPORT
     void Dump(const Standard_Integer aHex = 0) const;
index 7e1dccbc101906819a9a9e4b9940f8286696cdfa..e926870f966e1adc85d292571820a711bf184c56 100644 (file)
@@ -27,6 +27,8 @@
 //
 #include <GEOMAlgo_PassKeyShapeMapHasher.hxx>
 
+#if OCC_VERSION_LARGE < 0x07080000
+
 //=======================================================================
 //function : HashCode
 //purpose  :
 {
   return aPK1.IsEqual(aPK2);
 }
+
+#else
+
+size_t GEOMAlgo_PassKeyShapeMapHasher::operator()(const GEOMAlgo_PassKeyShape& aPKey) const
+{
+  return aPKey.GetSum();
+}
+
+bool GEOMAlgo_PassKeyShapeMapHasher::operator()(const GEOMAlgo_PassKeyShape& aPKey1,
+                                                const GEOMAlgo_PassKeyShape& aPKey2) const
+{
+  return aPKey1.IsEqual(aPKey2);
+}
+
+#endif // OCC_VERSION_LARGE < 0x07080000
index 921d53db2520c1b1761e6198ad54e0bea631d1b7..c656c45a4c73f40e357d6713d57386c4dc282dae 100644 (file)
@@ -34,6 +34,8 @@
 #include <Standard_Boolean.hxx>
 #include <GEOMAlgo_PassKeyShape.hxx>
 
+#include <Basics_OCCTVersion.hxx>
+
 //=======================================================================
 //class    : GEOMAlgo_PassKeyShapeMapHasher
 //purpose  :
@@ -41,6 +43,7 @@
 class GEOMAlgo_PassKeyShapeMapHasher
 {
  public:
+#if OCC_VERSION_LARGE < 0x07080000
   Standard_EXPORT
     static  Standard_Integer HashCode(const GEOMAlgo_PassKeyShape& aPKey,
                                       const Standard_Integer Upper) ;
@@ -48,5 +51,13 @@ class GEOMAlgo_PassKeyShapeMapHasher
   Standard_EXPORT
     static  Standard_Boolean IsEqual(const GEOMAlgo_PassKeyShape& aPKey1,
                                      const GEOMAlgo_PassKeyShape& aPKey2) ;
+#else
+  Standard_EXPORT
+  size_t operator()(const GEOMAlgo_PassKeyShape& aPKey) const;
+
+  Standard_EXPORT
+  bool operator()(const GEOMAlgo_PassKeyShape& aPKey1,
+                  const GEOMAlgo_PassKeyShape& aPKey2) const;
+#endif // OCC_VERSION_LARGE < 0x07080000
 };
 #endif
index 0c4eebd1ae0784a1a4efde1c30c0e66dd4401cc9..0b0cfe95f22e7b5d1852d83f3a9f0152a5f3a97e 100644 (file)
 //  File   : GeometryGUI.cxx
 //  Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
 
-#include <Standard_math.hxx>  // E.A. must be included before Python.h to fix compilation on windows
+#include <Basics_OCCTVersion.hxx>
+
+#include <Standard_Real.hxx>  // E.A. must be included before Python.h to fix compilation on windows
+
 #ifdef HAVE_FINITE
 #undef HAVE_FINITE            // VSR: avoid compilation warning on Linux : "HAVE_FINITE" redefined
 #endif
index e20f8eac2f79ed89a1eea97b6fbda54b00604ced..eff9b923327bc8b740add25967556c9831a74bb0 100644 (file)
 // E.A. : On windows with python 2.6, there is a conflict
 // E.A. : between pymath.h and Standard_math.h which define
 // E.A. : some same symbols : acosh, asinh, ...
- #include <Standard_math.hxx>
- #include <Python.h>
- #include <pymath.h>
-#else
- #include <Python.h>
+#include <Standard_Real.hxx>
+#include <pyport.h>
+#include <pymath.h>
 #endif
 
+#include <Python.h>
 #include <structmember.h>
 
 #ifdef HAVE_FINITE
index db1ac798f0cb06b2d2c1bedcf36290cacdf4558e..6292333569651bded3dcf446c8246ecc0e41d716 100644 (file)
 
 #include <GEOMImpl_ITestOperations.hxx>
 
-#include <BRepBndLib.hxx>
+#include <GEOMUtils.hxx>
+
 #include <BRepBuilderAPI_Copy.hxx>
-#include <BRepMesh_IncrementalMesh.hxx>
-#include <BRepTools.hxx>
-#include <Bnd_Box.hxx>
+
 #include <utilities.h>
 
 #ifndef MAX2
@@ -83,25 +82,22 @@ bool GEOMImpl_ITestOperations::Tesselate(Handle(GEOM_Object) theShape,
 
   // reset error code
   SetErrorCode(KO);
+
   // create a copy of the source shape
   TopoDS_Shape aShape = BRepBuilderAPI_Copy(theShape->GetValue()).Shape();
+
   // use default deflection if necessary
   if (theLinearDeflection <= 0)
     theLinearDeflection = 0.001;
-  // compute absolute deflection if necessary: 0.001
-  if (theIsRelative) {
-    Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax;
-    Bnd_Box bndBox;
-    BRepBndLib::Add(aShape, bndBox);
-    bndBox.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
-    theLinearDeflection = MAX3(aXmax-aXmin, aYmax-aYmin, aZmax-aZmin) * theLinearDeflection * 4;
-  }
+
   // use default deviation angle if necessary: 20 degrees
   if (theAngularDeflection <= 0)
     theAngularDeflection = 20. * M_PI / 180.;
+
   // compute triangulation
-  BRepTools::Clean(aShape);
-  BRepMesh_IncrementalMesh aMesh(aShape, theLinearDeflection, Standard_False, theAngularDeflection);
+  GEOMUtils::MeshShape(aShape, theLinearDeflection, /*theForced*/ true,
+                       theAngularDeflection, theIsRelative);
+
   // set OK status and return
   SetErrorCode(OK);
   return true;
index 23404069bbf8e562c21fdf7cb96c20006cfb41ef..df823e314922a35c03670629ce7341a4d54280ab 100644 (file)
@@ -21,6 +21,8 @@
 #include <GEOMImpl_IProximity.hxx>
 #include <GEOMImpl_Types.hxx>
 
+#include <GEOMUtils.hxx>
+
 #include <BRep_Tool.hxx>
 #include <BRepAdaptor_Curve.hxx>
 #include <BRepAdaptor_Surface.hxx>
 #include <TopoDS.hxx>
 
 namespace {
-  static void tessellateShape(const TopoDS_Shape& theShape)
-  {
-    Standard_Boolean isTessellate = Standard_False;
-    TopLoc_Location aLoc;
-    for (TopExp_Explorer anExp(theShape, TopAbs_FACE); anExp.More() && !isTessellate; anExp.Next())
-    {
-      Handle(Poly_Triangulation) aTria = BRep_Tool::Triangulation(TopoDS::Face(anExp.Value()), aLoc);
-      isTessellate = aTria.IsNull();
-    }
-    for (TopExp_Explorer anExp(theShape, TopAbs_EDGE); anExp.More() && !isTessellate; anExp.Next())
-    {
-      Handle(Poly_Polygon3D) aPoly = BRep_Tool::Polygon3D(TopoDS::Edge(anExp.Value()), aLoc);
-      isTessellate = aPoly.IsNull();
-    }
-
-    if (isTessellate)
-    {
-      BRepMesh_IncrementalMesh aMesher(theShape, 0.1);
-      Standard_ProgramError_Raise_if(!aMesher.IsDone(), "Meshing failed");
-    }
-  }
-
   static Standard_Real paramOnCurve(const BRepAdaptor_Curve& theCurve, const gp_Pnt& thePoint, const Standard_Real theTol)
   {
     Extrema_ExtPC aParamSearch(thePoint, theCurve, theCurve.FirstParameter(), theCurve.LastParameter());
@@ -293,8 +273,8 @@ Standard_Integer GEOMImpl_ShapeProximityDriver::Execute(Handle(TFunction_Logbook
   if (aFunction->GetType() == PROXIMITY_COARSE)
   {
     // tessellate shapes if there is no mesh exists
-    tessellateShape(aShape1);
-    tessellateShape(aShape2);
+    GEOMUtils::MeshShape(aShape1, 0.1, /*theForced*/false, 0.5, /*isRelative*/false);
+    GEOMUtils::MeshShape(aShape2, 0.1, /*theForced*/false, 0.5, /*isRelative*/false);
 
     // compute proximity basing on the tessellation
     BRepExtrema_ShapeProximity aCalcProx;
index f61f871e76edebe69fb349337317eb304969ff33..cb36716e44fde8e49aabcd3b272925939cb899bd 100644 (file)
@@ -93,6 +93,8 @@
 #include <ProjLib.hxx>
 #include <ElSLib.hxx>
 
+#include <Prs3d.hxx>
+
 #include <vector>
 #include <sstream>
 #include <algorithm>
@@ -677,56 +679,6 @@ void GEOMUtils::AddSimpleShapes (const TopoDS_Shape& theShape, TopTools_ListOfSh
   }
 }
 
-//=======================================================================
-//function : CheckTriangulation
-//purpose  :
-//=======================================================================
-bool GEOMUtils::CheckTriangulation (const TopoDS_Shape& aShape)
-{
-  bool isTriangulation = true;
-
-  TopExp_Explorer exp (aShape, TopAbs_FACE);
-  if (exp.More())
-  {
-    TopLoc_Location aTopLoc;
-    Handle(Poly_Triangulation) aTRF;
-    aTRF = BRep_Tool::Triangulation(TopoDS::Face(exp.Current()), aTopLoc);
-    if (aTRF.IsNull()) {
-      isTriangulation = false;
-    }
-  }
-  else // no faces, try edges
-  {
-    TopExp_Explorer expe (aShape, TopAbs_EDGE);
-    if (!expe.More()) {
-      return false;
-    }
-    TopLoc_Location aLoc;
-    Handle(Poly_Polygon3D) aPE = BRep_Tool::Polygon3D(TopoDS::Edge(expe.Current()), aLoc);
-    if (aPE.IsNull()) {
-      isTriangulation = false;
-    }
-  }
-
-  if (!isTriangulation) {
-    // calculate deflection
-    Standard_Real aDeviationCoefficient = 0.001;
-
-    Bnd_Box B;
-    BRepBndLib::Add(aShape, B);
-    Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax;
-    B.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
-
-    Standard_Real dx = aXmax - aXmin, dy = aYmax - aYmin, dz = aZmax - aZmin;
-    Standard_Real aDeflection = Max(Max(dx, dy), dz) * aDeviationCoefficient * 4;
-    Standard_Real aHLRAngle = 0.349066;
-
-    BRepMesh_IncrementalMesh Inc (aShape, aDeflection, Standard_False, aHLRAngle);
-  }
-
-  return true;
-}
-
 //=======================================================================
 //function : GetTypeOfSimplePart
 //purpose  :
@@ -1286,44 +1238,110 @@ TopoDS_Shape GEOMUtils::ReduceCompound( const TopoDS_Shape& shape )
   return result;
 }
 
-void GEOMUtils::MeshShape( const TopoDS_Shape shape,
-                           double deflection, bool theForced )
+//=======================================================================
+//function : DefaultDeflection
+//purpose  :
+//=======================================================================
+double GEOMUtils::DefaultDeflection()
+{
+  return 0.001;
+}
+
+//=======================================================================
+//function : CanBeMeshed
+//purpose  :
+//=======================================================================
+static bool GEOMUtils_CanBeMeshed (const TopoDS_Shape& theShape,
+                                   const bool          theCheckMesh,
+                                   bool&               theHasMesh)
 {
-  Standard_Real aDeflection = ( deflection <= 0 ) ? DefaultDeflection() : deflection;
-  
   // Is shape triangulated?
-  Standard_Boolean alreadyMeshed = true;
-  TopExp_Explorer ex;
+  theHasMesh = true;
+
+  TopExp_Explorer ex (theShape, TopAbs_FACE);
   TopLoc_Location aLoc;
-  for ( ex.Init( shape, TopAbs_FACE ); ex.More() && alreadyMeshed; ex.Next() ) {
-    const TopoDS_Face& aFace = TopoDS::Face( ex.Current() );
-    Handle(Poly_Triangulation) aPoly = BRep_Tool::Triangulation( aFace, aLoc );
-    alreadyMeshed = !aPoly.IsNull(); 
+  if (ex.More()) {
+    if (theCheckMesh) {
+      for ( ; ex.More() && theHasMesh; ex.Next() ) {
+        const TopoDS_Face& aFace = TopoDS::Face( ex.Current() );
+        Handle(Poly_Triangulation) aPoly = BRep_Tool::Triangulation( aFace, aLoc );
+        theHasMesh = !aPoly.IsNull(); 
+      }
+    }
   }
-  
-  if ( !alreadyMeshed || theForced ) {
+  else { // no faces, try edges
+    ex.Init(theShape, TopAbs_EDGE);
+    if (!ex.More()) {
+      return false; // nothing to mesh
+    }
+    if (theCheckMesh) {
+      for ( ; ex.More() && theHasMesh; ex.Next() ) {
+        Handle(Poly_Polygon3D) aPE = BRep_Tool::Polygon3D(TopoDS::Edge(ex.Current()), aLoc);
+        theHasMesh = !aPE.IsNull();
+      }
+    }
+  }
+
+  return true;
+}
+
+//=======================================================================
+//function : MeshShape
+//purpose  :
+//=======================================================================
+bool GEOMUtils::MeshShape( const TopoDS_Shape theShape,
+                           const double theDeflection,
+                           const bool theForced,
+                           const double theAngleDeflection,
+                           const bool isRelative,
+                           const bool doPostCheck)
+{
+  Standard_Real aDeflection = (theDeflection <= 0) ? DefaultDeflection() : theDeflection;
+
+  // Is shape triangulated?
+  bool alreadyMeshed = true;
+  if (!GEOMUtils_CanBeMeshed (theShape, /*theCheckMesh*/true, alreadyMeshed))
+    return false;
+
+  if (alreadyMeshed && !theForced)
+    return true;
+
+  if (isRelative) {
     // Compute bounding box
     Bnd_Box B;
-    BRepBndLib::Add( shape, B );
-    if ( B.IsVoid() )
-      return; // NPAL15983 (Bug when displaying empty groups) 
-    Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax;
-    B.Get( aXmin, aYmin, aZmin, aXmax, aYmax, aZmax );
-    
-    // This magic line comes from Prs3d_ShadedShape.gxx in OCCT
-    aDeflection = MAX3(aXmax-aXmin, aYmax-aYmin, aZmax-aZmin) * aDeflection * 4;
-    
-    // Clean triangulation before compute incremental mesh
-    BRepTools::Clean( shape );
-    
-    // Compute triangulation
-    BRepMesh_IncrementalMesh mesh( shape, aDeflection ); 
+    BRepBndLib::Add(theShape, B);
+    if (B.IsVoid())
+      return false; // NPAL15983 (Bug when displaying empty groups)
+
+    Standard_Real aDeviationCoeff = aDeflection;
+    Standard_Real aMaxChordialDeviation = aDeflection;
+    aDeflection = Prs3d::GetDeflection(B, aDeviationCoeff, aMaxChordialDeviation);
   }
+
+  // Clean triangulation before compute incremental mesh
+  BRepTools::Clean(theShape);
+
+  // Compute triangulation
+  BRepMesh_IncrementalMesh mesh (theShape, aDeflection, Standard_False, theAngleDeflection); 
+
+  if (!doPostCheck)
+    return true;
+
+  if (!mesh.IsDone())
+    return false;
+
+  GEOMUtils_CanBeMeshed(theShape, /*theCheckMesh*/true, alreadyMeshed);
+  return alreadyMeshed;
 }
 
-double GEOMUtils::DefaultDeflection()
+//=======================================================================
+//function : CheckTriangulation
+//purpose  :
+//=======================================================================
+bool GEOMUtils::CheckTriangulation (const TopoDS_Shape& theShape)
 {
-  return 0.001;
+  Standard_Real aHLRAngle = 0.349066;
+  return MeshShape(theShape, DefaultDeflection(), false, aHLRAngle);
 }
 
 //=======================================================================
index fe36edd650a343e1f2a6619fcb3880c7a22bf71d..ba6b7d0459d4091d352eb0eb7b292c540ed0d226 100644 (file)
@@ -155,13 +155,6 @@ namespace GEOMUtils
   Standard_EXPORT void AddSimpleShapes (const TopoDS_Shape& theShape,
                                        TopTools_ListOfShape& theList);
 
-  /*!
-   * \brief Build a triangulation on \a theShape if it is absent.
-   * \param theShape The shape to check/build triangulation on.
-   * \retval bool Returns false if the shape has no faces, i.e. impossible to build triangulation.
-   */
-  Standard_EXPORT bool CheckTriangulation (const TopoDS_Shape& theShape);
-
   /*!
    * \brief Return type of shape for explode. In case of compound it will be a type of its first sub shape.
    * \param theShape The shape to get type of.
@@ -348,20 +341,38 @@ namespace GEOMUtils
   Standard_EXPORT TopoDS_Shape ReduceCompound( const TopoDS_Shape& shape );
 
   /*!
-   * \brief Generate triangulation for the shape.
+   * \brief Get default deflection coefficient used for triangulation
+   * \return default deflection value
+   */
+  Standard_EXPORT double DefaultDeflection();
+
+  /*!
+   * \brief Generate triangulation for \a theShape.
    *
-   * \param shape shape being meshed
-   * \param deflection deflection coefficient to be used
-   * \param forced if \c true, causes generation of mesh regardless it is already present in the shape
+   * \param theShape shape to be meshed.
+   * \param theDeflection deflection coefficient to be used.
+   * \param theForced if \c true, causes generation of mesh regardless it is already present in the shape.
+   * \param theAngleDeflection angular deflection coefficient to be used.
+   * \param isRelative if true, \a theDeflection is considered relative to \a theShape maximum axial dimension.
+   * \param doPostCheck if true, check mesh generation result and return corresponding boolean value.
+   * \retval bool Returns false in the following cases:
+   *              1. The shape has neither faces nor edges, i.e. impossible to build triangulation or polygon.
+   *              2. \a theForced is false and \a theShape has no mesh or has incomplete mesh.
+   *              3. \a doPostCheck is true and mesh generation failed or produced an incomplete mesh.
    */
-  Standard_EXPORT void MeshShape( const TopoDS_Shape shape,
-                                  double deflection, bool forced = true );
+  Standard_EXPORT bool MeshShape( const TopoDS_Shape theShape,
+                                  const double theDeflection = DefaultDeflection(),
+                                  const bool theForced = true,
+                                  const double theAngleDeflection = 0.5,
+                                  const bool isRelative = true,
+                                  const bool doPostCheck = false);
 
   /*!
-   * \brief Get default deflection coefficient used for triangulation
-   * \return default deflection value
+   * \brief Build a triangulation on \a theShape if it is absent.
+   * \param theShape The shape to check/build triangulation on.
+   * \retval bool Returns false if the shape has no faces, i.e. impossible to build triangulation.
    */
-  Standard_EXPORT double DefaultDeflection();
+  Standard_EXPORT bool CheckTriangulation (const TopoDS_Shape& theShape);
 
   /**
    * \brief Check if the shape is not a closed wire or edge.
index 377d4c3c0f31cd352bc903f6dffa0a9ce34e3361..e125b680600fe26da335843256eb00e7c03aefc9 100644 (file)
@@ -30,7 +30,6 @@
 #include <BRepTools.hxx>
 
 #include <BRepBndLib.hxx>
-#include <BRepMesh_IncrementalMesh.hxx>
 #include <Poly_Triangulation.hxx>
 #include <TopExp_Explorer.hxx>
 #include <TopoDS.hxx>
index 1ed99c516f512456e8535076161f7b9623301c96..fa7492ea1a13dcea85cadcf5802f3c4227e3779c 100644 (file)
@@ -33,6 +33,8 @@
 // OOCT includes
 #include <IFSelect_ReturnStatus.hxx>
 #include <STEPControl_Writer.hxx>
+#include <StepData_StepModel.hxx>
+#include <UnitsMethods.hxx>
 #include <Interface_Static.hxx>
 #include <TCollection_AsciiString.hxx>
 #include <TopoDS_Shape.hxx>
@@ -126,12 +128,22 @@ Standard_Integer STEPPlugin_ExportDriver::Execute(Handle(TFunction_Logbook)& /*l
     Interface_Static::SetCVal("xstep.cascade.unit","M");
     Interface_Static::SetCVal("write.step.unit", aWriteUnit.ToCString());
     Interface_Static::SetIVal("write.step.nonmanifold", 1);
-#else
+#elif OCC_VERSION_LARGE < 0x07080000
     STEPControl_Writer aWriterTmp;
     Interface_Static::SetCVal("xstep.cascade.unit","M");
     Interface_Static::SetCVal("write.step.unit", aWriteUnit.ToCString());
     Interface_Static::SetIVal("write.step.nonmanifold", 1);
     STEPControl_Writer aWriter;
+#else
+    STEPControl_Writer aWriter;
+    Interface_Static::SetCVal("xstep.cascade.unit","M");
+    Interface_Static::SetCVal("write.step.unit", aWriteUnit.ToCString());
+    Interface_Static::SetIVal("write.step.nonmanifold", 1);
+    Handle(StepData_StepModel) aModel = aWriter.Model();
+    aModel->InternalParameters.InitFromStatic();
+    Standard_Integer aWriteUnitInt = Interface_Static::IVal("write.step.unit");
+    Standard_Real aWriteUnitReal = UnitsMethods::GetLengthFactorValue(aWriteUnitInt);
+    aModel->SetWriteLengthUnit(aWriteUnitReal);
 #endif
 
     IFSelect_ReturnStatus status = aWriter.Transfer( aShape, STEPControl_AsIs );
index b98686a944afeaf07a5b53a051aad8590d7706a8..0bb1352cae673afb3643b827239cde885510c18a 100644 (file)
@@ -102,6 +102,7 @@ Standard_Integer STLPlugin_ExportDriver::Execute(Handle(TFunction_Logbook)& log)
       BRepBndLib::Add( aShape, bndBox );
       bndBox.Get( aXmin, aYmin, aZmin, aXmax, aYmax, aZmax );
       aDeflection = MAX3( aXmax-aXmin, aYmax-aYmin, aZmax-aZmin ) * aDeflection;
+      aDeflection = MAX2( aDeflection, Precision::Confusion() );
     }
     //Compute triangulation
     BRepTools::Clean( aCopyShape );