Back to index

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

The algorithm to change the Wire Edges Set (WES) contents.
The NewWES will contain only wires instead of wires and edges.
More...

#include <GEOMAlgo_WESCorrector.hxx>

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

List of all members.

Public Member Functions

Standard_EXPORT GEOMAlgo_WESCorrector ()
 Empty constructor;


virtual Standard_EXPORT ~GEOMAlgo_WESCorrector ()
Standard_EXPORT void SetWES (const GEOMAlgo_WireEdgeSet &aWES)
 Modifier

virtual Standard_EXPORT void Perform ()
 Performs the algorithm that consists of two steps

Standard_EXPORT
GEOMAlgo_WireEdgeSet
WES ()
 Selector

Standard_EXPORT
GEOMAlgo_WireEdgeSet
NewWES ()
 Selector

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

Standard_EXPORT void DoConnexityBlocks ()
Standard_EXPORT void DoCorrections ()
virtual Standard_EXPORT void CheckData ()
virtual Standard_EXPORT void CheckResult ()

Protected Attributes

GEOMAlgo_PWireEdgeSet myWES
GEOMAlgo_WireEdgeSet myNewWES
BOP_ListOfConnexityBlock myConnexityBlocks
Standard_Integer myErrorStatus
Standard_Integer myWarningStatus
Standard_Boolean myComputeInternalShapes

Detailed Description

The algorithm to change the Wire Edges Set (WES) contents.
The NewWES will contain only wires instead of wires and edges.

Definition at line 45 of file GEOMAlgo_WESCorrector.hxx.


Constructor & Destructor Documentation

Empty constructor;

Definition at line 74 of file GEOMAlgo_WESCorrector.cxx.

:
  GEOMAlgo_Algo()
{
}

Definition at line 83 of file GEOMAlgo_WESCorrector.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:

Definition at line 126 of file GEOMAlgo_WESCorrector.cxx.

