Back to index

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

#include <GEOMAlgo_GlueDetector.hxx>

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

List of all members.

Public Member Functions

Standard_EXPORT GEOMAlgo_GlueDetector ()
virtual Standard_EXPORT ~GEOMAlgo_GlueDetector ()
virtual Standard_EXPORT void Perform ()
Standard_EXPORT const
TopTools_IndexedDataMapOfShapeListOfShape & 
StickedShapes ()
virtual Standard_EXPORT void SetArgument (const TopoDS_Shape &theShape)
Standard_EXPORT const
TopoDS_Shape & 
Argument () const
Standard_EXPORT void SetTolerance (const Standard_Real aT)
Standard_EXPORT Standard_Real Tolerance () const
Standard_EXPORT void SetCheckGeometry (const Standard_Boolean aFlag)
Standard_EXPORT Standard_Boolean CheckGeometry () const
virtual Standard_EXPORT void Clear ()
Standard_EXPORT void SetContext (const Handle(IntTools_Context)&)
Standard_EXPORT const Handle (IntTools_Context)&Context()
Standard_EXPORT const
TopTools_DataMapOfShapeListOfShape & 
Images () const
Standard_EXPORT const
TopTools_DataMapOfShapeShape & 
Origins () 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

Standard_EXPORT void DetectVertices ()
Standard_EXPORT void DetectEdges ()
Standard_EXPORT void DetectFaces ()
Standard_EXPORT void DetectShapes (const TopAbs_ShapeEnum aType)
Standard_EXPORT void EdgePassKey (const TopoDS_Edge &aE, GEOMAlgo_PassKeyShape &aPK)
Standard_EXPORT void FacePassKey (const TopoDS_Face &aF, GEOMAlgo_PassKeyShape &aPK)
Standard_EXPORT void CheckDetected ()
Standard_EXPORT void CheckDetected (const TopTools_ListOfShape &aLVSD, const TopTools_IndexedDataMapOfShapeListOfShape &aMVE, const TopTools_IndexedDataMapOfShapeListOfShape &aMEV)
 Handle (IntTools_Context) myContext
virtual Standard_EXPORT void CheckData ()
virtual Standard_EXPORT void CheckResult ()

Protected Attributes

TopTools_IndexedDataMapOfShapeListOfShape myStickedShapes
TopoDS_Shape myArgument
Standard_Real myTolerance
Standard_Boolean myCheckGeometry
TopTools_DataMapOfShapeListOfShape myImages
TopTools_DataMapOfShapeShape myOrigins
Standard_Integer myErrorStatus
Standard_Integer myWarningStatus
Standard_Boolean myComputeInternalShapes

Detailed Description

Definition at line 45 of file GEOMAlgo_GlueDetector.hxx.


Constructor & Destructor Documentation

Definition at line 83 of file GEOMAlgo_GlueDetector.cxx.

Definition at line 92 of file GEOMAlgo_GlueDetector.cxx.

{}

Member Function Documentation

const TopoDS_Shape & GEOMAlgo_GluerAlgo::Argument ( ) const [inherited]

Definition at line 59 of file GEOMAlgo_GluerAlgo.cxx.

{
  return myArgument;
}
void GEOMAlgo_Algo::CheckData ( ) [protected, virtual, inherited]

Definition at line 469 of file GEOMAlgo_GlueDetector.cxx.

{
  TopoDS_Iterator aItA;
  TopExp_Explorer aExp;
  TopTools_ListOfShape aLV;
  TopTools_MapOfShape aMFence;
  TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItIm;
  TopTools_IndexedDataMapOfShapeListOfShape aMVE, aMEV;
  //
  // 1. aMVE, aMEV
  TopExp::MapShapesAndAncestors(myArgument, TopAbs_VERTEX, TopAbs_EDGE, aMVE);
  //
  aExp.Init(myArgument, TopAbs_EDGE);
  for (; aExp.More(); aExp.Next()) {
    const TopoDS_Shape& aE=aExp.Current();
    //
    aLV.Clear();
    aMFence.Clear();
    aItA.Initialize(aE);
    for (; aItA.More(); aItA.Next()) {
      const TopoDS_Shape& aV=aItA.Value();
      if (aMFence.Add(aV)) {
        aLV.Append(aV);
      }
    }
    //
    aMEV.Add(aE, aLV);
  }
  // 2. Checking
  aItIm.Initialize(myImages);
  for (; aItIm.More(); aItIm.Next()) {
    //const TopoDS_Shape& aV=aItIm.Key();
    const TopTools_ListOfShape& aLVSD=aItIm.Value();
    CheckDetected(aLVSD, aMVE, aMEV);
  }
}

