Back to index

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

Implementation some formal
opereations with Set of shapes
More...

#include <GEOMAlgo_ShapeSet.hxx>

List of all members.

Public Member Functions

Standard_EXPORT GEOMAlgo_ShapeSet ()
 Empty constructor

Standard_EXPORT void Add (const TopTools_ListOfShape &theLS)
 Adds shapes from the list theLS to the Set

Standard_EXPORT void Add (const TopoDS_Shape &theShape)
 Adds shape theShape to the Set

Standard_EXPORT void Add (const TopoDS_Shape &theShape, const TopAbs_ShapeEnum theType)
 Adds sub-shapes of shape theShape,
that have type theType to the Set

Standard_EXPORT void Subtract (const GEOMAlgo_ShapeSet &theSet)
 Removes shapes of theSet from the Set

Standard_EXPORT void Clear ()
 Clears internal fields

Standard_EXPORT Standard_Boolean Contains (const GEOMAlgo_ShapeSet &theSet) const
 Returns True if the Set contains
all shapes of theSet

Standard_EXPORT const
TopTools_ListOfShape & 
GetSet () const
 Returns the Set

Standard_EXPORT Standard_Boolean IsEqual (const GEOMAlgo_ShapeSet &theOther) const
 Returns True if the Set==theSet

Standard_Boolean operator== (const GEOMAlgo_ShapeSet &theOther) const

Protected Attributes

TopTools_MapOfOrientedShape myMap
TopTools_ListOfShape myList

Detailed Description

Implementation some formal
opereations with Set of shapes

Definition at line 44 of file GEOMAlgo_ShapeSet.hxx.


Constructor & Destructor Documentation

Empty constructor

Definition at line 38 of file GEOMAlgo_ShapeSet.cxx.

{
}

Member Function Documentation

void GEOMAlgo_ShapeSet::Add ( const TopTools_ListOfShape &  theLS)

Adds shapes from the list theLS to the Set

Definition at line 81 of file GEOMAlgo_ShapeSet.cxx.

{
  TopTools_ListIteratorOfListOfShape aIt;
  //
  aIt.Initialize(theLS);
  for (; aIt.More(); aIt.Next()) {
    const TopoDS_Shape& aS=aIt.Value();
    if (myMap.Add(aS)) {
      myList.Append(aS);
    }
  }
}

Here is the caller graph for this function:

void GEOMAlgo_ShapeSet::Add ( const TopoDS_Shape &  theShape)

Adds shape theShape to the Set

Definition at line 54 of file GEOMAlgo_ShapeSet.cxx.

{
  if (myMap.Add(theShape)) {
    myList.Append(theShape);
  }
}
void GEOMAlgo_ShapeSet::Add ( const TopoDS_Shape &  theShape,
const TopAbs_ShapeEnum  theType 
)

Adds sub-shapes of shape theShape,
that have type theType to the Set

Definition at line 64 of file GEOMAlgo_ShapeSet.cxx.

{
  TopExp_Explorer aExp;
  //
  aExp.Init(theShape, theType);
  for (; aExp.More(); aExp.Next()) {
    const TopoDS_Shape& aS=aExp.Current();
    if (myMap.Add(aS)) {
      myList.Append(aS);
    }
  }
}

Clears internal fields

Definition at line 45 of file GEOMAlgo_ShapeSet.cxx.

{
  myMap.Clear();
  myList.Clear();
}

Here is the caller graph for this function:

Standard_Boolean GEOMAlgo_ShapeSet::Contains ( const GEOMAlgo_ShapeSet theSet) const

Returns True if the Set contains
all shapes of theSet

Definition at line 105 of file GEOMAlgo_ShapeSet.cxx.

{
  Standard_Boolean bRet;
  TopAbs_Orientation aOr;
  TopTools_ListIteratorOfListOfShape aIt;
  //
  bRet=Standard_True;
  const TopTools_ListOfShape& aLS=theOther.GetSet();
  aIt.Initialize(aLS);
  for (; aIt.More(); aIt.Next()) {
    const TopoDS_Shape& aF=aIt.Value();
    aOr=aF.Orientation();
    if (aOr==TopAbs_FORWARD || aOr==TopAbs_REVERSED) {
      bRet=myMap.Contains(aF);
      if (!bRet) {
        break;
      }
    }
  }
  return bRet;
}

Here is the call graph for this function:

Here is the caller graph for this function:

const TopTools_ListOfShape & GEOMAlgo_ShapeSet::GetSet ( ) const

Returns the Set

Definition at line 97 of file GEOMAlgo_ShapeSet.cxx.

{
  return myList;
}

Here is the caller graph for this function:

Standard_Boolean GEOMAlgo_ShapeSet::IsEqual ( const GEOMAlgo_ShapeSet theOther) const

Returns True if the Set==theSet

Definition at line 153 of file GEOMAlgo_ShapeSet.cxx.

{
  Standard_Boolean bRet;
  Standard_Integer aNb1, aNb2;
  TopTools_ListIteratorOfListOfShape aIt;
  //
  bRet=Standard_True;
  aNb1=myList.Extent();
  const TopTools_ListOfShape& aLS2=theOther.GetSet();
  aNb2=aLS2.Extent();
  if (aNb1!=aNb2) {
    return !bRet;
  }
  //
  aIt.Initialize(myList);
  for (; aIt.More(); aIt.Next()) {
    const TopoDS_Shape& aS=aIt.Value();
    if(!theOther.myMap.Contains(aS)) {
      bRet=!bRet;
      break;
    }
  }
  return bRet;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Standard_Boolean GEOMAlgo_ShapeSet::operator== ( const GEOMAlgo_ShapeSet theOther) const [inline]

Definition at line 84 of file GEOMAlgo_ShapeSet.hxx.

                                                                        {
    return IsEqual(theOther);
  }

Here is the call graph for this function:

Removes shapes of theSet from the Set

Definition at line 130 of file GEOMAlgo_ShapeSet.cxx.

{
  TopTools_ListIteratorOfListOfShape aIt;
  TopTools_ListOfShape aLS;
  //
  myMap.Clear();
  aIt.Initialize(myList);
  for (; aIt.More(); aIt.Next()) {
    const TopoDS_Shape& aS=aIt.Value();
    if (!theOther.myMap.Contains(aS)) {
      if(myMap.Add(aS)){
        aLS.Append(aS);
      }
    }
  }
  //
  myList=aLS;
}

Here is the caller graph for this function:


Member Data Documentation

TopTools_ListOfShape GEOMAlgo_ShapeSet::myList [protected]

Definition at line 90 of file GEOMAlgo_ShapeSet.hxx.

TopTools_MapOfOrientedShape GEOMAlgo_ShapeSet::myMap [protected]

Definition at line 89 of file GEOMAlgo_ShapeSet.hxx.


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