Mantis issue 0020545: error in Partition with keep non-limit shapes.

This commit is contained in:
jfa 2009-11-05 08:55:21 +00:00
parent 27e9b15d0a
commit c34e09e68d

View File

@ -19,11 +19,9 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// File: GEOMAlgo_Splitter.cxx // File: GEOMAlgo_Splitter.cxx
// Created: // Author: Peter KURNEV
// Author: Peter KURNEV
// <pkv@irinox>
//
#include <GEOMAlgo_Splitter.ixx> #include <GEOMAlgo_Splitter.ixx>
#include <TopAbs_ShapeEnum.hxx> #include <TopAbs_ShapeEnum.hxx>
@ -45,13 +43,13 @@
#include <BOP_CorrectTolerances.hxx> #include <BOP_CorrectTolerances.hxx>
static static
void TreatCompound(const TopoDS_Shape& aC, void TreatCompound(const TopoDS_Shape& aC,
TopTools_ListOfShape& aLSX); TopTools_ListOfShape& aLSX);
//======================================================================= //=======================================================================
//function : //function :
//purpose : //purpose :
//======================================================================= //=======================================================================
GEOMAlgo_Splitter::GEOMAlgo_Splitter() GEOMAlgo_Splitter::GEOMAlgo_Splitter()
: :
@ -62,14 +60,14 @@ static
} }
//======================================================================= //=======================================================================
//function : ~ //function : ~
//purpose : //purpose :
//======================================================================= //=======================================================================
GEOMAlgo_Splitter::~GEOMAlgo_Splitter() GEOMAlgo_Splitter::~GEOMAlgo_Splitter()
{ {
} }
//======================================================================= //=======================================================================
//function : AddToolCompound //function : AddToolCompound
//purpose : //purpose :
//======================================================================= //=======================================================================
void GEOMAlgo_Splitter::AddToolCompound(const TopoDS_Shape& theShape) void GEOMAlgo_Splitter::AddToolCompound(const TopoDS_Shape& theShape)
{ {
@ -83,7 +81,7 @@ static
} }
//======================================================================= //=======================================================================
//function : AddTool //function : AddTool
//purpose : //purpose :
//======================================================================= //=======================================================================
void GEOMAlgo_Splitter::AddTool(const TopoDS_Shape& theShape) void GEOMAlgo_Splitter::AddTool(const TopoDS_Shape& theShape)
{ {
@ -95,7 +93,7 @@ static
} }
//======================================================================= //=======================================================================
//function : Tools //function : Tools
//purpose : //purpose :
//======================================================================= //=======================================================================
const TopTools_ListOfShape& GEOMAlgo_Splitter::Tools()const const TopTools_ListOfShape& GEOMAlgo_Splitter::Tools()const
{ {
@ -103,15 +101,15 @@ static
} }
//======================================================================= //=======================================================================
//function : SetLimit //function : SetLimit
//purpose : //purpose :
//======================================================================= //=======================================================================
void GEOMAlgo_Splitter::SetLimit(const TopAbs_ShapeEnum aLimit) void GEOMAlgo_Splitter::SetLimit(const TopAbs_ShapeEnum aLimit)
{ {
myLimit=aLimit; myLimit=aLimit;
} }
//======================================================================= //=======================================================================
//function : Limit //function : Limit
//purpose : //purpose :
//======================================================================= //=======================================================================
TopAbs_ShapeEnum GEOMAlgo_Splitter::Limit()const TopAbs_ShapeEnum GEOMAlgo_Splitter::Limit()const
{ {
@ -119,7 +117,7 @@ static
} }
//======================================================================= //=======================================================================
//function : SetLimitMode //function : SetLimitMode
//purpose : //purpose :
//======================================================================= //=======================================================================
void GEOMAlgo_Splitter::SetLimitMode(const Standard_Integer aMode) void GEOMAlgo_Splitter::SetLimitMode(const Standard_Integer aMode)
{ {
@ -127,7 +125,7 @@ static
} }
//======================================================================= //=======================================================================
//function : LimitMode //function : LimitMode
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Integer GEOMAlgo_Splitter::LimitMode()const Standard_Integer GEOMAlgo_Splitter::LimitMode()const
{ {
@ -135,7 +133,7 @@ static
} }
//======================================================================= //=======================================================================
//function : Clear //function : Clear
//purpose : //purpose :
//======================================================================= //=======================================================================
void GEOMAlgo_Splitter::Clear() void GEOMAlgo_Splitter::Clear()
{ {
@ -146,7 +144,7 @@ static
} }
//======================================================================= //=======================================================================
//function : BuildResult //function : BuildResult
//purpose : //purpose :
//======================================================================= //=======================================================================
void GEOMAlgo_Splitter::BuildResult(const TopAbs_ShapeEnum theType) void GEOMAlgo_Splitter::BuildResult(const TopAbs_ShapeEnum theType)
{ {
@ -163,26 +161,26 @@ static
aType=aS.ShapeType(); aType=aS.ShapeType();
if (aType==theType && !myMapTools.Contains(aS)) { if (aType==theType && !myMapTools.Contains(aS)) {
if (myImages.HasImage(aS)) { if (myImages.HasImage(aS)) {
const TopTools_ListOfShape& aLSIm=myImages.Image(aS); const TopTools_ListOfShape& aLSIm=myImages.Image(aS);
aItIm.Initialize(aLSIm); aItIm.Initialize(aLSIm);
for (; aItIm.More(); aItIm.Next()) { for (; aItIm.More(); aItIm.Next()) {
const TopoDS_Shape& aSIm=aItIm.Value(); const TopoDS_Shape& aSIm=aItIm.Value();
if (aM.Add(aSIm)) { if (aM.Add(aSIm)) {
aBB.Add(myShape, aSIm); aBB.Add(myShape, aSIm);
} }
} }
} }
else { else {
if (aM.Add(aS)) { if (aM.Add(aS)) {
aBB.Add(myShape, aS); aBB.Add(myShape, aS);
} }
} }
} }
} }
} }
//======================================================================= //=======================================================================
//function : PostTreat //function : PostTreat
//purpose : //purpose :
//======================================================================= //=======================================================================
void GEOMAlgo_Splitter::PostTreat() void GEOMAlgo_Splitter::PostTreat()
{ {
@ -200,7 +198,7 @@ static
const TopoDS_Shape& aS=aMx(i); const TopoDS_Shape& aS=aMx(i);
aBB.Add(aC, aS); aBB.Add(aC, aS);
} }
//modified by NIZNHY-PKV Thu Feb 15 17:09:32 2007f //
if (myLimitMode) { if (myLimitMode) {
Standard_Integer iType, iLimit, iTypeX; Standard_Integer iType, iLimit, iTypeX;
TopAbs_ShapeEnum aType, aTypeX; TopAbs_ShapeEnum aType, aTypeX;
@ -208,63 +206,77 @@ static
TopTools_ListIteratorOfListOfShape aIt, aItX, aItIm; TopTools_ListIteratorOfListOfShape aIt, aItX, aItIm;
TopTools_MapOfShape aM; TopTools_MapOfShape aM;
// //
iLimit=(Standard_Integer)myLimit; iLimit=(Standard_Integer)myLimit;
// //
// 1. Collect the shapes to process aLSP // 1. Collect the shapes to process aLSP
aIt.Initialize(myShapes); aIt.Initialize(myShapes);
for (; aIt.More(); aIt.Next()) { for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS=aIt.Value(); const TopoDS_Shape& aS=aIt.Value();
if (myMapTools.Contains(aS)) { if (myMapTools.Contains(aS)) {
continue; continue;
} }
// //
aType=aS.ShapeType(); aType=aS.ShapeType();
iType=(Standard_Integer)aType; iType=(Standard_Integer)aType;
// //
if (iType>iLimit) { if (iType>iLimit) {
aLSP.Append(aS); aLSP.Append(aS);
} }
// //
else if (aType==TopAbs_COMPOUND) { else if (aType==TopAbs_COMPOUND) {
aLSX.Clear(); aLSX.Clear();
// //
TreatCompound(aS, aLSX); TreatCompound(aS, aLSX);
// //
aItX.Initialize(aLSX); aItX.Initialize(aLSX);
for (; aItX.More(); aItX.Next()) { for (; aItX.More(); aItX.Next()) {
const TopoDS_Shape& aSX=aItX.Value(); const TopoDS_Shape& aSX=aItX.Value();
aTypeX=aSX.ShapeType(); aTypeX=aSX.ShapeType();
iTypeX=(Standard_Integer)aTypeX; iTypeX=(Standard_Integer)aTypeX;
// //
if (iTypeX>iLimit) { if (iTypeX>iLimit) {
aLSP.Append(aSX); aLSP.Append(aSX);
} }
} }
} }
}// for (; aIt.More(); aIt.Next()) { }// for (; aIt.More(); aIt.Next()) {
// //
//modified by NIZNHY-PKV Fri Oct 30 11:07:08 2009 f
aMx.Clear();
TopExp::MapShapes(aC, aMx);
//modified by NIZNHY-PKV Fri Oct 30 11:12:30 2009t
//
// 2. Add them to aC // 2. Add them to aC
aIt.Initialize(aLSP); aIt.Initialize(aLSP);
for (; aIt.More(); aIt.Next()) { for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS=aIt.Value(); const TopoDS_Shape& aS=aIt.Value();
if (myImages.HasImage(aS)) { if (myImages.HasImage(aS)) {
const TopTools_ListOfShape& aLSIm=myImages.Image(aS); const TopTools_ListOfShape& aLSIm=myImages.Image(aS);
aItIm.Initialize(aLSIm); aItIm.Initialize(aLSIm);
for (; aItIm.More(); aItIm.Next()) { for (; aItIm.More(); aItIm.Next()) {
const TopoDS_Shape& aSIm=aItIm.Value(); const TopoDS_Shape& aSIm=aItIm.Value();
if (aM.Add(aSIm)) { if (aM.Add(aSIm)) {
aBB.Add(aC, aSIm); //modified by NIZNHY-PKV Fri Oct 30 11:09:57 2009f
} if (!aMx.Contains(aSIm)) {
} aBB.Add(aC, aSIm);
} }
else { //aBB.Add(aC, aSIm);
if (aM.Add(aS)) { //modified by NIZNHY-PKV Fri Oct 30 11:10:02 2009
aBB.Add(aC, aS); }
} }
} }
else {
if (aM.Add(aS)) {
//modified by NIZNHY-PKV Fri Oct 30 11:10:46 2009f
if (!aMx.Contains(aS)) {
aBB.Add(aC, aS);
}
//aBB.Add(aC, aS);
//modified by NIZNHY-PKV Fri Oct 30 11:11:00 2009t
}
}
} }
}// if (myLimitMode) { }// if (myLimitMode) {
//modified by NIZNHY-PKV Thu Feb 15 17:09:34 2007t
myShape=aC; myShape=aC;
}//if (myLimit!=TopAbs_SHAPE) { }//if (myLimit!=TopAbs_SHAPE) {
// //
@ -272,10 +284,10 @@ static
} }
//======================================================================= //=======================================================================
//function : TreatCompound //function : TreatCompound
//purpose : //purpose :
//======================================================================= //=======================================================================
void TreatCompound(const TopoDS_Shape& aC1, void TreatCompound(const TopoDS_Shape& aC1,
TopTools_ListOfShape& aLSX) TopTools_ListOfShape& aLSX)
{ {
Standard_Integer aNbC1; Standard_Integer aNbC1;
TopAbs_ShapeEnum aType; TopAbs_ShapeEnum aType;
@ -292,14 +304,14 @@ void TreatCompound(const TopoDS_Shape& aC1,
// //
aItC.Initialize(aC); aItC.Initialize(aC);
for (; aItC.More(); aItC.Next()) { for (; aItC.More(); aItC.Next()) {
const TopoDS_Shape& aS=aItC.Value(); const TopoDS_Shape& aS=aItC.Value();
aType=aS.ShapeType(); aType=aS.ShapeType();
if (aType==TopAbs_COMPOUND) { if (aType==TopAbs_COMPOUND) {
aLC1.Append(aS); aLC1.Append(aS);
} }
else { else {
aLSX.Append(aS); aLSX.Append(aS);
} }
} }
} }
// //
@ -318,7 +330,7 @@ void TreatCompound(const TopoDS_Shape& aC1,
} }
// //
// myErrorStatus // myErrorStatus
// //
// 0 - Ok // 0 - Ok
// 1 - The object is just initialized // 1 - The object is just initialized
// 2 - PaveFiller is failed // 2 - PaveFiller is failed