1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0027104: DownCast() cannot return null for mismatched handle

Method DownCast() is made template, to be available only when argument is actually a pointer or handle to a base class.

For compatibility with existing code, method DownCast() that can be used for the same type, derived, or unrelated class (i.e. where there is no actual down casting) is still available, its use shall cause "deprecated" compiler warning.

OCCT code is updated to remove meaningless DownCast()s; a few places where DownCast() was used with argument of unrelated type are corrected.

DRAW command QAHandleCast is removed (it was useful only during redesign of handles).
This commit is contained in:
abv
2016-01-25 10:14:20 +03:00
parent 5d351a0822
commit a9dde4a31b
65 changed files with 190 additions and 380 deletions

View File

@@ -161,11 +161,10 @@ void GeomAdaptor_Surface::load(const Handle(Geom_Surface)& S,
Handle(Geom_SurfaceOfRevolution)::DownCast(mySurface);
// Create nested adaptor for base curve
Handle(Geom_Curve) aBaseCurve = myRevSurf->BasisCurve();
Handle(GeomAdaptor_HCurve) aBaseAdaptor = new GeomAdaptor_HCurve(aBaseCurve);
Handle(Adaptor3d_HCurve) aBaseAdaptor = new GeomAdaptor_HCurve(aBaseCurve);
// Create corresponding evaluator
myNestedEvaluator = new GeomEvaluator_SurfaceOfRevolution(
Handle(Adaptor3d_HCurve)::DownCast(aBaseAdaptor),
myRevSurf->Direction(), myRevSurf->Location());
myNestedEvaluator =
new GeomEvaluator_SurfaceOfRevolution (aBaseAdaptor, myRevSurf->Direction(), myRevSurf->Location());
}
else if ( TheType == STANDARD_TYPE(Geom_SurfaceOfLinearExtrusion))
{
@@ -174,10 +173,10 @@ void GeomAdaptor_Surface::load(const Handle(Geom_Surface)& S,
Handle(Geom_SurfaceOfLinearExtrusion)::DownCast(mySurface);
// Create nested adaptor for base curve
Handle(Geom_Curve) aBaseCurve = myExtSurf->BasisCurve();
Handle(GeomAdaptor_HCurve) aBaseAdaptor = new GeomAdaptor_HCurve(aBaseCurve);
Handle(Adaptor3d_HCurve) aBaseAdaptor = new GeomAdaptor_HCurve(aBaseCurve);
// Create corresponding evaluator
myNestedEvaluator = new GeomEvaluator_SurfaceOfExtrusion(
Handle(Adaptor3d_HCurve)::DownCast(aBaseAdaptor), myExtSurf->Direction());
myNestedEvaluator =
new GeomEvaluator_SurfaceOfExtrusion (aBaseAdaptor, myExtSurf->Direction());
}
else if (TheType == STANDARD_TYPE(Geom_BezierSurface))
{