Back to index

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

#include <NMTDS_Iterator.hxx>

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

List of all members.

Public Member Functions

Standard_EXPORT NMTDS_Iterator ()
virtual Standard_EXPORT ~NMTDS_Iterator ()
Standard_EXPORT void SetDS (const NMTDS_PShapesDataStructure &pDS)
Standard_EXPORT const
NMTDS_ShapesDataStructure
DS () const
Standard_EXPORT void Initialize (const TopAbs_ShapeEnum aType1, const TopAbs_ShapeEnum aType2)
Standard_EXPORT Standard_Boolean More () const
Standard_EXPORT void Next ()
Standard_EXPORT void Current (Standard_Integer &aIndex1, Standard_Integer &aIndex2, Standard_Boolean &aWithSubShape) const
virtual Standard_EXPORT void Prepare ()
Standard_EXPORT Standard_Integer ExpectedLength () const
Standard_EXPORT Standard_Integer BlockLength () const
Standard_EXPORT const
TColStd_DataMapOfIntegerListOfInteger & 
SDVertices () const

Static Public Member Functions

static Standard_EXPORT void FillMVSD (const TColStd_DataMapOfIntegerListOfInteger &aMVSD1, TColStd_DataMapOfIntegerListOfInteger &aMVSD2)

Protected Member Functions

virtual Standard_EXPORT void Intersect ()

Protected Attributes

NMTDS_PShapesDataStructure myDS
NMTDS_ListOfPairBoolean myLists [6]
NMTDS_ListIteratorOfListOfPairBoolean myIterator
NMTDS_ListOfPairBoolean myEmptyList
Standard_Integer myLength
TColStd_DataMapOfIntegerListOfInteger myMVSD

Detailed Description

Definition at line 45 of file NMTDS_Iterator.hxx.


Constructor & Destructor Documentation

Definition at line 62 of file NMTDS_Iterator.cxx.

{
  myDS=NULL; 
  myLength=0;
}

Definition at line 71 of file NMTDS_Iterator.cxx.

{
}

Member Function Documentation

Standard_Integer NMTDS_Iterator::BlockLength ( ) const

Definition at line 102 of file NMTDS_Iterator.cxx.