Here is the caller graph for this function:

void GEOMAlgo_GlueDetector::CheckDetected ( const TopTools_ListOfShape &  aLVSD,
const TopTools_IndexedDataMapOfShapeListOfShape &  aMVE,
const TopTools_IndexedDataMapOfShapeListOfShape &  aMEV 
) [protected]

Definition at line 510 of file GEOMAlgo_GlueDetector.cxx.

{
  Standard_Integer i, aNbVSD, aNbA, iRet;
  TopAbs_ShapeEnum aTypeS, aTypeA[2];
  TopExp_Explorer aExp, aExpA;
  TopTools_MapOfShape aMFence, aMVSD;
  TopTools_ListOfShape aLV;
  TopTools_ListIteratorOfListOfShape aItLS;
  //
  myErrorStatus=0;
  //
  aNbVSD=aLVSD.Extent();
  if (aNbVSD < 2) {
    return ;
  }
  //
  aItLS.Initialize(aLVSD);
  for (; aItLS.More(); aItLS.Next()) {
    const TopoDS_Shape& aVSD=aItLS.Value();
    aMVSD.Add(aVSD);
  }
  //
  aItLS.Initialize(aLVSD);
  for (; aItLS.More(); aItLS.Next()) {
    const TopoDS_Shape& aVSD=aItLS.Value();
    //
    iRet=CheckAncesstors(aVSD, aMVSD, aMVE, aMEV, myStickedShapes);
    if (iRet) {
      // Sticked shapes detected
      myWarningStatus=2;
    }
  }
}

Here is the call graph for this function:

Standard_Boolean GEOMAlgo_GluerAlgo::CheckGeometry ( ) const [inherited]

Definition at line 92 of file GEOMAlgo_GluerAlgo.cxx.

{
  return myCheckGeometry;
}
void GEOMAlgo_Algo::CheckResult ( ) [protected, virtual, inherited]

Reimplemented in GEOMAlgo_Gluer.

Definition at line 59 of file GEOMAlgo_Algo.cxx.

void GEOMAlgo_GluerAlgo::Clear ( ) [virtual, inherited]

Reimplemented in GEOMAlgo_GetInPlace, and GEOMAlgo_Gluer2.

Definition at line 132 of file GEOMAlgo_GluerAlgo.cxx.

