mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-08 14:17:06 +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:
@@ -61,11 +61,11 @@ void LocOpe_FindEdges::Set(const TopoDS_Shape& FFrom,
|
||||
Cf = BRep_Tool::Curve(edgf,Loc,ff,lf);
|
||||
if (!Loc.IsIdentity()) {
|
||||
Handle(Geom_Geometry) GGf = Cf->Transformed(Loc.Transformation());
|
||||
Cf = *((Handle(Geom_Curve)*)&GGf);
|
||||
Cf = Handle(Geom_Curve)::DownCast (GGf);
|
||||
}
|
||||
Tf = Cf->DynamicType();
|
||||
if (Tf == STANDARD_TYPE(Geom_TrimmedCurve)) {
|
||||
Cf = (*((Handle(Geom_TrimmedCurve)*)&Cf))->BasisCurve();
|
||||
Cf = Handle(Geom_TrimmedCurve)::DownCast (Cf)->BasisCurve();
|
||||
Tf = Cf->DynamicType();
|
||||
}
|
||||
if (Tf != STANDARD_TYPE(Geom_Line) && Tf != STANDARD_TYPE(Geom_Circle) &&
|
||||
@@ -78,11 +78,11 @@ void LocOpe_FindEdges::Set(const TopoDS_Shape& FFrom,
|
||||
Ct = BRep_Tool::Curve(edgt,Loc,ft,lt);
|
||||
if (!Loc.IsIdentity()) {
|
||||
Handle(Geom_Geometry) GGt = Ct->Transformed(Loc.Transformation());
|
||||
Ct = *((Handle(Geom_Curve)*)&GGt);
|
||||
Ct = Handle(Geom_Curve)::DownCast (GGt);
|
||||
}
|
||||
Tt = Ct->DynamicType();
|
||||
if (Tt == STANDARD_TYPE(Geom_TrimmedCurve)) {
|
||||
Ct = (*((Handle(Geom_TrimmedCurve)*)&Ct))->BasisCurve();
|
||||
Ct = Handle(Geom_TrimmedCurve)::DownCast (Ct)->BasisCurve();
|
||||
Tt = Ct->DynamicType();
|
||||
}
|
||||
if (Tt != Tf) {
|
||||
@@ -91,8 +91,8 @@ void LocOpe_FindEdges::Set(const TopoDS_Shape& FFrom,
|
||||
// On a presomption de confusion
|
||||
Standard_Real Tol = Precision::Confusion();
|
||||
if (Tt == STANDARD_TYPE(Geom_Line)) {
|
||||
gp_Lin lif = (*((Handle(Geom_Line)*)&Cf))->Lin();
|
||||
gp_Lin lit = (*((Handle(Geom_Line)*)&Ct))->Lin();
|
||||
gp_Lin lif = Handle(Geom_Line)::DownCast (Cf)->Lin();
|
||||
gp_Lin lit = Handle(Geom_Line)::DownCast (Ct)->Lin();
|
||||
gp_Pnt p1 = ElCLib::Value(ff,lif);
|
||||
gp_Pnt p2 = ElCLib::Value(lf,lif);
|
||||
Standard_Real prm1 = ElCLib::Parameter(lit,p1);
|
||||
@@ -112,8 +112,8 @@ void LocOpe_FindEdges::Set(const TopoDS_Shape& FFrom,
|
||||
}
|
||||
}
|
||||
else if (Tt == STANDARD_TYPE(Geom_Circle)) {
|
||||
gp_Circ cif = (*((Handle(Geom_Circle)*)&Cf))->Circ();
|
||||
gp_Circ cit = (*((Handle(Geom_Circle)*)&Ct))->Circ();
|
||||
gp_Circ cif = Handle(Geom_Circle)::DownCast (Cf)->Circ();
|
||||
gp_Circ cit = Handle(Geom_Circle)::DownCast (Ct)->Circ();
|
||||
if (Abs(cif.Radius()-cit.Radius()) <= Tol &&
|
||||
cif.Location().SquareDistance(cit.Location()) <= Tol*Tol) {
|
||||
// Point debut, calage dans periode, et detection meme sens
|
||||
@@ -163,8 +163,8 @@ void LocOpe_FindEdges::Set(const TopoDS_Shape& FFrom,
|
||||
}
|
||||
}
|
||||
else if (Tt == STANDARD_TYPE(Geom_Ellipse)) {
|
||||
gp_Elips cif = (*((Handle(Geom_Ellipse)*)&Cf))->Elips();
|
||||
gp_Elips cit = (*((Handle(Geom_Ellipse)*)&Ct))->Elips();
|
||||
gp_Elips cif = Handle(Geom_Ellipse)::DownCast (Cf)->Elips();
|
||||
gp_Elips cit = Handle(Geom_Ellipse)::DownCast (Ct)->Elips();
|
||||
|
||||
|
||||
if (Abs(cif.MajorRadius()-cit.MajorRadius()) <= Tol &&
|
||||
@@ -213,8 +213,8 @@ void LocOpe_FindEdges::Set(const TopoDS_Shape& FFrom,
|
||||
}
|
||||
}
|
||||
else if (Tt == STANDARD_TYPE(Geom_BSplineCurve)) {
|
||||
Handle(Geom_BSplineCurve) Bf = *((Handle(Geom_BSplineCurve)*)&Cf);
|
||||
Handle(Geom_BSplineCurve) Bt = *((Handle(Geom_BSplineCurve)*)&Ct);
|
||||
Handle(Geom_BSplineCurve) Bf = Handle(Geom_BSplineCurve)::DownCast (Cf);
|
||||
Handle(Geom_BSplineCurve) Bt = Handle(Geom_BSplineCurve)::DownCast (Ct);
|
||||
|
||||
Standard_Boolean IsSame = Standard_True;
|
||||
|
||||
@@ -299,8 +299,8 @@ void LocOpe_FindEdges::Set(const TopoDS_Shape& FFrom,
|
||||
}
|
||||
}
|
||||
else if (Tt == STANDARD_TYPE(Geom_BezierCurve)) {
|
||||
Handle(Geom_BezierCurve) Bf = *((Handle(Geom_BezierCurve)*)&Cf);
|
||||
Handle(Geom_BezierCurve) Bt = *((Handle(Geom_BezierCurve)*)&Ct);
|
||||
Handle(Geom_BezierCurve) Bf = Handle(Geom_BezierCurve)::DownCast (Cf);
|
||||
Handle(Geom_BezierCurve) Bt = Handle(Geom_BezierCurve)::DownCast (Ct);
|
||||
|
||||
Standard_Boolean IsSame = Standard_True;
|
||||
|
||||
|
@@ -472,7 +472,7 @@ void LocOpe_Generator::Perform(const Handle(LocOpe_GeneratedShape)& G)
|
||||
newface.Orientation(TopAbs_FORWARD);
|
||||
S = BRep_Tool::Surface(fac);
|
||||
if (S->DynamicType()== STANDARD_TYPE(Geom_RectangularTrimmedSurface)) {
|
||||
S = (*((Handle(Geom_RectangularTrimmedSurface)*)&S))->BasisSurface();
|
||||
S = Handle(Geom_RectangularTrimmedSurface)::DownCast (S)->BasisSurface();
|
||||
}
|
||||
P = Handle(Geom_Plane)::DownCast(S);
|
||||
TopoDS_Wire wir;
|
||||
@@ -548,10 +548,10 @@ void LocOpe_Generator::Perform(const Handle(LocOpe_GeneratedShape)& G)
|
||||
C = BRep_Tool::Curve(edg,loc,f,l);
|
||||
if (!loc.IsIdentity()) {
|
||||
Handle(Geom_Geometry) GG = C->Transformed(loc.Transformation());
|
||||
C = *((Handle(Geom_Curve)*)&GG);
|
||||
C = Handle(Geom_Curve)::DownCast (GG);
|
||||
}
|
||||
if (C->DynamicType() == STANDARD_TYPE(Geom_TrimmedCurve)) {
|
||||
C = (*((Handle(Geom_TrimmedCurve)*)&C))->BasisCurve();
|
||||
C = Handle(Geom_TrimmedCurve)::DownCast (C)->BasisCurve();
|
||||
}
|
||||
|
||||
Handle(Geom2d_Curve) C2d = GeomProjLib::Curve2d(C,f,l,S,tol);
|
||||
@@ -613,10 +613,10 @@ void LocOpe_Generator::Perform(const Handle(LocOpe_GeneratedShape)& G)
|
||||
C = BRep_Tool::Curve(newedg,loc,f,l);
|
||||
if (!loc.IsIdentity()) {
|
||||
Handle(Geom_Geometry) GG = C->Transformed(loc.Transformation());
|
||||
C = *((Handle(Geom_Curve)*)&GG);
|
||||
C = Handle(Geom_Curve)::DownCast (GG);
|
||||
}
|
||||
if (C->DynamicType() == STANDARD_TYPE(Geom_TrimmedCurve)) {
|
||||
C = (*((Handle(Geom_TrimmedCurve)*)&C))->BasisCurve();
|
||||
C = Handle(Geom_TrimmedCurve)::DownCast (C)->BasisCurve();
|
||||
}
|
||||
if (P.IsNull()) { // on met les courbes 2d si on n`est pas
|
||||
// sur un plan
|
||||
@@ -707,10 +707,10 @@ void LocOpe_Generator::Perform(const Handle(LocOpe_GeneratedShape)& G)
|
||||
C = BRep_Tool::Curve(edgbis,loc,f,l);
|
||||
if (!loc.IsIdentity()) {
|
||||
Handle(Geom_Geometry) GG = C->Transformed(loc.Transformation());
|
||||
C = *((Handle(Geom_Curve)*)&GG);
|
||||
C = Handle(Geom_Curve)::DownCast (GG);
|
||||
}
|
||||
if (C->DynamicType() == STANDARD_TYPE(Geom_TrimmedCurve)) {
|
||||
C = (*((Handle(Geom_TrimmedCurve)*)&C))->BasisCurve();
|
||||
C = Handle(Geom_TrimmedCurve)::DownCast (C)->BasisCurve();
|
||||
}
|
||||
prmvt =
|
||||
BRep_Tool::Parameter(TopoDS::Vertex(it1.Value()),edgbis);
|
||||
@@ -864,10 +864,10 @@ void LocOpe_Generator::Perform(const Handle(LocOpe_GeneratedShape)& G)
|
||||
C = BRep_Tool::Curve(edg,loc,f,l);
|
||||
if (!loc.IsIdentity()) {
|
||||
Handle(Geom_Geometry) GG = C->Transformed(loc.Transformation());
|
||||
C = *((Handle(Geom_Curve)*)&GG);
|
||||
C = Handle(Geom_Curve)::DownCast (GG);
|
||||
}
|
||||
if (C->DynamicType() == STANDARD_TYPE(Geom_TrimmedCurve)) {
|
||||
C = (*((Handle(Geom_TrimmedCurve)*)&C))->BasisCurve();
|
||||
C = Handle(Geom_TrimmedCurve)::DownCast (C)->BasisCurve();
|
||||
}
|
||||
|
||||
C2d = GeomProjLib::Curve2d(C,f,l,S,tol);
|
||||
@@ -1074,12 +1074,12 @@ Standard_Boolean ToFuse(const TopoDS_Face& F1,
|
||||
typS2 = S2->DynamicType();
|
||||
|
||||
if (typS1 == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) {
|
||||
S1 = (*((Handle(Geom_RectangularTrimmedSurface)*)&S1))->BasisSurface();
|
||||
S1 = Handle(Geom_RectangularTrimmedSurface)::DownCast (S1)->BasisSurface();
|
||||
typS1 = S1->DynamicType();
|
||||
}
|
||||
|
||||
if (typS2 == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) {
|
||||
S2 = (*((Handle(Geom_RectangularTrimmedSurface)*)&S2))->BasisSurface();
|
||||
S2 = Handle(Geom_RectangularTrimmedSurface)::DownCast (S2)->BasisSurface();
|
||||
typS2 = S2->DynamicType();
|
||||
}
|
||||
|
||||
@@ -1091,8 +1091,8 @@ Standard_Boolean ToFuse(const TopoDS_Face& F1,
|
||||
Standard_Boolean ValRet = Standard_False;
|
||||
if (typS1 == STANDARD_TYPE(Geom_Plane)) {
|
||||
|
||||
gp_Pln pl1( (*((Handle(Geom_Plane)*)&S1))->Pln());
|
||||
gp_Pln pl2( (*((Handle(Geom_Plane)*)&S2))->Pln());
|
||||
gp_Pln pl1( Handle(Geom_Plane)::DownCast (S1)->Pln());
|
||||
gp_Pln pl2( Handle(Geom_Plane)::DownCast (S2)->Pln());
|
||||
|
||||
pl1.Transform(loc1.Transformation());
|
||||
pl2.Transform(loc2.Transformation());
|
||||
@@ -1129,24 +1129,24 @@ Standard_Boolean ToFuse(const TopoDS_Edge& E1,
|
||||
C1 = BRep_Tool::Curve(E1,loc1,f,l);
|
||||
if (!loc1.IsIdentity()) {
|
||||
Handle(Geom_Geometry) CC1 = C1->Transformed(loc1.Transformation());
|
||||
C1 = *((Handle(Geom_Curve)*)&CC1);
|
||||
C1 = Handle(Geom_Curve)::DownCast (CC1);
|
||||
}
|
||||
|
||||
C2 = BRep_Tool::Curve(E2,loc2,f,l);
|
||||
if (!loc2.IsIdentity()) {
|
||||
Handle(Geom_Geometry) CC2 = C2->Transformed(loc2.Transformation());
|
||||
C2 = *((Handle(Geom_Curve)*)&CC2);
|
||||
C2 = Handle(Geom_Curve)::DownCast (CC2);
|
||||
}
|
||||
|
||||
typC1 = C1->DynamicType();
|
||||
typC2 = C2->DynamicType();
|
||||
|
||||
if (typC1 == STANDARD_TYPE(Geom_TrimmedCurve)) {
|
||||
C1 = (*((Handle(Geom_TrimmedCurve)*)&C1))->BasisCurve();
|
||||
C1 = Handle(Geom_TrimmedCurve)::DownCast (C1)->BasisCurve();
|
||||
typC1 = C1->DynamicType();
|
||||
}
|
||||
if (typC2 == STANDARD_TYPE(Geom_TrimmedCurve)) {
|
||||
C2 = (*((Handle(Geom_TrimmedCurve)*)&C2))->BasisCurve();
|
||||
C2 = Handle(Geom_TrimmedCurve)::DownCast (C2)->BasisCurve();
|
||||
typC2 = C2->DynamicType();
|
||||
}
|
||||
|
||||
@@ -1156,8 +1156,8 @@ Standard_Boolean ToFuse(const TopoDS_Edge& E1,
|
||||
|
||||
Standard_Boolean ValRet = Standard_False;
|
||||
if (typC1 == STANDARD_TYPE(Geom_Line)) {
|
||||
gp_Lin li1( (*((Handle(Geom_Line)*)&C1))->Lin());
|
||||
gp_Lin li2( (*((Handle(Geom_Line)*)&C2))->Lin());
|
||||
gp_Lin li1( Handle(Geom_Line)::DownCast (C1)->Lin());
|
||||
gp_Lin li2( Handle(Geom_Line)::DownCast (C2)->Lin());
|
||||
|
||||
if (li1.Position().IsCoaxial(li2.Position(),tolang,tollin)) {
|
||||
ValRet = Standard_True;
|
||||
@@ -1216,20 +1216,20 @@ Standard_Real NewParameter(const TopoDS_Edge& Edg,
|
||||
C = BRep_Tool::Curve(Edg,loc,f,l);
|
||||
if (!loc.IsIdentity()) {
|
||||
Handle(Geom_Geometry) GG = C->Transformed(loc.Transformation());
|
||||
C = *((Handle(Geom_Curve)*)&GG);
|
||||
C = Handle(Geom_Curve)::DownCast (GG);
|
||||
}
|
||||
typC = C->DynamicType();
|
||||
if (typC == STANDARD_TYPE(Geom_TrimmedCurve)) {
|
||||
C = (*((Handle(Geom_TrimmedCurve)*)&C))->BasisCurve();
|
||||
C = Handle(Geom_TrimmedCurve)::DownCast (C)->BasisCurve();
|
||||
typC = C->DynamicType();
|
||||
}
|
||||
|
||||
if (typC == STANDARD_TYPE(Geom_Line)) {
|
||||
return ElCLib::Parameter( (*((Handle(Geom_Line)*)&C))->Lin(),P);
|
||||
return ElCLib::Parameter( Handle(Geom_Line)::DownCast (C)->Lin(),P);
|
||||
}
|
||||
else if (typC == STANDARD_TYPE(Geom_Circle)) {
|
||||
Standard_Real prm = ElCLib::Parameter
|
||||
( (*((Handle(Geom_Circle)*)&C))->Circ(),P);
|
||||
( Handle(Geom_Circle)::DownCast (C)->Circ(),P);
|
||||
// Vtx vient d`une exploration de Edg orientee FORWARD
|
||||
|
||||
TopAbs_Orientation orient = TopAbs::Reverse(Vtx.Orientation());
|
||||
|
@@ -602,7 +602,7 @@ static void Select(const TopoDS_Edge& Ebase,
|
||||
|
||||
if (!Loc.IsIdentity()) {
|
||||
Handle(Geom_Geometry) GG = C->Transformed(Loc.Transformation());
|
||||
C = *((Handle(Geom_Curve)*)&GG);
|
||||
C = Handle(Geom_Curve)::DownCast (GG);
|
||||
}
|
||||
gp_Pnt Pt(C->Value((f+l)/2.));
|
||||
|
||||
@@ -615,7 +615,7 @@ static void Select(const TopoDS_Edge& Ebase,
|
||||
C = BRep_Tool::Curve(edg,Loc,f,l);
|
||||
if (!Loc.IsIdentity()) {
|
||||
Handle(Geom_Geometry) GG = C->Transformed(Loc.Transformation());
|
||||
C = *((Handle(Geom_Curve)*)&GG);
|
||||
C = Handle(Geom_Curve)::DownCast (GG);
|
||||
}
|
||||
proj.Init(Pt,C,f,l);
|
||||
if (proj.NbPoints() > 0) {
|
||||
|
@@ -541,7 +541,7 @@ Standard_Real Project(const TopoDS_Vertex& V,
|
||||
C = BRep_Tool::Curve(theEdge,Loc,f,l);
|
||||
if (!Loc.IsIdentity()) {
|
||||
Handle(Geom_Geometry) GG = C->Transformed(Loc.Transformation());
|
||||
C = *((Handle(Geom_Curve)*)&GG);
|
||||
C = Handle(Geom_Curve)::DownCast (GG);
|
||||
}
|
||||
proj.Init(toproj,C,f,l);
|
||||
|
||||
@@ -570,7 +570,7 @@ Standard_Real Project(const TopoDS_Vertex&,
|
||||
/*
|
||||
if (!Loc.IsIdentity()) {
|
||||
Handle(Geom_Geometry) GG = C->Transformed(Loc.Transformation());
|
||||
C = *((Handle(Geom_Curve)*)&GG);
|
||||
C = Handle(Geom_Curve)::DownCast (GG);
|
||||
}
|
||||
*/
|
||||
proj.Init(p2d, PC, f, l);
|
||||
@@ -636,7 +636,7 @@ void PutPCurve(const TopoDS_Edge& Edg,
|
||||
Handle(Geom_Curve) C = BRep_Tool::Curve(Edg,Loc,f,l);
|
||||
if (!Loc.IsIdentity()) {
|
||||
Handle(Geom_Geometry) GG = C->Transformed(Loc.Transformation());
|
||||
C = *((Handle(Geom_Curve)*)&GG);
|
||||
C = Handle(Geom_Curve)::DownCast (GG);
|
||||
}
|
||||
|
||||
if (C->DynamicType() != STANDARD_TYPE(Geom_TrimmedCurve)) {
|
||||
@@ -835,7 +835,7 @@ void PutPCurves(const TopoDS_Edge& Efrom,
|
||||
C = BRep_Tool::Curve(Efrom,Loc,f,l);
|
||||
if (!Loc.IsIdentity()) {
|
||||
Handle(Geom_Geometry) GG = C->Transformed(Loc.Transformation());
|
||||
C = *((Handle(Geom_Curve)*)&GG);
|
||||
C = Handle(Geom_Curve)::DownCast (GG);
|
||||
}
|
||||
|
||||
if (C->DynamicType() != STANDARD_TYPE(Geom_TrimmedCurve)) {
|
||||
@@ -1000,7 +1000,7 @@ void PutPCurves(const TopoDS_Edge& Efrom,
|
||||
C = BRep_Tool::Curve(Efrom,Loc,f,l);
|
||||
if (!Loc.IsIdentity()) {
|
||||
Handle(Geom_Geometry) GG = C->Transformed(Loc.Transformation());
|
||||
C = *((Handle(Geom_Curve)*)&GG);
|
||||
C = Handle(Geom_Curve)::DownCast (GG);
|
||||
}
|
||||
|
||||
gp_Pnt pt;
|
||||
@@ -1019,7 +1019,7 @@ void PutPCurves(const TopoDS_Edge& Efrom,
|
||||
C = BRep_Tool::Curve(Eto,Loc,f,l);
|
||||
if (!Loc.IsIdentity()) {
|
||||
Handle(Geom_Geometry) GG = C->Transformed(Loc.Transformation());
|
||||
C = *((Handle(Geom_Curve)*)&GG);
|
||||
C = Handle(Geom_Curve)::DownCast (GG);
|
||||
}
|
||||
|
||||
C->D1(prmproj,pt,d1t);
|
||||
@@ -1038,7 +1038,7 @@ void PutPCurves(const TopoDS_Edge& Efrom,
|
||||
C = BRep_Tool::Curve(Efrom,Loc,f,l);
|
||||
if (!Loc.IsIdentity()) {
|
||||
Handle(Geom_Geometry) GG = C->Transformed(Loc.Transformation());
|
||||
C = *((Handle(Geom_Curve)*)&GG);
|
||||
C = Handle(Geom_Curve)::DownCast (GG);
|
||||
}
|
||||
|
||||
if (C->DynamicType() != STANDARD_TYPE(Geom_TrimmedCurve)) {
|
||||
|
Reference in New Issue
Block a user