Back to index

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

#include <NMTDS_ShapesDataStructure.hxx>

Collaboration diagram for NMTDS_ShapesDataStructure:
Collaboration graph
[legend]

List of all members.

Public Member Functions

Standard_EXPORT NMTDS_ShapesDataStructure ()
Standard_EXPORT void SetCompositeShape (const TopoDS_Shape &aS)
Standard_EXPORT void Init ()
Standard_EXPORT const
NMTDS_CArray1OfIndexRange
Ranges () const
Standard_EXPORT const
TopoDS_Shape & 
CompositeShape () const
Standard_EXPORT Standard_Integer ShapeRangeIndex (const Standard_Integer aId) const
virtual Standard_EXPORT
Standard_Integer 
Rank (const Standard_Integer anIndex) const
virtual Standard_EXPORT
Standard_Integer 
ShapeIndex (const TopoDS_Shape &aS, const Standard_Integer iRank) const
Standard_EXPORT void FillMap (const TopoDS_Shape &aS, BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors &aMSA, BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors &aMS) const
Standard_EXPORT void FillSubshapes (const TopoDS_Shape &aS, BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors &aMSA, BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors &aMS) const
Standard_EXPORT void GetAllSuccessors (const Standard_Integer anIndex, TColStd_IndexedMapOfInteger &aScrs) const
Standard_EXPORT void ComputeBoxEx (const Standard_Integer anIndex, Bnd_Box &aBox) const

Protected Attributes

TopoDS_Shape myCompositeShape
NMTDS_CArray1OfIndexRange myRanges
TopTools_DataMapOfShapeInteger myShapeIndexMap

Detailed Description

Definition at line 44 of file NMTDS_ShapesDataStructure.hxx.


Constructor & Destructor Documentation

Definition at line 54 of file NMTDS_ShapesDataStructure.cxx.

:
  BooleanOperations_ShapesDataStructure()
{}

Member Function Documentation

const TopoDS_Shape & NMTDS_ShapesDataStructure::CompositeShape ( ) const

Definition at line 70 of file NMTDS_ShapesDataStructure.cxx.

{
  return myCompositeShape;
}
void NMTDS_ShapesDataStructure::ComputeBoxEx ( const Standard_Integer  anIndex,
Bnd_Box &  aBox 
) const

Definition at line 326 of file NMTDS_ShapesDataStructure.cxx.