{
  myImages.Clear();
  myOrigins.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:

void GEOMAlgo_GlueDetector::DetectEdges ( ) [protected]

Definition at line 309 of file GEOMAlgo_GlueDetector.cxx.

{
  DetectShapes(TopAbs_EDGE);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void GEOMAlgo_GlueDetector::DetectFaces ( ) [protected]

Definition at line 301 of file GEOMAlgo_GlueDetector.cxx.

{
  DetectShapes(TopAbs_FACE);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void GEOMAlgo_GlueDetector::DetectShapes ( const TopAbs_ShapeEnum  aType) [protected]

Definition at line 317 of file GEOMAlgo_GlueDetector.cxx.

{
  Standard_Boolean bDegenerated;
  Standard_Integer i, aNbF, aNbSDF, iErr;
  TopTools_IndexedMapOfShape aMF;
  TopTools_ListIteratorOfListOfShape aItLS;
  GEOMAlgo_PassKeyShape aPKF;
  GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape aMPKLF;
  //
  myErrorStatus=0;
  //
  TopExp::MapShapes(myArgument, aType, aMF);
  //
  aNbF=aMF.Extent();
  for (i=1; i<=aNbF; ++i) {
    const TopoDS_Shape& aS=aMF(i);
    //
    if (aType==TopAbs_FACE) {
      const TopoDS_Face& aF=*((TopoDS_Face*)&aS);
      FacePassKey(aF, aPKF);
    }
    else if (aType==TopAbs_EDGE) {
      const TopoDS_Edge& aE=*((TopoDS_Edge*)&aS);
      EdgePassKey(aE, aPKF);
    }
    //
    if (myErrorStatus) {
      return;
    }
    //
    if (aMPKLF.Contains(aPKF)) {
      TopTools_ListOfShape& aLSDF=aMPKLF.ChangeFromKey(aPKF);
      aLSDF.Append(aS);
    }
    else {
      TopTools_ListOfShape aLSDF;
      //
      aLSDF.Append(aS);
      aMPKLF.Add(aPKF, aLSDF);
    }
  }
  // check geometric coincidence
  if (myCheckGeometry) {
    iErr=GEOMAlgo_Tools::RefineSDShapes(aMPKLF, myTolerance, myContext);
    if (iErr) {
      myErrorStatus=200;
      return;
    }
  }
  //
  // Images/Origins
  aNbF=aMPKLF.Extent();
  for (i=1; i<=aNbF; ++i) {
    const TopTools_ListOfShape& aLSDF=aMPKLF(i);
    aNbSDF=aLSDF.Extent();
    if (!aNbSDF) {
      myErrorStatus=4; // it must not be
    }
    //
    if (aNbSDF==1) {
      continue;
    }
    //
    const TopoDS_Shape& aS1=aLSDF.First();
    //
    if (aType==TopAbs_EDGE) {
      const TopoDS_Edge& aE1=*((TopoDS_Edge*)&aS1);
      bDegenerated=BRep_Tool::Degenerated(aE1);
      if (bDegenerated) {
        continue;
      }
    }
    //
    myImages.Bind(aS1, aLSDF);
    //
    // origins
    aItLS.Initialize(aLSDF);
    for (; aItLS.More(); aItLS.Next()) {
      const TopoDS_Shape& aFSD=aItLS.Value();
      if (!myOrigins.IsBound(aFSD)) {
        myOrigins.Bind(aFSD, aS1);
      }
    }
  }// for (i=1; i<=aNbF; ++i)
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 149 of file GEOMAlgo_GlueDetector.cxx.

{
  Standard_Integer j, i, aNbV, aNbVSD;
  Standard_Real aTolV;
  gp_Pnt aPV;
  TColStd_ListIteratorOfListOfInteger aIt;
  TopoDS_Shape aVF;
  TopTools_IndexedMapOfShape aMV;
  TopTools_MapOfShape aMVProcessed;
  TopTools_ListIteratorOfListOfShape aItS;
  TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItIm;
  TopTools_DataMapOfShapeListOfShape aMVV;
  GEOMAlgo_IndexedDataMapOfIntegerShape aMIS;
  NMTDS_IndexedDataMapOfShapeBndSphere aMSB;
  NMTDS_BndSphereTreeSelector aSelector;
  NMTDS_BndSphereTree aBBTree;
  NCollection_UBTreeFiller <Standard_Integer, NMTDS_BndSphere> aTreeFiller(aBBTree);
  //
  myErrorStatus=0;
  //
  TopExp::MapShapes(myArgument, TopAbs_VERTEX, aMV);
  aNbV=aMV.Extent();
  if (!aNbV) {
    myErrorStatus=2; // no vertices in source shape
    return;
  }
  //
  for (i=1; i<=aNbV; ++i) {
    NMTDS_BndSphere aBox;
    //
    const TopoDS_Vertex& aV=*((TopoDS_Vertex*)&aMV(i));
    aPV=BRep_Tool::Pnt(aV);
    aTolV=BRep_Tool::Tolerance(aV);
    //
    aBox.SetGap(myTolerance);
    aBox.SetCenter(aPV);
    aBox.SetRadius(aTolV);
    //
    aTreeFiller.Add(i, aBox);
    //
    aMIS.Add(i, aV);
    aMSB.Add(aV, aBox);
  }
  //
  aTreeFiller.Fill();
  //
  //---------------------------------------------------
  // Chains
  for (i=1; i<=aNbV; ++i) {
    const TopoDS_Shape& aV=aMV(i);
    //
    if (aMVProcessed.Contains(aV)) {
      continue;
    }
    //
    Standard_Integer aNbIP, aIP, aNbIP1, aIP1;
    TopTools_ListOfShape aLVSD;
    TColStd_MapOfInteger aMIP, aMIP1, aMIPC;
    TColStd_MapIteratorOfMapOfInteger aIt1;
    //
    aMIP.Add(i);
    while(1) {
      aNbIP=aMIP.Extent();
      aIt1.Initialize(aMIP);
      for(; aIt1.More(); aIt1.Next()) {
        aIP=aIt1.Key();
        if (aMIPC.Contains(aIP)) {
          continue;
        }
        //
        const TopoDS_Shape& aVP=aMIS.FindFromKey(aIP);
        const NMTDS_BndSphere& aBoxVP=aMSB.FindFromKey(aVP);
        //
        aSelector.Clear();
        aSelector.SetBox(aBoxVP);
        //
        aNbVSD=aBBTree.Select(aSelector);
        if (!aNbVSD) {
          continue;  // it shoild not be so [at least IP itself]
        }
        //
        const TColStd_ListOfInteger& aLI=aSelector.Indices();
        aIt.Initialize(aLI);
        for (; aIt.More(); aIt.Next()) {
          aIP1=aIt.Value();
          if (aMIP.Contains(aIP1)) {
            continue;
          }
          aMIP1.Add(aIP1);
        } //for (; aIt.More(); aIt.Next()) {
      }//for(; aIt1.More(); aIt1.Next()) {
      //
      aNbIP1=aMIP1.Extent();
      if (!aNbIP1) {
        break;
      }
      //
      aIt1.Initialize(aMIP);
      for(; aIt1.More(); aIt1.Next()) {
        aIP=aIt1.Key();
        aMIPC.Add(aIP);
      }
      //
      aMIP.Clear();
      aIt1.Initialize(aMIP1);
      for(; aIt1.More(); aIt1.Next()) {
        aIP=aIt1.Key();
        aMIP.Add(aIP);
      }
      aMIP1.Clear();
    }// while(1)
    //
    // Fill myImages
    aNbIP=aMIPC.Extent();
    //
    if (!aNbIP) {// no SD vertices is found
      aMVProcessed.Add(aV);
      continue;
    }
    //else { // SD vertices founded [ aMIPC ]
    aIt1.Initialize(aMIPC);
    for(j=0; aIt1.More(); aIt1.Next(), ++j) {
      aIP=aIt1.Key();
      const TopoDS_Shape& aVP=aMIS.FindFromKey(aIP);
      if (!j) {
        aVF=aVP;
      }
      aLVSD.Append(aVP);
      aMVProcessed.Add(aVP);
    }
    //}
    myImages.Bind(aVF, aLVSD);
  }// for (i=1; i<=aNbV; ++i) {
  //------------------------------
  // Origins
  aItIm.Initialize(myImages);
  for (; aItIm.More(); aItIm.Next()) {
    const TopoDS_Shape& aV=aItIm.Key();
    const TopTools_ListOfShape& aLVSD=aItIm.Value();
    aItS.Initialize(aLVSD);
    for (; aItS.More(); aItS.Next()) {
      const TopoDS_Shape& aVSD=aItS.Value();
      if (!myOrigins.IsBound(aVSD)) {
        myOrigins.Bind(aVSD, aV);
      }
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void GEOMAlgo_GlueDetector::EdgePassKey ( const TopoDS_Edge &  aE,
GEOMAlgo_PassKeyShape aPK 
) [protected]

Definition at line 439 of file GEOMAlgo_GlueDetector.cxx.

{
  TopAbs_Orientation aOr;
  TopoDS_Shape aVR;
  TopoDS_Iterator aIt;
  TopTools_ListOfShape aLV;
  //
  aIt.Initialize(aE);
  for (; aIt.More(); aIt.Next()) {
    const TopoDS_Shape& aV=aIt.Value();
    aOr=aV.Orientation();
    if (aOr==TopAbs_FORWARD || aOr==TopAbs_REVERSED) {
      if (myOrigins.IsBound(aV)) {
        aVR=myOrigins.Find(aV);
      }
      else {
        aVR=aV;
      }
      aLV.Append(aVR);
    }
  }
  //
  aPK.SetShapes(aLV);
}

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:

void GEOMAlgo_GlueDetector::FacePassKey ( const TopoDS_Face &  aF,
GEOMAlgo_PassKeyShape aPK 
) [protected]

Definition at line 406 of file GEOMAlgo_GlueDetector.cxx.

{
  Standard_Integer i, aNbE;
  TopoDS_Shape aER;
  TopTools_ListOfShape aLE;
  TopTools_IndexedMapOfShape aME;
  //
  TopExp::MapShapes(aF, TopAbs_EDGE, aME);
  //
  aNbE=aME.Extent();
  for (i=1; i<=aNbE; ++i) {
    const TopoDS_Shape& aE=aME(i);
    //
    const TopoDS_Edge& aEE=*((TopoDS_Edge*)&aE);
    if (BRep_Tool::Degenerated(aEE)) {
      continue;
    }
    //
    if (myOrigins.IsBound(aE)) {
      aER=myOrigins.Find(aE);
    }
    else {
      aER=aE;
    }
    aLE.Append(aER);
  }
  aPK.SetShapes(aLE);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Standard_EXPORT const GEOMAlgo_GluerAlgo::Handle ( IntTools_Context  ) [inherited]

Here is the caller graph for this function:

GEOMAlgo_GluerAlgo::Handle ( IntTools_Context  ) [protected, inherited]
const TopTools_DataMapOfShapeListOfShape & GEOMAlgo_GluerAlgo::Images ( ) const [inherited]

Definition at line 116 of file GEOMAlgo_GluerAlgo.cxx.

{
  return myImages;
}

Here is the caller graph for this function:

const TopTools_DataMapOfShapeShape & GEOMAlgo_GluerAlgo::Origins ( ) const [inherited]

Definition at line 124 of file GEOMAlgo_GluerAlgo.cxx.

{
  return myOrigins;
}
void GEOMAlgo_GlueDetector::Perform ( ) [virtual]

Implements GEOMAlgo_Algo.

Definition at line 109 of file GEOMAlgo_GlueDetector.cxx.

{
  myErrorStatus=0;
  myWarningStatus=0;
  myStickedShapes.Clear();
  //
  CheckData();
  if (myErrorStatus) {
    return;
  }
  //
  // Initialize the context
  GEOMAlgo_GluerAlgo::Perform();
  //
  DetectVertices();
  if (myErrorStatus) {
    return;
  }
  //
  //modified by NIZNHY-PKV Wed Mar 14 08:00:09 2012f
  CheckDetected();
  if (myErrorStatus) {
    return;
  }
  //modified by NIZNHY-PKV Wed Mar 14 08:00:12 2012t
  //
  DetectEdges();
  if (myErrorStatus) {
    return;
  }
  //
  DetectFaces();
  if (myErrorStatus) {
    return;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void GEOMAlgo_GluerAlgo::SetArgument ( const TopoDS_Shape &  theShape) [virtual, inherited]

Definition at line 51 of file GEOMAlgo_GluerAlgo.cxx.

{
  myArgument=theShape;
}

Here is the caller graph for this function:

void GEOMAlgo_GluerAlgo::SetCheckGeometry ( const Standard_Boolean  aFlag) [inherited]

Definition at line 84 of file GEOMAlgo_GluerAlgo.cxx.

{
  myCheckGeometry=aFlag;
}

Here is the caller graph for this function:

void GEOMAlgo_GluerAlgo::SetContext ( const Handle(IntTools_Context)&  theContext) [inherited]

Definition at line 100 of file GEOMAlgo_GluerAlgo.cxx.

{
  myContext=theContext;
}

Here is the caller graph for this function:

void GEOMAlgo_GluerAlgo::SetTolerance ( const Standard_Real  aT) [inherited]

Definition at line 67 of file GEOMAlgo_GluerAlgo.cxx.

{
  myTolerance=aT;
}

Here is the caller graph for this function:

const TopTools_IndexedDataMapOfShapeListOfShape & GEOMAlgo_GlueDetector::StickedShapes ( )

Definition at line 100 of file GEOMAlgo_GlueDetector.cxx.

{
  return myStickedShapes;
}

Here is the caller graph for this function:

Standard_Real GEOMAlgo_GluerAlgo::Tolerance ( ) const [inherited]

Definition at line 75 of file GEOMAlgo_GluerAlgo.cxx.

{
  return myTolerance;
}

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

TopoDS_Shape GEOMAlgo_GluerAlgo::myArgument [protected, inherited]

Definition at line 89 of file GEOMAlgo_GluerAlgo.hxx.

Standard_Boolean GEOMAlgo_GluerAlgo::myCheckGeometry [protected, inherited]

Definition at line 91 of file GEOMAlgo_GluerAlgo.hxx.

Standard_Boolean GEOMAlgo_Algo::myComputeInternalShapes [protected, inherited]

Definition at line 73 of file GEOMAlgo_Algo.hxx.

Standard_Integer GEOMAlgo_Algo::myErrorStatus [protected, inherited]

Definition at line 71 of file GEOMAlgo_Algo.hxx.

TopTools_DataMapOfShapeListOfShape GEOMAlgo_GluerAlgo::myImages [protected, inherited]

Definition at line 93 of file GEOMAlgo_GluerAlgo.hxx.

TopTools_DataMapOfShapeShape GEOMAlgo_GluerAlgo::myOrigins [protected, inherited]

Definition at line 94 of file GEOMAlgo_GluerAlgo.hxx.

TopTools_IndexedDataMapOfShapeListOfShape GEOMAlgo_GlueDetector::myStickedShapes [protected]

Definition at line 96 of file GEOMAlgo_GlueDetector.hxx.

Standard_Real GEOMAlgo_GluerAlgo::myTolerance [protected, inherited]

Definition at line 90 of file GEOMAlgo_GluerAlgo.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: