Back to index

salome-geom  6.5.0
Classes | Typedefs | Functions
GEOMAlgo_Tools_1.cxx File Reference
#include <GEOMAlgo_Tools.hxx>
#include <NCollection_DataMap.hxx>
#include <gp_Pnt2d.hxx>
#include <gp_Pnt.hxx>
#include <Geom2dAdaptor_Curve.hxx>
#include <Geom2dInt_GInter.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom_Curve.hxx>
#include <Geom_Surface.hxx>
#include <GeomAdaptor_Surface.hxx>
#include <IntRes2d_Domain.hxx>
#include <IntRes2d_IntersectionPoint.hxx>
#include <IntRes2d_Transition.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Wire.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopExp_Explorer.hxx>
#include <BRep_Tool.hxx>
#include <BRep_Builder.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopTools_ShapeMapHasher.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_DataMapOfShapeListOfShape.hxx>
#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
#include <BRepTools.hxx>

Go to the source code of this file.

Classes

class  GEOMAlgo_InfoEdge

Typedefs

typedef NCollection_DataMap
< TopoDS_Shape,
GEOMAlgo_InfoEdge
GEOMAlgo_DataMapOfShapeInfoEdge
typedef
GEOMAlgo_DataMapOfShapeInfoEdge::Iterator 
GEOMAlgo_DataMapIteratorOfDataMapOfShapeInfoEdge

Functions

static Standard_Boolean IsEqual (const TopoDS_Shape &aS1, const TopoDS_Shape &aS2)
static Standard_Boolean CorrectWire (const TopoDS_Wire &aW, const TopoDS_Face &aF)

Typedef Documentation

typedef GEOMAlgo_DataMapOfShapeInfoEdge::Iterator GEOMAlgo_DataMapIteratorOfDataMapOfShapeInfoEdge

Definition at line 162 of file GEOMAlgo_Tools_1.cxx.

typedef NCollection_DataMap<TopoDS_Shape, GEOMAlgo_InfoEdge> GEOMAlgo_DataMapOfShapeInfoEdge

Definition at line 161 of file GEOMAlgo_Tools_1.cxx.


Function Documentation

Standard_Boolean CorrectWire ( const TopoDS_Wire &  aW,
const TopoDS_Face &  aF 
) [static]

Definition at line 203 of file GEOMAlgo_Tools_1.cxx.