{
  Standard_Integer aNbIIs, iTresh;
  Standard_Real aCfPredict=.5;
  
  aNbIIs=ExpectedLength();
  
  if (aNbIIs<=1) {
    return 1;
  }
  //modified by NIZNHY-PKV Mon Dec 12 08:50:50 2011f
  iTresh=1000;
  if (aNbIIs>iTresh) {
    aNbIIs=iTresh;
    return aNbIIs;
  }
  //modified by NIZNHY-PKV Mon Dec 12 08:50:54 2011t
  //
  aNbIIs=(Standard_Integer) (aCfPredict*(Standard_Real)aNbIIs);
  return aNbIIs;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void NMTDS_Iterator::Current ( Standard_Integer &  aIndex1,
Standard_Integer &  aIndex2,
Standard_Boolean &  aWithSubShape 
) const

Definition at line 162 of file NMTDS_Iterator.cxx.

{
  const NMTDS_PairBoolean& aPKB=myIterator.Value();
  aPKB.Ids(aIndex1, aIndex2);
  aWithSubShape=aPKB.Flag();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 86 of file NMTDS_Iterator.cxx.

{
  return *myDS;
}
Standard_Integer NMTDS_Iterator::ExpectedLength ( ) const

Definition at line 94 of file NMTDS_Iterator.cxx.

{
  return myLength;
}

Here is the caller graph for this function:

void NMTDS_Iterator::FillMVSD ( const TColStd_DataMapOfIntegerListOfInteger &  aMVSD1,
TColStd_DataMapOfIntegerListOfInteger &  aMVSD2 
) [static]

Definition at line 350 of file NMTDS_Iterator.cxx.

{
  Standard_Boolean bFound;
  Standard_Integer aNbVSD, iCnt, i, j, k;
  TColStd_ListOfInteger aLV;
  TColStd_ListIteratorOfListOfInteger aIt;
  TColStd_MapOfInteger aMF;
  TColStd_MapIteratorOfMapOfInteger aItMI;
  TColStd_DataMapIteratorOfDataMapOfIntegerListOfInteger aItVSD;
  NMTDS_DataMapOfIntegerMapOfInteger aDMIMI;
  NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger aIti, aItj;
  //
  aNbVSD=aMVSD.Extent();
  if (!aNbVSD) {
    return;
  }
  //
  aItVSD.Initialize(aMVSD);
  for (; aItVSD.More(); aItVSD.Next()) {
    TColStd_MapOfInteger aMI;
    //
    i=aItVSD.Key();
    aMI.Add(i);
    const TColStd_ListOfInteger& aLVSD=aItVSD.Value();
    aIt.Initialize(aLVSD);
    for (; aIt.More(); aIt.Next()) {
      j=aIt.Value();
      aMI.Add(j);
    }
    aDMIMI.Bind(i, aMI);
  }
  // i
  aIti.Initialize(aDMIMI);
  for (; aIti.More(); aIti.Next()) {
    i=aIti.Key();
    if (aMF.Contains(i)) {
      continue;
    }
    aMF.Add(i);
    //
    //TColStd_MapOfInteger& aMIi=aDMIMI.ChangeFind(i);
    TColStd_MapOfInteger *pMIi=(TColStd_MapOfInteger *)&aIti.Value();
    TColStd_MapOfInteger& aMIi=*pMIi;
    //  j
    while (1) {
      iCnt=0;
      aItj.Initialize(aDMIMI);
      for (; aItj.More(); aItj.Next()) {
        j=aItj.Key();
        if (aMF.Contains(j)) {
          continue;
        }
        //
        //TColStd_MapOfInteger& aMIj=aDMIMI.ChangeFind(j);
        TColStd_MapOfInteger *pMj=(TColStd_MapOfInteger *)&aItj.Value();
        TColStd_MapOfInteger& aMIj=*pMj;
        //
        aItMI.Initialize(aMIj);
        for (; aItMI.More(); aItMI.Next()) {
          k=aItMI.Key();
          bFound=aMIi.Contains(k);
          if (bFound) {
            break;
          }
        }
        if (!bFound) {
          continue;
        }
        //
        aItMI.Initialize(aMIj);
        for (; aItMI.More(); aItMI.Next()) {
          k=aItMI.Key();
          aMIi.Add(k);
        }
        //
        if (aMF.Add(j)) {
          ++iCnt;
        }
      } //for (; aItj.More(); aItj.Next()) {
      if (!iCnt) {
        break;
      }
    } // while (1) {
    //
    aLV.Clear();
    aItMI.Initialize(aMIi);
    for (; aItMI.More(); aItMI.Next()) {
      k=aItMI.Key();
        if (k!=i) {
          aLV.Append(k);
        }
    }
    bMVSD.Bind(i, aLV);
  }// for (; aIti.More(); aIti.Next()) {
}

Here is the caller graph for this function:

void NMTDS_Iterator::Initialize ( const TopAbs_ShapeEnum  aType1,
const TopAbs_ShapeEnum  aType2 
)

Definition at line 127 of file NMTDS_Iterator.cxx.

{
  Standard_Integer iX;
  //
  iX=NMTDS_Tools::TypeToInteger(aType1, aType2);
  if (iX>=0) {
    myIterator.Initialize(myLists[iX]);
    myLength=myLists[iX].Extent();
  }
  else {
    myIterator.Initialize(myEmptyList);
    myLength=0;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void NMTDS_Iterator::Intersect ( ) [protected, virtual]

Reimplemented in NMTDS_IteratorCheckerSI.

Definition at line 201 of file NMTDS_Iterator.cxx.

{
  Standard_Boolean bFlag;
  Standard_Integer aNb, i, aNbB, aNbR, iFlag;
  Standard_Integer i1, i2, aNbSD, iX, j, iDS, jB, iR, k, aNbLV, aNbLV1;
  TColStd_ListIteratorOfListOfInteger aIt;
  TColStd_DataMapOfIntegerInteger aMII;
  TColStd_DataMapOfIntegerListOfInteger aMVSD;
  TColStd_DataMapIteratorOfDataMapOfIntegerListOfInteger aItVSD;
  TopTools_DataMapOfShapeInteger aMSI;
  TopAbs_ShapeEnum aTi, aTj;
  NMTDS_PairBoolean aPKXB; 
  NMTDS_MapOfPairBoolean aMPKXB;
  NMTDS_IndexedDataMapOfShapeBox aMSB;
  //
  NMTDS_BoxBndTreeSelector aSelector;
  NMTDS_BoxBndTree aBBTree;
  NCollection_UBTreeFiller <Standard_Integer, Bnd_Box> aTreeFiller(aBBTree);
  //
  const NMTDS_CArray1OfIndexRange& aRanges=myDS->Ranges();
  aNbR=aRanges.Extent();
  //
  aNb=myDS->NumberOfShapesOfTheObject();
  for (i=1; i<=aNb; ++i) {
    const TopoDS_Shape& aS=myDS->Shape(i);
    aTi=aS.ShapeType();
    if (NMTDS_Tools::HasBRep(aTi)) {
      Bnd_Box aBoxEx;
      //
      myDS->ComputeBoxEx(i, aBoxEx);
      aMSI.Bind(aS, i);
      aMSB.Add(aS, aBoxEx);
    }
  }
  //
  aNbB=aMSB.Extent();
  //
  for (i=1; i<=aNbB; ++i) {
    const TopoDS_Shape& aS=aMSB.FindKey(i);
    const Bnd_Box& aBoxEx=aMSB(i);
    //
    aTreeFiller.Add(i, aBoxEx);
    //
    iDS=aMSI.Find(aS);
    aMII.Bind(i, iDS);
  }
  //
  aTreeFiller.Fill();
  //
  for (iR=1; iR<aNbR; ++iR) {
    const NMTDS_IndexRange& aR=aRanges(iR);
    i1=aR.First();
    i2=aR.Last();
    for (i=i1; i<=i2; ++i) {
      const TopoDS_Shape& aSi=myDS->Shape(i);
      aTi=aSi.ShapeType();
      if (!NMTDS_Tools::HasBRep(aTi)){
        continue;
      }
      const Bnd_Box& aBoxEx=aMSB.FindFromKey(aSi);
      aSelector.Clear();
      aSelector.SetBox(aBoxEx);
      //
      aNbSD=aBBTree.Select(aSelector);
      //
      if (!aNbSD){
        continue;
      }
      //
      const TColStd_ListOfInteger& aLI=aSelector.Indices();
      //
      k=0;
      TColStd_ListOfInteger aLV;
      //
      aIt.Initialize(aLI);
      for (; aIt.More(); aIt.Next()) {
        jB=aIt.Value();  // box index in MII
        j=aMII.Find(jB); // DS index
        if (j>=i1 && j<=i2) {
          continue;// same range
        }
        //
        aPKXB.SetIds(i, j);
        //
        if (aMPKXB.Add(aPKXB)) {
          bFlag=Standard_False;// Bounding boxes are intersected
          const Bnd_Box& aBoxi=myDS->GetBoundingBox(i);
          const Bnd_Box& aBoxj=myDS->GetBoundingBox(j);
          if (aBoxi.IsOut(aBoxj)) {
            bFlag=!bFlag; //Bounding boxes of Sub-shapes are intersected
          }
          const TopoDS_Shape& aSj=myDS->Shape(j);
          aTj=aSj.ShapeType();
          iX=NMTDS_Tools::TypeToInteger(aTi, aTj);
          //bFlag=(iStatus==2);
          aPKXB.SetFlag(bFlag);
          myLists[iX].Append(aPKXB);
          //
          // VSD prepare
          if (iX==5) { //VV
            aLV.Append(j);
          }
        }// if (aMPKXB.Add(aPKXB)) {
      }// for (; aIt.More(); aIt.Next()) {
      //
      // VSD treatment
      aNbLV=aLV.Extent();
      if (aNbLV) {
        TColStd_ListOfInteger aLV1;
        //
        const TopoDS_Vertex& aVi=TopoDS::Vertex(aSi);
        aIt.Initialize(aLV);
        for (; aIt.More(); aIt.Next()) {
          j=aIt.Value();  
          const TopoDS_Shape&  aSj=myDS->Shape(j);
          const TopoDS_Vertex& aVj=TopoDS::Vertex(aSj);
          iFlag=NMTDS_Tools::ComputeVV(aVi, aVj);
          if (!iFlag) {
            aLV1.Append(j);
          }
          else {
            aPKXB.SetIds(i, j);
            aMPKXB.Remove(aPKXB);
          }
        }
       //
       aNbLV1=aLV1.Extent();
       if (aNbLV1) {
         aMVSD.Bind(i, aLV1);
       }
      }
    }//for (i=i1; i<=i2; ++i) {
  }//for (iR=1; iR<aNbR; ++iR) {
  //
  //
  // Chains
  //=================
  myMVSD.Clear();
  NMTDS_Iterator::FillMVSD(aMVSD, myMVSD);
  
  //modified by NIZNHY-PKV Mon Dec 12 09:51:29 2011f
  aMPKXB.Clear();
  Standard::Purge();
  //modified by NIZNHY-PKV Mon Dec 12 09:51:33 2011t
}

Here is the call graph for this function:

Here is the caller graph for this function:

Standard_Boolean NMTDS_Iterator::More ( ) const

Definition at line 146 of file NMTDS_Iterator.cxx.

{
  return myIterator.More();
}

Here is the caller graph for this function:

Definition at line 154 of file NMTDS_Iterator.cxx.

{
  myIterator.Next();
}

Here is the caller graph for this function:

void NMTDS_Iterator::Prepare ( ) [virtual]

Definition at line 182 of file NMTDS_Iterator.cxx.

{
  Standard_Integer i;
  //
  myLength=0;
  for (i=0; i<6; ++i) {
    myLists[i].Clear();
  }
  myMVSD.Clear();
  //
  if (myDS==NULL){
    return;
  }
  Intersect();
}

Here is the call graph for this function:

Here is the caller graph for this function:

const TColStd_DataMapOfIntegerListOfInteger & NMTDS_Iterator::SDVertices ( ) const

Definition at line 174 of file NMTDS_Iterator.cxx.

{
  return myMVSD;
}

Here is the caller graph for this function:

Definition at line 78 of file NMTDS_Iterator.cxx.

{
  myDS=aDS;
}

Here is the caller graph for this function:


Member Data Documentation

Definition at line 95 of file NMTDS_Iterator.hxx.

Definition at line 98 of file NMTDS_Iterator.hxx.

Definition at line 97 of file NMTDS_Iterator.hxx.

Standard_Integer NMTDS_Iterator::myLength [protected]

Definition at line 99 of file NMTDS_Iterator.hxx.

Definition at line 96 of file NMTDS_Iterator.hxx.

TColStd_DataMapOfIntegerListOfInteger NMTDS_Iterator::myMVSD [protected]

Definition at line 100 of file NMTDS_Iterator.hxx.


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