Back to index

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

#include <GEOMAlgo_Builder.hxx>

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

List of all members.

Public Member Functions

Standard_EXPORT GEOMAlgo_Builder ()
 Empty constructor

virtual Standard_EXPORT ~GEOMAlgo_Builder ()
virtual Standard_EXPORT void Perform ()
 Performs calculations

virtual Standard_EXPORT void PerformWithFiller (const NMTTools_PaveFiller &theDSF)
 Performs calculations using prepared PaveFiller
object theDSF

virtual Standard_EXPORT void AddShape (const TopoDS_Shape &theShape)
 Adds argument theShape of the operation

virtual Standard_EXPORT void Clear ()
 Clears internal fields and arguments

Standard_EXPORT const
TopTools_ListOfShape & 
Shapes () const
 Returns the arguments of the operation

virtual Standard_EXPORT const
TopTools_ListOfShape & 
Generated (const TopoDS_Shape &theS)
 Returns the list of shapes generated from the
shape theS.

virtual Standard_EXPORT const
TopTools_ListOfShape & 
Modified (const TopoDS_Shape &theS)
 Returns the list of shapes modified from the shape
theS.

virtual Standard_EXPORT
Standard_Boolean 
IsDeleted (const TopoDS_Shape &theS)
 Returns true if the shape theS has been deleted.

Standard_EXPORT void AddCompound (const TopoDS_Shape &theShape)
 Adds arguments of the operation as
shapes of upper level of container shape theShape

Standard_EXPORT const
TopTools_ListOfShape & 
Shapes1 (const Standard_Integer theType) const
 Returns list of arguments of type theType

Standard_EXPORT const
BRepAlgo_Image & 
Images () const
 Returns image shapes

Standard_EXPORT const
TopTools_ListOfShape & 
InParts (const TopoDS_Shape &theShape) const
 Returns split-parts of shapes that have
state IN for the domain of shape theShape

Standard_EXPORT const
TopoDS_Shape & 
Shape () const
 Returns the result of algorithm

Standard_EXPORT Standard_Boolean HasDeleted () const
 Returns true if the at least one shape(or sub-shape)
of arguments has been deleted.

Standard_EXPORT Standard_Boolean HasGenerated () const
 Returns true if the at least one shape(or sub-shape)
of arguments has generated shapes.

Standard_EXPORT Standard_Boolean HasModified () const
 Returns true if the at least one shape(or sub-shape)
of arguments has modified shapes.

Standard_EXPORT const
TopTools_IndexedDataMapOfShapeListOfShape & 
ImagesResult () 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 PerformInternal (const NMTTools_PaveFiller &theDSF)
 Performs calculations using prepared DSFiller
object theDSF

virtual Standard_EXPORT void PrepareHistory ()
 Prepare information for history support

virtual Standard_EXPORT void ClearInternals ()
 Clears internal fields

virtual Standard_EXPORT void Prepare ()
 Provides preparing actions

virtual Standard_EXPORT void PostTreat ()
 Provides post-tratment actions

Standard_EXPORT void AddShape1 (const TopoDS_Shape &theShape)
 Append the argument theShape to
typified lists of arguments myShapes1

virtual Standard_EXPORT void BuildResult (const TopAbs_ShapeEnum theType)
 Build the resulting shapes of type theType

Standard_EXPORT void FillImagesVertices ()
 Fill Images for vertices

Standard_EXPORT void FillImagesEdges ()
 Fill Images for edges

Standard_EXPORT void FillImagesFaces ()
 Fill Images for faces

Standard_EXPORT void FillIn2DParts ()
 For each interferred face find split edges
that are in 2-D domain of the face

Standard_EXPORT void BuildSplitFaces ()
 Build draft faces

Standard_EXPORT void FillSameDomainFaces ()
 Among draft faces find same domain faces

Standard_EXPORT void FillImagesFaces1 ()
 Fill Images for faces
taking into account same domain faces

Standard_EXPORT void FillInternalVertices ()
 Update Images for faces by
internal vertices

Standard_EXPORT void FillImagesContainers (const TopAbs_ShapeEnum theType)
 Fill Images for Wires, Shells, Compsolids, Compounds

Standard_EXPORT void FillImagesSolids ()
 Fill Images for solids

Standard_EXPORT void FillIn3DParts ()
 For each interferred solid find split faces
that are in 3-D domain of the solid

Standard_EXPORT void BuildSplitSolids ()
 Build draft solids

Standard_EXPORT void FillInternalShapes ()
 Update draft solids by
internal shells, edges, vertices

Standard_EXPORT void BuildDraftSolid (const TopoDS_Shape &theSolid, TopoDS_Shape &theDraftSolid, TopTools_ListOfShape &theInternalFaces)
 Build solid theDraftSolid that consists of
non-internal split faces of the solid
theSolid.
All splits of internal faces of
theSolid are in the list: theInternalFaces

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

Protected Attributes

NMTTools_PPaveFiller myPaveFiller
TopTools_ListOfShape myShapes
Standard_Integer myNbTypes
TopTools_MapOfShape myMapFence
TopTools_ListOfShape myShapes1 [9]
BRepAlgo_Image myImages
TopTools_IndexedDataMapOfShapeListOfShape myInParts
BRepAlgo_Image mySplitFaces
TopTools_IndexedDataMapOfShapeShape mySameDomainShapes
TopTools_IndexedDataMapOfShapeShape myDraftSolids
Standard_Integer myEntryPoint
TopoDS_Shape myShape
TopTools_ListOfShape myHistShapes
TopTools_MapOfShape myMapShape
Standard_Boolean myHasDeleted
Standard_Boolean myHasGenerated
Standard_Boolean myHasModified
TopTools_IndexedDataMapOfShapeListOfShape myImagesResult
Standard_Integer myErrorStatus
Standard_Integer myWarningStatus
Standard_Boolean myComputeInternalShapes

Detailed Description

Definition at line 49 of file GEOMAlgo_Builder.hxx.


Constructor & Destructor Documentation

Empty constructor

Definition at line 50 of file GEOMAlgo_Builder.cxx.

:
  GEOMAlgo_BuilderShape()
{
  myNbTypes=9;
  myPaveFiller=NULL;
  myEntryPoint=0; // Entry point through PerformWithFiller ()
}

Definition at line 62 of file GEOMAlgo_Builder.cxx.

{
  if (myEntryPoint==1) {
    if (myPaveFiller) {
      delete myPaveFiller;
      myPaveFiller=NULL;
    }
  }
}

Member Function Documentation

void GEOMAlgo_Builder::AddCompound ( const TopoDS_Shape &  theShape)

Adds arguments of the operation as
shapes of upper level of container shape theShape

Definition at line 75 of file GEOMAlgo_Builder.cxx.

{
  TopoDS_Iterator aIt;
  //
  aIt.Initialize(theShape);
  for (; aIt.More(); aIt.Next()) {
    const TopoDS_Shape& aS=aIt.Value();
    AddShape(aS);
  }
}

Here is the call graph for this function:

void GEOMAlgo_Builder::AddShape ( const TopoDS_Shape &  theShape) [virtual]

Adds argument theShape of the operation

Definition at line 89 of file GEOMAlgo_Builder.cxx.

{
  if (myMapFence.Add(theShape)) {
    myShapes.Append(theShape);
  }
}

Here is the caller graph for this function:

void GEOMAlgo_Builder::AddShape1 ( const TopoDS_Shape &  theShape) [protected]

Append the argument theShape to
typified lists of arguments myShapes1

Definition at line 166 of file GEOMAlgo_Builder.cxx.

{
  Standard_Integer iType;
  TopAbs_ShapeEnum aType;
  TopoDS_Iterator aIt;
  TopTools_MapOfShape aM;
  //
  aType=theShape.ShapeType();
  if (aType==TopAbs_COMPOUND) {
    aIt.Initialize(theShape);
    for (; aIt.More(); aIt.Next()) {
      const TopoDS_Shape& aS=aIt.Value();
      AddShape1(aS);
    }
  }
  //
  iType=(Standard_Integer)aType;
  if (aM.Add(theShape)) {
    myShapes1[iType].Append(theShape);
  }
}

Here is the caller graph for this function:

void GEOMAlgo_Builder::BuildDraftSolid ( const TopoDS_Shape &  theSolid,
TopoDS_Shape &  theDraftSolid,
TopTools_ListOfShape &  theInternalFaces 
) [protected]

Build solid theDraftSolid that consists of
non-internal split faces of the solid
theSolid.
All splits of internal faces of
theSolid are in the list: theInternalFaces

Definition at line 91 of file GEOMAlgo_Builder_3.cxx.

{
  myErrorStatus=0;
  //
  NMTTools_PaveFiller* pPF=myPaveFiller;
  const Handle(IntTools_Context)& aCtx= pPF->Context();
  //
  Standard_Boolean bToReverse;
  Standard_Integer  iFlag;
  TopAbs_Orientation aOrF, aOrSh, aOrSd;
  TopoDS_Iterator aIt1, aIt2;
  TopTools_ListIteratorOfListOfShape aItS;
  BRep_Builder aBB;
  TopoDS_Shell aShD;
  TopoDS_Shape aFSDx, aFx;
  //
  aOrSd=theSolid.Orientation();
  theDraftSolid.Orientation(aOrSd);
  //
  aIt1.Initialize(theSolid);
  for (; aIt1.More(); aIt1.Next()) {
    const TopoDS_Shape& aSh=aIt1.Value();
    if(aSh.ShapeType()!=TopAbs_SHELL) {
      continue; // mb internal edges,vertices
    }
    //
    aOrSh=aSh.Orientation();
    aBB.MakeShell(aShD);
    aShD.Orientation(aOrSh);
    iFlag=0;
    //
    aIt2.Initialize(aSh);
    for (; aIt2.More(); aIt2.Next()) {
      const TopoDS_Shape& aF=aIt2.Value();
      aOrF=aF.Orientation();
      //
      if (myImages.HasImage(aF)) {
        const TopTools_ListOfShape& aLSp=myImages.Image(aF);
        aItS.Initialize(aLSp);
        for (; aItS.More(); aItS.Next()) {
          aFx=aItS.Value();
          //
          if (mySameDomainShapes.Contains(aFx)) {
            aFSDx=mySameDomainShapes.FindFromKey(aFx);
            //
            if (aOrF==TopAbs_INTERNAL) {
              aFSDx.Orientation(aOrF);
              theLIF.Append(aFSDx);
            }
            else {
              bToReverse=GEOMAlgo_Tools3D::IsSplitToReverse(aFSDx, aF, aCtx);
              if (bToReverse) {
                aFSDx.Reverse();
              }
              //
              iFlag=1;
              aBB.Add(aShD, aFSDx);
            }
          }// if (mySameDomainShapes.Contains(aFx)) {
          else {
            aFx.Orientation(aOrF);
            if (aOrF==TopAbs_INTERNAL) {
              theLIF.Append(aFx);
            }
            else{
              iFlag=1;
              aBB.Add(aShD, aFx);
            }
          }
        }
      } //if (myImages.HasImage(aF)) {
      //
      else {
        if (aOrF==TopAbs_INTERNAL) {
          theLIF.Append(aF);
        }
        else{
          iFlag=1;
          aBB.Add(aShD, aF);
        }
      }
    } //for (; aIt2.More(); aIt2.Next()) {
    //
    if (iFlag) {
      aBB.Add(theDraftSolid, aShD);
    }
  } //for (; aIt1.More(); aIt1.Next()) {
}

Here is the call graph for this function:

Here is the caller graph for this function:

void GEOMAlgo_Builder::BuildResult ( const TopAbs_ShapeEnum  theType) [protected, virtual]

Build the resulting shapes of type theType

Reimplemented in GEOMAlgo_Splitter.

Definition at line 191 of file GEOMAlgo_Builder.cxx.

{
  myErrorStatus=0;
  //
  TopAbs_ShapeEnum aType;
  BRep_Builder aBB;
  TopTools_MapOfShape aM;
  TopTools_ListIteratorOfListOfShape aIt, aItIm;
  //
  aIt.Initialize(myShapes);
  for (; aIt.More(); aIt.Next()) {
    const TopoDS_Shape& aS=aIt.Value();
    aType=aS.ShapeType();
    if (aType==theType) {
      if (myImages.HasImage(aS)){
        const TopTools_ListOfShape& aLSIm=myImages.Image(aS);
        aItIm.Initialize(aLSIm);
        for (; aItIm.More(); aItIm.Next()) {
          const TopoDS_Shape& aSIm=aItIm.Value();
          if (aM.Add(aSIm)) {
            aBB.Add(myShape, aSIm);
          }
        }
      }
      else {
        if (aM.Add(aS)) {
          aBB.Add(myShape, aS);
        }
      }
    }
  }
}

Here is the caller graph for this function:

void GEOMAlgo_Builder::BuildSplitFaces ( ) [protected]

Build draft faces

Definition at line 210 of file GEOMAlgo_Builder_2.cxx.

{
  const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS();
  NMTTools_PaveFiller* pPF=myPaveFiller;
  NMTDS_InterfPool* pIP=pPF->IP();
  BOPTools_CArray1OfSSInterference& aFFs=pIP->SSInterferences();
  const Handle(IntTools_Context)& aCtx= pPF->Context();
  //
  Standard_Boolean bToReverse, bIsClosed, bIsDegenerated;
  Standard_Integer i, aNb, aNbF, nF;
  TopTools_MapOfShape aMFence;
  TColStd_IndexedMapOfInteger aMFP;
  TopExp_Explorer anExp;
  TopoDS_Face aFF;
  TopoDS_Edge aSp, aEE;
  TopTools_ListIteratorOfListOfShape aIt;
  TopAbs_Orientation anOriF, anOriE;
  //
  mySplitFaces.Clear();
  //
  // 1. Select Faces to process (MFP)
  aNb=aDS.NumberOfShapesOfTheObject();
  for (i=1; i<=aNb; ++i) {
    const TopoDS_Shape& aF=aDS.Shape(i);
    if (aF.ShapeType()!=TopAbs_FACE) {
      continue;
    }
    if (!aMFence.Add(aF)) {
      continue;
    }
    //
    if (myInParts.Contains(aF)) {
      aMFP.Add(i);
      continue;
    }
    //
    anExp.Init(aF, TopAbs_EDGE);
    for (; anExp.More(); anExp.Next()) {
      const TopoDS_Shape& aE=anExp.Current();
      if (myImages.HasImage(aE)) {
        aMFP.Add(i);
        break;
      }
    }
    //
    //===
    {
      Standard_Integer aNbFFs, aNbSE, j, n1, n2;
      //
      aNbFFs=aFFs.Extent();
      for (j=1; j<=aNbFFs; ++j) {
        BOPTools_SSInterference& aFFj=aFFs(j);
        aFFj.Indices(n1, n2);
        if (!(n1==i || n2==i)) {
          continue;
        }
        //
        const TColStd_ListOfInteger& aLSE=aFFj.SharedEdges();
        aNbSE=aLSE.Extent();
        if (aNbSE) {
          aMFP.Add(i);
          break;
        }
      }
    }
    //===
    //
  }// for (i=1; i<=aNb; ++i)
  //
  // 2. ProcessFaces
  aNbF=aMFP.Extent();
  for (i=1; i<=aNbF; ++i) {
    nF=aMFP(i);
    const TopoDS_Face& aF=TopoDS::Face(aDS.Shape(nF));
    anOriF=aF.Orientation();
    aFF=aF;
    aFF.Orientation(TopAbs_FORWARD);
    //
    aMFence.Clear();
    //
    // 2.1. Fill WES
    GEOMAlgo_WireEdgeSet aWES;
    aWES.SetFace(aFF);
    //
    //  2.1.1. Add Split parts
    anExp.Init(aFF, TopAbs_EDGE);
    for (; anExp.More(); anExp.Next()) {
      const TopoDS_Edge& aE=TopoDS::Edge(anExp.Current());
      anOriE=aE.Orientation();
      //
      if (!myImages.HasImage(aE)) {
        if (anOriE==TopAbs_INTERNAL) {
          aEE=aE;
          aEE.Orientation(TopAbs_FORWARD);
          aWES.AddStartElement(aEE);
          aEE.Orientation(TopAbs_REVERSED);
          aWES.AddStartElement(aEE);
        }
        else {
          aWES.AddStartElement(aE);
        }
        continue;
      }
      //
      bIsDegenerated=BRep_Tool::Degenerated(aE);
      //modified by NIZNHY-PKV Wed Mar 07 07:46:09 2012f
      bIsClosed=IsClosed(aE, aF);
      //bIsClosed=BRep_Tool::IsClosed(aE, aF);
      //modified by NIZNHY-PKV Wed Mar 07 07:46:13 2012t
      //
      const TopTools_ListOfShape& aLIE=myImages.Image(aE);
      aIt.Initialize(aLIE);
      for (; aIt.More(); aIt.Next()) {
        aSp=TopoDS::Edge(aIt.Value());
        //
        if (bIsDegenerated) {
          aSp.Orientation(anOriE);
          aWES.AddStartElement(aSp);
          continue;
        }
        //
        if (anOriE==TopAbs_INTERNAL) {
          aSp.Orientation(TopAbs_FORWARD);
          aWES.AddStartElement(aSp);
          aSp.Orientation(TopAbs_REVERSED);
          aWES.AddStartElement(aSp);
          continue;
        }
        //
        if (bIsClosed){
          if (aMFence.Add(aSp)) {
            //
            if (!BRep_Tool::IsClosed(aSp, aF)){
              BOPTools_Tools3D::DoSplitSEAMOnFace(aSp, aF);
            }
            //
            aSp.Orientation(TopAbs_FORWARD);
            aWES.AddStartElement(aSp);
            aSp.Orientation(TopAbs_REVERSED);
            aWES.AddStartElement(aSp);
          }
          continue;
        }// if (aMFence.Add(aSp))
        //
        aSp.Orientation(anOriE);
        bToReverse=BOPTools_Tools3D::IsSplitToReverse1(aSp, aE, aCtx);
        if (bToReverse) {
          aSp.Reverse();
        }
        aWES.AddStartElement(aSp);
      }// for (; aIt.More(); aIt.Next()) {
    }// for (; anExp.More(); anExp.Next()) {
    //
    // 2.1.2. Add In2D Parts
    if (myInParts.Contains(aF)) {
      const TopTools_ListOfShape& aLE=myInParts.FindFromKey(aF);
      aIt.Initialize(aLE);
      for (; aIt.More(); aIt.Next()) {
        aSp=TopoDS::Edge(aIt.Value());
        //
        aSp.Orientation(TopAbs_FORWARD);
        aWES.AddStartElement(aSp);
        //
        aSp.Orientation(TopAbs_REVERSED);
        aWES.AddStartElement(aSp);
      }
    }
    //
    // 2.2. Build images Faces
    TopTools_ListOfShape aLFR;
    GEOMAlgo_ShapeSet aS1, aS2;
    //
    const TopTools_ListOfShape& aSE=aWES.StartElements();
    aS1.Add(aSE);
    aS2.Add(aFF, TopAbs_EDGE);
    if (aS1.IsEqual(aS2)) {
      aLFR.Append(aF);
    }
    else {
      GEOMAlgo_BuilderFace aBF;
      //
      aBF.SetFace(aFF);
      aBF.SetContext(aCtx);
      aBF.SetShapes(aSE);
      // <-DEB
      aBF.Perform();
      //
      const TopTools_ListOfShape& aLF=aBF.Areas();
      aIt.Initialize(aLF);
      for (; aIt.More(); aIt.Next()) {
        TopoDS_Shape& aFR=aIt.Value();
        if (anOriF==TopAbs_REVERSED) {
          aFR.Orientation(TopAbs_REVERSED);
        }
        aLFR.Append(aFR);
      }
    }
    //
    // 2.3. Collect draft images Faces
    mySplitFaces.Bind(aF, aLFR);
  }//for (i=1; i<=aNbF; ++i)
}

Here is the call graph for this function:

Here is the caller graph for this function:

void GEOMAlgo_Builder::BuildSplitSolids ( ) [protected]

Build draft solids

Definition at line 418 of file GEOMAlgo_Builder_3.cxx.

{
  myErrorStatus=0;
  //
  const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS();
  NMTTools_PaveFiller* pPF=myPaveFiller;
  const Handle(IntTools_Context)& aCtx= pPF->Context();
  //
  Standard_Integer i, aNbS, iErr;
  TopExp_Explorer aExp;
  TopTools_ListOfShape aSFS, aLSEmpty;
  TopTools_MapOfShape aMFence;
  TopTools_ListIteratorOfListOfShape aIt;
  GEOMAlgo_BuilderSolid aSB;
  GEOMAlgo_DataMapIteratorOfDataMapOfShapeShapeSet aItSS;
  GEOMAlgo_DataMapOfShapeShapeSet aMSS;
  GEOMAlgo_ShapeSet aSSi;
  //
  // 0. Find same domain solids for non-interferred solids
  aNbS=aDS.NumberOfShapesOfTheObject();
  for (i=1; i<=aNbS; ++i) {
    const TopoDS_Shape& aS=aDS.Shape(i);
    if (aS.ShapeType()!=TopAbs_SOLID) {
      continue;
    }
    if (!aMFence.Add(aS)) {
      continue;
    }
    if(myDraftSolids.Contains(aS)) {
      continue;
    }
    //
    aSSi.Clear();
    aSSi.Add(aS, TopAbs_FACE);
    //
    aMSS.Bind(aS, aSSi);
  } //for (i=1; i<=aNbS; ++i)
  //
  // 1. Build solids for interferred source solids
  aSB.SetContext(aCtx);
  aSB.ComputeInternalShapes(myComputeInternalShapes);
  aNbS=myDraftSolids.Extent();
  for (i=1; i<=aNbS; ++i) {
    const TopoDS_Shape& aS =myDraftSolids.FindKey(i);
    const TopoDS_Shape& aSD=myDraftSolids.FindFromIndex(i);
    const TopTools_ListOfShape& aLFIN=
      (myInParts.Contains(aS)) ? myInParts.FindFromKey(aS) : aLSEmpty;
    //
    // 1.1 Fill Shell Faces Set
    aSFS.Clear();

    aExp.Init(aSD, TopAbs_FACE);
    for (; aExp.More(); aExp.Next()) {
      const TopoDS_Shape& aF=aExp.Current();
      aSFS.Append(aF);
    }
    //
    aIt.Initialize(aLFIN);
    for (; aIt.More(); aIt.Next()) {
      TopoDS_Shape aF=aIt.Value();
      //
      aF.Orientation(TopAbs_FORWARD);
      aSFS.Append(aF);
      aF.Orientation(TopAbs_REVERSED);
      aSFS.Append(aF);
    }
    //
    Standard_Integer aNbSFS;
    aNbSFS=aSFS.Extent();
    //
    // 1.2
    // Check whether aSFS contains a subsets of faces
    // of solids that have been already built.
    // If yes, shrink aSFS by these subsets.
    aSSi.Clear();
    aSSi.Add(aSFS);
    //
    aItSS.Initialize(aMSS);
    for (; aItSS.More(); aItSS.Next()) {
      const TopoDS_Shape& aSR=aItSS.Key();
      const GEOMAlgo_ShapeSet& aSSR=aItSS.Value();
      if (aSSi.Contains(aSSR)) {
        // the aSR is SD solid for aS
        aSSi.Subtract(aSSR);
        // update images
        if(myImages.HasImage(aS)) {
          myImages.Add(aS, aSR);
        }
        else {
          myImages.Bind(aS, aSR);
        }
        //
        // update SD Shapes
        mySameDomainShapes.Add(aSR, aSR);
      }
    }
    const TopTools_ListOfShape& aSFS1=aSSi.GetSet();
    aNbSFS=aSFS1.Extent();
    //modified by NIZNHY-PKV Wed Oct 27 09:53:15 2010f
    if (!aNbSFS) {
      continue;
    }
    //modified by NIZNHY-PKV Wed Oct 27 09:53:18 2010t
    //
    // 1.3 Build new solids
    aSB.SetContext(aCtx);
    aSB.SetShapes(aSFS1);
    aSB.Perform();
    iErr=aSB.ErrorStatus();
    if (iErr) {
      myErrorStatus=30; // SolidBuilder failed
      return;
    }
    //
    const TopTools_ListOfShape& aLSR=aSB.Areas();
    //
      // 1.4 Collect resulting solids and theirs set of faces
    aIt.Initialize(aLSR);
    for (; aIt.More(); aIt.Next()) {
      const TopoDS_Shape& aSR=aIt.Value();
      //
      aSSi.Clear();
      aExp.Init(aSR, TopAbs_FACE);
      for (; aExp.More(); aExp.Next()) {
        const TopoDS_Shape& aF=aExp.Current();
        aSSi.Add(aF);
      }
      aMSS.Bind(aSR, aSSi);
    }
    //
    // Update images
    if (myImages.HasImage(aS)) {
      myImages.Add(aS, aLSR);
    }
    else {
      myImages.Bind(aS, aLSR);
    }
  } // for (i=1; i<=aNbS; ++i) {
}

Here is the call graph for this function:

Here is the caller graph for this function:

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_Builder::Clear ( ) [virtual]

Clears internal fields and arguments

Reimplemented in GEOMAlgo_Splitter.

Definition at line 107 of file GEOMAlgo_Builder.cxx.

{
  myShapes.Clear();
  ClearInternals();
}

Here is the call graph for this function:

void GEOMAlgo_Builder::ClearInternals ( ) [protected, virtual]

Clears internal fields

Definition at line 116 of file GEOMAlgo_Builder.cxx.

{
  Standard_Integer i;
  //
  for (i=0; i<myNbTypes; ++i){
    myShapes1[i].Clear();
  }
  myImages.Clear();
  //
  myInParts.Clear();
  mySplitFaces.Clear();
  mySameDomainShapes.Clear();
  myDraftSolids.Clear();
  myMapFence.Clear();
}

Here is the caller graph for this function:

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:

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:

void GEOMAlgo_Builder::FillImagesContainers ( const TopAbs_ShapeEnum  theType) [protected]

Fill Images for Wires, Shells, Compsolids, Compounds

Definition at line 214 of file GEOMAlgo_Builder_1.cxx.

{
  myErrorStatus=0;
  //
  Standard_Boolean bInterferred, bToReverse;
  Standard_Integer i, aNbS;
  TopAbs_ShapeEnum aType;
  BRep_Builder aBB;
  TopoDS_Iterator aIt;
  TopTools_ListIteratorOfListOfShape aItIm;
  TopTools_MapOfShape aMS;
  TopTools_MapIteratorOfMapOfShape aItS;
  //
  const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS();
  NMTTools_PaveFiller* pPF=myPaveFiller;
  const Handle(IntTools_Context)& aCtx= pPF->Context();
  //
  aNbS=aDS.NumberOfShapesOfTheObject();
  for (i=1; i<=aNbS; ++i) {
    const TopoDS_Shape& aC=aDS.Shape(i);
    aType=aC.ShapeType();
    if (aType==theType) {
      aMS.Add(aC);
    }
  }
  //
  if (theType==TopAbs_COMPOUND) {
    FillImagesCompounds(aMS, myImages);
    return;
  }
  //
  aItS.Initialize(aMS);
  for (; aItS.More(); aItS.Next()) {
    const TopoDS_Shape& aC=aItS.Key();
    // whether the shape has image
    bInterferred=Standard_False;
    aIt.Initialize(aC);
    for (; aIt.More(); aIt.Next()) {
      const TopoDS_Shape& aF=aIt.Value();
      if (myImages.HasImage(aF)) {
        bInterferred=!bInterferred;
        break;
      }
    }
    if (!bInterferred){
      continue;
    }
    //
    TopoDS_Shape aCIm;
    GEOMAlgo_Tools3D::MakeContainer(theType, aCIm);
    //
    aIt.Initialize(aC);
    for (; aIt.More(); aIt.Next()) {
      const TopoDS_Shape& aF=aIt.Value();
      if (myImages.HasImage(aF)) {
        const TopTools_ListOfShape& aLFIm=myImages.Image(aF);
        aItIm.Initialize(aLFIm);
        for (; aItIm.More(); aItIm.Next()) {
          TopoDS_Shape aFIm=aItIm.Value();
          //
          bToReverse=GEOMAlgo_Tools3D::IsSplitToReverse(aFIm, aF, aCtx);
          if (bToReverse) {
            aFIm.Reverse();
          }
          aBB.Add(aCIm, aFIm);
        }
      }
      else {
        aBB.Add(aCIm, aF);
      }
    }
    myImages.Bind(aC, aCIm);
  }// for (; aItS.More(); aItS.Next()) {
}

Here is the call graph for this function:

Here is the caller graph for this function:

void GEOMAlgo_Builder::FillImagesEdges ( ) [protected]

Fill Images for edges

Definition at line 108 of file GEOMAlgo_Builder_1.cxx.

{
  myErrorStatus=0;
  //
  const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS();
  NMTTools_PaveFiller* pPF=myPaveFiller;
  const BOPTools_SplitShapesPool& aSSP=pPF->SplitShapesPool();
  const Handle(IntTools_Context)& aCtx=pPF->Context();
  //
  Standard_Boolean bToReverse;
  Standard_Integer i, aNb, aNbSp, nSp, nSpR, nSpx, aIsCB, aNbLB;
  TColStd_ListIteratorOfListOfInteger aItLB;
  TColStd_ListOfInteger aLB;
  TopoDS_Edge aEE, aESpR;
  TopTools_MapOfShape aMFence;
  TopTools_ListOfShape aLSp;
  TopTools_ListIteratorOfListOfShape aIt1;
  BOPTools_ListIteratorOfListOfPaveBlock aIt;
  //
  aNb=aDS.NumberOfShapesOfTheObject();
  for (i=1; i<=aNb; ++i) {
    const TopoDS_Shape& aE=aDS.Shape(i);
    if (aE.ShapeType()!=TopAbs_EDGE) {
      continue;
    }
    //
    if (!aMFence.Add(aE)) {
      continue;
    }
    //
    const BOPTools_ListOfPaveBlock& aLPB=aSSP(aDS.RefEdge(i));
    aNbSp=aLPB.Extent();
    if (!aNbSp) {
      continue;
    }
    //
    aEE=TopoDS::Edge(aE);
    aLSp.Clear();
    //
    if (aNbSp==1) {
      const BOPTools_PaveBlock& aPB=aLPB.First();
      nSp=aPB.Edge();
      const TopoDS_Shape& aSp=aDS.Shape(nSp);
      //
      const BOPTools_PaveBlock& aPBR=pPF->RealPaveBlock(aPB, aLB, aIsCB);
      //modified by NIZNHY-PKV Wed Oct 27 11:19:30 2010f
      aNbLB=aLB.Extent();
      if (aIsCB && aNbLB<2) {
       aIsCB=0;
      }
      //modified by NIZNHY-PKV Wed Oct 27 11:19:34 2010t
      //
      nSpR=aPBR.Edge();
      const TopoDS_Shape& aSpR=aDS.Shape(nSpR);
      if (aSpR.IsSame(aSp) && aSpR.IsSame(aE) && !aIsCB) {
        continue;
      }
      //
      aESpR=TopoDS::Edge(aSpR);
      bToReverse=GEOMAlgo_Tools3D::IsSplitToReverse(aESpR, aEE, aCtx);
      if (bToReverse) {
        aESpR.Reverse();
      }
      aLSp.Append(aESpR);
      //
      aItLB.Initialize(aLB);
      for (; aItLB.More(); aItLB.Next()) {
        nSpx=aItLB.Value();
        const TopoDS_Shape& aSpx=aDS.Shape(nSpx);
        mySameDomainShapes.Add(aSpx ,aSpR);
      }
      //
      //
    }// if (aNbSp==1) {
    else {
      aIt.Initialize(aLPB);
      for (; aIt.More(); aIt.Next()) {
        const BOPTools_PaveBlock& aPB=aIt.Value();
        const BOPTools_PaveBlock& aPBR=pPF->RealPaveBlock(aPB, aLB, aIsCB);
        nSpR=aPBR.Edge();
        const TopoDS_Shape& aSpR=aDS.Shape(nSpR);
        //
        aESpR=TopoDS::Edge(aSpR);
        bToReverse=GEOMAlgo_Tools3D::IsSplitToReverse(aESpR, aEE, aCtx);
        if (bToReverse) {
          aESpR.Reverse();
        }
        aLSp.Append(aESpR);
        //
        aItLB.Initialize(aLB);
        for (; aItLB.More(); aItLB.Next()) {
          nSpx=aItLB.Value();
          const TopoDS_Shape& aSpx=aDS.Shape(nSpx);
          mySameDomainShapes.Add(aSpx ,aSpR);
        }
      }
    }
    //
    myImages.Bind(aE, aLSp);

  }//for (i=1; i<=aNb; ++i)
}

Here is the call graph for this function:

Here is the caller graph for this function:

void GEOMAlgo_Builder::FillImagesFaces ( ) [protected]

Fill Images for faces

Definition at line 114 of file GEOMAlgo_Builder_2.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

void GEOMAlgo_Builder::FillImagesFaces1 ( ) [protected]

Fill Images for faces
taking into account same domain faces

Definition at line 655 of file GEOMAlgo_Builder_2.cxx.

