Back to index

salome-geom  6.5.0
Public Member Functions | Protected Member Functions | Protected Attributes
GEOMAlgo_WireSplitter Class Reference

the algorithm to split multiconnexed set of edges
wires on a face onto simple connexed wires
.
More...

#include <GEOMAlgo_WireSplitter.hxx>

Inheritance diagram for GEOMAlgo_WireSplitter:
Inheritance graph
[legend]
Collaboration diagram for GEOMAlgo_WireSplitter:
Collaboration graph
[legend]

List of all members.

Public Member Functions

Standard_EXPORT GEOMAlgo_WireSplitter ()
virtual Standard_EXPORT ~GEOMAlgo_WireSplitter ()
Standard_EXPORT void SetFace (const TopoDS_Face &aF)
Standard_EXPORT void SetEdges (const TopTools_ListOfShape &aLE)
Standard_EXPORT const
TopTools_ListOfShape & 
Edges () const
virtual Standard_EXPORT void Perform ()
Standard_EXPORT Standard_Boolean IsNothingToDo () const
Standard_EXPORT const TopoDS_Face & Face () const
Standard_EXPORT const
BOPTColStd_ListOfListOfShape & 
Shapes () const
Standard_EXPORT Standard_Integer ErrorStatus () const
Standard_EXPORT Standard_Integer WarningStatus () const
Standard_EXPORT void ComputeInternalShapes (const Standard_Boolean theFlag)
 Allows to omit of creation of internal shapes (manifold topology).
Needed for the SALOME/TRIPOLI module.

Protected Member Functions

virtual Standard_EXPORT void CheckData ()
virtual Standard_EXPORT void CheckResult ()

Protected Attributes

TopoDS_Face myFace
Standard_Boolean myIsDone
Standard_Boolean myNothingToDo
BOPTColStd_ListOfListOfShape myShapes
BOP_IndexedDataMapOfVertexListEdgeInfo mySmartMap
TopTools_ListOfShape myEdges
Standard_Integer myErrorStatus
Standard_Integer myWarningStatus
Standard_Boolean myComputeInternalShapes

Detailed Description

the algorithm to split multiconnexed set of edges
wires on a face onto simple connexed wires
.

Definition at line 45 of file GEOMAlgo_WireSplitter.hxx.


Constructor & Destructor Documentation

Definition at line 129 of file GEOMAlgo_WireSplitter.cxx.

:
  GEOMAlgo_Algo(),
  myNothingToDo(Standard_False)
{
}

Definition at line 139 of file GEOMAlgo_WireSplitter.cxx.

{
}

Member Function Documentation

void GEOMAlgo_Algo::CheckData ( ) [protected, virtual, inherited]
void GEOMAlgo_Algo::CheckResult ( ) [protected, virtual, inherited]

Reimplemented in GEOMAlgo_Gluer.

Definition at line 59 of file GEOMAlgo_Algo.cxx.

void GEOMAlgo_Algo::ComputeInternalShapes ( const Standard_Boolean  theFlag) [inherited]

Allows to omit of creation of internal shapes (manifold topology).
Needed for the SALOME/TRIPOLI module.

Definition at line 87 of file GEOMAlgo_Algo.cxx.

{
  myComputeInternalShapes = theFlag;
}

Here is the caller graph for this function:

const TopTools_ListOfShape & GEOMAlgo_WireSplitter::Edges ( ) const

Definition at line 182 of file GEOMAlgo_WireSplitter.cxx.

{
  return myEdges;
}
Standard_Integer GEOMAlgo_Algo::ErrorStatus ( ) const [inherited]

Definition at line 67 of file GEOMAlgo_Algo.cxx.

{
  return myErrorStatus;
}

Here is the caller graph for this function:

const TopoDS_Face & GEOMAlgo_WireSplitter::Face ( ) const

Definition at line 154 of file GEOMAlgo_WireSplitter.cxx.

{
  return myFace;
}
Standard_Boolean GEOMAlgo_WireSplitter::IsNothingToDo ( ) const

Definition at line 190 of file GEOMAlgo_WireSplitter.cxx.

{
  return myNothingToDo;
}

Here is the caller graph for this function:

void GEOMAlgo_WireSplitter::Perform ( ) [virtual]

Implements GEOMAlgo_Algo.

Definition at line 206 of file GEOMAlgo_WireSplitter.cxx.