{
  Standard_Boolean bRegular, bClosed;
  Standard_Integer i, aNbV, j, aNbC, aNbVP, aNbVS;
  TopTools_ListIteratorOfListOfShape aIt;
  TopoDS_Iterator aItE;
  TopoDS_Shape aER;
  TopTools_IndexedMapOfShape aMER, aMEP, aMEC, aMVP;
  TopTools_IndexedMapOfShape aMVS, aMVAdd;
  TopTools_IndexedDataMapOfShapeListOfShape aMVE;
  //
  // 1. aMVE;
  const TopTools_ListOfShape& aLSE=myWES->StartElements();
  aIt.Initialize(aLSE);
  for (; aIt.More(); aIt.Next()) {
    const TopoDS_Shape& aE=aIt.Value();
    if (!aMEP.Contains(aE)) {
      aMEP.Add(aE);
      TopExp::MapShapesAndAncestors(aE, TopAbs_VERTEX, TopAbs_EDGE, aMVE);
    }
    else {
      aMER.Add(aE);
    }
  }
  //
  // 2.
  aNbV=aMVE.Extent();
  for (i=1; i<=aNbV; ++i) {
    const TopoDS_Shape& aV=aMVE.FindKey(i);
    //
    aNbVS=aMVS.Extent();
    if (aNbVS==aNbV) {
      break;
    }
    //
    if (aMVS.Contains(aV)) {
      continue;
    }
    aMVS.Add(aV);    // aMVS - globally processed vertices
    //
    //------------------------------------- goal: aMEC
    aMEC.Clear();    // aMEC - edges of CB
    aMVP.Clear();    // aMVP - vertices to process right now
    aMVAdd.Clear();  // aMVAdd vertices to process on next step of while(1)
    //
    aMVP.Add(aV);
    //
    while(1) {
      aNbVP=aMVP.Extent();
      for (j=1; j<=aNbVP; ++j) {
        const TopoDS_Shape& aVP=aMVP(j);
        const TopTools_ListOfShape& aLE=aMVE.FindFromKey(aVP);
        aIt.Initialize(aLE);
        for (; aIt.More(); aIt.Next()) {
          const TopoDS_Shape& aE=aIt.Value();
          if (aMEC.Contains(aE)) {
            continue;
          }
          aMEC.Add(aE);
          //
          aItE.Initialize(aE);
          for (; aItE.More(); aItE.Next()) {
            const TopoDS_Shape& aVE=aItE.Value();
            if (!aMVS.Contains(aVE)) {
              aMVS.Add(aVE);
              aMVAdd.Add(aVE);
            }
          }
        }
      }//for (j=1; j<=aNbVP; ++j)
      //
      aNbVP=aMVAdd.Extent();
      if (!aNbVP) {
        break; // from while(1)
      }
      //
      aMVP.Clear();
      for (j=1; j<=aNbVP; ++j) {
        const TopoDS_Shape& aVE=aMVAdd(j);
        aMVP.Add(aVE);
      }
      aMVAdd.Clear();
    }// while(1) {
    //-------------------------------------
    BOP_ConnexityBlock aCB;
    TopTools_ListOfShape aLEC;
    TopTools_IndexedDataMapOfShapeListOfShape aMVER;
    //
    bRegular=Standard_True;
    //
    aNbC=aMEC.Extent();
    for (j=1; j<=aNbC; ++j) {
      aER=aMEC(j);
      //
      if (aMER.Contains(aER)) {
        aER.Orientation(TopAbs_FORWARD);
        aLEC.Append(aER);
        aER.Orientation(TopAbs_REVERSED);
        aLEC.Append(aER);
        //
        bRegular=Standard_False;
      }
      else {
        aLEC.Append(aER);
      }
      //
      if (bRegular) {
        const  TopoDS_Edge& aEx=*((TopoDS_Edge*)&aER);
        if (!BRep_Tool::Degenerated(aEx)) {
          TopExp::MapShapesAndAncestors(aER, TopAbs_VERTEX, TopAbs_EDGE, aMVER);
        }
      }
    }//for (j=1; j<=aNbC; ++j) {
    //
    if (bRegular) {
      Standard_Integer k, aNbVR, aNbER;
      //
      aNbVR=aMVER.Extent();
      for (k=1; k<=aNbVR; ++k) {
        const TopTools_ListOfShape& aLER=aMVER(k);
        aNbER=aLER.Extent();
        if (aNbER==1) {
          const TopoDS_Edge& aEx=TopoDS::Edge(aER);
          bClosed=BRep_Tool::IsClosed(aEx, myWES->Face());
          if (!bClosed) {
            bRegular=!bRegular;
            break;
          }
        }
        if (aNbER>2) {
          bRegular=!bRegular;
          break;
        }
      }
    }
    //
    aCB.SetShapes(aLEC);
    aCB.SetRegularity(bRegular);
    myConnexityBlocks.Append(aCB);
    aMEC.Clear();
  }//for (i=1; i<=aNbV; ++i) {
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 273 of file GEOMAlgo_WESCorrector.cxx.

{
  Standard_Boolean bIsRegular, bIsNothingToDo, bToScale;
  Standard_Integer iErr;
  Standard_Real aScale;
  TopoDS_Wire aW;
  BOP_ListIteratorOfListOfConnexityBlock aCBIt;
  GEOMAlgo_WESScaler aWSC;
  //
  const TopoDS_Face& aF=myWES->Face();
  //
  bToScale=IsToScale(aF, aScale);
  //
  myNewWES.SetFace(aF);
  aCBIt.Initialize(myConnexityBlocks);
  for (; aCBIt.More(); aCBIt.Next()) {
    const BOP_ConnexityBlock& aCB=aCBIt.Value();
    const TopTools_ListOfShape& aLE=aCB.Shapes();
    //
    bIsRegular=aCB.IsRegular();
    if (bIsRegular) {
      MakeWire(aLE, aW);
      myNewWES.AddShape (aW);
      continue;
    }
    //
    GEOMAlgo_WireSplitter aWS;
    //
    if(bToScale) {
      TopoDS_Shape aE;
      TopTools_ListIteratorOfListOfShape aIt;
      BOPTColStd_ListIteratorOfListOfListOfShape aItLLSS;
      //
      aWSC.SetScale(aScale);
      aWSC.SetFace(aF);
      aWSC.SetEdges(aLE);
      //
      aWSC.Perform();
      iErr=aWSC.ErrorStatus();
      if (iErr) {
        return;
      }
      //
      const TopoDS_Face& aFS=aWSC.FaceScaled();
      const TopTools_ListOfShape& aLES=aWSC.EdgesScaled();
      //
      aWS.SetFace(aFS);
      aWS.SetEdges(aLES);
      //
      aWS.Perform();
      iErr=aWS.ErrorStatus();
      if (iErr) {
        continue;
      }
      //
      bIsNothingToDo=aWS.IsNothingToDo();
      if (bIsNothingToDo) {
        MakeWire(aLE, aW);
        myNewWES.AddShape (aW);
        continue;
      }
      //
      const BOPTColStd_ListOfListOfShape& aLLSS=aWS.Shapes();
      aItLLSS.Initialize(aLLSS);
      for (; aItLLSS.More(); aItLLSS.Next()) {
        TopTools_ListOfShape aLS;
        //
        const TopTools_ListOfShape& aLSS=aItLLSS.Value();
        aIt.Initialize(aLSS);
        for (; aIt.More(); aIt.Next()) {
          const TopoDS_Shape& aES=aIt.Value();
          aE=aWSC.Origin(aES);
          aLS.Append(aE);
        }
        //
        MakeWire(aLS, aW);
        myNewWES.AddShape (aW);
      }
    }//if(bToScale)
    //
    else {
      aWS.SetFace(aF);
      aWS.SetEdges(aLE);
      //
      aWS.Perform();
      iErr=aWS.ErrorStatus();
      if (iErr) {
        continue;
      }
      bIsNothingToDo=aWS.IsNothingToDo();
      if (bIsNothingToDo) {
        MakeWire(aLE, aW);
        myNewWES.AddShape (aW);
        continue;
      }
      //
      const BOPTColStd_ListOfListOfShape& aSSS=aWS.Shapes();
      //
      BOPTColStd_ListIteratorOfListOfListOfShape aWireIt(aSSS);
      for (; aWireIt.More(); aWireIt.Next()) {
        const TopTools_ListOfShape& aLEx=aWireIt.Value();
        //
        MakeWire(aLEx, aW);
        myNewWES.AddShape (aW);
      }
    }// else
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

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:

Selector

Definition at line 107 of file GEOMAlgo_WESCorrector.cxx.

{
  return myNewWES;
}

Here is the caller graph for this function:

void GEOMAlgo_WESCorrector::Perform ( ) [virtual]

Performs the algorithm that consists of two steps

  1. Make conexity blocks ( DoConnexityBlocks() )
  2. Make corrections ( DoCorrections() )

Implements GEOMAlgo_Algo.

Definition at line 115 of file GEOMAlgo_WESCorrector.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

Modifier

Definition at line 90 of file GEOMAlgo_WESCorrector.cxx.

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:

Selector

Definition at line 99 of file GEOMAlgo_WESCorrector.cxx.

{
  return *myWES;
}

Member Data Documentation

Standard_Boolean GEOMAlgo_Algo::myComputeInternalShapes [protected, inherited]

Definition at line 73 of file GEOMAlgo_Algo.hxx.

BOP_ListOfConnexityBlock GEOMAlgo_WESCorrector::myConnexityBlocks [protected]

Definition at line 84 of file GEOMAlgo_WESCorrector.hxx.

Standard_Integer GEOMAlgo_Algo::myErrorStatus [protected, inherited]

Definition at line 71 of file GEOMAlgo_Algo.hxx.

Definition at line 83 of file GEOMAlgo_WESCorrector.hxx.

Standard_Integer GEOMAlgo_Algo::myWarningStatus [protected, inherited]

Definition at line 72 of file GEOMAlgo_Algo.hxx.

Definition at line 82 of file GEOMAlgo_WESCorrector.hxx.


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