void MakeInternalShells(const TopTools_MapOfShape& ,
TopTools_ListOfShape& );
-//modified by NIZNHY-PKV Tue Aug 5 15:06:50 2008f
static
- Standard_Boolean IsClosedShell(const TopoDS_Shell& theShell);
-//modified by NIZNHY-PKV Tue Aug 5 15:06:57 2008t
+ Standard_Boolean IsClosedShell(const TopoDS_Shell& );
+
+//modified by NIZNHY-PKV Tue Oct 26 13:30:39 2010f
+static
+ Standard_Boolean RefineShell(const TopoDS_Shell& ,
+ TopoDS_Shell& );
+//modified by NIZNHY-PKV Tue Oct 26 13:30:42 2010t
//=======================================================================
//function :
if (!myShapesToAvoid.Contains(aF)) {
TopExp::MapShapesAndAncestors(aF, TopAbs_EDGE, TopAbs_FACE, aMEF);
}
- else {
- int a=0;
+ /*
+ else {
+ int a=0;
}
+ */
}
aNbE=aMEF.Extent();
//
// 2. myFacesToAvoid
for (i=1; i<=aNbE; ++i) {
- const TopoDS_Edge& aE=TopoDS::Edge(aMEF.FindKey(i));
+ const TopoDS_Edge& aE=*((TopoDS_Edge*)(&aMEF.FindKey(i)));
if (BRep_Tool::Degenerated(aE)) {
continue;
}
//
aOrE=aE.Orientation();
//
- const TopoDS_Face& aF1=TopoDS::Face(aLF.First());
+ const TopoDS_Face& aF1=*((TopoDS_Face*)(&aLF.First()));
if (aNbF==1) {
if (aOrE==TopAbs_INTERNAL) {
continue;
myShapesToAvoid.Add(aF1);
}
else if (aNbF==2) {
- const TopoDS_Face& aF2=TopoDS::Face(aLF.Last());
+ const TopoDS_Face& aF2=*((TopoDS_Face*)(&aLF.Last()));
if (aF2.IsSame(aF1)) {
if (BRep_Tool::IsClosed(aE, aF1)) {
continue;
myShapesToAvoid.Add(aF2);
}
}
- //DEB
+ /*//DEB
else {
TopTools_ListIteratorOfListOfShape aItLF;
//
int a=0;
}
}
- //DEB
+ *///DEB
}// for (i=1; i<=aNbE; ++i) {
//
if (!bFound) {
//
myLoops.Clear();
//
- Standard_Integer aNbLF, aNbOff, aNbFP, aNbFA;
+ Standard_Integer aNbLF, aNbOff, aNbFP;
TopAbs_Orientation anOr;
TopoDS_Edge aEL;
BRep_Builder aBB;
NMTTools_CoupleOfShape aCSOff;
- TopTools_MapOfOrientedShape AddedFacesMap;//, aMFP;
+ TopTools_MapOfOrientedShape AddedFacesMap;
TopTools_IndexedDataMapOfShapeListOfShape aEFMap, aMEFP;
TopTools_ListIteratorOfListOfShape aItF, aIt;
TopTools_MapIteratorOfMapOfOrientedShape aItM;
// loop on faces added to Shell; add their neighbor faces to Shell and so on
TopoDS_Iterator aItAddedF (aShell);
for (; aItAddedF.More(); aItAddedF.Next()) {
- const TopoDS_Face& aF = TopoDS::Face(aItAddedF.Value());
+ const TopoDS_Face& aF = *((TopoDS_Face*)(&aItAddedF.Value()));
//
// loop on edges of aF; find a good neighbor face of aF by aE
TopExp_Explorer aEdgeExp(aF, TopAbs_EDGE);
for (; aEdgeExp.More(); aEdgeExp.Next()) {
- const TopoDS_Edge& aE = TopoDS::Edge(aEdgeExp.Current());
+ const TopoDS_Edge& aE=*((TopoDS_Edge*)(&aEdgeExp.Current()));
//
//1
if (aMEFP.Contains(aE)) {
//
aItLF.Initialize(aLF);
for (; aItLF.More(); aItLF.Next()) {
- const TopoDS_Face& aFL=TopoDS::Face(aItLF.Value());
+ const TopoDS_Face& aFL=*((TopoDS_Face*)(&aItLF.Value()));
if (myShapesToAvoid.Contains(aFL)) {
continue;
}
//
TopoDS_Face aSelF;
if (aNbOff==1) {
- aSelF=TopoDS::Face(aLCSOff.First().Shape2());
+ aSelF=*((TopoDS_Face*)(&aLCSOff.First().Shape2()));
}
else if (aNbOff>1){
GEOMAlgo_Tools3D::GetFaceOff(aE, aF, aLCSOff, aSelF);
}
} // for (; aEdgeExp.More(); aEdgeExp.Next()) {
} //for (; aItAddedF.More(); aItAddedF.Next()) {
- //modified by NIZNHY-PKV Tue Aug 5 15:07:08 2008f
- //myLoops.Append(aShell);
+ //
if (IsClosedShell(aShell)) {
myLoops.Append(aShell);
}
- /*
+ //modified by NIZNHY-PKV Wed Oct 27 07:10:41 2010f
else {
- TopoDS_Iterator aItS;
- aItS.Initialize(aShell);
- for (; aItS.More(); aItS.Next()) {
- const TopoDS_Shape& aFs=aItS.Value();
- aMFP.Add(aFs);
+ Standard_Boolean bRefine;
+ TopoDS_Shell aShx;
+ //
+ bRefine=RefineShell(aShell, aShx);
+ if (bRefine) {
+ myLoops.Append(aShx);
}
}
- */
- //modified by NIZNHY-PKV Tue Aug 5 15:07:30 2008t
- } // for (; aItF.More(); aItF.Next()) {
- //modified by NIZNHY-PKV Tue Aug 5 15:07:35 2008f
+ //modified by NIZNHY-PKV Wed Oct 27 07:10:44 2010t
+ } // for (; aItF.More(); aItF.Next()) {
//
// Post Treatment
TopTools_MapOfOrientedShape aMP;
}
}
//
- // b. collect all edges that are to avoid
+ // b. collect all faces that are to avoid
aItM.Initialize(myShapesToAvoid);
for (; aItM.More(); aItM.Next()) {
const TopoDS_Shape& aF=aItM.Key();
aMP.Add(aF);
}
//
- // c. add all edges that are not processed to myShapesToAvoid
+ // c. add all faces that are not processed to myShapesToAvoid
aIt.Initialize (myShapes);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aF=aIt.Value();
myShapesToAvoid.Add(aF);
}
}
- //modified by NIZNHY-PKV Tue Aug 5 15:07:44 2008t
//=================================================
//
// 2.Internal Shells
aEFMap.Clear();
AddedFacesMap.Clear();
//
- aNbFA=myShapesToAvoid.Extent();
- //
aItM.Initialize(myShapesToAvoid);
for (; aItM.More(); aItM.Next()) {
const TopoDS_Shape& aFF=aItM.Key();
//
TopoDS_Iterator aItAddedF (aShell);
for (; aItAddedF.More(); aItAddedF.Next()) {
- const TopoDS_Face& aF = TopoDS::Face(aItAddedF.Value());
+ const TopoDS_Face& aF = *((TopoDS_Face*)(&aItAddedF.Value()));
//
TopExp_Explorer aEdgeExp(aF, TopAbs_EDGE);
for (; aEdgeExp.More(); aEdgeExp.Next()) {
- const TopoDS_Edge& aE = TopoDS::Edge(aEdgeExp.Current());
+ const TopoDS_Edge& aE = *((TopoDS_Edge*)(&aEdgeExp.Current()));
const TopTools_ListOfShape& aLF=aEFMap.FindFromKey(aE);
aItF.Initialize(aLF);
for (; aItF.More(); aItF.Next()) {
- const TopoDS_Face& aFL=TopoDS::Face(aItF.Value());
+ const TopoDS_Face& aFL=*((TopoDS_Face*)(&aItF.Value()));
if (AddedFacesMap.Add(aFL)){
aBB.Add(aShell, aFL);
}
}
else{
// check if a shell is a hole
- //XX
bIsHole=IsHole(aShell, myContext);
- //bIsHole=GEOMAlgo_BuilderTools::IsHole(aShell);
- //XX
+ //
if (bIsHole) {
aHoleShells.Append(aShell);
TopExp::MapShapes(aShell, TopAbs_FACE, aMHF);
// 3. Add aHoles to Solids
aItMSH.Initialize(aMSH);
for (; aItMSH.More(); aItMSH.Next()) {
- TopoDS_Solid aSolid=TopoDS::Solid(aItMSH.Key());
+ TopoDS_Solid aSolid=*((TopoDS_Solid*)(&aItMSH.Key()));
//
const TopTools_ListOfShape& aLH=aItMSH.Value();
aShellIt.Initialize(aLH);
// 2 Process solids
aSolidIt.Initialize(myAreas);
for ( ; aSolidIt.More(); aSolidIt.Next()) {
- TopoDS_Solid& aSolid=TopoDS::Solid(aSolidIt.Value());
+ TopoDS_Solid& aSolid=*((TopoDS_Solid*)(&aSolidIt.Value()));
//
aMEF.Clear();
TopExp::MapShapesAndAncestors(aSolid, TopAbs_EDGE, TopAbs_FACE, aMEF);
aMFP.Clear();
aItMF.Initialize(aMF);
for (; aItMF.More(); aItMF.Next()) {
- const TopoDS_Face& aF=TopoDS::Face(aItMF.Key());
+ const TopoDS_Face& aF=*((TopoDS_Face*)(&aItMF.Key()));
if (GEOMAlgo_Tools3D::IsInternalFace(aF, aSolid, aMEF, 1.e-14, *myContext)) {
aMFP.Add(aF);
}
}
return bRet;
}
-//modified by NIZNHY-PKV Tue Aug 5 15:07:50 2008f
//=======================================================================
//function : IsClosedShell
//purpose :
const TopoDS_Face& aF=TopoDS::Face(aIt.Value());
aExp.Init(aF, TopAbs_EDGE);
for (; aExp.More(); aExp.Next()) {
- const TopoDS_Edge& aE=TopoDS::Edge(aExp.Current());
+ const TopoDS_Edge& aE=*((TopoDS_Edge*)(&aExp.Current()));
if (BRep_Tool::Degenerated(aE)) {
continue;
}
- /*
- if (BRep_Tool::IsClosed(aE, aF)) {
- continue;
- }
- */
+ //
if (aE.Orientation()==TopAbs_INTERNAL) {
continue;
}
+ //
if (!aM.Add(aE)) {
aM.Remove(aE);
}
}
return bRet;
}
-//modified by NIZNHY-PKV Tue Aug 5 15:08:07 2008t
-//BRepTools::Write(aFF, "ff");
+//modified by NIZNHY-PKV Tue Oct 26 13:30:23 2010f
+//=======================================================================
+//function : RefineShell
+//purpose :
+//=======================================================================
+ Standard_Boolean RefineShell(const TopoDS_Shell& aShell,
+ TopoDS_Shell& aShx)
+
+{
+ Standard_Boolean bRet;
+ Standard_Integer i, aNbE, aNbF;
+ TopAbs_Orientation aOrE;
+ TopTools_IndexedDataMapOfShapeListOfShape aMEF;
+ TopTools_MapOfOrientedShape aMFx;
+ //
+ bRet=Standard_False;
+ //
+ TopExp::MapShapesAndAncestors(aShell, TopAbs_EDGE, TopAbs_FACE, aMEF);
+ aNbE=aMEF.Extent();
+ for (i=1; i<=aNbE; ++i) {
+ const TopoDS_Edge &aE=*((TopoDS_Edge*)(&aMEF.FindKey(i)));
+ //
+ if (BRep_Tool::Degenerated(aE)) {
+ continue;
+ }
+ //
+ aOrE=aE.Orientation();
+ //
+ const TopTools_ListOfShape& aLF=aMEF(i);
+ aNbF=aLF.Extent();
+ if (!aNbF) {
+ continue;
+ }
+ //
+ const TopoDS_Face& aF1=*((TopoDS_Face*)(&aLF.First()));
+ if (aNbF==1) {
+ if (aOrE==TopAbs_INTERNAL) {
+ continue;
+ }
+ aMFx.Add(aF1);
+ }
+ //
+ else if (aNbF==2) {
+ const TopoDS_Face& aF2=*((TopoDS_Face*)(&aLF.Last()));
+ if (aF2.IsSame(aF1)) {
+ if (BRep_Tool::IsClosed(aE, aF1)) {
+ continue;
+ }
+ if (aOrE==TopAbs_INTERNAL) {
+ continue;
+ }
+ aMFx.Add(aF1);
+ aMFx.Add(aF2);
+ }
+ }
+ }
+ //
+ aNbF=aMFx.Extent();
+ if (!aNbF) {
+ return bRet;
+ }
+ //
+ BRep_Builder aBB;
+ TopoDS_Iterator aIt;
+ //
+ aNbF=0;
+ aBB.MakeShell(aShx);
+ aIt.Initialize(aShell);
+ for (; aIt.More(); aIt.Next()) {
+ const TopoDS_Shape& aF=aIt.Value();
+ if (!aMFx.Contains(aF)) {
+ aBB.Add(aShx, aF);
+ ++aNbF;
+ }
+ }
+ //
+ if (aNbF) {
+ bRet=IsClosedShell(aShx);
+ }
+ //
+ return bRet;
+}
+//modified by NIZNHY-PKV Tue Oct 26 13:30:26 2010t
//
// ErrorStatus :
// 11 - Null Context
IntTools_Context& aCtx=pPF->ChangeContext();
//
Standard_Boolean bToReverse;
- Standard_Integer i, aNb, aNbSp, nSp, nSpR, nSpx, aIsCB;
+ Standard_Integer i, aNb, aNbSp, nSp, nSpR, nSpx, aIsCB, aNbLB;
TColStd_ListIteratorOfListOfInteger aItLB;
TColStd_ListOfInteger aLB;
TopoDS_Edge aEE, aESpR;
nSp=aPB.Edge();
const TopoDS_Shape& aSp=aDS.Shape(nSp);
//
- //modified by NIZNHY-PKV Fri Nov 30 10:40:36 2007 f
- //const BOPTools_PaveBlock& aPBR=pPF->RealPaveBlock(aPB, aLB);
const BOPTools_PaveBlock& aPBR=pPF->RealPaveBlock(aPB, aLB, aIsCB);
- //modified by NIZNHY-PKV Fri Nov 30 10:40:48 2007t
+ //modified by NIZNHY-PKV Wed Oct 27 11:19:30 2010f
+ aNbLB=aLB.Extent();
+ if (aIsCB && aNbLB<2) {
+ aIsCB=0;
+ }
+ //modified by NIZNHY-PKV Wed Oct 27 11:19:34 2010t
+ //
nSpR=aPBR.Edge();
const TopoDS_Shape& aSpR=aDS.Shape(nSpR);
- //modified by NIZNHY-PKV Fri Nov 30 10:41:39 2007f
- //if (aSpR.IsSame(aSp) && aSpR.IsSame(aE)) {
if (aSpR.IsSame(aSp) && aSpR.IsSame(aE) && !aIsCB) {
- //modified by NIZNHY-PKV Fri Nov 30 10:41:46 2007t
continue;
}
//
aIt.Initialize(aLPB);
for (; aIt.More(); aIt.Next()) {
const BOPTools_PaveBlock& aPB=aIt.Value();
- //modified by NIZNHY-PKV Fri Nov 30 10:42:15 2007f
- //const BOPTools_PaveBlock& aPBR=pPF->RealPaveBlock(aPB, aLB);
const BOPTools_PaveBlock& aPBR=pPF->RealPaveBlock(aPB, aLB, aIsCB);
- //modified by NIZNHY-PKV Fri Nov 30 10:42:20 2007t
nSpR=aPBR.Edge();
const TopoDS_Shape& aSpR=aDS.Shape(nSpR);
//
const TopoDS_Shape& aSpx=aDS.Shape(nSpx);
mySameDomainShapes.Add(aSpx ,aSpR);
}
- //
}
}
//
#include <BOPTools_CArray1OfESInterference.hxx>
#include <NMTDS_ShapesDataStructure.hxx>
+#include <NMTDS_InterfPool.hxx>
+
#include <NMTTools_PaveFiller.hxx>
#include <NMTTools_ListOfCoupleOfShape.hxx>
#include <NMTTools_Tools.hxx>
#include <GEOMAlgo_Tools3D.hxx>
#include <GEOMAlgo_WireEdgeSet.hxx>
#include <GEOMAlgo_BuilderFace.hxx>
-#include <NMTDS_InterfPool.hxx>
+
+#include <GEOMAlgo_ShapeSet.hxx>
static
void UpdateCandidates(const Standard_Integer ,
aNbSE=aLSE.Extent();
if (aNbSE) {
aMFP.Add(i);
+ //modified by NIZNHY-PKV Wed Oct 27 11:40:57 2010f
+ break;
+ //modified by NIZNHY-PKV Wed Oct 27 11:41:07 2010t
}
}
}
}
//
// 2.2. Build images Faces
- GEOMAlgo_BuilderFace aBF;
+ TopTools_ListOfShape aLFR;
+ GEOMAlgo_ShapeSet aS1, aS2;
//
- aBF.SetFace(aFF);
- aBF.SetContext(aCtx);
const TopTools_ListOfShape& aSE=aWES.StartElements();
- //
- //DEB f
- /*
- {
- TopoDS_Compound aCx;
- BRep_Builder aBBx;
- TopTools_ListIteratorOfListOfShape aItx;
+ //modified by NIZNHY-PKV Thu Oct 28 08:30:41 2010f
+ aS1.Add(aSE);
+ aS2.Add(aFF, TopAbs_EDGE);
+ if (aS1.IsEqual(aS2)) {
+ aLFR.Append(aF);
+ }
+ //modified by NIZNHY-PKV Thu Oct 28 08:30:42 2010t
+ else {
+ GEOMAlgo_BuilderFace aBF;
//
- aBBx.MakeCompound(aCx);
- aBBx.Add(aCx, aFF);
- aItx.Initialize(aSE);
- for (; aItx.More(); aItx.Next()) {
- TopoDS_Shape& aEx=aItx.Value();
- aBBx.Add(aCx, aEx);
- }
- int a=0;
- }
- */
- //DEB t
- //
- aBF.SetShapes(aSE);
- //
- aBF.Perform();
- //
- const TopTools_ListOfShape& aLF=aBF.Areas();
- //
- TopTools_ListOfShape aLFR;
- //
- aIt.Initialize(aLF);
- for (; aIt.More(); aIt.Next()) {
- TopoDS_Shape& aFR=aIt.Value();
- if (anOriF==TopAbs_REVERSED) {
- aFR.Orientation(TopAbs_REVERSED);
+ aBF.SetFace(aFF);
+ aBF.SetContext(aCtx);
+ aBF.SetShapes(aSE);
+ // <-DEB
+ aBF.Perform();
+ //
+ const TopTools_ListOfShape& aLF=aBF.Areas();
+ aIt.Initialize(aLF);
+ for (; aIt.More(); aIt.Next()) {
+ TopoDS_Shape& aFR=aIt.Value();
+ if (anOriF==TopAbs_REVERSED) {
+ aFR.Orientation(TopAbs_REVERSED);
+ }
+ aLFR.Append(aFR);
}
- aLFR.Append(aFR);
}
//
// 2.3. Collect draft images Faces
//=======================================================================
void GEOMAlgo_Builder::FillImagesFaces1()
{
- Standard_Integer i, aNb, iSense;
+ Standard_Integer i, aNb, iSense, aNbLFx;
TopoDS_Face aF, aFSp, aFSD;
TopTools_ListOfShape aLFx;
TopTools_ListIteratorOfListOfShape aIt;
aLFx.Append(aFSD);
}
}
- if (!myImages.HasImage(aF)) {//XX
+ if (!myImages.HasImage(aF)) {
+ //modified by NIZNHY-PKV Wed Oct 27 14:41:34 2010f
+ aNbLFx=aLFx.Extent();
+ if (aNbLFx==1) {
+ const TopoDS_Shape& aFx=aLFx.First();
+ if (aF.IsSame(aFx)) {
+ continue;
+ }
+ }
+ //modified by NIZNHY-PKV Wed Oct 27 14:41:36 2010t
myImages.Bind(aF, aLFx);
}
}
theMFMV.Add(theNF, aMV);
}
}
+
+/*
+ {
+ TopoDS_Compound aCx;
+ BRep_Builder aBBx;
+ TopTools_ListIteratorOfListOfShape aItx;
+ //
+ aBBx.MakeCompound(aCx);
+ aBBx.Add(aCx, aFF);
+ aItx.Initialize(aSE);
+ for (; aItx.More(); aItx.Next()) {
+ TopoDS_Shape& aEx=aItx.Value();
+ aBBx.Add(aCx, aEx);
+ }
+ int a=0;
+ }
+ */
IntTools_Context& aCtx= pPF->ChangeContext();
//
Standard_Boolean bIsIN, bHasImage;
- Standard_Integer aNbS, aNbSolids, i, j, aNbFaces, aNbFP, aNbFPx, aNbFIN, aNbLIF;// k,
+ Standard_Integer aNbS, aNbSolids, i, j, aNbFaces, aNbFP, aNbFPx, aNbFIN, aNbLIF;
TopAbs_ShapeEnum aType;
TopAbs_State aState;
TopTools_IndexedMapOfShape aMSolids, aMS, aMFaces, aMFIN;
GEOMAlgo_DataMapOfShapeShapeSet aMSS;
GEOMAlgo_ShapeSet aSSi;
//
- //modified by NIZNHY-PKV Wed Dec 6 17:08:03 2006f
- //
// 0. Find same domain solids for non-interferred solids
aNbS=aDS.NumberOfShapesOfTheObject();
for (i=1; i<=aNbS; ++i) {
aMSS.Bind(aS, aSSi);
} //for (i=1; i<=aNbS; ++i)
//
- //modified by NIZNHY-PKV Wed Dec 6 17:08:09 2006t
- //
// 1. Build solids for interferred source solids
- //
aSB.SetContext(aCtx);
aNbS=myDraftSolids.Extent();
for (i=1; i<=aNbS; ++i) {
}
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.SetShapes(aSFS1);
//
const TopTools_ListOfShape& aLSR=aSB.Areas();
//
- // 1.4 Collect resulting solids and theirs set of faces
+ // 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);
+ const TopoDS_Shape& aF=aExp.Current();
+ aSSi.Add(aF);
}
aMSS.Bind(aSR, aSSi);
}
myImages.Bind(aS, aLSR);
}
} // for (i=1; i<=aNbS; ++i) {
- //modified by NIZNHY-PKV Wed Dec 6 17:07:47 2006f
- /*
- //
- // 2. 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(myImages.HasImage(aS)) {
- continue;
- }
- //
- aSSi.Clear();
- aSSi.Add(aS, TopAbs_FACE);
- //
- aItSS.Initialize(aMSS);
- for (; aItSS.More(); aItSS.Next()) {
- const TopoDS_Shape& aSR=aItSS.Key();
- const GEOMAlgo_ShapeSet& aSSR=aItSS.Value();
- if (aSSi.Contains(aSSR)) {
- myImages.Bind(aS, aSR);
- break;
- }
- }
- } //for (i=1; i<=aNbS; ++i)
- */
- //modified by NIZNHY-PKV Wed Dec 6 17:07:55 2006t
}
//=======================================================================
//function :FillInternalShapes
---Purpose: Returns the Set
returns ListOfShape from TopTools;
---C++: return const &
-
+ --modified by NIZNHY-PKV Wed Oct 28 13:51:45 2010f
+ IsEqual(me;
+ theOther: ShapeSet from GEOMAlgo)
+ ---Purpose: Returns True if the Set==theSet
+ returns Boolean from Standard;
+ ---C++: alias operator ==
+ --modified by NIZNHY-PKV Wed Oct 28 13:51:50 2010t
+
fields
myMap : MapOfOrientedShape from TopTools is protected;
myList : ListOfShape from TopTools is protected;
//=======================================================================
const TopTools_ListOfShape& GEOMAlgo_ShapeSet::GetSet()const
{
- /*
- TopTools_ListOfShape *pL;
- TopTools_MapIteratorOfMapOfOrientedShape aIt;
- //
- pL=(TopTools_ListOfShape *)&myList;
- pL->Clear();
- aIt.Initialize(myMap);
- for (; aIt.More(); aIt.Next()) {
- pL->Append(aIt.Key());
- }
- */
return myList;
}
//=======================================================================
//=======================================================================
void GEOMAlgo_ShapeSet::Subtract(const GEOMAlgo_ShapeSet& theOther)
{
- /*
- TopTools_MapIteratorOfMapOfOrientedShape aIt;
- //
- aIt.Initialize(theOther.myMap);
- for (; aIt.More(); aIt.Next()) {
- const TopoDS_Shape& aS=aIt.Key();
- myMap.Remove(aS);
- }
- */
- //
TopTools_ListIteratorOfListOfShape aIt;
TopTools_ListOfShape aLS;
//
//
myList=aLS;
}
+//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;
+ TopAbs_Orientation aOr;
+ 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;
+}
+//modified by NIZNHY-PKV Wed Oct 28 13:51:38 2010t
#ifndef _GEOMAlgo_ShapeSet_HeaderFile
#define _GEOMAlgo_ShapeSet_HeaderFile
+#ifndef _Standard_HeaderFile
+#include <Standard.hxx>
+#endif
+#ifndef _Standard_Macro_HeaderFile
+#include <Standard_Macro.hxx>
+#endif
+
#ifndef _TopTools_MapOfOrientedShape_HeaderFile
#include <TopTools_MapOfOrientedShape.hxx>
#endif
class TopoDS_Shape;
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-
//! Implementation some formal <br>
//! opereations with Set of shapes <br>
class GEOMAlgo_ShapeSet {
-
public:
- void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
- // Methods PUBLIC
- //
-
-//! Empty constructor <br>
-Standard_EXPORT GEOMAlgo_ShapeSet();
-
-//! Adds shapes from the list theLS to the Set <br>
-Standard_EXPORT void Add(const TopTools_ListOfShape& theLS) ;
-
-//! Adds shape theShape to the Set <br>
-Standard_EXPORT void Add(const TopoDS_Shape& theShape) ;
-
-//! Adds sub-shapes of shape theShape, <br>
+ void* operator new(size_t,void* anAddress)
+ {
+ return anAddress;
+ }
+ void* operator new(size_t size)
+ {
+ return Standard::Allocate(size);
+ }
+ void operator delete(void *anAddress)
+ {
+ if (anAddress) Standard::Free((Standard_Address&)anAddress);
+ }
+
+ //! Empty constructor <br>
+ Standard_EXPORT GEOMAlgo_ShapeSet();
+ //! Adds shapes from the list theLS to the Set <br>
+ Standard_EXPORT void Add(const TopTools_ListOfShape& theLS) ;
+ //! Adds shape theShape to the Set <br>
+ Standard_EXPORT void Add(const TopoDS_Shape& theShape) ;
+ //! Adds sub-shapes of shape theShape, <br>
//! that have type theType to the Set <br>
-Standard_EXPORT void Add(const TopoDS_Shape& theShape,const TopAbs_ShapeEnum theType) ;
-
-//! Removes shapes of theSet from the Set <br>
-Standard_EXPORT void Subtract(const GEOMAlgo_ShapeSet& theSet) ;
-
-//! Clears internal fields <br>
-Standard_EXPORT void Clear() ;
-
-//! Returns True if the Set contains <br>
+ Standard_EXPORT void Add(const TopoDS_Shape& theShape,const TopAbs_ShapeEnum theType) ;
+ //! Removes shapes of theSet from the Set <br>
+ Standard_EXPORT void Subtract(const GEOMAlgo_ShapeSet& theSet) ;
+ //! Clears internal fields <br>
+ Standard_EXPORT void Clear() ;
+ //! Returns True if the Set contains <br>
//! all shapes of theSet <br>
-Standard_EXPORT Standard_Boolean Contains(const GEOMAlgo_ShapeSet& theSet) const;
-
-//! Returns the Set <br>
-Standard_EXPORT const TopTools_ListOfShape& GetSet() const;
+ Standard_EXPORT Standard_Boolean Contains(const GEOMAlgo_ShapeSet& theSet) const;
+ //! Returns the Set <br>
+ Standard_EXPORT const TopTools_ListOfShape& GetSet() const;
+ //! Returns True if the Set==theSet <br>
+ Standard_EXPORT Standard_Boolean IsEqual(const GEOMAlgo_ShapeSet& theOther) const;
+ Standard_Boolean operator ==(const GEOMAlgo_ShapeSet& theOther) const
+{
+ return IsEqual(theOther);
+}
protected:
- // Methods PROTECTED
- //
- // Fields PROTECTED
- //
TopTools_MapOfOrientedShape myMap;
TopTools_ListOfShape myList;
-private:
+private:
- // Methods PRIVATE
- //
- // Fields PRIVATE
- //
};
// other Inline functions and methods (like "C++: function call" methods)
-//
#endif