1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-05 18:16:23 +03:00

0022938: HLRBRep_InternalAlgo.cxx

This commit is contained in:
DBV 2012-02-17 11:11:03 +00:00 committed by bugmaster
parent 64efb152a0
commit b8f2022a11

View File

@ -7,6 +7,7 @@
#include <HLRBRep_InternalAlgo.ixx>
#include <Standard_ErrorHandler.hxx>
#include <TColStd_Array1OfReal.hxx>
#include <HLRAlgo.hxx>
#include <HLRBRep_ShapeToHLR.hxx>
#include <HLRBRep_Hider.hxx>
@ -792,29 +793,29 @@ void HLRBRep_InternalAlgo::HideSelected (const Standard_Integer I,
//--
Standard_Integer *Val = new Standard_Integer [nf+1];
Standard_Real *Size = new Standard_Real [nf+1];
Standard_Integer *Index = new Standard_Integer [nf+1];
TColStd_Array1OfInteger Val(1, nf);
TColStd_Array1OfReal Size(1, nf);
TColStd_Array1OfInteger Index(1, nf);
fd = &(myDS->FDataArray().ChangeValue(1));
for (f = 1; f <= nf; f++) {
if(fd->Plane()) Val[f]=10;
else if(fd->Cylinder()) Val[f]=9;
else if(fd->Cone()) Val[f]=8;
else if(fd->Sphere()) Val[f]=7;
else if(fd->Torus()) Val[f]=6;
else Val[f]=0;
if(fd->Cut()) Val[f]-=10;
if(fd->Side()) Val[f]-=100;
if(fd->WithOutL()) Val[f]-=20;
if(fd->Plane()) Val(f)=10;
else if(fd->Cylinder()) Val(f)=9;
else if(fd->Cone()) Val(f)=8;
else if(fd->Sphere()) Val(f)=7;
else if(fd->Torus()) Val(f)=6;
else Val(f)=0;
if(fd->Cut()) Val(f)-=10;
if(fd->Side()) Val(f)-=100;
if(fd->WithOutL()) Val(f)-=20;
Size[f]=fd->Size();
Size(f)=fd->Size();
fd++;
}
for(Standard_Integer tt=1;tt<=nf;tt++) {
Index[tt]=tt;
Index(tt)=tt;
}
//-- ======================================================================
@ -823,13 +824,13 @@ void HLRBRep_InternalAlgo::HideSelected (const Standard_Integer I,
Standard_Integer t,tp1;
TriOk=Standard_True;
for(t=1,tp1=2;t<nf;t++,tp1++) {
if(Val[Index[t]]<Val[Index[tp1]]) {
Standard_Integer q=Index[t]; Index[t]=Index[tp1]; Index[tp1]=q;
if(Val(Index(t))<Val(Index(tp1))) {
Standard_Integer q=Index(t); Index(t)=Index(tp1); Index(tp1)=q;
TriOk=Standard_False;
}
else if(Val[Index[t]]==Val[Index[tp1]]) {
if(Size[Index[t]]<Size[Index[tp1]]) {
Standard_Integer q=Index[t]; Index[t]=Index[tp1]; Index[tp1]=q;
else if(Val(Index(t))==Val(Index(tp1))) {
if(Size(Index(t))<Size(Index(tp1))) {
Standard_Integer q=Index(t); Index(t)=Index(tp1); Index(tp1)=q;
TriOk=Standard_False;
}
}
@ -845,13 +846,13 @@ void HLRBRep_InternalAlgo::HideSelected (const Standard_Integer I,
ir=nf;
for(;;) {
if(l>1) {
rra=Index[--l];
rra=Index(--l);
}
else {
rra=Index[ir];
Index[ir]=Index[1];
rra=Index(ir);
Index(ir)=Index(1);
if(--ir == 1) {
Index[1]=rra;
Index(1)=rra;
break;
}
}
@ -859,20 +860,20 @@ void HLRBRep_InternalAlgo::HideSelected (const Standard_Integer I,
j=l+l;
while(j<=ir) {
if(j<ir) {
if(Val[Index[j]] > Val[Index[j+1]])
if(Val(Index(j)) > Val(Index(j+1)))
j++;
else if(Val[Index[j]] == Val[Index[j+1]]) {
if(Size[Index[j]] > Size[Index[j+1]])
else if(Val(Index(j)) == Val(Index(j+1))) {
if(Size(Index(j)) > Size(Index(j+1)))
j++;
}
}
if(Val[rra] > Val[Index[j]]) {
Index[i]=Index[j];
if(Val(rra) > Val(Index(j))) {
Index(i)=Index(j);
i=j;
j<<=1;
}
else if((Val[rra] == Val[Index[j]]) && (Size[rra] > Size[Index[j]])) {
Index[i]=Index[j];
else if((Val(rra) == Val(Index(j))) && (Size(rra) > Size(Index(j)))) {
Index(i)=Index(j);
i=j;
j<<=1;
}
@ -880,7 +881,7 @@ void HLRBRep_InternalAlgo::HideSelected (const Standard_Integer I,
j=ir+1;
}
}
Index[i]=rra;
Index(i)=rra;
}
}
@ -889,7 +890,7 @@ void HLRBRep_InternalAlgo::HideSelected (const Standard_Integer I,
QWE=0;
for (f = 1; f <= nf; f++) {
Standard_Integer fi = Index[f];
Standard_Integer fi = Index(f);
fd=&(FD.ChangeValue(fi));
if (fd->Selected()) {
if (fd->Hiding()) {
@ -910,10 +911,6 @@ void HLRBRep_InternalAlgo::HideSelected (const Standard_Integer I,
}
}
delete Val;
delete Size;
delete Index;
#ifdef DEB
if (myDebug) {
fd = &(myDS->FDataArray().ChangeValue(1));