{
  Standard_Boolean bRet;
  Standard_Real aTolInt;
  Standard_Integer iErr, aNbV, aNbE;
  TopoDS_Iterator aItW, aItE;
  Geom2dInt_GInter aInter;
  GEOMAlgo_DataMapOfShapeInfoEdge aDMEIE;
  TopTools_DataMapOfShapeListOfShape aDMVLE;
  TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItDMVLE;
  //
  bRet=Standard_False;
  aTolInt=1.0e-10;
  //
  aItW.Initialize(aW);
  for (; aItW.More(); aItW.Next()) {
    const TopoDS_Edge& aE=*((TopoDS_Edge*)&aItW.Value());

    aItE.Initialize(aE);
    for (aNbV=0; aItE.More(); aItE.Next(), ++aNbV) {
    }
    if (aNbV<2) {
      return bRet; //
    }
    //
    if (!aDMEIE.IsBound(aE)) {
      GEOMAlgo_InfoEdge aInfoEdge;
      //
      aInfoEdge.Init (aE, aF);
      iErr=aInfoEdge.ErrorStatus();
      if (iErr) {
       return bRet; //
      }
      //
      aDMEIE.Bind(aE, aInfoEdge);
    }
    //
    aItE.Initialize(aE);
    for (; aItE.More(); aItE.Next()) {
      const TopoDS_Shape& aV=aItE.Value();
      if (aDMVLE.IsBound(aV)) {
       TopTools_ListOfShape& aLE=aDMVLE.ChangeFind(aV);
       aLE.Append(aE);
      }
      else {
       TopTools_ListOfShape aLE;
       aLE.Append(aE);
       aDMVLE.Bind(aV, aLE);
      }
    }
  }
  //
  // 2
  Standard_Real aTolV, aD1, aD2, aDmax, aCoeff;
  gp_Pnt aPV;
  Handle(Geom_Surface) aS;
  BRep_Builder aBB;
  //
  aCoeff=1.1;
  aS=BRep_Tool::Surface(aF);
  //
  aItDMVLE.Initialize(aDMVLE);
  for(; aItDMVLE.More(); aItDMVLE.Next()) {
    const TopoDS_Vertex& aV=*((TopoDS_Vertex*)&aItDMVLE.Key());
    const TopTools_ListOfShape& aLE=aItDMVLE.Value();
    aNbE=aLE.Extent();
    if (aNbE!=2) {
      continue;
    }
    //
    aPV=BRep_Tool::Pnt(aV);
    aTolV=BRep_Tool::Tolerance(aV);
    //
    const TopoDS_Edge& aE1=*((TopoDS_Edge*)&aLE.First());
    const GEOMAlgo_InfoEdge& aIE1=aDMEIE.Find(aE1);
    const Geom2dAdaptor_Curve& aGAC1=aIE1.Adaptor();
    const IntRes2d_Domain& aDomain1=aIE1.Domain();
    //
    const TopoDS_Edge& aE2=*((TopoDS_Edge*)&aLE.Last());
    const GEOMAlgo_InfoEdge& aIE2=aDMEIE.Find(aE2);
    const Geom2dAdaptor_Curve& aGAC2=aIE2.Adaptor();
    const IntRes2d_Domain& aDomain2=aIE2.Domain();
    //
    aInter.Perform(aGAC1, aDomain1,aGAC2, aDomain2, aTolInt, aTolInt);
    if(!aInter.IsDone()) {
      continue;
    }
    //
    Standard_Integer i, aNbP;
    Standard_Real aIP_ParamOnFirst, aIP_ParamOnSecond;
    gp_Pnt aP3D1, aP3D2;
    gp_Pnt2d aP2D1, aP2D2;
    IntRes2d_Transition aTr1, aTr2;
    //
    aNbP=aInter.NbPoints();
    for (i=1; i<=aNbP; ++i) {
      const IntRes2d_IntersectionPoint& aIP = aInter.Point(i);
      aIP_ParamOnFirst  = aIP.ParamOnFirst();
      aIP_ParamOnSecond = aIP.ParamOnSecond();
      aTr1 =aIP.TransitionOfFirst();
      aTr2 =aIP.TransitionOfSecond();
      if(aTr1.PositionOnCurve()==IntRes2d_Middle ||
        aTr2.PositionOnCurve()==IntRes2d_Middle) {
       //
       const Handle(Geom_Curve)& aC3D1=aIE1.Curve();
       if (!aC3D1.IsNull()) {
         aP3D1=aC3D1->Value(aIP_ParamOnFirst);
       }
       else {
         aP2D1=aGAC1.Value(aIP_ParamOnFirst);
         aS->D0(aP2D1.X(), aP2D1.Y(), aP3D1);
       }
       //
       const Handle(Geom_Curve)& aC3D2=aIE2.Curve();
       if (!aC3D2.IsNull()) {
         aP3D2=aC3D2->Value(aIP_ParamOnSecond);
       }
       else {
         aP2D2=aGAC2.Value(aIP_ParamOnSecond);
         aS->D0(aP2D2.X(), aP2D2.Y(), aP3D2);
       }
       //
       aD1=aPV.Distance(aP3D1);
       aD2=aPV.Distance(aP3D2);
       aDmax=(aD1>aD2)? aD1 : aD2;
       if (aDmax>aCoeff*aTolV) {
         if (aDmax<10.*aTolV){
           aBB.UpdateVertex(aV, aDmax);
           bRet=Standard_True;
         }
       }
      }//
    }//for (i=1; i<=aNbP; ++i) {
  }//for(; aItDMVLE.More(); aItDMVLE.Next()) {
  return bRet;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static Standard_Boolean IsEqual ( const TopoDS_Shape &  aS1,
const TopoDS_Shape &  aS2 
) [inline, static]

Definition at line 61 of file GEOMAlgo_Tools_1.cxx.

                                                       {
  return TopTools_ShapeMapHasher::IsEqual(aS1, aS2);
}