diff --git a/src/HLRBRep/HLRBRep_InternalAlgo.cxx b/src/HLRBRep/HLRBRep_InternalAlgo.cxx index 8974b872cd..1a1a1a06d4 100755 --- a/src/HLRBRep/HLRBRep_InternalAlgo.cxx +++ b/src/HLRBRep/HLRBRep_InternalAlgo.cxx @@ -7,6 +7,7 @@ #include #include +#include #include #include #include @@ -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;t1) { - 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 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));