1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0024023: Revamp the OCCT Handle -- downcast (automatic)

Automatic update by command "occt_upgrade . -downcast"

C-style cast of Handle to that of derived type (now illegal) is replaced by call to DownCast()
Const reference local variables of Handle type initialized by result of DownCast are replaced by normal variables.
This commit is contained in:
abv
2015-07-02 16:41:05 +03:00
parent ce8b059af3
commit c5f3a42524
158 changed files with 863 additions and 888 deletions

View File

@@ -1303,10 +1303,10 @@ Standard_Real ResolutionCoeff(const BRepAdaptor_Curve& theBAC,
//
switch (aCurveType) {
case GeomAbs_Circle :
aResCoeff = 1. / (2 * (*((Handle(Geom_Circle)*)&aCurve))->Circ().Radius());
aResCoeff = 1. / (2 * Handle(Geom_Circle)::DownCast (aCurve)->Circ().Radius());
break;
case GeomAbs_Ellipse :
aResCoeff = 1. / (*((Handle(Geom_Ellipse)*)&aCurve))->MajorRadius();
aResCoeff = 1. / Handle(Geom_Ellipse)::DownCast (aCurve)->MajorRadius();
break;
case GeomAbs_Hyperbola :
case GeomAbs_Parabola :
@@ -1365,10 +1365,10 @@ Standard_Real Resolution(const Handle(Geom_Curve)& theCurve,
break;
}
case GeomAbs_BezierCurve:
(*((Handle(Geom_BezierCurve)*)&theCurve))->Resolution(theR3D, aRes);
Handle(Geom_BezierCurve)::DownCast (theCurve)->Resolution(theR3D, aRes);
break;
case GeomAbs_BSplineCurve:
(*((Handle(Geom_BSplineCurve)*)&theCurve))->Resolution(theR3D, aRes);
Handle(Geom_BSplineCurve)::DownCast (theCurve)->Resolution(theR3D, aRes);
break;
default:
aRes = theResCoeff * theR3D;

View File

@@ -963,8 +963,7 @@ Standard_Real IntTools_FaceFace::ComputeTolerance()
//
const IntTools_Curve& aIC=mySeqOfCurve(1);
const Handle(Geom_Curve)& aC3D=aIC.Curve();
const Handle(Geom_BSplineCurve)& aBS=
Handle(Geom_BSplineCurve)::DownCast(aC3D);
Handle(Geom_BSplineCurve) aBS (Handle(Geom_BSplineCurve)::DownCast(aC3D));
if (aBS.IsNull()) {
return;
}
@@ -1061,8 +1060,7 @@ Standard_Real IntTools_FaceFace::ComputeTolerance()
if(typl==IntPatch_Walking) {
Handle(IntPatch_Line) anewL;
//
const Handle(IntPatch_WLine)& aWLine=
Handle(IntPatch_WLine)::DownCast(L);
Handle(IntPatch_WLine) aWLine (Handle(IntPatch_WLine)::DownCast(L));
//DumpWLine(aWLine);
anewL = ComputePurgedWLine(aWLine);
@@ -1071,7 +1069,7 @@ Standard_Real IntTools_FaceFace::ComputeTolerance()
}
L = anewL;
//const Handle(IntPatch_WLine)& aWLineX = Handle(IntPatch_WLine)::DownCast(L);
//Handle(IntPatch_WLine) aWLineX (Handle(IntPatch_WLine)::DownCast(L));
//DumpWLine(aWLineX);
//