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

0024955: Misuse of DownCast

Code where DownCast was applied to Handle of the type being not a base class of the target one is revised and (hopefully) corrected.
Code corrected following review remarks
GeomConvert::CurveToBSplineCurve() is called even for b-spline curves to ensure that result is non-periodic
Check for conic is corrected
This commit is contained in:
abv
2014-06-05 14:14:14 +04:00
committed by apn
parent 3a01a933af
commit 5e5b6f81c1
7 changed files with 182 additions and 204 deletions

View File

@@ -520,24 +520,19 @@ GeomFill_NSections::GeomFill_NSections(const TColGeom_SequenceOfCurve& NC,
GeomFill_SectionGenerator section;
Handle(Geom_BSplineSurface) surface;
Handle(Geom_TrimmedCurve) curvTrim;
Handle(Geom_BSplineCurve) curvBS, curvBS1;
Handle(Geom_Curve) curv = mySections(1);
for (j=jdeb; j<=jfin; j++) {
// read the j-th curve
curv = mySections(j);
curvTrim = new Geom_TrimmedCurve(curv,
curv->FirstParameter(),
curv->LastParameter());
Handle(Geom_Curve) curv = mySections(j);
// transformation en BSpline reparametree sur [UFirst,ULast]
curvBS = Handle(Geom_BSplineCurve)::DownCast(curvTrim);
if (curvBS.IsNull()) {
Convert_ParameterisationType ParamType = Convert_QuasiAngular;
curvBS = GeomConvert::CurveToBSplineCurve(curvTrim,ParamType);
// transformation to BSpline reparametrized to [UFirst,ULast]
Handle(Geom_BSplineCurve) curvBS = Handle(Geom_BSplineCurve)::DownCast (curv);
if (curvBS.IsNull())
{
curvBS = GeomConvert::CurveToBSplineCurve (curv, Convert_QuasiAngular);
}
TColStd_Array1OfReal BSK(1,curvBS->NbKnots());
curvBS->Knots(BSK);
BSplCLib::Reparametrize(UFirst,ULast,BSK);