{
  myErrorStatus=2;
  myNothingToDo=Standard_True;

  Standard_Integer index, i, aNb, aCntIn, aCntOut;
  Standard_Boolean anIsIn;
  Standard_Real anAngle;

  BOP_ListOfEdgeInfo emptyInfo;
  TopTools_ListIteratorOfListOfShape anItList;
  //
  // 1.Filling mySmartMap
  mySmartMap.Clear();

  anItList.Initialize(myEdges);
  for (; anItList.More(); anItList.Next()) {
    const TopoDS_Edge& anEdge = TopoDS::Edge(anItList.Value());
    //
    if (!BOPTools_Tools2D::HasCurveOnSurface (anEdge, myFace)) {
      continue;
    }
    //
    TopExp_Explorer anExpVerts (anEdge, TopAbs_VERTEX);
    for (; anExpVerts.More(); anExpVerts.Next()) {
      const TopoDS_Shape& aVertex= anExpVerts.Current();

      index = mySmartMap.FindIndex(aVertex);
      if (!index) {
        index=mySmartMap.Add(aVertex, emptyInfo);
      }

      BOP_ListOfEdgeInfo& aListOfEInfo=mySmartMap(index);

      BOP_EdgeInfo aEInfo;
      aEInfo.SetEdge(anEdge);

      TopAbs_Orientation anOr=aVertex.Orientation();

      if (anOr==TopAbs_FORWARD) {
        aEInfo.SetInFlag(Standard_False);
      }

      else if (anOr==TopAbs_REVERSED) {
        aEInfo.SetInFlag(Standard_True);
      }

      aListOfEInfo.Append(aEInfo);
    }
  }
  //
  aNb=mySmartMap.Extent();
  //
  // 2. myNothingToDo
  myNothingToDo=Standard_True;

  for (i=1; i<=aNb; i++) {
    aCntIn=0;
    aCntOut=0;
    const BOP_ListOfEdgeInfo& aLEInfo= mySmartMap(i);
    BOP_ListIteratorOfListOfEdgeInfo anIt(aLEInfo);
    for (; anIt.More(); anIt.Next()) {
      const BOP_EdgeInfo& anEdgeInfo=anIt.Value();
      anIsIn=anEdgeInfo.IsIn();
      if (anIsIn) {
        aCntIn++;
      }
      else {
        aCntOut++;
      }
    }
    if (aCntIn!=1 || aCntOut!=1) {
      myNothingToDo=Standard_False;
      break;
    }
  }
  //
  // Each vertex has one edge In and one - Out. Good. But it is not enought
  // to consider that nothing to do with this. We must check edges on TShape
  // coinsidence. If there are such edges there is something to do with.
  //
  if (myNothingToDo) {
    Standard_Integer aNbE, aNbMapEE;
    TopTools_IndexedDataMapOfShapeListOfShape aMapEE;
    aNbE=myEdges.Extent();

    anItList.Initialize(myEdges);
    for (; anItList.More(); anItList.Next()) {
      const TopoDS_Shape& aE = anItList.Value();

      if (!aMapEE.Contains(aE)) {
        TopTools_ListOfShape aLEx;
        aLEx.Append(aE);
        aMapEE.Add(aE, aLEx);
      }
      else {
        TopTools_ListOfShape& aLEx=aMapEE.ChangeFromKey(aE);
        aLEx.Append(aE);
      }
    }

    Standard_Boolean bFlag;
    bFlag=Standard_True;
    aNbMapEE=aMapEE.Extent();
    for (i=1; i<=aNbMapEE; i++) {
      const TopTools_ListOfShape& aLEx=aMapEE(i);
      aNbE=aLEx.Extent();
      if (aNbE==1) {
        // usual case
        continue;
      }
      else if (aNbE==2){
        const TopoDS_Shape& aE1=aLEx.First();
        const TopoDS_Shape& aE2=aLEx.Last();
        if (aE1.IsSame(aE2)) {
          bFlag=Standard_False;
          break;
        }
      }
      else {
        bFlag=Standard_False;
        break;
      }
    }
    myNothingToDo=myNothingToDo && bFlag;
  }
  //
  //
  if (myNothingToDo) {
    myErrorStatus=0;
    return;
  }
  //
  // 3. Angles in mySmartMap
  BRepAdaptor_Surface aBAS(myFace);
  const GeomAdaptor_Surface& aGAS=aBAS.Surface();
  for (i=1; i<=aNb; i++) {
    const TopoDS_Vertex& aV=TopoDS::Vertex (mySmartMap.FindKey(i));
    const BOP_ListOfEdgeInfo& aLEInfo= mySmartMap(i);

    BOP_ListIteratorOfListOfEdgeInfo anIt(aLEInfo);
    for (; anIt.More(); anIt.Next()) {
      BOP_EdgeInfo& anEdgeInfo=anIt.Value();
      const TopoDS_Edge& aE=anEdgeInfo.Edge();
      //
      TopoDS_Vertex aVV=aV;
      //
      anIsIn=anEdgeInfo.IsIn();
      if (anIsIn) {
        //
        aVV.Orientation(TopAbs_REVERSED);
        anAngle=Angle2D (aVV, aE, myFace, aGAS, Standard_True);
      }
      //
      else { // OUT
        //
        aVV.Orientation(TopAbs_FORWARD);
        anAngle=Angle2D (aVV, aE, myFace, aGAS, Standard_False);
      }
      anEdgeInfo.SetAngle(anAngle);

    }
  }
  //
  // 4. Do
  //
  Standard_Boolean anIsOut, anIsNotPassed;

  TopTools_SequenceOfShape aLS, aVertVa;
  TColgp_SequenceOfPnt2d aCoordVa;

  BOP_ListIteratorOfListOfEdgeInfo anIt;

  for (i=1; i<=aNb; i++) {
    const TopoDS_Vertex aVa=TopoDS::Vertex (mySmartMap.FindKey(i));
    const BOP_ListOfEdgeInfo& aLEInfo=mySmartMap(i);

    anIt.Initialize(aLEInfo);
    for (; anIt.More(); anIt.Next()) {
      BOP_EdgeInfo& anEdgeInfo=anIt.Value();
      const TopoDS_Edge& aEOuta=anEdgeInfo.Edge();

      anIsOut=!anEdgeInfo.IsIn();
      anIsNotPassed=!anEdgeInfo.Passed();

      if (anIsOut && anIsNotPassed) {
        //
        aLS.Clear();
        aVertVa.Clear();
        aCoordVa.Clear();
        //
        Path(aGAS, myFace, aVa, aEOuta, anEdgeInfo, aLS,
             aVertVa, aCoordVa, myShapes, mySmartMap);
      }
    }
  }
  //
  {
    Standard_Integer aNbV, aNbE;
    TopoDS_Vertex aV1, aV2;
    BOPTColStd_ListOfListOfShape aShapes;
    BOPTColStd_ListIteratorOfListOfListOfShape anItW(myShapes);

    for (; anItW.More(); anItW.Next()) {
      TopTools_IndexedMapOfShape aMV, aME;
      const TopTools_ListOfShape& aLE=anItW.Value();
      TopTools_ListIteratorOfListOfShape anItE(aLE);
      for (; anItE.More(); anItE.Next()) {
        const TopoDS_Edge& aE=TopoDS::Edge(anItE.Value());
        aME.Add(aE);
        TopExp::Vertices(aE, aV1, aV2);
        aMV.Add(aV1);
        aMV.Add(aV2);
      }
      aNbV=aMV.Extent();
      aNbE=aME.Extent();
      if (aNbV<=aNbE) {
        aShapes.Append(aLE);
      }
    }
    //
    myShapes.Clear();
    anItW.Initialize(aShapes);
    for (; anItW.More(); anItW.Next()) {
      const TopTools_ListOfShape& aLE=anItW.Value();
      myShapes.Append(aLE);
    }
  }
  //
  myErrorStatus=0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void GEOMAlgo_WireSplitter::SetEdges ( const TopTools_ListOfShape &  aLE)

Definition at line 162 of file GEOMAlgo_WireSplitter.cxx.

{
  TopTools_ListIteratorOfListOfShape anIt;
  //
  myEdges.Clear();
  anIt.Initialize(aLE);
  for (; anIt.More(); anIt.Next()) {
    const TopoDS_Shape& aE =anIt.Value();
    //
    if (aE.Orientation()==TopAbs_INTERNAL){
      continue;
    }
    //
    myEdges.Append(aE);
  }
}

Here is the caller graph for this function:

void GEOMAlgo_WireSplitter::SetFace ( const TopoDS_Face &  aF)

Definition at line 146 of file GEOMAlgo_WireSplitter.cxx.

{
  myFace=aFace;
}

Here is the caller graph for this function:

const BOPTColStd_ListOfListOfShape & GEOMAlgo_WireSplitter::Shapes ( ) const

Definition at line 198 of file GEOMAlgo_WireSplitter.cxx.

{
  return myShapes;
}

Here is the caller graph for this function:

Standard_Integer GEOMAlgo_Algo::WarningStatus ( ) const [inherited]

Definition at line 75 of file GEOMAlgo_Algo.cxx.

{
  return myWarningStatus;
}

Here is the caller graph for this function:


Member Data Documentation

Standard_Boolean GEOMAlgo_Algo::myComputeInternalShapes [protected, inherited]

Definition at line 73 of file GEOMAlgo_Algo.hxx.

TopTools_ListOfShape GEOMAlgo_WireSplitter::myEdges [protected]

Definition at line 81 of file GEOMAlgo_WireSplitter.hxx.

Standard_Integer GEOMAlgo_Algo::myErrorStatus [protected, inherited]

Definition at line 71 of file GEOMAlgo_Algo.hxx.

TopoDS_Face GEOMAlgo_WireSplitter::myFace [protected]

Definition at line 76 of file GEOMAlgo_WireSplitter.hxx.

Standard_Boolean GEOMAlgo_WireSplitter::myIsDone [protected]

Definition at line 77 of file GEOMAlgo_WireSplitter.hxx.

Standard_Boolean GEOMAlgo_WireSplitter::myNothingToDo [protected]

Definition at line 78 of file GEOMAlgo_WireSplitter.hxx.

BOPTColStd_ListOfListOfShape GEOMAlgo_WireSplitter::myShapes [protected]

Definition at line 79 of file GEOMAlgo_WireSplitter.hxx.

BOP_IndexedDataMapOfVertexListEdgeInfo GEOMAlgo_WireSplitter::mySmartMap [protected]

Definition at line 80 of file GEOMAlgo_WireSplitter.hxx.

Standard_Integer GEOMAlgo_Algo::myWarningStatus [protected, inherited]

Definition at line 72 of file GEOMAlgo_Algo.hxx.


The documentation for this class was generated from the following files: