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

@@ -1104,9 +1104,9 @@ Standard_Boolean AIS_Dimension::InitCircularDimension (const TopoDS_Shape& theSh
Handle(Geom_TrimmedCurve) aTrimmedCurve = Handle(Geom_TrimmedCurve)::DownCast (aCurve);
aFirstU = aTrimmedCurve->FirstParameter();
aLastU = aTrimmedCurve->LastParameter();
if (aTrimmedCurve->DynamicType() == STANDARD_TYPE (Geom_Circle))
if (aTrimmedCurve->BasisCurve()->DynamicType() == STANDARD_TYPE (Geom_Circle))
{
theCircle = Handle(Geom_Circle)::DownCast(aTrimmedCurve)->Circ();
theCircle = Handle(Geom_Circle)::DownCast(aTrimmedCurve->BasisCurve())->Circ();
}
}
else

View File

@@ -537,10 +537,12 @@ void AIS_InteractiveObject::SetInfiniteState(const Standard_Boolean aFlag)
myInfiniteState = aFlag;
Handle(Prs3d_Presentation) P;
for(Standard_Integer i =1; i<=myPresentations.Length();i++){
P = Handle(Prs3d_Presentation)::DownCast(myPresentations(i).Presentation());
for(Standard_Integer i =1; i<=myPresentations.Length();i++)
{
P = myPresentations(i).Presentation()->Presentation();
if(!P.IsNull())
P->SetInfiniteState(myInfiniteState);}
P->SetInfiniteState(myInfiniteState);
}
}
//=======================================================================