{
  Standard_Integer i, aNb, iSense, aNbLFx;
  TopoDS_Face aF, aFSp, aFSD;
  TopTools_ListOfShape aLFx;
  TopTools_ListIteratorOfListOfShape aIt;
  //
  const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS();
  //
  aNb=aDS.NumberOfShapesOfTheObject();
  for (i=1; i<=aNb; ++i) {
    const TopoDS_Shape& aS=aDS.Shape(i);
    if (aS.ShapeType()!=TopAbs_FACE) {
      continue;
    }
    //
    if (!mySplitFaces.HasImage(aS)) {
      continue;
    }
    //
    aF=*((TopoDS_Face*)&aS);
    //
    aLFx.Clear();
    const TopTools_ListOfShape& aLF=mySplitFaces.Image(aF);
    aIt.Initialize(aLF);
    for (; aIt.More(); aIt.Next()) {
      aFSp=*((TopoDS_Face*)(&aIt.Value()));
      if (!mySameDomainShapes.Contains(aFSp)) {
        aLFx.Append(aFSp);
      }
      else {
        const TopoDS_Shape& aSx=mySameDomainShapes.FindFromKey(aFSp);
        aFSD=*((TopoDS_Face*)(&aSx));
        iSense=GEOMAlgo_Tools3D::Sense(aFSp, aFSD);
        if (iSense<0) {
          aFSD.Reverse();
        }
        aLFx.Append(aFSD);
      }
    }
    //
    if (!myImages.HasImage(aF)) {
      aNbLFx=aLFx.Extent();
      if (aNbLFx==1) {
        const TopoDS_Shape& aFx=aLFx.First();
        if (aF.IsSame(aFx)) {
          continue;
        }
      }
      myImages.Bind(aF, aLFx);
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void GEOMAlgo_Builder::FillImagesSolids ( ) [protected]

Fill Images for solids

Definition at line 79 of file GEOMAlgo_Builder_3.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

Fill Images for vertices

Definition at line 79 of file GEOMAlgo_Builder_1.cxx.

{
  myErrorStatus=0;
  //
  const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS();
  NMTTools_PaveFiller* pPF=myPaveFiller;
  //
  Standard_Integer i, aNb, iV;
  //
  aNb=aDS.NumberOfShapesOfTheObject();
  for (i=1; i<=aNb; ++i) {
    const TopoDS_Shape& aV=aDS.Shape(i);
    if (aV.ShapeType()==TopAbs_VERTEX) {
      iV=pPF->FindSDVertex(i);
      if (iV) {
        const TopoDS_Shape& aVSD=aDS.Shape(iV);
        if (!myImages.HasImage(aV)) {
          myImages.Bind(aV, aVSD);
          //
          mySameDomainShapes.Add(aV, aVSD);
        }
      }
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void GEOMAlgo_Builder::FillIn2DParts ( ) [protected]

For each interferred face find split edges
that are in 2-D domain of the face

Definition at line 129 of file GEOMAlgo_Builder_2.cxx.

{
  const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS();
  NMTTools_PaveFiller* pPF=myPaveFiller;
  NMTDS_InterfPool* pIP=pPF->IP();
  BOPTools_CArray1OfSSInterference& aFFs=pIP->SSInterferences();
  NMTTools_CommonBlockPool& aCBP=pPF->ChangeCommonBlockPool();
  //
  Standard_Integer  j, nSpIn, nSpSc, aNbCurves;
  Standard_Integer aNbS, nF, aNbCBP, n1, n2, aNbFFs, aNbSpIn;
  TopTools_MapOfShape  aMFence;
  TopTools_ListOfShape aLSpIn;
  TopoDS_Face aF;
  NMTTools_ListIteratorOfListOfCommonBlock aItCB;
  BOPTools_ListIteratorOfListOfPaveBlock aItPB;
  //
  myInParts.Clear();
  //
  aNbFFs=aFFs.Extent();
  aNbCBP=aCBP.Extent();
  //
  aNbS=aDS.NumberOfShapesOfTheObject();
  for (nF=1; nF<=aNbS; ++nF) {
    if (aDS.GetShapeType(nF)!=TopAbs_FACE) {
      continue;
    }
    //
    aF=TopoDS::Face(aDS.Shape(nF));
    //
    aMFence.Clear();
    aLSpIn.Clear();
    //
    // 1. In Parts
    BOPTools_ListOfPaveBlock aLPBIn;
    //
    pPF->RealSplitsInFace(nF, aLPBIn);
    //
    aItPB.Initialize(aLPBIn);
    for (; aItPB.More(); aItPB.Next()) {
      const BOPTools_PaveBlock& aPB1=aItPB.Value();
      nSpIn=aPB1.Edge();
      const TopoDS_Shape& aSpIn=aDS.Shape(nSpIn);
      aLSpIn.Append(aSpIn);
    }
    //
    // 2. Section Parts
    for (j=1; j<=aNbFFs; ++j) {
      BOPTools_SSInterference& aFF=aFFs(j);
      aFF.Indices(n1, n2);
      if (!(n1==nF || n2==nF)) {
        continue;
      }
      BOPTools_SequenceOfCurves& aSC=aFF.Curves();
      aNbCurves=aSC.Length();
      if (!aNbCurves) {
        continue;
      }
      //
      const BOPTools_Curve& aBC=aSC(1);
      const BOPTools_ListOfPaveBlock& aLPB=aBC.NewPaveBlocks();
      aItPB.Initialize(aLPB);
      for (; aItPB.More(); aItPB.Next()) {
        const BOPTools_PaveBlock& aPBSc=aItPB.Value();
        nSpSc=aPBSc.Edge();
        const TopoDS_Shape& aSpSc=aDS.Shape(nSpSc);
        if (aMFence.Add(aSpSc)){
          aLSpIn.Append(aSpSc);
        }
      }
    }
    aNbSpIn=aLSpIn.Extent();
    if (aNbSpIn) {
      myInParts.Add(aF, aLSpIn);
    }
  }//for (nF=1; nF<=aNbS; ++nF) {
}

Here is the call graph for this function:

Here is the caller graph for this function:

void GEOMAlgo_Builder::FillIn3DParts ( ) [protected]

For each interferred solid find split faces
that are in 3-D domain of the solid

Definition at line 185 of file GEOMAlgo_Builder_3.cxx.

{
  myErrorStatus=0;
  //
  const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS();
  NMTTools_PaveFiller* pPF=myPaveFiller;
  const Handle(IntTools_Context)& aCtx= pPF->Context();
  //
  Standard_Boolean bIsIN, bHasImage;
  Standard_Integer aNbS, aNbSolids, i, j, aNbFaces, aNbFP, aNbFPx, aNbFIN, aNbLIF;
  TopAbs_ShapeEnum aType;
  TopAbs_State aState;
  TopTools_IndexedMapOfShape aMSolids, aMS, aMFaces, aMFIN;
  TopTools_MapOfShape aMFDone;
  TopTools_IndexedDataMapOfShapeListOfShape aMEF;
  TopTools_ListIteratorOfListOfShape aItS;
  TopoDS_Iterator aIt, aItF;
  BRep_Builder aBB;
  TopoDS_Solid aSolidSp;
  TopoDS_Face aFP;
  //
  myDraftSolids.Clear();
  //
  aNbS=aDS.NumberOfShapesOfTheObject();
  for (i=1; i<=aNbS; ++i) {
    const TopoDS_Shape& aS=aDS.Shape(i);
    //
    aType=aS.ShapeType();
    if (aType==TopAbs_SOLID) {
      // all solids from DS
      aMSolids.Add(aS);
    }
    else if (aType==TopAbs_FACE) {
      // all faces (originals from DS or theirs images)
      if (myImages.HasImage(aS)) {
        const TopTools_ListOfShape& aLS=myImages.Image(aS);
        aItS.Initialize(aLS);
        for (; aItS.More(); aItS.Next()) {
          const TopoDS_Shape& aFx=aItS.Value();
          //
          if (mySameDomainShapes.Contains(aFx)) {
            const TopoDS_Shape& aFSDx=mySameDomainShapes.FindFromKey(aFx);
            aMFaces.Add(aFSDx);
          }
          else {
            aMFaces.Add(aFx);
          }
        }
      }
      else {
        if (mySameDomainShapes.Contains(aS)) {
          const TopoDS_Shape& aFSDx=mySameDomainShapes.FindFromKey(aS);
          aMFaces.Add(aFSDx);
        }
        else {
          aMFaces.Add(aS);
        }
      }
    }
  }
  //
  aNbFaces=aMFaces.Extent();
  aNbSolids=aMSolids.Extent();
  //
  for (i=1; i<=aNbSolids; ++i) {
    const TopoDS_Solid& aSolid=TopoDS::Solid(aMSolids(i));
    aMFDone.Clear();
    aMFIN.Clear();
    aMEF.Clear();
    //
    aBB.MakeSolid(aSolidSp);
    //
    TopTools_ListOfShape aLIF;
    //
    BuildDraftSolid(aSolid, aSolidSp, aLIF);
    aNbLIF=aLIF.Extent();
    //
    // 1 all faces/edges from aSolid [ aMS ]
    bHasImage=Standard_False;
    aMS.Clear();
    aIt.Initialize(aSolid);
    for (; aIt.More(); aIt.Next()) {
      const TopoDS_Shape& aShell=aIt.Value();
      //
      if (myImages.HasImage(aShell)) {
        bHasImage=Standard_True;
        //
        const TopTools_ListOfShape& aLS=myImages.Image(aShell);
        aItS.Initialize(aLS);
        for (; aItS.More(); aItS.Next()) {
          const TopoDS_Shape& aSx=aItS.Value();
          aMS.Add(aSx);
          TopExp::MapShapes(aSx, TopAbs_FACE, aMS);
          TopExp::MapShapes(aSx, TopAbs_EDGE, aMS);
          TopExp::MapShapesAndAncestors(aSx, TopAbs_EDGE, TopAbs_FACE, aMEF);
        }
      }
      else {
        //aMS.Add(aShell);
        TopExp::MapShapes(aShell, TopAbs_FACE, aMS);
        //modified by NIZNHY-PKV Fri Dec 03 11:18:45 2010f
        TopExp::MapShapes(aShell, TopAbs_EDGE, aMS);
        //modified by NIZNHY-PKV Fri Dec 03 11:18:51 2010t
        TopExp::MapShapesAndAncestors(aShell, TopAbs_EDGE, TopAbs_FACE, aMEF);
      }
    }
    //
    // 2 all faces that are not from aSolid [ aLFP1 ]
    Standard_Integer aNbEFP;
    TopTools_IndexedDataMapOfShapeListOfShape aMEFP;
    TopTools_ListIteratorOfListOfShape aItFP, aItEx;
    TopTools_MapOfShape aMFence;
    TopTools_ListOfShape aLFP1, aLFP2, aLFP, aLCBF, aLFIN, aLEx;//*pLFP,
    //
    // for all non-solid faces build EF map [ aMEFP ]
    for (j=1; j<=aNbFaces; ++j) {
      const TopoDS_Shape& aFace=aMFaces(j);
      if (!aMS.Contains(aFace)) {
        TopExp::MapShapesAndAncestors(aFace, TopAbs_EDGE, TopAbs_FACE, aMEFP);
      }
    }
    //
    // among all faces from aMEFP select these that have same edges
    // with the solid (i.e aMEF). These faces will be treated first
    // to prevent the usage of 3D classifier.
    // The full list of faces to process is aLFP1.
    aNbEFP=aMEFP.Extent();
    for (j=1; j<=aNbEFP; ++j) {
      const TopoDS_Shape& aE=aMEFP.FindKey(j);
      //
      if (aMEF.Contains(aE)) { // !!
        const TopTools_ListOfShape& aLF=aMEFP(j);
        aItFP.Initialize(aLF);
        for (; aItFP.More(); aItFP.Next()) {
          const TopoDS_Shape& aF=aItFP.Value();
          if (aMFence.Add(aF)) {
            aLFP1.Append(aF);
          }
        }
      }
      else {
        aLEx.Append(aE);
      }
    }
    //
    aItEx.Initialize(aLEx);
    for (; aItEx.More(); aItEx.Next()) {
      const TopoDS_Shape& aE=aItEx.Value();
      const TopTools_ListOfShape& aLF=aMEFP.FindFromKey(aE);
      aItFP.Initialize(aLF);
      for (; aItFP.More(); aItFP.Next()) {
        const TopoDS_Shape& aF=aItFP.Value();
        if (aMFence.Add(aF)) {
          aLFP2.Append(aF);
        }
      }
    }
    aLFP1.Append(aLFP2);
    //==========
    //
    // 3 Process faces aLFP1
    aNbFP=aLFP1.Extent();
    aItFP.Initialize(aLFP1);
    for (; aItFP.More(); aItFP.Next()) {
      const TopoDS_Shape& aSP=aItFP.Value();
      if (!aMFDone.Add(aSP)) {
        continue;
      }

      //
      // first face to process
      aFP=TopoDS::Face(aSP);
      bIsIN= GEOMAlgo_Tools3D::IsInternalFace(aFP, aSolidSp, aMEF, 1.e-14, aCtx);
      aState=(bIsIN) ? TopAbs_IN : TopAbs_OUT;
      //
      // collect faces to process [ aFP is the first ]
      aLFP.Clear();
      aLFP.Append(aFP);
      aItS.Initialize(aLFP1);
      for (; aItS.More(); aItS.Next()) {
        const TopoDS_Shape& aSk=aItS.Value();
        if (!aMFDone.Contains(aSk)) {
          aLFP.Append(aSk);
        }
      }
      //
      // Connexity Block that spreads from aFP the Bound
      // or till the end of the block itself
      aLCBF.Clear();
      GEOMAlgo_Tools3D::MakeConnexityBlock(aLFP, aMS, aLCBF);
      //
      // fill states for the Connexity Block
      aItS.Initialize(aLCBF);
      for (; aItS.More(); aItS.Next()) {
        const TopoDS_Shape& aSx=aItS.Value();
        aMFDone.Add(aSx);
        if (aState==TopAbs_IN) {
          aMFIN.Add(aSx);
        }
      }
      //
      aNbFPx=aMFDone.Extent();
      if (aNbFPx==aNbFP) {
        break;
      }
    }//for (; aItFP.More(); aItFP.Next())
    //
    // faces Inside aSolid
    aLFIN.Clear();
    aNbFIN=aMFIN.Extent();
    if (aNbFIN || aNbLIF) {
      for (j=1; j<=aNbFIN; ++j) {
        const TopoDS_Shape& aFIN=aMFIN(j);
        aLFIN.Append(aFIN);
      }
      //
      aItS.Initialize(aLIF);
      for (; aItS.More(); aItS.Next()) {
        const TopoDS_Shape& aFIN=aItS.Value();
        aLFIN.Append(aFIN);
      }
      //
      myInParts.Add(aSolid, aLFIN);
    }
    if (aNbFIN || bHasImage) {
      myDraftSolids.Add(aSolid, aSolidSp);
    }
  }//for (i=1; i<=aNbSolids; ++i) { // next solid
}

Here is the call graph for this function:

Here is the caller graph for this function:

Update draft solids by
internal shells, edges, vertices

Definition at line 561 of file GEOMAlgo_Builder_3.cxx.

{
  myErrorStatus=0;
  //
  const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS();
  NMTTools_PaveFiller* pPF=myPaveFiller;
  const Handle(IntTools_Context)& aCtx= pPF->Context();
  //
  //Standard_Boolean bHasImage;
  Standard_Integer i, j, jT, aNbS, aNbSI, aNbSx, aNbSd;
  TopAbs_ShapeEnum aType, aT[]={ TopAbs_VERTEX, TopAbs_EDGE };
  TopAbs_State aState;
  TopTools_ListIteratorOfListOfShape aIt, aIt1;
  TopTools_IndexedDataMapOfShapeListOfShape aMSx;
  TopTools_IndexedMapOfShape aMx;
  TopTools_MapOfShape aMSI, aMFence, aMSOr;
  TopTools_MapIteratorOfMapOfShape aItM;
  TopTools_ListOfShape aLSI, aLSd;
  TopoDS_Iterator aItS;
  BRep_Builder aBB;
  //
  // 1. Shapes to process
  //
  // 1.1 Shapes from pure arguments aMSI
  // 1.1.1 vertex, edge
  for (i=0; i<2; ++i) {
    jT=(Standard_Integer)aT[i];
    const TopTools_ListOfShape &aLS=myShapes1[jT];
    aIt.Initialize(aLS);
    for (; aIt.More(); aIt.Next()) {
      const TopoDS_Shape& aS=aIt.Value();
      if (aMFence.Add(aS)) {
        aLSI.Append(aS);
      }
    }
  }
  // 1.1.2 wire
  {
    jT=(Standard_Integer)TopAbs_WIRE;
    const TopTools_ListOfShape &aLW=myShapes1[jT];
    aIt.Initialize(aLW);
    for (; aIt.More(); aIt.Next()) {
      const TopoDS_Shape& aW=aIt.Value();
      aItS.Initialize(aW);
      for (; aItS.More(); aItS.Next()) {
        const TopoDS_Shape& aE=aItS.Value();
        if (aMFence.Add(aE)) {
          aLSI.Append(aE);
        }
      }
    }
  }
  // 1.1.3 theirs images/sources
  aIt1.Initialize(aLSI);
  for (; aIt1.More(); aIt1.Next()) {
    const TopoDS_Shape& aS=aIt1.Value();
    if (myImages.HasImage(aS)) {
      const TopTools_ListOfShape &aLSp=myImages.Image(aS);
      aIt.Initialize(aLSp);
      for (; aIt.More(); aIt.Next()) {
        const TopoDS_Shape& aSI=aIt.Value();
        aMSI.Add(aSI);
      }
    }
    else {
      aMSI.Add(aS);
    }
  }
  aLSI.Clear();
  aNbSI=aMSI.Extent();
  //
  // 2. Internal vertices, edges from source solids
  aMFence.Clear();
  aLSd.Clear();
  //
  aNbS=aDS.NumberOfShapesOfTheObject();
  for (i=1; i<=aNbS; ++i) {
    const TopoDS_Shape& aS=aDS.Shape(i);
    aType=aS.ShapeType();
    if (aType==TopAbs_SOLID) {
      //
      aMx.Clear();
      OwnInternalShapes(aS, aMx);
      //
      aNbSx=aMx.Extent();
      for (j=1; j<=aNbSx; ++j) {
        const TopoDS_Shape& aSI=aMx(j);
        if (myImages.HasImage(aSI)) {
          const TopTools_ListOfShape &aLSp=myImages.Image(aSI);
          aIt.Initialize(aLSp);
          for (; aIt.More(); aIt.Next()) {
            const TopoDS_Shape& aSp=aIt.Value();
            aMSI.Add(aSp);
          }
        }
        else {
          aMSI.Add(aSI);
        }
      }
      //
      // build aux map from splits of solids
      if (myImages.HasImage(aS)) {
        const TopTools_ListOfShape &aLSp=myImages.Image(aS);
        aIt.Initialize(aLSp);
        for (; aIt.More(); aIt.Next()) {
          const TopoDS_Shape& aSp=aIt.Value();
          if (aMFence.Add(aSp)) {
            TopExp::MapShapesAndAncestors(aSp, TopAbs_VERTEX, TopAbs_EDGE, aMSx);
            TopExp::MapShapesAndAncestors(aSp, TopAbs_VERTEX, TopAbs_FACE, aMSx);
            TopExp::MapShapesAndAncestors(aSp, TopAbs_EDGE  , TopAbs_FACE, aMSx);
            aLSd.Append(aSp);
          }
        }
      }
      else {
        if (aMFence.Add(aS)) {
          TopExp::MapShapesAndAncestors(aS, TopAbs_VERTEX, TopAbs_EDGE, aMSx);
          TopExp::MapShapesAndAncestors(aS, TopAbs_VERTEX, TopAbs_FACE, aMSx);
          TopExp::MapShapesAndAncestors(aS, TopAbs_EDGE  , TopAbs_FACE, aMSx);
          aLSd.Append(aS);
          aMSOr.Add(aS);
        }
      }
    }//if (aType==TopAbs_SOLID)
  }
  //
  aNbSd=aLSd.Extent();
  //
  // 3. Some shapes of aMSI can be already tied with faces of
  //    split solids
  aItM.Initialize(aMSI);
  for (; aItM.More(); aItM.Next()) {
    const TopoDS_Shape& aSI=aItM.Key();
    if (aMSx.Contains(aSI)) {
      const TopTools_ListOfShape &aLSx=aMSx.FindFromKey(aSI);
      aNbSx=aLSx.Extent();
      if (aNbSx) {
        aMSI.Remove(aSI);
      }
    }
  }
  //
  // 4. Just check it
  aNbSI=aMSI.Extent();
  if (!aNbSI) {
    return;
  }
  //
  // 5 Settle internal vertices and edges into solids
  aMx.Clear();
  aIt.Initialize(aLSd);
  for (; aIt.More(); aIt.Next()) {
    TopoDS_Solid aSd=TopoDS::Solid(aIt.Value());
    //
    aItM.Initialize(aMSI);
    for (; aItM.More(); aItM.Next()) {
      TopoDS_Shape aSI=aItM.Key();
      aSI.Orientation(TopAbs_INTERNAL);
      //
      aState=GEOMAlgo_Tools3D::ComputeStateByOnePoint(aSI, aSd, 1.e-11, aCtx);
      if (aState==TopAbs_IN) {
        //
        if(aMSOr.Contains(aSd)) {
          //
          TopoDS_Solid aSdx;
          //
          aBB.MakeSolid(aSdx);
          aItS.Initialize(aSd);
          for (; aItS.More(); aItS.Next()) {
            const TopoDS_Shape& aSh=aItS.Value();
            aBB.Add(aSdx, aSh);
          }
          //
          aBB.Add(aSdx, aSI);
          //
          myImages.Bind(aSd, aSdx);
          aMSOr.Remove(aSd);
          aSd=aSdx;
        }
        else {
          aBB.Add(aSd, aSI);
        }
        //
        aMSI.Remove(aSI);
      } //if (aState==TopAbs_IN) {
    }// for (; aItM.More(); aItM.Next()) {
  }//for (; aIt1.More(); aIt1.Next()) {
}

Here is the call graph for this function:

Here is the caller graph for this function:

Update Images for faces by
internal vertices

Definition at line 713 of file GEOMAlgo_Builder_2.cxx.

{
  const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS();
  NMTTools_PaveFiller* pPF=myPaveFiller;
  NMTDS_InterfPool* pIP=pPF->IP();
  const Handle(IntTools_Context)& aCtx= pPF->Context();
  //
  BOPTools_CArray1OfVSInterference& aVFs=pIP->VSInterferences();
  BOPTools_CArray1OfESInterference& aEFs=pIP->ESInterferences();
  const NMTTools_IndexedDataMapOfIndexedMapOfInteger& aMAV=pPF->AloneVertices();
  //
  Standard_Boolean bHasImage;
  Standard_Integer i, j, nF, aNbS, nV, nVSD, n1, n2, iFlag;
  Standard_Integer aNbVFs, aNbAVF, aNbEFs, aNbVC, aNbE, aNbV;
  Standard_Real aU1, aU2, aTol;
  NMTTools_IndexedDataMapOfIndexedMapOfInteger aMFMV;
  TopTools_MapOfShape aMFence;
  TopTools_ListIteratorOfListOfShape aIt, aItV;
  BRep_Builder aBB;
  //
  // 1. Collect face-vertex candidates [aMFMV]
  //
  // 1.1. VFs
  aNbVFs=aVFs.Extent();
  for (i=1; i<=aNbVFs; ++i) {
    const BOPTools_VSInterference& aVS=aVFs(i);
    aVS.Indices(n1, n2);
    nF=n2;
    nV=n1;
    if (aDS.Shape(n1).ShapeType()==TopAbs_FACE) {
      nF=n1;
      nV=n2;
    }
    nVSD=pPF->FindSDVertex(nV);
    if (nVSD) {
      nV=nVSD;
    }
    //
    UpdateCandidates(nF, nV, aMFMV);
  }
  //
  // 1.2 EFs
  aNbEFs=aEFs.Extent();
  for (i=1; i<=aNbEFs; ++i) {
    const BOPTools_ESInterference& aEF=aEFs(i);
    aEF.Indices(n1, n2);
    nV=aEF.NewShape();
    if (!nV) {
      continue;
    }
    const TopoDS_Shape& aSnew=aDS.Shape(nV);
    if (aSnew.ShapeType()!=TopAbs_VERTEX) {
      continue;
    }
    //
    nF=(aDS.Shape(n1).ShapeType()==TopAbs_FACE) ? n1 : n2;
    nVSD=pPF->FindSDVertex(nV);
    if (nVSD) {
      nV=nVSD;
    }
    UpdateCandidates(nF, nV, aMFMV);
  }
  //
  aNbS=aDS.NumberOfShapesOfTheObject();
  for (nF=1; nF<=aNbS; ++nF) {
    const TopoDS_Shape& aF=aDS.Shape(nF);
    //
    if (aF.ShapeType()!=TopAbs_FACE) {
      continue;
    }
    if (!aMFence.Add(aF)) {
      continue;
    }
    //
    const TopoDS_Face& aFF=TopoDS::Face(aF);
    aTol=BRep_Tool::Tolerance(aFF);
    //
    // 1.3 FFs
    if (aMAV.Contains(nF)) {
      const TColStd_IndexedMapOfInteger& aMAVF=aMAV.FindFromKey(nF);
      aNbAVF=aMAVF.Extent();
      for (j=1; j<=aNbAVF; ++j) {
        nV=aMAVF(j);
        nVSD=pPF->FindSDVertex(nV);
        if (nVSD) {
          nV=nVSD;
        }
        //
        UpdateCandidates(nF, nV, aMFMV);
      }
    }
    //
    // 1.4 Internal vertices of the face nF
    BooleanOperations_OnceExplorer aExp(aDS);
    aExp.Init(nF, TopAbs_VERTEX);
    for (; aExp.More(); aExp.Next()) {
      nV=aExp.Current();
      const TopoDS_Shape& aV=aDS.Shape(nV);
      if (aV.Orientation()==TopAbs_INTERNAL) {
        nVSD=pPF->FindSDVertex(nV);
        if (nVSD) {
          nV=nVSD;
        }
        //
        UpdateCandidates(nF, nV, aMFMV);
      }
    }
    //
    // 2. Process face nF
    if (!aMFMV.Contains(nF)) {
      continue;
    }
    //
    const TColStd_IndexedMapOfInteger& aMVC=aMFMV.FindFromKey(nF);
    aNbVC=aMVC.Extent();
    if (!aNbVC) {
      continue;
    }
    //
    // 2.1 Refine candidates
    TopTools_IndexedDataMapOfShapeListOfShape aMVE;
    TopTools_ListOfShape aLV;
    //
    bHasImage=myImages.HasImage(aF);
    if (bHasImage) {
      const TopTools_ListOfShape& aLFx=myImages.Image(aF);
      aIt.Initialize(aLFx);
      for (; aIt.More(); aIt.Next()) {
        const TopoDS_Shape& aFx=aIt.Value();
        TopExp::MapShapesAndAncestors(aFx, TopAbs_VERTEX, TopAbs_EDGE, aMVE);
      }
    }
    else {
      Standard_Boolean bFaceToProcess;
      //
      TopExp::MapShapesAndAncestors(aF, TopAbs_VERTEX, TopAbs_EDGE, aMVE);
      bFaceToProcess=Standard_False;
      for (j=1; j<=aNbVC; ++j) {
        nV=aMVC(j);
        const TopoDS_Shape& aV=aDS.Shape(nV);
        if (!aMVE.Contains(aV)) {
          bFaceToProcess=!bFaceToProcess;
          break;
        }
      }
      if (!bFaceToProcess) {
        continue;
      }
    }// else
    //
    for (j=1; j<=aNbVC; ++j) {
      nV=aMVC(j);
      const TopoDS_Shape& aV=aDS.Shape(nV);
      if (aMVE.Contains(aV)) {
        const TopTools_ListOfShape& aLE=aMVE.FindFromKey(aV);
        aNbE=aLE.Extent();
        if (aNbE) {
          continue;
        }
      }
      aLV.Append(aV);
    }
    //
    aNbV=aLV.Extent();
    if (aNbV) {
      //  3. Try to put vertices into the face(s)
      aItV.Initialize(aLV);
      for (; aItV.More(); aItV.Next()) {
        TopoDS_Vertex aV=TopoDS::Vertex(aItV.Value());
        aV.Orientation(TopAbs_INTERNAL);
        //
        bHasImage=myImages.HasImage(aF);
        if (bHasImage) {
          const TopTools_ListOfShape& aLFx=myImages.Image(aF);
          aIt.Initialize(aLFx);
          for (; aIt.More(); aIt.Next()) {
            TopoDS_Face aFx=TopoDS::Face(aIt.Value());
            // update classifier
            IntTools_FClass2d& aClsf=aCtx->FClass2d(aFx);
            aClsf.Init(aFx, aTol);
            //
            iFlag=aCtx->ComputeVS (aV, aFx, aU1, aU2);
            if (!iFlag) {
              aBB.Add(aFx, aV);
              break;
            }
          }
        }
        else {
          const TopoDS_Face& aFx=TopoDS::Face(aF);
          // update classifier
          IntTools_FClass2d& aClsf=aCtx->FClass2d(aFx);
          aClsf.Init(aFx, aTol);
          //
          iFlag=aCtx->ComputeVS (aV, aFx, aU1, aU2);
          if (!iFlag) {
            TopoDS_Face aFz;
            //
            GEOMAlgo_Tools3D::CopyFace(aFx, aFz);
            aBB.Add(aFz, aV);
            myImages.Bind(aF, aFz);
          }
        }
      }// for (; aItV.More(); aItV.Next()) {
    }// if (aNbV) {
  }// for (nF=1; nF<=aNb; ++nF) {
}

Here is the call graph for this function:

Here is the caller graph for this function:

Among draft faces find same domain faces

Definition at line 417 of file GEOMAlgo_Builder_2.cxx.

{
  Standard_Boolean bIsSDF, bHasImage1, bHasImage2, bForward;
  Standard_Integer i, j, aNbFF, nF1, nF2, aNbPBInOn, aNbC, aNbSE;
  Standard_Integer aNbF1, aNbF2, i2s, aNbSD;
  TopTools_MapOfShape aMFence;
  TopTools_ListOfShape aLX1, aLX2;
  TopTools_ListIteratorOfListOfShape aItF1, aItF2;
  NMTTools_ListOfCoupleOfShape aLCS;
  //
  const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS();
  NMTTools_PaveFiller* pPF=myPaveFiller;
  NMTDS_InterfPool* pIP=pPF->IP();
  BOPTools_CArray1OfSSInterference& aFFs=pIP->SSInterferences();
  const Handle(IntTools_Context)& aCtx= pPF->Context();
  //
  //
  //mySameDomainShapes.Clear();
  //
  // 1. For each FF find among images of faces
  //    all pairs of same domain faces (SDF) [=> aLCS]
  aNbFF=aFFs.Extent();
  for (i=1; i<=aNbFF; ++i) {
    BOPTools_SSInterference& aFF=aFFs(i);
    aFF.Indices(nF1, nF2);
    //
    const TopoDS_Face& aF1=TopoDS::Face(aDS.Shape(nF1));
    const TopoDS_Face& aF2=TopoDS::Face(aDS.Shape(nF2));
    //
    // if there are no in/on 2D split parts the faces nF1, nF2
    // can not be SDF
    const BOPTools_ListOfPaveBlock& aLPBInOn=aFF.PaveBlocks();
    aNbPBInOn=aLPBInOn.Extent();
    //
    //===
    const TColStd_ListOfInteger& aLSE=aFF.SharedEdges();
    aNbSE=aLSE.Extent();
    if (!aNbPBInOn && !aNbSE) {
      continue;
    }
    //===
    //
    // if there is at least one section edge between faces nF1, nF2
    // they can not be SDF
    BOPTools_SequenceOfCurves& aSC=aFF.Curves();
    aNbC=aSC.Length();
    if (aNbC) {
      continue;
    }
    //
    // the faces are suspected to be SDF.
    // Try to find SDF among images of nF1, nF2
    aMFence.Clear();
    //
    //--------------------------------------------------------
    bHasImage1=mySplitFaces.HasImage(aF1);
    bHasImage2=mySplitFaces.HasImage(aF2);
    //
    aLX1.Clear();
    if (!bHasImage1) {
      aLX1.Append(aF1);
    }
    //
    aLX2.Clear();
    if (!bHasImage2) {
      aLX2.Append(aF2);
    }
    //
    const TopTools_ListOfShape& aLF1r=(bHasImage1)? mySplitFaces.Image(aF1) : aLX1;
    const TopTools_ListOfShape& aLF2r=(bHasImage2)? mySplitFaces.Image(aF2) : aLX2;
    //
    TopTools_DataMapOfIntegerShape aMIS;
    TColStd_ListIteratorOfListOfInteger aItLI;
    NMTDS_BoxBndTreeSelector aSelector;
    NMTDS_BoxBndTree aBBTree;
    NCollection_UBTreeFiller <Standard_Integer, Bnd_Box> aTreeFiller(aBBTree);
    //
    aNbF1=aLF1r.Extent();
    aNbF2=aLF2r.Extent();
    bForward=(aNbF1<aNbF2);
    //
    const TopTools_ListOfShape& aLF1=bForward ? aLF1r : aLF2r;
    const TopTools_ListOfShape& aLF2=bForward ? aLF2r : aLF1r;
    //
    // 1. aTreeFiller
    aItF2.Initialize(aLF2);
    for (i2s=1; aItF2.More(); aItF2.Next(), ++i2s) {
      Bnd_Box aBoxF2s;
      //
      const TopoDS_Face& aF2s=*((TopoDS_Face*)(&aItF2.Value()));
      //
      BRepBndLib::Add(aF2s, aBoxF2s);
      //
      aMIS.Bind(i2s, aF2s);
      //
      aTreeFiller.Add(i2s, aBoxF2s);
    }//for (i2s=1; aItF2.More(); aItF2.Next(), ++i2s) {
    //
    aTreeFiller.Fill();
    //
    // 2.
    aItF1.Initialize(aLF1);
    for (j=1; aItF1.More(); aItF1.Next(), ++j) {
      Bnd_Box aBoxF1x;
      //
      const TopoDS_Face& aF1x=*((TopoDS_Face*)(&aItF1.Value()));
      //
      BRepBndLib::Add(aF1x, aBoxF1x);
      //
      aSelector.Clear();
      aSelector.SetBox(aBoxF1x);
      aNbSD=aBBTree.Select(aSelector);
      if (!aNbSD) {
        continue;
      }
      //
      const TColStd_ListOfInteger& aLI=aSelector.Indices();
      aItLI.Initialize(aLI);
      for (; aItLI.More(); aItLI.Next()) {
        i2s=aItLI.Value();
        const TopoDS_Face& aF2y=*((TopoDS_Face*)(&aMIS.Find(i2s)));
        //
        bIsSDF=NMTTools_Tools::AreFacesSameDomain(aF1x, aF2y, aCtx);
        if (bIsSDF) {
          if (aMFence.Contains(aF1x) || aMFence.Contains(aF2y)) {
            continue;
          }
          aMFence.Add(aF1x);
          aMFence.Add(aF2y);
          //
          NMTTools_CoupleOfShape aCS;
          //
          aCS.SetShape1(aF1x);
          aCS.SetShape2(aF2y);
          aLCS.Append(aCS);
          //
          if (bForward) {
            if (aF1x==aF1) {
              if (!mySplitFaces.HasImage(aF1)) {
                mySplitFaces.Bind(aF1, aF1);
              }
            }
            if (aF2y==aF2) {
              if (!mySplitFaces.HasImage(aF2)) {
                mySplitFaces.Bind(aF2, aF2);
              }
            }
          }
          else {
            if (aF1x==aF2) {
              if (!mySplitFaces.HasImage(aF2)) {
                mySplitFaces.Bind(aF2, aF2);
              }
            }
            if (aF2y==aF1) {
              if (!mySplitFaces.HasImage(aF1)) {
                mySplitFaces.Bind(aF1, aF1);
              }
            }
          }
          //
          break;
        }//if (bIsSDF) {
      }//for (; aItLI.More(); aItLI.Next()) {
    }//for (; aItF1.More(); aItF1.Next()) {
  }//for (i=1; i<=aNbFF; ++i)
  //-------------------------------------------------------------
  aNbC=aLCS.Extent();
  if (!aNbC) {
    return;
  }
  //
  // 2. Find Chains
  NMTTools_IndexedDataMapOfShapeIndexedMapOfShape aMC;
  //
  NMTTools_Tools::FindChains(aLCS, aMC);
  //
  Standard_Boolean bIsImage;
  Standard_Integer aIx, aIxMin, aNbMSDF, k, aNbMFj;
  TopoDS_Shape aFOld, aFSDmin;
  TopTools_IndexedMapOfShape aMFj;
  TopTools_DataMapOfShapeInteger aDMSI;
  //
  aItF1.Initialize(myShapes);
  for (j=1; aItF1.More(); aItF1.Next(), ++j) {
    const TopoDS_Shape& aSj=aItF1.Value();
    aMFj.Clear();
    TopExp::MapShapes(aSj, TopAbs_FACE, aMFj);
    aNbMFj=aMFj.Extent();
    for (k=1; k<=aNbMFj; ++k) {
      const TopoDS_Shape& aFk=aMFj(k);
      if (!aDMSI.IsBound(aFk)) {
       aDMSI.Bind(aFk, j);
      }
    }
  }
  //
  // 3. Fill the map of SDF mySameDomainFaces
  aNbC=aMC.Extent();
  for (i=1; i<=aNbC; ++i) {
   // const TopoDS_Shape& aF=aMC.FindKey(i);
    const TopTools_IndexedMapOfShape& aMSDF=aMC(i);
    //
    aNbMSDF=aMSDF.Extent();
    for (j=1; j<=aNbMSDF; ++j) {
      const TopoDS_Shape& aFSD=aMSDF(j);
      bIsImage=mySplitFaces.IsImage(aFSD);
      aFOld=aFSD;
      if (bIsImage) {
       aFOld=mySplitFaces.ImageFrom(aFSD);
      }
      //
      aIx=aDMSI.Find(aFOld);
      if (j==1) {
       aIxMin=aIx;
       aFSDmin=aFSD;
       continue;
      }
      else {
       if (aIx<aIxMin) {
         aIxMin=aIx;
         aFSDmin=aFSD;
       }
      }
    }
    //
    for (j=1; j<=aNbMSDF; ++j) {
      const TopoDS_Shape& aFSD=aMSDF(j);
      mySameDomainShapes.Add(aFSD, aFSDmin);
    }
  }
  //
}

Here is the call graph for this function:

Here is the caller graph for this function:

const TopTools_ListOfShape & GEOMAlgo_Builder::Generated ( const TopoDS_Shape &  theS) [virtual]

Returns the list of shapes generated from the
shape theS.

Reimplemented from GEOMAlgo_BuilderShape.

Definition at line 52 of file GEOMAlgo_Builder_4.cxx.

{
  NMTTools_PaveFiller* pPF=myPaveFiller;
  const Handle(IntTools_Context)& aCtx=pPF->Context();
  //
  Standard_Boolean bHasImage, bToReverse;
  TopAbs_ShapeEnum aType;
  TopTools_ListIteratorOfListOfShape aIt;
  //
  myHistShapes.Clear();
  //
  if (theS.IsNull()) {
    return myHistShapes;
  }
  //
  bHasImage=myImages.HasImage(theS);
  if (!bHasImage) {
    return myHistShapes;
  }
  //
  aType=theS.ShapeType();
  //
  if (aType==TopAbs_EDGE   || aType==TopAbs_FACE ||
      aType==TopAbs_VERTEX || aType==TopAbs_SOLID) {
    const TopTools_ListOfShape& aLSp=myImages.Image(theS);
    aIt.Initialize(aLSp);
    for (; aIt.More(); aIt.Next()) {
      const TopoDS_Shape& aSp=aIt.Value();
      if (mySameDomainShapes.Contains(aSp)) {
        if (myMapShape.Contains(aSp)) {
          TopoDS_Shape aSpR=mySameDomainShapes.FindFromKey(aSp);
          //
          if (aType==TopAbs_VERTEX || aType==TopAbs_SOLID) {
            aSpR.Orientation(theS.Orientation());
          }
          else {
            bToReverse=GEOMAlgo_Tools3D::IsSplitToReverse(aSpR, theS, aCtx);
            if (bToReverse) {
              aSpR.Reverse();
            }
          }
          //
          myHistShapes.Append(aSpR);
        }
      }
    }
  }
  //
  return myHistShapes;
}

Here is the call graph for this function:

Standard_Boolean GEOMAlgo_BuilderShape::HasDeleted ( ) const [inherited]

Returns true if the at least one shape(or sub-shape)
of arguments has been deleted.

Definition at line 89 of file GEOMAlgo_BuilderShape.cxx.

{
  return myHasDeleted;
}
Standard_Boolean GEOMAlgo_BuilderShape::HasGenerated ( ) const [inherited]

Returns true if the at least one shape(or sub-shape)
of arguments has generated shapes.

Definition at line 97 of file GEOMAlgo_BuilderShape.cxx.

{
  return myHasGenerated;
}
Standard_Boolean GEOMAlgo_BuilderShape::HasModified ( ) const [inherited]

Returns true if the at least one shape(or sub-shape)
of arguments has modified shapes.

Definition at line 105 of file GEOMAlgo_BuilderShape.cxx.

{
  return myHasModified;
}
const BRepAlgo_Image & GEOMAlgo_Builder::Images ( ) const

Returns image shapes

Definition at line 48 of file GEOMAlgo_Builder_0.cxx.

{
  return myImages;
}
const TopTools_IndexedDataMapOfShapeListOfShape & GEOMAlgo_BuilderShape::ImagesResult ( ) const [inherited]

Definition at line 129 of file GEOMAlgo_BuilderShape.cxx.

{
  return myImagesResult;
}

Here is the caller graph for this function:

const TopTools_ListOfShape & GEOMAlgo_Builder::InParts ( const TopoDS_Shape &  theShape) const

Returns split-parts of shapes that have
state IN for the domain of shape theShape

Definition at line 56 of file GEOMAlgo_Builder_0.cxx.

{
  static TopTools_ListOfShape sLS;
  //
  if (myInParts.Contains(theS)) {
    return myInParts.FindFromKey(theS);
  }
  return sLS;
}
Standard_Boolean GEOMAlgo_Builder::IsDeleted ( const TopoDS_Shape &  theS) [virtual]

Returns true if the shape theS has been deleted.

Reimplemented from GEOMAlgo_BuilderShape.

Definition at line 159 of file GEOMAlgo_Builder_4.cxx.

{
  Standard_Boolean bRet, bHasImage, bContains;
  TopAbs_ShapeEnum aType;
  TopTools_ListIteratorOfListOfShape aIt;
  //
  bRet=Standard_False;
  //
  if (theS.IsNull()) {
    return !bRet; //true
  }
  //
  bContains=myMapShape.Contains(theS);
  if (bContains) {
    return bRet; //false
  }
  //
  bHasImage=myImages.HasImage(theS);
  if (!bHasImage) {
    return !bRet; //true
  }
  //
  aType=theS.ShapeType();
  if (aType==TopAbs_EDGE   || aType==TopAbs_FACE ||
      aType==TopAbs_VERTEX || aType==TopAbs_SOLID) {
    const TopTools_ListOfShape& aLSp=myImages.Image(theS);
    aIt.Initialize(aLSp);
    for (; aIt.More(); aIt.Next()) {
      TopoDS_Shape aSp=aIt.Value();
      //
      if (!mySameDomainShapes.Contains(aSp)) {
        if (myMapShape.Contains(aSp)) {
          return bRet; //false
        }
      }
      else {
        TopoDS_Shape aSpR=mySameDomainShapes.FindFromKey(aSp);
        if (myMapShape.Contains(aSpR)) {
          return bRet; //false
        }
      }
    }
  }
  return !bRet; // true
}

Here is the caller graph for this function:

const TopTools_ListOfShape & GEOMAlgo_Builder::Modified ( const TopoDS_Shape &  theS) [virtual]

Returns the list of shapes modified from the shape
theS.

Reimplemented from GEOMAlgo_BuilderShape.

Definition at line 106 of file GEOMAlgo_Builder_4.cxx.

{
  NMTTools_PaveFiller* pPF=myPaveFiller;
  const Handle(IntTools_Context)& aCtx=pPF->Context();
  //
  Standard_Boolean bHasImage, bToReverse;
  TopAbs_ShapeEnum aType;
  TopTools_ListIteratorOfListOfShape aIt;
  //
  myHistShapes.Clear();
  //
  if (theS.IsNull()) {
    return myHistShapes;
  }
  //
  bHasImage=myImages.HasImage(theS);
  if (!bHasImage) {
    return myHistShapes;
  }
  //
  aType=theS.ShapeType();
  //
  if (aType==TopAbs_EDGE   || aType==TopAbs_FACE ||
      aType==TopAbs_VERTEX || aType==TopAbs_SOLID) {
    const TopTools_ListOfShape& aLSp=myImages.Image(theS);
    aIt.Initialize(aLSp);
    for (; aIt.More(); aIt.Next()) {
      TopoDS_Shape aSp=aIt.Value();
      if (!mySameDomainShapes.Contains(aSp)) {
        if (myMapShape.Contains(aSp)) {
          //
          if (aType==TopAbs_VERTEX || aType==TopAbs_SOLID) {
            aSp.Orientation(theS.Orientation());
          }
          else {
            bToReverse=GEOMAlgo_Tools3D::IsSplitToReverse(aSp, theS, aCtx);
            if (bToReverse) {
              aSp.Reverse();
            }
          }
          //
          myHistShapes.Append(aSp);
        }
      }
    }
  }
  //
  return myHistShapes;
}

Here is the call graph for this function:

void GEOMAlgo_Builder::Perform ( ) [virtual]

Performs calculations

Implements GEOMAlgo_Algo.

Definition at line 227 of file GEOMAlgo_Builder.cxx.

{
  myErrorStatus=0;
  //
  BRep_Builder aBB;
  TopoDS_Compound aCS;
  TopTools_ListIteratorOfListOfShape aIt;
  //
  aBB.MakeCompound(aCS);
  //
  aIt.Initialize(myShapes);
  for (; aIt.More(); aIt.Next()) {
    const TopoDS_Shape& aS=aIt.Value();
    aBB.Add(aCS, aS);
  }
  //
  NMTTools_PaveFiller* pPF=new NMTTools_PaveFiller;
  //
  pPF->SetCompositeShape(aCS);
  pPF->Perform();
  //
  myEntryPoint=1;
  PerformInternal(*pPF);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void GEOMAlgo_Builder::PerformInternal ( const NMTTools_PaveFiller theDSF) [protected, virtual]

Performs calculations using prepared DSFiller
object theDSF

Definition at line 265 of file GEOMAlgo_Builder.cxx.

{
  myErrorStatus=0;
  //
  Standard_Boolean bIsDone;
  //
  // 0. myPaveFiller
  myPaveFiller=(NMTTools_PaveFiller *)&pPF;
  //
  bIsDone=myPaveFiller->IsDone();
  if (!bIsDone) {
    myErrorStatus=2; // PaveFiller is failed
    return;
  }
  //
  // 1. Clear Internal fields
  ClearInternals();
  //
  // 2. Prepare
  Prepare();
  if (myErrorStatus) {
    return;
  }
  //
  // 3. Fill Images
  //
  // 3.1 Vertices
  FillImagesVertices();
  if (myErrorStatus) {
    return;
  }
  //
  BuildResult(TopAbs_VERTEX);
  if (myErrorStatus) {
    return;
  }
  // 3.2 Edges
  FillImagesEdges();
  if (myErrorStatus) {
    return;
  }

  BuildResult(TopAbs_EDGE);
  if (myErrorStatus) {
    return;
  }
  // 3.3 Wires
  FillImagesContainers(TopAbs_WIRE);
  if (myErrorStatus) {
    return;
  }

  BuildResult(TopAbs_WIRE);
  if (myErrorStatus) {
    return;
  }

  // 3.4 Faces
  FillImagesFaces();
  if (myErrorStatus) {
    return;
  }

  BuildResult(TopAbs_FACE);
  if (myErrorStatus) {
    return;
  }
  // 3.5 Shells

  FillImagesContainers(TopAbs_SHELL);
  if (myErrorStatus) {
    return;
  }

  BuildResult(TopAbs_SHELL);
  if (myErrorStatus) {
    return;
  }
  // 3.6 Solids
  FillImagesSolids();
  if (myErrorStatus) {
    return;
  }

  BuildResult(TopAbs_SOLID);
  if (myErrorStatus) {
    return;
  }
  // 3.7 CompSolids
  FillImagesContainers(TopAbs_COMPSOLID);
  if (myErrorStatus) {
    return;
  }

  BuildResult(TopAbs_COMPSOLID);
  if (myErrorStatus) {
    return;
  }
  // 3.8 Compounds
  FillImagesContainers(TopAbs_COMPOUND);
  if (myErrorStatus) {
    return;
  }

  BuildResult(TopAbs_COMPOUND);
  if (myErrorStatus) {
    return;
  }
  //
  // 4.History
  PrepareHistory();
  //
  // 5 Post-treatment
  PostTreat();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void GEOMAlgo_Builder::PerformWithFiller ( const NMTTools_PaveFiller theDSF) [virtual]

Performs calculations using prepared PaveFiller
object theDSF

Definition at line 255 of file GEOMAlgo_Builder.cxx.

{
  myEntryPoint=0;
  //
  PerformInternal(theDSF);
}

Here is the call graph for this function:

void GEOMAlgo_Builder::PostTreat ( ) [protected, virtual]

Provides post-tratment actions

Reimplemented in GEOMAlgo_Splitter.

Definition at line 388 of file GEOMAlgo_Builder.cxx.

{
  Standard_Integer aNbS;
  TopoDS_Iterator aIt;
  TopTools_ListOfShape aLS;
  //
  aIt.Initialize(myShape);
  for (; aIt.More(); aIt.Next()) {
    const TopoDS_Shape& aS=aIt.Value();
    aLS.Append(aS);
  }
  aNbS=aLS.Extent();
  if (aNbS==1) {
    myShape=aLS.First();
  }

  BRepLib::SameParameter(myShape, 1.e-7, Standard_True);
  //
  GEOMAlgo_Tools::CorrectWires(myShape);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void GEOMAlgo_Builder::Prepare ( ) [protected, virtual]

Provides preparing actions

Definition at line 135 of file GEOMAlgo_Builder.cxx.

{
  myErrorStatus=0;
  //
  Standard_Integer aNb;
  BRep_Builder aBB;
  TopoDS_Compound aC;
  TopTools_ListIteratorOfListOfShape aIt;
  //
  aNb=myShapes.Extent();
  if (aNb<2) {
    myErrorStatus=10; // No shapes to process
    return;
  }
  //
  // 1. myShape is empty compound
  aBB.MakeCompound(aC);
  myShape=aC;
  //
  // 2. myShapes1
  aIt.Initialize(myShapes);
  for (; aIt.More(); aIt.Next()) {
    const TopoDS_Shape& aS=aIt.Value();
    AddShape1(aS);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void GEOMAlgo_Builder::PrepareHistory ( ) [protected, virtual]

Prepare information for history support

Reimplemented from GEOMAlgo_BuilderShape.

Definition at line 208 of file GEOMAlgo_Builder_4.cxx.

{
  if(myShape.IsNull()) {
    return;
  }
  //
  Standard_Boolean bHasImage, bContainsSD;
  TopAbs_ShapeEnum aType;
  TopTools_MapOfShape aMS;
  TopTools_ListIteratorOfListOfShape aIt;
  TopTools_MapIteratorOfMapOfShape aItM;
  //
  // 1. Clearing
  GEOMAlgo_BuilderShape::PrepareHistory();
  //
  // 2. myMapShape - all shapes of result with theirs sub-shapes
  MapShapes(myShape, myMapShape);
  //
  // 3. MS - all argument shapes with theirs sub-shapes
  aIt.Initialize(myShapes);
  for (; aIt.More(); aIt.Next()) {
    const TopoDS_Shape& aSx=aIt.Value();
    MapShapes(aSx, aMS);
  }
  //
  // 4. Treatment
  aItM.Initialize(aMS);
  for (; aItM.More(); aItM.Next()) {
    const TopoDS_Shape& aSx=aItM.Key();
    aType=aSx.ShapeType();
    //modified by NIZNHY-PKV Thu Dec  7 11:34:05 2006f
    //
    // 4.1 .myImagesResult
    TopTools_ListOfShape aLSx;
    //
    bHasImage=myImages.HasImage(aSx);
    if (!bHasImage) {
      if (myMapShape.Contains(aSx)) {
        aLSx.Append(aSx);
        myImagesResult.Add(aSx, aLSx);
      }
    }
    else {
      const TopTools_ListOfShape& aLSp=myImages.Image(aSx);
      aIt.Initialize(aLSp);
      for (; aIt.More(); aIt.Next()) {
        const TopoDS_Shape& aSp=aIt.Value();
        if (myMapShape.Contains(aSp)) {
          aLSx.Append(aSp);
        }
      }
      myImagesResult.Add(aSx, aLSx);
    }
    //
    //modified by NIZNHY-PKV Thu Dec  7 11:34:10 2006t
    //
    // 4.2 As it was
    if (!myHasDeleted) {
      myHasDeleted=IsDeleted(aSx);//xx
    }
    //
    if (!myHasGenerated || !myHasModified) {
      if (aType==TopAbs_EDGE   || aType==TopAbs_FACE ||
          aType==TopAbs_VERTEX || aType==TopAbs_SOLID) {
        //modified by NIZNHY-PKV Thu Dec  7 11:53:01 2006f
        //bHasImage=myImages.HasImage(aSx);
        //modified by NIZNHY-PKV Thu Dec  7 11:53:04 2006t
        if (bHasImage) {
          const TopTools_ListOfShape& aLSp=myImages.Image(aSx);
          aIt.Initialize(aLSp);
          for (; aIt.More(); aIt.Next()) {
            const TopoDS_Shape& aSp=aIt.Value();
            //
            if (myMapShape.Contains(aSp)) {
              bContainsSD=mySameDomainShapes.Contains(aSp);
              //
              if (!myHasGenerated) {
                if (bContainsSD) {
                  myHasGenerated=Standard_True;
                }
              }
              if (!myHasModified) {
                if (!bContainsSD) {
                  myHasModified=Standard_True;
                }
              }
            } // if (myMapShape.Contains(aSp))
          }
        }
      }
    }
  }

}

Here is the call graph for this function:

Here is the caller graph for this function:

const TopoDS_Shape & GEOMAlgo_BuilderShape::Shape ( ) const [inherited]

Returns the result of algorithm

Definition at line 51 of file GEOMAlgo_BuilderShape.cxx.

{
  return myShape;
}

Here is the caller graph for this function:

const TopTools_ListOfShape & GEOMAlgo_Builder::Shapes ( ) const

Returns the arguments of the operation

Definition at line 99 of file GEOMAlgo_Builder.cxx.

{
  return myShapes;
}
const TopTools_ListOfShape & GEOMAlgo_Builder::Shapes1 ( const Standard_Integer  theType) const

Returns list of arguments of type theType

Definition at line 40 of file GEOMAlgo_Builder_0.cxx.

{
  return myShapes1[theType];
}
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_IndexedDataMapOfShapeShape GEOMAlgo_Builder::myDraftSolids [protected]

Definition at line 220 of file GEOMAlgo_Builder.hxx.

Standard_Integer GEOMAlgo_Builder::myEntryPoint [protected]

Definition at line 221 of file GEOMAlgo_Builder.hxx.

Standard_Integer GEOMAlgo_Algo::myErrorStatus [protected, inherited]

Definition at line 71 of file GEOMAlgo_Algo.hxx.

Standard_Boolean GEOMAlgo_BuilderShape::myHasDeleted [protected, inherited]

Definition at line 100 of file GEOMAlgo_BuilderShape.hxx.

Standard_Boolean GEOMAlgo_BuilderShape::myHasGenerated [protected, inherited]

Definition at line 101 of file GEOMAlgo_BuilderShape.hxx.

Standard_Boolean GEOMAlgo_BuilderShape::myHasModified [protected, inherited]

Definition at line 102 of file GEOMAlgo_BuilderShape.hxx.

TopTools_ListOfShape GEOMAlgo_BuilderShape::myHistShapes [protected, inherited]

Definition at line 98 of file GEOMAlgo_BuilderShape.hxx.

BRepAlgo_Image GEOMAlgo_Builder::myImages [protected]

Definition at line 216 of file GEOMAlgo_Builder.hxx.

TopTools_IndexedDataMapOfShapeListOfShape GEOMAlgo_BuilderShape::myImagesResult [protected, inherited]

Definition at line 103 of file GEOMAlgo_BuilderShape.hxx.

TopTools_IndexedDataMapOfShapeListOfShape GEOMAlgo_Builder::myInParts [protected]

Definition at line 217 of file GEOMAlgo_Builder.hxx.

TopTools_MapOfShape GEOMAlgo_Builder::myMapFence [protected]

Definition at line 214 of file GEOMAlgo_Builder.hxx.

TopTools_MapOfShape GEOMAlgo_BuilderShape::myMapShape [protected, inherited]

Definition at line 99 of file GEOMAlgo_BuilderShape.hxx.

Standard_Integer GEOMAlgo_Builder::myNbTypes [protected]

Definition at line 213 of file GEOMAlgo_Builder.hxx.

Definition at line 211 of file GEOMAlgo_Builder.hxx.

TopTools_IndexedDataMapOfShapeShape GEOMAlgo_Builder::mySameDomainShapes [protected]

Definition at line 219 of file GEOMAlgo_Builder.hxx.

TopoDS_Shape GEOMAlgo_BuilderShape::myShape [protected, inherited]

Definition at line 97 of file GEOMAlgo_BuilderShape.hxx.

TopTools_ListOfShape GEOMAlgo_Builder::myShapes [protected]

Definition at line 212 of file GEOMAlgo_Builder.hxx.

TopTools_ListOfShape GEOMAlgo_Builder::myShapes1[9] [protected]

Definition at line 215 of file GEOMAlgo_Builder.hxx.

BRepAlgo_Image GEOMAlgo_Builder::mySplitFaces [protected]

Definition at line 218 of file GEOMAlgo_Builder.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: