Mantis issue 0021129: EDF 1541 GEOM: Problem with GetInPlace.

This commit is contained in:
jfa 2011-06-16 09:30:35 +00:00
parent 82dd601449
commit 10e60380a9
2 changed files with 161 additions and 154 deletions

View File

@ -19,9 +19,9 @@
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: GEOMAlgo_GetInPlace.cxx
// File: GEOMAlgo_GetInPlace.cxx
// Created:
// Author: Peter KURNEV
// Author: Peter KURNEV
#include <GEOMAlgo_GetInPlace.hxx>
@ -65,7 +65,7 @@
static
void MapBRepShapes(const TopoDS_Shape& aS,
TopTools_IndexedMapOfShape& aM);
TopTools_IndexedMapOfShape& aM);
//=======================================================================
@ -316,7 +316,10 @@ void GEOMAlgo_GetInPlace::Intersect()
//
const TopoDS_Shape& aS1=aMS1(i);
BRepBndLib::Add(aS1, aBox1);
aBox1.SetGap(myTolerance);
//modified by NIZNHY-PKV Fri Jun 10 08:20:03 2011f
//aBox1.SetGap(myTolerance);
aBox1.Enlarge(myTolerance);
//modified by NIZNHY-PKV Fri Jun 10 08:20:06 2011t
//
aTreeFiller.Add(i, aBox1);
}
@ -330,7 +333,10 @@ void GEOMAlgo_GetInPlace::Intersect()
//
const TopoDS_Shape& aS2=aMS2(j);
BRepBndLib::Add(aS2, aBox2);
aBox2.SetGap(myTolerance);
//modified by NIZNHY-PKV Fri Jun 10 08:20:23 2011f
//aBox2.SetGap(myTolerance);
aBox2.Enlarge(myTolerance);
//modified by NIZNHY-PKV Fri Jun 10 08:20:25 2011t
//
aSelector.Clear();
aSelector.SetBox(aBox2);
@ -346,14 +352,14 @@ void GEOMAlgo_GetInPlace::Intersect()
const TopoDS_Shape& aS1=aMS1(i);
//
if (aDMSLS.IsBound(aS1)) {
TopTools_ListOfShape& aLS=aDMSLS.ChangeFind(aS1);
aLS.Append(aS2);
TopTools_ListOfShape& aLS=aDMSLS.ChangeFind(aS1);
aLS.Append(aS2);
}
else {
TopTools_ListOfShape aLS;
//
aLS.Append(aS2);
aDMSLS.Bind(aS1, aLS);
TopTools_ListOfShape aLS;
//
aLS.Append(aS2);
aDMSLS.Bind(aS1, aLS);
}
}
}// for (j=1; j<=aNbS2; ++j) {
@ -395,7 +401,7 @@ void GEOMAlgo_GetInPlace::PerformVV()
//=======================================================================
void GEOMAlgo_GetInPlace::FillEdgesOn()
{
Standard_Integer i, aNbE, aNbSOn;
Standard_Integer i, aNbE;
TopoDS_Iterator aIt;
TopTools_IndexedMapOfShape aME;
TopTools_MapIteratorOfMapOfShape aItMS;
@ -412,13 +418,13 @@ void GEOMAlgo_GetInPlace::FillEdgesOn()
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aV1=aIt.Value();
if (myShapesOn.IsBound(aV1)) {
const TopTools_MapOfShape& aMSOn=myShapesOn.Find(aV1);
aNbSOn=aMSOn.Extent();
aItMS.Initialize(aMSOn);
for (; aItMS.More(); aItMS.Next()) {
const TopoDS_Shape& aV2=aItMS.Key();
FillShapesOn(aE1, aV2);
}
const TopTools_MapOfShape& aMSOn=myShapesOn.Find(aV1);
//aNbSOn=aMSOn.Extent();
aItMS.Initialize(aMSOn);
for (; aItMS.More(); aItMS.Next()) {
const TopoDS_Shape& aV2=aItMS.Key();
FillShapesOn(aE1, aV2);
}
}
}
}
@ -444,7 +450,7 @@ void GEOMAlgo_GetInPlace::PerformVE()
if (myShapesOn.IsBound(aE1)) {
const TopTools_MapOfShape& aMSOn=myShapesOn.Find(aE1);
if (aMSOn.Contains(aV2)) {
continue;
continue;
}
}
//
@ -486,8 +492,8 @@ void GEOMAlgo_GetInPlace::PerformEE()
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aV2=aIt.Value();
if (!(aMSOn.Contains(aV2) || aMSIn.Contains(aV2))) {
bFound=!bFound;
break;
bFound=!bFound;
break;
}
}
if (!bFound) {
@ -531,7 +537,7 @@ void GEOMAlgo_GetInPlace::PerformVF()
for (i=1; i<=aNbE; ++i) {
const TopoDS_Edge& aE1=*((TopoDS_Edge*)&aME(i));
if (BRep_Tool::Degenerated(aE1)) {
continue;
continue;
}
//
bHasOn=myShapesOn.IsBound(aE1);
@ -540,7 +546,7 @@ void GEOMAlgo_GetInPlace::PerformVF()
const TopTools_MapOfShape& aMSIn=(bHasIn) ? myShapesIn.Find(aE1) : aMSX;
bFound= (aMSOn.Contains(aV2) || aMSIn.Contains(aV2));
if (bFound) {
break;
break;
}
}
//
@ -563,7 +569,7 @@ void GEOMAlgo_GetInPlace::PerformVF()
//=======================================================================
void GEOMAlgo_GetInPlace::FillFacesOn()
{
Standard_Integer i, j, aNbF, aNbE, aNbSOn;
Standard_Integer i, j, aNbF, aNbE;
TopoDS_Iterator aIt;
TopTools_IndexedMapOfShape aMF, aME;
TopTools_MapIteratorOfMapOfShape aItMS;
@ -579,25 +585,25 @@ void GEOMAlgo_GetInPlace::FillFacesOn()
for (j=1; j<=aNbE; ++j) {
const TopoDS_Edge& aE1=*((TopoDS_Edge*)&aME(j));
if (BRep_Tool::Degenerated(aE1)) {
continue;
continue;
}
//
if (myShapesOn.IsBound(aE1)) {
const TopTools_MapOfShape& aMSOn=myShapesOn.Find(aE1);
aItMS.Initialize(aMSOn);
for (; aItMS.More(); aItMS.Next()) {
const TopoDS_Shape& aS2=aItMS.Key();
FillShapesOn(aF1, aS2);
}
const TopTools_MapOfShape& aMSOn=myShapesOn.Find(aE1);
aItMS.Initialize(aMSOn);
for (; aItMS.More(); aItMS.Next()) {
const TopoDS_Shape& aS2=aItMS.Key();
FillShapesOn(aF1, aS2);
}
}
//
if (myShapesIn.IsBound(aE1)) {
const TopTools_MapOfShape& aMSIn=myShapesIn.Find(aE1);
aItMS.Initialize(aMSIn);
for (; aItMS.More(); aItMS.Next()) {
const TopoDS_Shape& aS2=aItMS.Key();
FillShapesOn(aF1, aS2);
}
const TopTools_MapOfShape& aMSIn=myShapesIn.Find(aE1);
aItMS.Initialize(aMSIn);
for (; aItMS.More(); aItMS.Next()) {
const TopoDS_Shape& aS2=aItMS.Key();
FillShapesOn(aF1, aS2);
}
}
}//for (j=1; j<=aNbE; ++j) {
}//for (i=1; i<=aNbF; ++i) {
@ -609,7 +615,6 @@ void GEOMAlgo_GetInPlace::FillFacesOn()
void GEOMAlgo_GetInPlace::PerformEF()
{
Standard_Boolean bFound, bHasOnF, bHasInF;
Standard_Integer i, aNbE;
TopoDS_Iterator aIt;
TopTools_MapOfShape aMSX;
//
@ -639,7 +644,7 @@ void GEOMAlgo_GetInPlace::PerformEF()
const TopoDS_Shape& aV2=aIt.Value();
bFound=(aMSOnF.Contains(aV2) || aMSInF.Contains(aV2));
if (!bFound) {
break;
break;
}
}
if (!bFound) {
@ -689,11 +694,11 @@ void GEOMAlgo_GetInPlace::PerformFF()
for (i=1; i<=aNbS2; ++i) {
const TopoDS_Shape& aS2=aMS2(i);
if (aS2.IsSame(aF2)) {
continue;
continue;
}
bFound=(aMSOnF.Contains(aS2) || aMSInF.Contains(aS2));
if (!bFound) {
break;
break;
}
}
if (!bFound) {
@ -715,7 +720,7 @@ void GEOMAlgo_GetInPlace::PerformFF()
//=======================================================================
void GEOMAlgo_GetInPlace::FillSolidsOn()
{
Standard_Integer i, j, aNbS, aNbF, aNbSOn;
Standard_Integer i, j, aNbS, aNbF;
TopTools_IndexedMapOfShape aMS, aMF;
TopTools_MapIteratorOfMapOfShape aItMS;
//
@ -732,21 +737,21 @@ void GEOMAlgo_GetInPlace::FillSolidsOn()
const TopoDS_Shape& aF1=aMF(j);
//
if (myShapesOn.IsBound(aF1)) {
const TopTools_MapOfShape& aMSOn=myShapesOn.Find(aF1);
aItMS.Initialize(aMSOn);
for (; aItMS.More(); aItMS.Next()) {
const TopoDS_Shape& aS2=aItMS.Key();
FillShapesOn(aSD1, aS2);
}
const TopTools_MapOfShape& aMSOn=myShapesOn.Find(aF1);
aItMS.Initialize(aMSOn);
for (; aItMS.More(); aItMS.Next()) {
const TopoDS_Shape& aS2=aItMS.Key();
FillShapesOn(aSD1, aS2);
}
}
//
if (myShapesIn.IsBound(aF1)) {
const TopTools_MapOfShape& aMSIn=myShapesIn.Find(aF1);
aItMS.Initialize(aMSIn);
for (; aItMS.More(); aItMS.Next()) {
const TopoDS_Shape& aS2=aItMS.Key();
FillShapesOn(aSD1, aS2);
}
const TopTools_MapOfShape& aMSIn=myShapesIn.Find(aF1);
aItMS.Initialize(aMSIn);
for (; aItMS.More(); aItMS.Next()) {
const TopoDS_Shape& aS2=aItMS.Key();
FillShapesOn(aSD1, aS2);
}
}
}//for (j=1; j<=aNbF; ++j) {
}//for (i=1; i<=aNbS; ++i) {
@ -757,8 +762,7 @@ void GEOMAlgo_GetInPlace::FillSolidsOn()
//=======================================================================
void GEOMAlgo_GetInPlace::PerformZF()
{
Standard_Boolean bFound, bHasOnF, bHasInF;
Standard_Integer i, aNbE;
Standard_Boolean bFound, bHasOnF;
TopTools_MapOfShape aMSX;
//
myErrorStatus=0;
@ -824,17 +828,17 @@ void GEOMAlgo_GetInPlace::PerformZZ()
const TopoDS_Shape& aF2=aMS2(i);
//
if (aMSIn.Contains(aF2)) {
++iCntIn;
bFound=Standard_True;
break;
++iCntIn;
bFound=Standard_True;
break;
}
else if (!aMSOn.Contains(aF2)) {
++iCntOut;
bFound=Standard_False;// out
break;
++iCntOut;
bFound=Standard_False;// out
break;
}
else {
++iCntOn; //on
++iCntOn; //on
}
}
//
@ -845,7 +849,7 @@ void GEOMAlgo_GetInPlace::PerformZZ()
if (!iCntIn) {
bFound=CheckCoincidence(aSo1, aSo2);
if (myErrorStatus) {
return;
return;
}
}
if (bFound) {
@ -885,8 +889,8 @@ void GEOMAlgo_GetInPlace::FillImages()
aLSx.Clear();
aItMS.Initialize(aMSx);
for (; aItMS.More(); aItMS.Next()) {
const TopoDS_Shape& aVx=aItMS.Key();
aLSx.Append(aVx);
const TopoDS_Shape& aVx=aItMS.Key();
aLSx.Append(aVx);
}
//
myImages.Bind(aV, aLSx);
@ -906,11 +910,11 @@ void GEOMAlgo_GetInPlace::FillImages()
aLSx.Clear();
aItMS.Initialize(aMSx);
for (; aItMS.More(); aItMS.Next()) {
const TopoDS_Shape& aEx=aItMS.Key();
aType=aEx.ShapeType();
if (aType==TopAbs_EDGE){
aLSx.Append(aEx);
}
const TopoDS_Shape& aEx=aItMS.Key();
aType=aEx.ShapeType();
if (aType==TopAbs_EDGE){
aLSx.Append(aEx);
}
}
//
myImages.Bind(aE, aLSx);
@ -928,14 +932,14 @@ void GEOMAlgo_GetInPlace::FillImages()
for(; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aE=aIt.Value();
if (myImages.IsBound(aE)) {
const TopTools_ListOfShape& aLSi=myImages.Find(aE);
aNbSi=aLSi.Extent();
//
aItLS.Initialize(aLSi);
for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aEi=aItLS.Value();
aLSx.Append(aEi);
}
const TopTools_ListOfShape& aLSi=myImages.Find(aE);
aNbSi=aLSi.Extent();
//
aItLS.Initialize(aLSi);
for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aEi=aItLS.Value();
aLSx.Append(aEi);
}
}
}
myImages.Bind(aW, aLSx);
@ -954,11 +958,11 @@ void GEOMAlgo_GetInPlace::FillImages()
aLSx.Clear();
aItMS.Initialize(aMSx);
for (; aItMS.More(); aItMS.Next()) {
const TopoDS_Shape& aFx=aItMS.Key();
aType=aFx.ShapeType();
if (aType==TopAbs_FACE){
aLSx.Append(aFx);
}
const TopoDS_Shape& aFx=aItMS.Key();
aType=aFx.ShapeType();
if (aType==TopAbs_FACE){
aLSx.Append(aFx);
}
}
//
myImages.Bind(aF, aLSx);
@ -976,14 +980,14 @@ void GEOMAlgo_GetInPlace::FillImages()
for(; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aF=aIt.Value();
if (myImages.IsBound(aF)) {
const TopTools_ListOfShape& aLSi=myImages.Find(aF);
aNbSi=aLSi.Extent();
//
aItLS.Initialize(aLSi);
for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aFi=aItLS.Value();
aLSx.Append(aFi);
}
const TopTools_ListOfShape& aLSi=myImages.Find(aF);
aNbSi=aLSi.Extent();
//
aItLS.Initialize(aLSi);
for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aFi=aItLS.Value();
aLSx.Append(aFi);
}
}
}
myImages.Bind(aSh, aLSx);
@ -1002,11 +1006,11 @@ void GEOMAlgo_GetInPlace::FillImages()
aLSx.Clear();
aItMS.Initialize(aMSx);
for (; aItMS.More(); aItMS.Next()) {
const TopoDS_Shape& aZx=aItMS.Key();
aType=aZx.ShapeType();
if (aType==TopAbs_SOLID){
aLSx.Append(aZx);
}
const TopoDS_Shape& aZx=aItMS.Key();
aType=aZx.ShapeType();
if (aType==TopAbs_SOLID){
aLSx.Append(aZx);
}
}
//
myImages.Bind(aZ, aLSx);
@ -1024,14 +1028,14 @@ void GEOMAlgo_GetInPlace::FillImages()
for(; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aZ=aIt.Value();
if (myImages.IsBound(aZ)) {
const TopTools_ListOfShape& aLSi=myImages.Find(aZ);
aNbSi=aLSi.Extent();
//
aItLS.Initialize(aLSi);
for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aZi=aItLS.Value();
aLSx.Append(aZi);
}
const TopTools_ListOfShape& aLSi=myImages.Find(aZ);
aNbSi=aLSi.Extent();
//
aItLS.Initialize(aLSi);
for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aZi=aItLS.Value();
aLSx.Append(aZi);
}
}
}
myImages.Bind(aCs, aLSx);
@ -1067,8 +1071,8 @@ void GEOMAlgo_GetInPlace::FillImagesCompound(const TopoDS_Shape& aS)
const TopTools_ListOfShape& aLSi=myImages.Find(aSx);
aItLS.Initialize(aLSi);
for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aSi=aItLS.Value();
aLSx.Append(aSi);
const TopoDS_Shape& aSi=aItLS.Value();
aLSx.Append(aSi);
}
}
}
@ -1080,7 +1084,7 @@ void GEOMAlgo_GetInPlace::FillImagesCompound(const TopoDS_Shape& aS)
//purpose :
//=======================================================================
void GEOMAlgo_GetInPlace::FillShapesIn(const TopoDS_Shape& aS1,
const TopoDS_Shape& aS2)
const TopoDS_Shape& aS2)
{
if (myShapesIn.IsBound(aS1)) {
TopTools_MapOfShape& aMS=myShapesIn.ChangeFind(aS1);
@ -1098,7 +1102,7 @@ void GEOMAlgo_GetInPlace::FillShapesIn(const TopoDS_Shape& aS1,
//purpose :
//=======================================================================
void GEOMAlgo_GetInPlace::FillShapesOn(const TopoDS_Shape& aS1,
const TopoDS_Shape& aS2)
const TopoDS_Shape& aS2)
{
if (myShapesOn.IsBound(aS1)) {
TopTools_MapOfShape& aMS=myShapesOn.ChangeFind(aS1);
@ -1116,9 +1120,9 @@ void GEOMAlgo_GetInPlace::FillShapesOn(const TopoDS_Shape& aS1,
//purpose :
//=======================================================================
void MapBRepShapes(const TopoDS_Shape& aS,
TopTools_IndexedMapOfShape& aM)
TopTools_IndexedMapOfShape& aM)
{
Standard_Boolean bHasBRep, bDegenerated;
Standard_Boolean bDegenerated;
TopAbs_ShapeEnum aType;
TopoDS_Iterator aIt;
//

View File

@ -3858,10 +3858,13 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlace (Handle(GEOM_Object)
return NULL;
}
if (!aGIP.IsFound()) {
SetErrorCode(NOT_FOUND_ANY);
return NULL;
}
// aGIP.IsFound() returns true only when the whole theShapeWhat
// is found (as one shape or several parts). But we are also interested
// in the partial result, that is why this check is commented.
//if (!aGIP.IsFound()) {
// SetErrorCode(NOT_FOUND_ANY);
// return NULL;
//}
const TopTools_DataMapOfShapeListOfShape& aDMSLS = aGIP.Images();
if (!aDMSLS.IsBound(aWhat)) {
@ -3871,7 +3874,7 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlace (Handle(GEOM_Object)
// the list of shapes aLSA contains the shapes
// of the Shape For Search that corresponds
// to the Argument aWhat
// to the Argument aWhat
const TopTools_ListOfShape& aLSA = aDMSLS.Find(aWhat);
if (aLSA.Extent() == 0) {
SetErrorCode(NOT_FOUND_ANY); // Not found any Results