{
  ComputeBoxExS(aIx, this, aBoxEx);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void NMTDS_ShapesDataStructure::FillMap ( const TopoDS_Shape &  aS,
BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors &  aMSA,
BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors &  aMS 
) const

Definition at line 87 of file NMTDS_ShapesDataStructure.cxx.

{
  Standard_Integer iX, i, j, aIndex, aNbSc, aNbS;
  BooleanOperations_AncestorsSeqAndSuccessorsSeq aAS;
  //
  aMSA.Add(aS, aAS);
  aMS.Add(aS, aAS);
  FillSubshapes(aS, aMSA, aMS);
  //
  aNbS=aMS.Extent();
  for(i=1; i<=aNbS; ++i) {
    TColStd_MapOfInteger aMFence;
    //
    const TopoDS_Shape& aSX=aMS.FindKey(i);
    iX=aMSA.FindIndex(aSX);
    const BooleanOperations_AncestorsSeqAndSuccessorsSeq& aAS1=aMSA(iX);
    //
    aNbSc=aAS1.NumberOfSuccessors();
    for(j=1; j<=aNbSc; ++j) {
      aIndex=aAS1.GetSuccessor(j);
      if(aMFence.Add(aIndex)) {
        BooleanOperations_AncestorsSeqAndSuccessorsSeq& aAS2=aMSA.ChangeFromIndex(aIndex);
        aAS2.SetNewAncestor(iX);
      }
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void NMTDS_ShapesDataStructure::FillSubshapes ( const TopoDS_Shape &  aS,
BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors &  aMSA,
BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors &  aMS 
) const

Definition at line 121 of file NMTDS_ShapesDataStructure.cxx.

{
  Standard_Boolean bIsNewSubShape;
  Standard_Integer aIndexSubShape, aIndex;
  BooleanOperations_AncestorsSeqAndSuccessorsSeq aASx;
  //
  aIndex=aMSA.FindIndex(aS);
  BooleanOperations_AncestorsSeqAndSuccessorsSeq& aAS=aMSA.ChangeFromIndex(aIndex);
  //
  TopoDS_Iterator anIt(aS, Standard_True);
  for(; anIt.More(); anIt.Next()) {
    const TopoDS_Shape& aSubShape = anIt.Value();
    bIsNewSubShape = Standard_False;
    if(!aMSA.Contains(aSubShape)) {
      bIsNewSubShape=!bIsNewSubShape;
      aIndexSubShape=aMSA.Add(aSubShape, aASx);
      aMS.Add(aSubShape, aASx);
    }
    else {
      aIndexSubShape=aMSA.FindIndex(aSubShape);
    }
    aAS.SetNewSuccessor(aIndexSubShape);
    aAS.SetNewOrientation(aSubShape.Orientation());
    //
    if(bIsNewSubShape && (aSubShape.ShapeType() != TopAbs_VERTEX)) {
      FillSubshapes(aSubShape, aMSA, aMS);
    }
  }
}

Here is the caller graph for this function:

void NMTDS_ShapesDataStructure::GetAllSuccessors ( const Standard_Integer  anIndex,
TColStd_IndexedMapOfInteger &  aScrs 
) const

Definition at line 336 of file NMTDS_ShapesDataStructure.cxx.

{
  GetAllSuccessorsS(nS, this, aMA);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 156 of file NMTDS_ShapesDataStructure.cxx.

{
  Standard_Integer i, j, aNbSx, aNbS, aShift, aNbRanges;
  Standard_Integer iFirst, iLast;
  NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors aLx;
  NMTDS_ListIteratorOfListOfIndexedDataMapOfShapeAncestorsSuccessors aLit;
  TopoDS_Iterator anIt;
  BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors aMSA;
  //
  anIt.Initialize(myCompositeShape);
  for (; anIt.More(); anIt.Next()) {
    const TopoDS_Shape& aSx=anIt.Value(); 
    BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors aMS;
    //
    if (!aMSA.Contains(aSx)) {
      FillMap(aSx, aMSA, aMS);
      aLx.Append(aMS);
    }
  }
  aNbS=aMSA.Extent(); 
  //
  // Fill myRanges
  i=aLx.Extent();
  myRanges.Resize(i);
  aLit.Initialize(aLx);
  for (i=1; aLit.More(); aLit.Next(), ++i) {
    const BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors& aMSx=aLit.Value();
    aNbSx=aMSx.Extent();
    if (i==1) {
      iFirst=1;
      iLast=aNbSx;
      myRanges(i).SetFirst(iFirst);
      myRanges(i).SetLast(iLast);
      continue;
    }
    iFirst=myRanges(i-1).Last()+1;
    iLast=iFirst+aNbSx-1;
    myRanges(i).SetFirst(iFirst);
    myRanges(i).SetLast(iLast);
  }
  //
  myNumberOfShapesOfTheObject=aNbS;
  myNumberOfShapesOfTheTool=0;
  myLength=2*aNbS;
  //
  // Allocate the whole Table
  myListOfShapeAndInterferences = (BooleanOperations_PShapeAndInterferences)
    Standard::Allocate(myLength*sizeof(BooleanOperations_ShapeAndInterferences));
  //
  // Fill the table
  
  aShift=0;
  for (j=1; j<=aNbS; ++j) {
    const TopoDS_Shape& aSx=aMSA.FindKey(j);
    const BooleanOperations_AncestorsSeqAndSuccessorsSeq& aASx=aMSA.FindFromIndex(j);
    InsertShapeAndAncestorsSuccessors(aSx, aASx, aShift);
  }
  // myShapeIndexMap
  myShapeIndexMap.Clear();
  //
  //modified by NIZNHY-PKV Mon Dec 12 09:01:53 2011f
  aNbRanges=myRanges.Extent();
  for (i=1; i<=aNbRanges; ++i){
    const NMTDS_IndexRange& aR=myRanges(i);
    iFirst=aR.First();
    iLast =aR.Last();
    for (j=iFirst; j<=iLast; ++j) { 
      const TopoDS_Shape& aS=Shape(j);
      myShapeIndexMap.Bind(aS, j);
    }
  }
  //modified by NIZNHY-PKV Mon Dec 12 09:02:00 2011t
  //
  // myRefEdges
  iLast=myNumberOfShapesOfTheObject+myNumberOfShapesOfTheTool;
  myRefEdges.Resize(iLast);

  for (i=1; i<=iLast; ++i) {
    const TopoDS_Shape& aS=Shape(i);
    myRefEdges(i)=0;
    if (aS.ShapeType()==TopAbs_EDGE) {
      myNbEdges++;
      myRefEdges(i)=myNbEdges;
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 78 of file NMTDS_ShapesDataStructure.cxx.

{
  return myRanges;
}

Here is the caller graph for this function:

Standard_Integer NMTDS_ShapesDataStructure::Rank ( const Standard_Integer  anIndex) const [virtual]

Definition at line 278 of file NMTDS_ShapesDataStructure.cxx.

{
  Standard_Boolean bFound;
  Standard_Integer i, aNbR, aNbS, aZero=0;
  //
  aNbS=myNumberOfShapesOfTheObject;
  
  if (aId > aNbS || aId < 1){
    return aZero;
  }
  //  
  aNbR=myRanges.Extent();
  for (i=1; i<=aNbR; ++i) {
    const NMTDS_IndexRange& aRange=myRanges(i);
    bFound=aRange.IsInRange(aId);
    if (bFound) {
     return i;
    }
  }
  return aZero;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void NMTDS_ShapesDataStructure::SetCompositeShape ( const TopoDS_Shape &  aS)

Definition at line 62 of file NMTDS_ShapesDataStructure.cxx.

Here is the caller graph for this function:

Standard_Integer NMTDS_ShapesDataStructure::ShapeIndex ( const TopoDS_Shape &  aS,
const Standard_Integer  iRank 
) const [virtual]

Definition at line 304 of file NMTDS_ShapesDataStructure.cxx.

{
  Standard_Address pIndex;
  Standard_Integer aIndex;
  //
  aIndex=0;
  //
  //modified by NIZNHY-PKV Mon Dec 12 09:02:48 2011f
  pIndex=myShapeIndexMap.Find1(aS);
  if (pIndex) {
    aIndex=*((Standard_Integer*)pIndex);
  }
  //modified by NIZNHY-PKV Mon Dec 12 09:02:54 2011t
  return aIndex;
}

Here is the caller graph for this function:

Standard_Integer NMTDS_ShapesDataStructure::ShapeRangeIndex ( const Standard_Integer  aId) const

Definition at line 247 of file NMTDS_ShapesDataStructure.cxx.

{
  Standard_Boolean bFound;
  Standard_Integer i, aNbR, aIdx, aNbS, aZero=0;
  //
  aNbS=myNumberOfShapesOfTheObject+myNumberOfShapesOfTheTool;
  
  aIdx=aId;
  if (aIdx > aNbS || aIdx < 1){
    return aZero;
  }
  //  
  if (aIdx > myNumberOfShapesOfTheObject) {
    aIdx-=myNumberOfShapesOfTheObject;
  }
  //
  aNbR=myRanges.Extent();
  for (i=1; i<=aNbR; ++i) {
    const NMTDS_IndexRange& aRange=myRanges(i);
    bFound=aRange.IsInRange(aIdx);
    if (bFound) {
     return i;
    }
  }
  return aZero;
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 92 of file NMTDS_ShapesDataStructure.hxx.

Definition at line 93 of file NMTDS_ShapesDataStructure.hxx.

TopTools_DataMapOfShapeInteger NMTDS_ShapesDataStructure::myShapeIndexMap [protected]

Definition at line 94 of file NMTDS_ShapesDataStructure.hxx.


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