示例#1
0
//=======================================================================
//function : Contains
//purpose  : 
//=======================================================================
  Standard_Boolean GEOMAlgo_ShapeSet::Contains(const GEOMAlgo_ShapeSet& theOther)const
{
  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;
}
示例#2
0
//modified by NIZNHY-PKV Wed Oct 28 13:51:36 2010f
//=======================================================================
//function : IsEqual
//purpose  : 
//=======================================================================
  Standard_Boolean GEOMAlgo_ShapeSet::IsEqual(const GEOMAlgo_ShapeSet& theOther)const
{
  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;
}
//=======================================================================
//function : BuildSplitSolids
//purpose  :
//=======================================================================
  void GEOMAlgo_Builder::BuildSplitSolids()
{
  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) {
}