From c5f3a42524e2cc831c258e347e591ffa4bdaa4c2 Mon Sep 17 00:00:00 2001 From: abv Date: Thu, 2 Jul 2015 16:41:05 +0300 Subject: [PATCH] 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. --- src/AIS/AIS.cxx | 62 +++---- src/AIS/AIS_AttributeFilter.cxx | 8 +- src/AIS/AIS_BadEdgeFilter.cxx | 2 +- src/AIS/AIS_C0RegularityFilter.cxx | 2 +- src/AIS/AIS_ConcentricRelation.cxx | 6 +- src/AIS/AIS_EqualDistanceRelation.cxx | 10 +- src/AIS/AIS_IdenticRelation.cxx | 36 ++-- src/AIS/AIS_InteractiveContext.cxx | 14 +- src/AIS/AIS_InteractiveContext_1.cxx | 16 +- src/AIS/AIS_InteractiveObject.cxx | 2 +- src/AIS/AIS_LengthDimension.cxx | 2 +- src/AIS/AIS_LocalContext.cxx | 2 +- src/AIS/AIS_LocalContext_1.cxx | 24 +-- src/AIS/AIS_MidPointRelation.cxx | 14 +- src/AIS/AIS_ParallelRelation.cxx | 8 +- src/AIS/AIS_PerpendicularRelation.cxx | 12 +- src/AIS/AIS_Plane.cxx | 5 +- src/AIS/AIS_Relation.cxx | 4 +- src/AIS/AIS_Selection.cxx | 4 +- src/AIS/AIS_SymmetricRelation.cxx | 18 +- src/AIS/AIS_TangentRelation.cxx | 40 ++-- src/AIS/AIS_TypeFilter.cxx | 2 +- src/AppDef/AppDef_MultiPointConstraint.cxx | 8 +- src/AppDef/AppDef_Variational.cxx | 2 +- src/AppParCurves/AppParCurves_MultiPoint.cxx | 4 +- src/BOPTest/BOPTest_LowCommands.cxx | 2 +- src/BOPTools/BOPTools_AlgoTools2D.cxx | 6 +- src/BOPTools/BOPTools_AlgoTools_1.cxx | 7 +- src/BRep/BRep_Tool.cxx | 44 ++--- src/BRepCheck/BRepCheck_Edge.cxx | 7 +- src/BRepCheck/BRepCheck_Vertex.cxx | 2 +- src/BRepFeat/BRepFeat_MakeDPrism.cxx | 8 +- src/BRepFeat/BRepFeat_MakePrism.cxx | 8 +- src/BRepFeat/BRepFeat_MakeRevol.cxx | 8 +- src/BRepFill/BRepFill_Pipe.cxx | 6 +- src/BRepFill/BRepFill_Sweep.cxx | 4 +- src/BRepGProp/BRepGProp_EdgeTool.cxx | 4 +- src/BRepGProp/BRepGProp_Face.cxx | 4 +- src/BRepLib/BRepLib.cxx | 8 +- src/BRepLib/BRepLib_FuseEdges.cxx | 38 ++-- src/BRepMAT2d/BRepMAT2d_Explorer.cxx | 2 +- src/BRepOffset/BRepOffset_Inter2d.cxx | 12 +- src/BRepOffset/BRepOffset_Offset.cxx | 18 +- src/BRepOffset/BRepOffset_Tool.cxx | 84 ++++----- .../BRepOffsetAPI_DraftAngle.cxx | 26 +-- .../BRepOffsetAPI_MiddlePath.cxx | 10 +- src/BRepTest/BRepTest_MatCommands.cxx | 4 +- src/BinMDF/BinMDF_ADriverTable.cxx | 3 +- src/Bisector/Bisector_BisecAna.cxx | 2 +- src/BndLib/BndLib_Add3dCurve.cxx | 2 +- src/ChFi3d/ChFi3d_Builder_0.cxx | 5 +- src/DNaming/DNaming.cxx | 2 +- src/DrawDim/DrawDim_PlanarAngle.cxx | 10 +- src/FEmTool/FEmTool_Curve.cxx | 6 +- src/Geom/Geom_OsculatingSurface.cxx | 4 +- src/Geom2dAdaptor/Geom2dAdaptor_Curve.cxx | 52 +++--- src/GeomAdaptor/GeomAdaptor_Curve.cxx | 46 ++--- src/GeomAdaptor/GeomAdaptor_Surface.cxx | 128 ++++++------- src/GeomConvert/GeomConvert_1.cxx | 2 +- src/GeomFill/GeomFill_BoundWithSurf.cxx | 2 +- src/GeomFill/GeomFill_ConstrainedFilling.cxx | 8 +- src/GeomFill/GeomFill_Profiler.cxx | 2 +- src/GeomFill/GeomFill_SimpleBound.cxx | 2 +- src/GeomFill/GeomFill_Sweep.cxx | 3 +- src/GeomInt/GeomInt_LineConstructor.cxx | 8 +- src/GeomLib/GeomLib.cxx | 6 +- .../GeometryTest_CurveCommands.cxx | 2 +- src/HLRBRep/HLRBRep.cxx | 2 +- .../IntPatch_ImpImpIntersection_0.gxx | 172 +++++++++--------- .../IntPatch_ImpImpIntersection_4.gxx | 3 +- src/IntPatch/IntPatch_ImpPrmIntersection.cxx | 28 +-- src/IntPatch/IntPatch_Intersection.cxx | 38 ++-- src/IntPatch/IntPatch_LineConstructor.cxx | 32 ++-- src/IntPatch/IntPatch_PrmPrmIntersection.cxx | 8 +- src/IntPatch/IntPatch_RstInt.cxx | 8 +- src/IntTools/IntTools_EdgeEdge.cxx | 8 +- src/IntTools/IntTools_FaceFace.cxx | 8 +- src/LocOpe/LocOpe_FindEdges.cxx | 28 +-- src/LocOpe/LocOpe_Generator.cxx | 46 ++--- src/LocOpe/LocOpe_Spliter.cxx | 4 +- src/LocOpe/LocOpe_WiresOnShape.cxx | 14 +- src/PCDM/PCDM.cxx | 2 +- src/PCDM/PCDM_RetrievalDriver.cxx | 2 +- src/Prs3d/Prs3d_ShapeTool.cxx | 2 +- src/PrsMgr/PrsMgr_Presentation.cxx | 6 +- src/QABugs/QABugs_1.cxx | 2 +- src/QABugs/QABugs_16.cxx | 2 +- src/RWStepAP214/RWStepAP214_GeneralModule.cxx | 2 +- .../RWStepAP214_ReadWriteModule.cxx | 2 +- src/SelectMgr/SelectMgr_SelectionManager.cxx | 6 +- .../SelectMgr_SensitiveEntitySet.cxx | 3 +- src/SelectMgr/SelectMgr_ViewerSelector.cxx | 7 +- src/ShapeAnalysis/ShapeAnalysis_Curve.cxx | 22 +-- src/StdSelect/StdSelect_BRepSelectionTool.cxx | 2 +- src/StdSelect/StdSelect_EdgeFilter.cxx | 2 +- src/StdSelect/StdSelect_FaceFilter.cxx | 2 +- src/StdSelect/StdSelect_ViewerSelector3d.cxx | 7 +- .../StepToGeom_MakeBoundedCurve.cxx | 18 +- .../StepToGeom_MakeBoundedCurve2d.cxx | 8 +- .../StepToGeom_MakeBoundedSurface.cxx | 16 +- src/StepToGeom/StepToGeom_MakeConic.cxx | 8 +- src/StepToGeom/StepToGeom_MakeConic2d.cxx | 8 +- src/StepToGeom/StepToGeom_MakeCurve.cxx | 8 +- src/StepToGeom/StepToGeom_MakeCurve2d.cxx | 6 +- .../StepToGeom_MakeElementarySurface.cxx | 10 +- src/StepToGeom/StepToGeom_MakeSurface.cxx | 6 +- .../StepToGeom_MakeSweptSurface.cxx | 4 +- src/TDF/TDF_ClosureTool.cxx | 4 +- src/TDF/TDF_CopyTool.cxx | 4 +- src/TDataStd/TDataStd_ByteArray.cxx | 2 +- ...DataStd_DeltaOnModificationOfByteArray.cxx | 2 +- ...td_DeltaOnModificationOfExtStringArray.cxx | 2 +- ...TDataStd_DeltaOnModificationOfIntArray.cxx | 2 +- ...aStd_DeltaOnModificationOfIntPackedMap.cxx | 2 +- ...DataStd_DeltaOnModificationOfRealArray.cxx | 2 +- src/TDataStd/TDataStd_ExtStringArray.cxx | 2 +- src/TDataStd/TDataStd_IntPackedMap.cxx | 2 +- src/TDataStd/TDataStd_IntegerArray.cxx | 2 +- src/TDataStd/TDataStd_RealArray.cxx | 2 +- src/TDataXtd/TDataXtd_Constraint.cxx | 2 +- src/TDataXtd/TDataXtd_Geometry.cxx | 6 +- src/TDocStd/TDocStd_XLink.cxx | 6 +- src/TNaming/TNaming_DeltaOnModification.cxx | 2 +- src/TNaming/TNaming_NamedShape.cxx | 2 +- src/TNaming/TNaming_Selector.cxx | 2 +- src/TNaming/TNaming_Tool.cxx | 2 +- src/TNaming/TNaming_Translator.cxx | 4 +- src/TPrsStd/TPrsStd_ConstraintTools.cxx | 12 +- src/TopOpeBRep/TopOpeBRep_LineInter.cxx | 8 +- .../TopOpeBRepBuild_BuilderON.cxx | 4 +- .../TopOpeBRepBuild_BuilderON2d.cxx | 2 +- .../TopOpeBRepBuild_EdgeBuilder.cxx | 4 +- .../TopOpeBRepBuild_FuseFace.cxx | 28 +-- src/TopOpeBRepBuild/TopOpeBRepBuild_KPart.cxx | 2 +- .../TopOpeBRepBuild_Section.cxx | 4 +- .../TopOpeBRepBuild_Tools_1.cxx | 6 +- .../TopOpeBRepBuild_WireEdgeSet.cxx | 2 +- .../TopOpeBRepBuild_makefaces.cxx | 2 +- src/TopOpeBRepDS/TopOpeBRepDS_Check.cxx | 3 +- src/TopOpeBRepDS/TopOpeBRepDS_Curve.cxx | 8 +- src/TopOpeBRepDS/TopOpeBRepDS_Dumper.cxx | 4 +- src/TopOpeBRepDS/TopOpeBRepDS_EIR.cxx | 6 +- src/TopOpeBRepDS/TopOpeBRepDS_EXPORT.cxx | 6 +- src/TopOpeBRepDS/TopOpeBRepDS_FIR.cxx | 4 +- .../TopOpeBRepDS_FaceInterferenceTool.cxx | 4 +- src/TopOpeBRepDS/TopOpeBRepDS_GapFiller.cxx | 2 +- src/TopOpeBRepDS/TopOpeBRepDS_GapTool.cxx | 8 +- .../TopOpeBRepDS_InterferenceTool.cxx | 4 +- .../TopOpeBRepDS_PointIterator.cxx | 8 +- .../TopOpeBRepTool_CurveTool.cxx | 12 +- .../TopOpeBRepTool_FuseEdges.cxx | 36 ++-- .../TopOpeBRepTool_ShapeTool.cxx | 2 +- src/Units/Units_UnitsDictionary.cxx | 2 +- src/Units/Units_UnitsSystem.cxx | 2 +- src/V3d/V3d_View_4.cxx | 4 +- src/ViewerTest/ViewerTest.cxx | 14 +- src/ViewerTest/ViewerTest_ObjectCommands.cxx | 16 +- src/Visual3d/Visual3d_ViewManager.cxx | 2 +- 158 files changed, 863 insertions(+), 888 deletions(-) diff --git a/src/AIS/AIS.cxx b/src/AIS/AIS.cxx index a5d3ed2013..7bd61b9995 100644 --- a/src/AIS/AIS.cxx +++ b/src/AIS/AIS.cxx @@ -188,30 +188,30 @@ Standard_Boolean AIS::ComputeGeometry (const TopoDS_Edge& theEdge, if (!anEdgeLoc.IsIdentity()) { Handle(Geom_Geometry) aGeometry = theCurve->Transformed (anEdgeLoc.Transformation()); - theCurve = (Handle(Geom_Curve)&) aGeometry; + theCurve = Handle(Geom_Curve)::DownCast (aGeometry); } if (theCurve->IsInstance (STANDARD_TYPE (Geom_TrimmedCurve))) { - theCurve = ((Handle(Geom_TrimmedCurve)&) theCurve)->BasisCurve(); + theCurve = Handle(Geom_TrimmedCurve)::DownCast (theCurve)->BasisCurve(); } if (theCurve->IsInstance (STANDARD_TYPE (Geom_Line))) { - Handle(Geom_Line) aLine = (Handle(Geom_Line)&) theCurve; + Handle(Geom_Line) aLine = Handle(Geom_Line)::DownCast (theCurve); theFirstPnt = ElCLib::Value (aFirst, aLine->Lin()); theLastPnt = ElCLib::Value (aLast, aLine->Lin()); } else if (theCurve->IsInstance (STANDARD_TYPE (Geom_Circle))) { - Handle(Geom_Circle) aCirc = (Handle(Geom_Circle)&) theCurve; + Handle(Geom_Circle) aCirc = Handle(Geom_Circle)::DownCast (theCurve); theFirstPnt = ElCLib::Value (aFirst, aCirc->Circ()); theLastPnt = ElCLib::Value (aLast, aCirc->Circ()); } else if (theCurve->IsInstance (STANDARD_TYPE (Geom_Ellipse))) { - Handle(Geom_Ellipse) anEllipse = (Handle(Geom_Ellipse)&) theCurve; + Handle(Geom_Ellipse) anEllipse = Handle(Geom_Ellipse)::DownCast (theCurve); theFirstPnt = ElCLib::Value (aFirst, anEllipse->Elips()); theLastPnt = ElCLib::Value (aLast, anEllipse->Elips()); } @@ -252,7 +252,7 @@ Standard_Boolean AIS::ComputeGeometry (const TopoDS_Edge& theEdge, if (theCurve->IsInstance (STANDARD_TYPE (Geom_TrimmedCurve))) { - theCurve = ((Handle(Geom_TrimmedCurve)&) theCurve)->BasisCurve(); + theCurve = Handle(Geom_TrimmedCurve)::DownCast (theCurve)->BasisCurve(); } if (!theIsInfinite) @@ -306,19 +306,19 @@ Standard_Boolean AIS::ComputeGeometry (const TopoDS_Edge& theEdge, theIsOnPlane = Standard_True; if (theExtCurve->IsInstance (STANDARD_TYPE (Geom_TrimmedCurve))) { - theExtCurve = ((Handle(Geom_TrimmedCurve)&) theExtCurve)->BasisCurve(); + theExtCurve = Handle(Geom_TrimmedCurve)::DownCast (theExtCurve)->BasisCurve(); } if (theExtCurve->IsInstance (STANDARD_TYPE (Geom_Line))) { - Handle(Geom_Line) aLine = (Handle(Geom_Line)&) theExtCurve; + Handle(Geom_Line) aLine = Handle(Geom_Line)::DownCast (theExtCurve); theIsOnPlane = thePlane->Pln().Contains (aLine->Lin(), Precision::Confusion(), Precision::Angular()); } else if (theExtCurve->IsInstance (STANDARD_TYPE (Geom_Circle))) { - Handle(Geom_Circle) aCircle = (Handle(Geom_Circle)&) theExtCurve; + Handle(Geom_Circle) aCircle = Handle(Geom_Circle)::DownCast (theExtCurve); gp_Ax3 aCircPos (aCircle->Position()); theIsOnPlane = aCircPos.IsCoplanar (thePlane->Pln().Position(), @@ -337,7 +337,7 @@ Standard_Boolean AIS::ComputeGeometry (const TopoDS_Edge& theEdge, if (theCurve->IsInstance (STANDARD_TYPE (Geom_Line))) { - Handle(Geom_Line) aLine = (Handle(Geom_Line)&) theCurve; + Handle(Geom_Line) aLine = Handle(Geom_Line)::DownCast (theCurve); if (!theIsInfinite) { theFirstPnt = ElCLib::Value (aFirst, aLine->Lin()); @@ -346,14 +346,14 @@ Standard_Boolean AIS::ComputeGeometry (const TopoDS_Edge& theEdge, } else if (theCurve->IsInstance (STANDARD_TYPE (Geom_Circle))) { - Handle(Geom_Circle) aCirc = (Handle(Geom_Circle)&) theCurve; + Handle(Geom_Circle) aCirc = Handle(Geom_Circle)::DownCast (theCurve); theFirstPnt = ElCLib::Value (aFirst, aCirc->Circ()); theLastPnt = ElCLib::Value (aLast, aCirc->Circ()); } else if (theCurve->IsInstance (STANDARD_TYPE (Geom_Ellipse))) { - Handle(Geom_Ellipse) anEllipse = (Handle(Geom_Ellipse)&) theCurve; + Handle(Geom_Ellipse) anEllipse = Handle(Geom_Ellipse)::DownCast (theCurve); theFirstPnt = ElCLib::Value (aFirst, anEllipse->Elips()); theLastPnt = ElCLib::Value (aLast, anEllipse->Elips()); @@ -404,13 +404,13 @@ Standard_Boolean AIS::ComputeGeometry (const TopoDS_Edge& theFirstEdge, if (!aFirstEdgeLoc.IsIdentity()) { Handle(Geom_Geometry) aGeomGeometry = theFirstCurve->Transformed (aFirstEdgeLoc.Transformation()); - theFirstCurve = (Handle(Geom_Curve)&) aGeomGeometry; + theFirstCurve = Handle(Geom_Curve)::DownCast (aGeomGeometry); } if (!aSecondEdgeLoc.IsIdentity()) { Handle(Geom_Geometry) aGeomGeometry = theSecondCurve->Transformed (aSecondEdgeLoc.Transformation()); - theSecondCurve = (Handle(Geom_Curve)&) aGeomGeometry; + theSecondCurve = Handle(Geom_Curve)::DownCast (aGeomGeometry); } theFirstCurve = GeomProjLib::ProjectOnPlane (theFirstCurve, thePlane, @@ -425,24 +425,24 @@ Standard_Boolean AIS::ComputeGeometry (const TopoDS_Edge& theFirstEdge, if (theFirstCurve->IsInstance (STANDARD_TYPE(Geom_TrimmedCurve))) { - theFirstCurve = ((Handle(Geom_TrimmedCurve)&) theFirstCurve)->BasisCurve(); + theFirstCurve = Handle(Geom_TrimmedCurve)::DownCast (theFirstCurve)->BasisCurve(); } if (theSecondCurve->IsInstance (STANDARD_TYPE (Geom_TrimmedCurve))) { - theSecondCurve = ((Handle(Geom_TrimmedCurve)&) theSecondCurve)->BasisCurve(); + theSecondCurve = Handle(Geom_TrimmedCurve)::DownCast (theSecondCurve)->BasisCurve(); } if (theFirstCurve->IsInstance(STANDARD_TYPE(Geom_Line))) { - Handle(Geom_Line) aLine = (Handle(Geom_Line)&) theFirstCurve; + Handle(Geom_Line) aLine = Handle(Geom_Line)::DownCast (theFirstCurve); theFirstPnt1 = ElCLib::Value (aFirst1, aLine->Lin()); theLastPnt1 = ElCLib::Value (aLast1, aLine->Lin()); } else if (theFirstCurve->IsInstance(STANDARD_TYPE(Geom_Circle))) { - Handle(Geom_Circle) aCirc = (Handle(Geom_Circle)&) theFirstCurve; + Handle(Geom_Circle) aCirc = Handle(Geom_Circle)::DownCast (theFirstCurve); theFirstPnt1 = ElCLib::Value (aFirst1, aCirc->Circ()); theLastPnt1 = ElCLib::Value (aLast1, aCirc->Circ()); @@ -454,14 +454,14 @@ Standard_Boolean AIS::ComputeGeometry (const TopoDS_Edge& theFirstEdge, if (theSecondCurve->IsInstance (STANDARD_TYPE (Geom_Line))) { - Handle(Geom_Line) aLine = (Handle(Geom_Line)&) theSecondCurve; + Handle(Geom_Line) aLine = Handle(Geom_Line)::DownCast (theSecondCurve); theFirstPnt2 = ElCLib::Value (aFirst2, aLine->Lin()); theLastPnt2 = ElCLib::Value (aLast2, aLine->Lin()); } else if (theSecondCurve->IsInstance (STANDARD_TYPE (Geom_Circle))) { - Handle(Geom_Circle) aCirc = (Handle(Geom_Circle)&) theSecondCurve; + Handle(Geom_Circle) aCirc = Handle(Geom_Circle)::DownCast (theSecondCurve); theFirstPnt2 = ElCLib::Value (aFirst2, aCirc->Circ()); theLastPnt2 = ElCLib::Value (aLast2, aCirc->Circ()); @@ -505,8 +505,8 @@ Standard_Boolean AIS::ComputeGeometry (const TopoDS_Edge& theFirstEdge, { if (theFirstCurve->DynamicType() == theSecondCurve->DynamicType()) { - gp_Lin aLin1 = ((Handle(Geom_Line)&) theFirstCurve)->Lin(); - gp_Lin aLin2 = ((Handle(Geom_Line)&) theSecondCurve)->Lin(); + gp_Lin aLin1 = Handle(Geom_Line)::DownCast (theFirstCurve)->Lin(); + gp_Lin aLin2 = Handle(Geom_Line)::DownCast (theSecondCurve)->Lin(); if (theIsInfinite1) { @@ -597,11 +597,11 @@ Standard_Boolean AIS::ComputeGeometry (const TopoDS_Edge& theFirstEdge, if (theFirstCurve->IsInstance (STANDARD_TYPE (Geom_TrimmedCurve))) { - theFirstCurve = ((Handle(Geom_TrimmedCurve)&) theFirstCurve)->BasisCurve(); + theFirstCurve = Handle(Geom_TrimmedCurve)::DownCast (theFirstCurve)->BasisCurve(); } if (theSecondCurve->IsInstance (STANDARD_TYPE (Geom_TrimmedCurve))) { - theSecondCurve = ((Handle(Geom_TrimmedCurve)&) theSecondCurve)->BasisCurve(); + theSecondCurve = Handle(Geom_TrimmedCurve)::DownCast (theSecondCurve)->BasisCurve(); } aFirst1 = aFirstAdaptor.FirstParameter(); @@ -646,8 +646,8 @@ Standard_Boolean AIS::ComputeGeometry (const TopoDS_Edge& theFirstEdge, { if (theFirstCurve->DynamicType() == theSecondCurve->DynamicType()) { - gp_Lin aLin1 = ((Handle(Geom_Line)&) theFirstCurve)->Lin(); - gp_Lin aLin2 = ((Handle(Geom_Line)&) theSecondCurve)->Lin(); + gp_Lin aLin1 = Handle(Geom_Line)::DownCast (theFirstCurve)->Lin(); + gp_Lin aLin2 = Handle(Geom_Line)::DownCast (theSecondCurve)->Lin(); if (theExtIndex == 1) { @@ -735,7 +735,7 @@ Standard_Boolean AIS::ComputeGeomCurve (Handle(Geom_Curve)& aCurve, aCurve = aGeomCurve; if (aCurve->IsInstance(STANDARD_TYPE(Geom_TrimmedCurve))) { - aCurve = ((Handle(Geom_TrimmedCurve)&) aCurve)->BasisCurve(); + aCurve = Handle(Geom_TrimmedCurve)::DownCast (aCurve)->BasisCurve(); } if (! Precision::IsInfinite(first1) && ! Precision::IsInfinite(last1)) { @@ -1426,8 +1426,8 @@ void AIS::ComputeProjEdgePresentation (const Handle(Prs3d_Presentation)& aPresen // Calculate presentation of the edge if (ProjCurve->IsInstance(STANDARD_TYPE(Geom_Line)) ) { // CLE - // const Handle(Geom_Line) & gl = (Handle(Geom_Line)&) ProjCurve; - Handle(Geom_Line) gl = (Handle(Geom_Line)&) ProjCurve; + // Handle(Geom_Line) gl (Handle(Geom_Line)::DownCast (ProjCurve)); + Handle(Geom_Line) gl = Handle(Geom_Line)::DownCast (ProjCurve); // ENDCLE if ( !isInfinite) { pf = ElCLib::Parameter(gl->Lin(),FirstP); @@ -1442,8 +1442,8 @@ void AIS::ComputeProjEdgePresentation (const Handle(Prs3d_Presentation)& aPresen } else if (ProjCurve->IsInstance(STANDARD_TYPE(Geom_Circle)) ) { // CLE - // const Handle(Geom_Circle) & gc = (Handle(Geom_Circle)&) ProjCurve; - Handle(Geom_Circle) gc = (Handle(Geom_Circle)&) ProjCurve; + // Handle(Geom_Circle) gc (Handle(Geom_Circle)::DownCast (ProjCurve)); + Handle(Geom_Circle) gc = Handle(Geom_Circle)::DownCast (ProjCurve); // ENDCLE pf = ElCLib::Parameter(gc->Circ(),FirstP); pl = ElCLib::Parameter(gc->Circ(),LastP); diff --git a/src/AIS/AIS_AttributeFilter.cxx b/src/AIS/AIS_AttributeFilter.cxx index a5eed56b3d..78b5b9dd6e 100644 --- a/src/AIS/AIS_AttributeFilter.cxx +++ b/src/AIS/AIS_AttributeFilter.cxx @@ -43,19 +43,19 @@ Standard_Boolean AIS_AttributeFilter::IsOk(const Handle(SelectMgr_EntityOwner)& //#ifndef OCCT_DEBUG Handle(SelectMgr_SelectableObject) aSelectable = anObj->Selectable() ; - if( hasC && ((Handle(AIS_InteractiveObject)&) aSelectable)->HasColor() ) + if( hasC && Handle(AIS_InteractiveObject)::DownCast (aSelectable)->HasColor() ) //#else // if(hasC && ((Handle(AIS_InteractiveObject)&) anObj->Selectable())->HasColor()) //#endif - okstat = (myCol == ((Handle(AIS_InteractiveObject)&) anObj)->Color()); + okstat = (myCol == Handle(AIS_InteractiveObject)::DownCast (anObj)->Color()); //#ifndef OCCT_DEBUG aSelectable = anObj->Selectable() ; - if( hasW && ((Handle(AIS_InteractiveObject)&) aSelectable)->HasWidth() ) + if( hasW && Handle(AIS_InteractiveObject)::DownCast (aSelectable)->HasWidth() ) //#else // if(hasW && ((Handle(AIS_InteractiveObject)&) anObj->Selectable())->HasWidth()) //#endif - okstat = (myWid == ((Handle(AIS_InteractiveObject)&) anObj)->Width()) && okstat; + okstat = (myWid == Handle(AIS_InteractiveObject)::DownCast (anObj)->Width()) && okstat; return okstat; diff --git a/src/AIS/AIS_BadEdgeFilter.cxx b/src/AIS/AIS_BadEdgeFilter.cxx index a8cfd10273..0a0b2fc901 100644 --- a/src/AIS/AIS_BadEdgeFilter.cxx +++ b/src/AIS/AIS_BadEdgeFilter.cxx @@ -59,7 +59,7 @@ Standard_Boolean AIS_BadEdgeFilter::IsOk(const Handle(SelectMgr_EntityOwner)& EO if (myContour==0) return Standard_True; - const TopoDS_Shape& aShape = ((Handle(StdSelect_BRepOwner)&)EO)->Shape(); + const TopoDS_Shape& aShape = Handle(StdSelect_BRepOwner)::DownCast (EO)->Shape(); if (myBadEdges.IsBound(myContour)) { TopTools_ListIteratorOfListOfShape it(myBadEdges.Find(myContour)); diff --git a/src/AIS/AIS_C0RegularityFilter.cxx b/src/AIS/AIS_C0RegularityFilter.cxx index f22155d390..8e2562f459 100644 --- a/src/AIS/AIS_C0RegularityFilter.cxx +++ b/src/AIS/AIS_C0RegularityFilter.cxx @@ -80,7 +80,7 @@ Standard_Boolean AIS_C0RegularityFilter::IsOk(const Handle(SelectMgr_EntityOwner if (Handle(StdSelect_BRepOwner)::DownCast(EO).IsNull()) return Standard_False; - const TopoDS_Shape& aShape = ((Handle(StdSelect_BRepOwner)&)EO)->Shape(); + const TopoDS_Shape& aShape = Handle(StdSelect_BRepOwner)::DownCast (EO)->Shape(); if(aShape.ShapeType()!= TopAbs_EDGE) return Standard_False; diff --git a/src/AIS/AIS_ConcentricRelation.cxx b/src/AIS/AIS_ConcentricRelation.cxx index f209345691..ee87e19aab 100644 --- a/src/AIS/AIS_ConcentricRelation.cxx +++ b/src/AIS/AIS_ConcentricRelation.cxx @@ -118,7 +118,7 @@ void AIS_ConcentricRelation::ComputeEdgeVertexConcentric(const Handle(Prs3d_Pres gp_Pnt P; AIS::ComputeGeometry(V,P, myPlane, isOnPlanVertex); - const Handle(Geom_Circle)& CIRCLE = (Handle(Geom_Circle)&) C; + Handle(Geom_Circle) CIRCLE (Handle(Geom_Circle)::DownCast (C)); myCenter = CIRCLE->Location(); myRad = Min(CIRCLE->Radius()/5.,15.); gp_Dir vec(p1.XYZ() - myCenter.XYZ() ); @@ -180,8 +180,8 @@ void AIS_ConcentricRelation::ComputeTwoEdgesConcentric(const Handle(Prs3d_Presen return; } - const Handle(Geom_Circle)& gcirc1 = (Handle(Geom_Circle)&) geom1; - const Handle(Geom_Circle)& gcirc2 = (Handle(Geom_Circle)&) geom2; + Handle(Geom_Circle) gcirc1 (Handle(Geom_Circle)::DownCast (geom1)); + Handle(Geom_Circle) gcirc2 (Handle(Geom_Circle)::DownCast (geom2)); myCenter = gcirc1->Location(); diff --git a/src/AIS/AIS_EqualDistanceRelation.cxx b/src/AIS/AIS_EqualDistanceRelation.cxx index e4c7bcca51..a72181fd48 100644 --- a/src/AIS/AIS_EqualDistanceRelation.cxx +++ b/src/AIS/AIS_EqualDistanceRelation.cxx @@ -401,8 +401,8 @@ void AIS_EqualDistanceRelation::ComputeTwoEdgesLength( const Handle( Prs3d_Prese if (cu1.GetType() == GeomAbs_Line && cu2.GetType() == GeomAbs_Line) { - const Handle(Geom_Line)& geom_lin1 = (Handle(Geom_Line)&) geom1; - const Handle(Geom_Line)& geom_lin2 = (Handle(Geom_Line)&) geom2; + Handle(Geom_Line) geom_lin1 (Handle(Geom_Line)::DownCast (geom1)); + Handle(Geom_Line) geom_lin2 (Handle(Geom_Line)::DownCast (geom2)); const gp_Lin& l1 = geom_lin1->Lin(); const gp_Lin& l2 = geom_lin2->Lin(); @@ -494,8 +494,8 @@ void AIS_EqualDistanceRelation::ComputeTwoEdgesLength( const Handle( Prs3d_Prese } if (cu1.GetType() == GeomAbs_Circle && cu2.GetType() == GeomAbs_Circle){ //Get first and last points of circles - const Handle(Geom_Circle)& aCir1 = Handle(Geom_Circle)::DownCast(geom1); - const Handle(Geom_Circle)& aCir2 = Handle(Geom_Circle)::DownCast(geom2); + Handle(Geom_Circle) aCir1 (Handle(Geom_Circle)::DownCast(geom1)); + Handle(Geom_Circle) aCir2 (Handle(Geom_Circle)::DownCast(geom2)); gp_Circ aCirc1 = aCir1->Circ(); gp_Circ aCirc2 = aCir2->Circ(); @@ -725,7 +725,7 @@ void AIS_EqualDistanceRelation::ComputeOneEdgeOneVertexLength( const Handle( Prs if ( aCurve->IsInstance(STANDARD_TYPE(Geom_Line)) ) { - const Handle(Geom_Line)& geom_lin = (Handle(Geom_Line)&) aCurve; + Handle(Geom_Line) geom_lin (Handle(Geom_Line)::DownCast (aCurve)); const gp_Lin& l = geom_lin->Lin(); // computation of Val diff --git a/src/AIS/AIS_IdenticRelation.cxx b/src/AIS/AIS_IdenticRelation.cxx index 6031f37205..3b6cbccc6e 100644 --- a/src/AIS/AIS_IdenticRelation.cxx +++ b/src/AIS/AIS_IdenticRelation.cxx @@ -420,7 +420,7 @@ void AIS_IdenticRelation::ComputeSelection(const Handle(SelectMgr_Selection)& aS if ( isCircle ) // case of Circles { - Handle(Geom_Circle) thecirc = (Handle(Geom_Circle)&) curv1; + Handle(Geom_Circle) thecirc = Handle(Geom_Circle)::DownCast (curv1); Standard_Real udeb = ElCLib::Parameter(thecirc->Circ(),myFAttach); Standard_Real ufin = ElCLib::Parameter(thecirc->Circ(),mySAttach); Handle(Geom_TrimmedCurve) thecu = new Geom_TrimmedCurve(thecirc,udeb,ufin); @@ -433,7 +433,7 @@ void AIS_IdenticRelation::ComputeSelection(const Handle(SelectMgr_Selection)& aS } else if ( curv1->IsInstance(STANDARD_TYPE(Geom_Ellipse)) ) // case of ellipses { - Handle(Geom_Ellipse) theEll = (Handle(Geom_Ellipse)&) curv1; + Handle(Geom_Ellipse) theEll = Handle(Geom_Ellipse)::DownCast (curv1); Standard_Real udeb = ElCLib::Parameter(theEll->Elips(),myFAttach); Standard_Real ufin = ElCLib::Parameter(theEll->Elips(),mySAttach); @@ -510,9 +510,9 @@ void AIS_IdenticRelation::ComputeTwoEdgesPresentation(const Handle(Prs3d_Present if ( curv1->IsInstance(STANDARD_TYPE(Geom_Line)) && curv2->IsInstance(STANDARD_TYPE(Geom_Line)) ) { // we take the line curv1 like support Handle(Geom_Line) thelin; - if (isInfinite1 && !isInfinite2) thelin = (Handle(Geom_Line)&) curv2; - else if (!isInfinite1 && isInfinite2) thelin = (Handle(Geom_Line)&) curv1; - else thelin = (Handle(Geom_Line)&) curv1; + if (isInfinite1 && !isInfinite2) thelin = Handle(Geom_Line)::DownCast (curv2); + else if (!isInfinite1 && isInfinite2) thelin = Handle(Geom_Line)::DownCast (curv1); + else thelin = Handle(Geom_Line)::DownCast (curv1); ComputeTwoLinesPresentation(aPrs, thelin, firstp1, lastp1, firstp2, lastp2, isInfinite1, isInfinite2); } @@ -520,7 +520,7 @@ void AIS_IdenticRelation::ComputeTwoEdgesPresentation(const Handle(Prs3d_Present else if ( curv1->IsInstance(STANDARD_TYPE(Geom_Circle)) && curv2->IsInstance(STANDARD_TYPE(Geom_Circle)) ) { //gp_Pnt curpos; isCircle = Standard_True; // useful for ComputeSelection - const Handle(Geom_Circle)& thecirc = (Handle(Geom_Circle)&) curv1; + Handle(Geom_Circle) thecirc (Handle(Geom_Circle)::DownCast (curv1)); ComputeTwoCirclesPresentation(aPrs, thecirc, firstp1, lastp1, firstp2, lastp2); } @@ -528,7 +528,7 @@ void AIS_IdenticRelation::ComputeTwoEdgesPresentation(const Handle(Prs3d_Present // Treatement of the case of ellipses else if ( curv1->IsInstance(STANDARD_TYPE(Geom_Ellipse)) && curv2->IsInstance(STANDARD_TYPE(Geom_Ellipse)) ) { - const Handle(Geom_Ellipse)& theEll = (Handle(Geom_Ellipse)&) curv1; + Handle(Geom_Ellipse) theEll (Handle(Geom_Ellipse)::DownCast (curv1)); ComputeTwoEllipsesPresentation(aPrs, theEll, firstp1, lastp1, firstp2, lastp2); } // jfa 10/10/2000 end @@ -1477,7 +1477,7 @@ void AIS_IdenticRelation::ComputeTwoVerticesPresentation(const Handle(Prs3d_Pres TColStd_ListIteratorOfListOfTransient it(Users()); if (it.More()) { - const Handle(AIS_Shape)& USER = Handle(AIS_Shape)::DownCast(it.Value()); + Handle(AIS_Shape) USER (Handle(AIS_Shape)::DownCast(it.Value())); if (!USER.IsNull()) { const TopoDS_Shape& SH =USER->Shape(); @@ -1576,19 +1576,19 @@ Standard_Boolean AIS_IdenticRelation::ComputeDirection(const TopoDS_Wire& aWire, gp_Dir d1, d2; if ( curv1->IsInstance(STANDARD_TYPE(Geom_Circle)) ) { - d1 = ComputeCircleDirection((Handle(Geom_Circle)&) curv1, VERT); + d1 = ComputeCircleDirection(Handle(Geom_Circle)::DownCast (curv1), VERT); } else if (curv1->IsInstance(STANDARD_TYPE(Geom_Line)) ) { - d1 = ComputeLineDirection((Handle(Geom_Line)&) curv1, firstp1); + d1 = ComputeLineDirection(Handle(Geom_Line)::DownCast (curv1), firstp1); } else return Standard_False; if ( curv2->IsInstance(STANDARD_TYPE(Geom_Circle)) ) { - d2 = ComputeCircleDirection( (Handle(Geom_Circle)&) curv2, VERT); + d2 = ComputeCircleDirection( Handle(Geom_Circle)::DownCast (curv2), VERT); } else if (curv2->IsInstance(STANDARD_TYPE(Geom_Line)) ) { - d2 =ComputeLineDirection( (Handle(Geom_Line)&) curv2, firstp2); + d2 =ComputeLineDirection( Handle(Geom_Line)::DownCast (curv2), firstp2); } else return Standard_False; @@ -1613,10 +1613,10 @@ Standard_Boolean AIS_IdenticRelation::ComputeDirection(const TopoDS_Wire& aWire, if ( !AIS::ComputeGeometry(VEdge, curv1, firstp1, lastp1) ) return Standard_False; if ( curv1->IsInstance(STANDARD_TYPE(Geom_Circle)) ) { - dF = ComputeCircleDirection( (Handle(Geom_Circle)&) curv1, VERT); + dF = ComputeCircleDirection( Handle(Geom_Circle)::DownCast (curv1), VERT); } else if (curv1->IsInstance(STANDARD_TYPE(Geom_Line)) ) { - dF = ComputeLineDirection( (Handle(Geom_Line)&) curv1, firstp1); + dF = ComputeLineDirection( Handle(Geom_Line)::DownCast (curv1), firstp1); } else return Standard_False; @@ -1704,16 +1704,16 @@ void AIS_IdenticRelation::ComputeOneEdgeOVertexPresentation(const Handle(Prs3d_P // we take the median of the edges connected to vertices gp_Dir myDir; if ( aCurve->IsKind(STANDARD_TYPE(Geom_Line))) { - myDir = ((Handle(Geom_Line)&) aCurve)->Lin().Direction(); + myDir = Handle(Geom_Line)::DownCast (aCurve)->Lin().Direction(); myDir.Cross(myPlane->Pln().Axis().Direction()); } else if (aCurve->IsKind(STANDARD_TYPE(Geom_Circle))) { - Handle(Geom_Circle) CIR = (Handle(Geom_Circle)&) aCurve; + Handle(Geom_Circle) CIR = Handle(Geom_Circle)::DownCast (aCurve); myDir.SetXYZ(myFAttach.XYZ() - CIR->Location().XYZ()); } // jfa 10/10/2000 else if (aCurve->IsKind(STANDARD_TYPE(Geom_Ellipse))) { - Handle(Geom_Ellipse) CIR = (Handle(Geom_Ellipse)&) aCurve; + Handle(Geom_Ellipse) CIR = Handle(Geom_Ellipse)::DownCast (aCurve); myDir.SetXYZ(myFAttach.XYZ() - CIR->Location().XYZ()); } // jfa 10/10/2000 end @@ -1735,7 +1735,7 @@ void AIS_IdenticRelation::ComputeOneEdgeOVertexPresentation(const Handle(Prs3d_P curpos); if (myExtShape != 0) { if (!extCurv.IsNull()) { // the edge is not in the WP - ComputeProjEdgePresentation(aPrs,E,(Handle(Geom_Line)&) aCurve,ptonedge1,ptonedge2); + ComputeProjEdgePresentation(aPrs,E,Handle(Geom_Line)::DownCast (aCurve),ptonedge1,ptonedge2); } } } diff --git a/src/AIS/AIS_InteractiveContext.cxx b/src/AIS/AIS_InteractiveContext.cxx index 1111281188..ff0cad77a0 100644 --- a/src/AIS/AIS_InteractiveContext.cxx +++ b/src/AIS/AIS_InteractiveContext.cxx @@ -213,7 +213,7 @@ void AIS_InteractiveContext::DisplayedObjects (AIS_ListOfInteractive& theListOfI for (TColStd_MapIteratorOfMapOfTransient aDispMapIter (aDispMap); aDispMapIter.More(); aDispMapIter.Next()) { const Handle(Standard_Transient)& aTransient = aDispMapIter.Key(); - anObj = *((Handle(AIS_InteractiveObject)* )&aTransient); + anObj = Handle(AIS_InteractiveObject)::DownCast (aTransient); theListOfIO.Append (anObj); } } @@ -2821,15 +2821,13 @@ void AIS_InteractiveContext::Disconnect (const Handle(AIS_InteractiveObject)& th { if (theAssembly->IsInstance ("AIS_MultipleConnectedInteractive")) { - const Handle(AIS_MultipleConnectedInteractive)& theObj = - Handle(AIS_MultipleConnectedInteractive)::DownCast (theAssembly); + Handle(AIS_MultipleConnectedInteractive) theObj (Handle(AIS_MultipleConnectedInteractive)::DownCast (theAssembly)); theObj->Disconnect (theObjToDisconnect); mgrSelector->Remove (theObjToDisconnect); } else if (theAssembly->IsInstance ("AIS_ConnectedInteractive") && theObjToDisconnect.IsNull()) { - const Handle(AIS_ConnectedInteractive)& theObj = - Handle(AIS_ConnectedInteractive)::DownCast (theAssembly); + Handle(AIS_ConnectedInteractive) theObj (Handle(AIS_ConnectedInteractive)::DownCast (theAssembly)); theObj->Disconnect(); mgrSelector->Remove (theObj); } @@ -2855,8 +2853,7 @@ void AIS_InteractiveContext::FitSelected (const Handle(V3d_View)& theView, AIS_MapOfObjectOwners anObjectOwnerMap; for (aSelection->Init(); aSelection->More(); aSelection->Next()) { - const Handle(AIS_InteractiveObject)& anObj = - Handle(AIS_InteractiveObject)::DownCast (aSelection->Value()); + Handle(AIS_InteractiveObject) anObj (Handle(AIS_InteractiveObject)::DownCast (aSelection->Value())); if (!anObj.IsNull()) { if (anObj->IsInfinite()) @@ -2868,8 +2865,7 @@ void AIS_InteractiveContext::FitSelected (const Handle(V3d_View)& theView, } else { - const Handle(SelectMgr_EntityOwner)& anOwner = - Handle(SelectMgr_EntityOwner)::DownCast (aSelection->Value()); + Handle(SelectMgr_EntityOwner) anOwner (Handle(SelectMgr_EntityOwner)::DownCast (aSelection->Value())); if (anOwner.IsNull()) continue; diff --git a/src/AIS/AIS_InteractiveContext_1.cxx b/src/AIS/AIS_InteractiveContext_1.cxx index 3e583dd1d0..4b7b25e24c 100644 --- a/src/AIS/AIS_InteractiveContext_1.cxx +++ b/src/AIS/AIS_InteractiveContext_1.cxx @@ -541,7 +541,7 @@ void AIS_InteractiveContext::SetCurrentObject(const Handle(AIS_InteractiveObject sel->Init(); while (sel->More()) { TR = sel->Value(); - IO = *((Handle(AIS_InteractiveObject)*)&TR); + IO = Handle(AIS_InteractiveObject)::DownCast (TR); Unhilight(IO,Standard_False); IO->State(0); sel->Next(); @@ -675,7 +675,7 @@ void AIS_InteractiveContext::NextCurrent() Handle(AIS_InteractiveObject) AIS_InteractiveContext::Current() const { Handle(Standard_Transient) TR = AIS_Selection::Selection(myCurrentName.ToCString())->Value(); - Handle(AIS_InteractiveObject) IO = *((Handle(AIS_InteractiveObject)*)&TR); + Handle(AIS_InteractiveObject) IO = Handle(AIS_InteractiveObject)::DownCast (TR); return IO; } @@ -718,7 +718,7 @@ void AIS_InteractiveContext::HilightCurrents(const Standard_Boolean updateviewer sel->Init(); while (sel->More()) { TR = sel->Value(); - IO = *((Handle(AIS_InteractiveObject)*)&TR); + IO = Handle(AIS_InteractiveObject)::DownCast (TR); HilightWithColor(IO,mySelectionColor,Standard_False); sel->Next(); } @@ -740,7 +740,7 @@ void AIS_InteractiveContext::UnhilightCurrents(const Standard_Boolean updateview sel->Init(); while (sel->More()) { TR = sel->Value(); - IO = *((Handle(AIS_InteractiveObject)*)&TR); + IO = Handle(AIS_InteractiveObject)::DownCast (TR); Unhilight(IO,Standard_False); sel->Next(); } @@ -762,7 +762,7 @@ void AIS_InteractiveContext::ClearCurrents(const Standard_Boolean updateviewer) Handle(AIS_InteractiveObject) IO; for(S->Init();S->More();S->Next()){ Tr = S->Value(); - IO = (*((Handle(AIS_InteractiveObject)*)&Tr)); + IO = Handle(AIS_InteractiveObject)::DownCast (Tr); IO->State(0); Unhilight(IO,Standard_False); } @@ -787,7 +787,7 @@ void AIS_InteractiveContext::HilightSelected(const Standard_Boolean updateviewer sel->Init(); while (sel->More()) { TR = sel->Value(); - IO = *((Handle(AIS_InteractiveObject)*)&TR); + IO = Handle(AIS_InteractiveObject)::DownCast (TR); HilightWithColor(IO,mySelectionColor,Standard_False); sel->Next(); } @@ -815,7 +815,7 @@ void AIS_InteractiveContext::UnhilightSelected(const Standard_Boolean updateview sel->Init(); while (sel->More()) { TR = sel->Value(); - IO = *((Handle(AIS_InteractiveObject)*)&TR); + IO = Handle(AIS_InteractiveObject)::DownCast (TR); Unhilight(IO,Standard_False); sel->Next(); } @@ -1055,7 +1055,7 @@ Handle(AIS_InteractiveObject) AIS_InteractiveContext::SelectedInteractive() cons if (AIS_Selection::Selection(myCurrentName.ToCString())->Extent() == 0) return NULL; Handle(Standard_Transient) TR =AIS_Selection::Selection(myCurrentName.ToCString())->Value(); - Handle(AIS_InteractiveObject) IO = *((Handle(AIS_InteractiveObject)*)&TR); + Handle(AIS_InteractiveObject) IO = Handle(AIS_InteractiveObject)::DownCast (TR); return IO;} return myLocalContexts(myCurLocalIndex)->SelectedInteractive(); diff --git a/src/AIS/AIS_InteractiveObject.cxx b/src/AIS/AIS_InteractiveObject.cxx index 0b52a52843..65a284be13 100644 --- a/src/AIS/AIS_InteractiveObject.cxx +++ b/src/AIS/AIS_InteractiveObject.cxx @@ -633,7 +633,7 @@ void AIS_InteractiveObject::BoundingBox (Bnd_Box& theBndBox) { for (PrsMgr_ListOfPresentableObjectsIter aPrsIter (Children()); aPrsIter.More(); aPrsIter.Next()) { - const Handle(AIS_InteractiveObject)& aChild = Handle(AIS_InteractiveObject)::DownCast (aPrsIter.Value()); + Handle(AIS_InteractiveObject) aChild (Handle(AIS_InteractiveObject)::DownCast (aPrsIter.Value())); if (aChild.IsNull()) { continue; diff --git a/src/AIS/AIS_LengthDimension.cxx b/src/AIS/AIS_LengthDimension.cxx index 005f9d5a77..ac481c09d2 100755 --- a/src/AIS/AIS_LengthDimension.cxx +++ b/src/AIS/AIS_LengthDimension.cxx @@ -411,7 +411,7 @@ Standard_Boolean AIS_LengthDimension::InitEdgeVertexLength (const TopoDS_Edge& t myFirstPoint = BRep_Tool::Pnt (theVertex); - const Handle(Geom_Line)& aGeomLine = (Handle(Geom_Line)&) aCurve; + Handle(Geom_Line) aGeomLine (Handle(Geom_Line)::DownCast (aCurve)); const gp_Lin& aLin = aGeomLine->Lin(); // Get direction of edge to build plane automatically. diff --git a/src/AIS/AIS_LocalContext.cxx b/src/AIS/AIS_LocalContext.cxx index 1b77cfd0d8..b9f6b74a0b 100644 --- a/src/AIS/AIS_LocalContext.cxx +++ b/src/AIS/AIS_LocalContext.cxx @@ -620,7 +620,7 @@ void AIS_LocalContext::Terminate (const Standard_Boolean theToUpdate) Handle(Standard_Transient) Tr; for(S->Init();S->More();S->Next()){ Tr = S->Value(); - (*((Handle(SelectMgr_EntityOwner)*)&Tr))->SetSelected (Standard_False); + Handle(SelectMgr_EntityOwner)::DownCast (Tr)->SetSelected (Standard_False); } diff --git a/src/AIS/AIS_LocalContext_1.cxx b/src/AIS/AIS_LocalContext_1.cxx index 4b3ad35bf0..2d57d56678 100644 --- a/src/AIS/AIS_LocalContext_1.cxx +++ b/src/AIS/AIS_LocalContext_1.cxx @@ -533,11 +533,11 @@ void AIS_LocalContext::HilightPicked(const Standard_Boolean updateviewer) Handle(StdSelect_BRepOwner) BROwnr = Handle(StdSelect_BRepOwner)::DownCast(Ownr); if(BROwnr.IsNull() || !BROwnr->ComesFromDecomposition()){ Handle(SelectMgr_SelectableObject) SO = Ownr->Selectable(); - IO = *((Handle(AIS_InteractiveObject)*)&SO); + IO = Handle(AIS_InteractiveObject)::DownCast (SO); } } Handle(SelectMgr_SelectableObject) SO = Ownr->Selectable(); - Standard_Integer HM = GetHiMod(*((Handle(AIS_InteractiveObject)*)&SO)); + Standard_Integer HM = GetHiMod(Handle(AIS_InteractiveObject)::DownCast (SO)); if ( Ownr->IsAutoHilight() ) Ownr->HilightWithColor(PM,myCTX->SelectionColor(),HM); else if ( aMap.IsBound (SO) ) @@ -585,7 +585,7 @@ void AIS_LocalContext::UnhilightPicked (const Standard_Boolean updateviewer) Standard_Integer HM(0); if(Ownr->HasSelectable()){ Handle(SelectMgr_SelectableObject) SO = Ownr->Selectable(); - Handle(AIS_InteractiveObject) IO = *((Handle(AIS_InteractiveObject)*)&SO); + Handle(AIS_InteractiveObject) IO = Handle(AIS_InteractiveObject)::DownCast (SO); anObjMap.Add (IO); HM = GetHiMod(IO); @@ -667,7 +667,7 @@ HasShape() const { Handle(Standard_Transient) Tr = AIS_Selection::CurrentSelection()->Value(); if( Tr.IsNull() ) return Standard_False; - Handle(SelectMgr_EntityOwner) EO = *((Handle(SelectMgr_EntityOwner)*)&Tr); + Handle(SelectMgr_EntityOwner) EO = Handle(SelectMgr_EntityOwner)::DownCast (Tr); Handle(StdSelect_BRepOwner) BRO = Handle(StdSelect_BRepOwner)::DownCast(EO); if(BRO.IsNull()) return Standard_False; Standard_Boolean hasshape = BRO->HasShape(); @@ -704,7 +704,7 @@ Standard_Boolean AIS_LocalContext::HasSelectedShape() const TopoDS_Shape AIS_LocalContext::SelectedShape() const { Handle(Standard_Transient) aTr = AIS_Selection::CurrentSelection()->Value(); - Handle(SelectMgr_EntityOwner) anEO = *((Handle(SelectMgr_EntityOwner)*)&aTr); + Handle(SelectMgr_EntityOwner) anEO = Handle(SelectMgr_EntityOwner)::DownCast (aTr); Handle(StdSelect_BRepOwner) aBRO = Handle(StdSelect_BRepOwner)::DownCast(anEO); if( aBRO.IsNull() ) { @@ -724,11 +724,11 @@ SelectedInteractive() const Handle(AIS_InteractiveObject) IO; Handle(Standard_Transient) Tr = AIS_Selection::CurrentSelection()->Value(); if( !Tr.IsNull() ) { - Handle(SelectMgr_EntityOwner) EO = *((Handle(SelectMgr_EntityOwner)*)&Tr); + Handle(SelectMgr_EntityOwner) EO = Handle(SelectMgr_EntityOwner)::DownCast (Tr); Handle(SelectMgr_SelectableObject) SO; if(EO->HasSelectable()){ SO = EO->Selectable(); - IO = *((Handle(AIS_InteractiveObject)*)&SO); + IO = Handle(AIS_InteractiveObject)::DownCast (SO); } } return IO; @@ -743,7 +743,7 @@ SelectedOwner() const Handle(SelectMgr_EntityOwner) EO; Handle(Standard_Transient) Tr = AIS_Selection::CurrentSelection()->Value(); if( !Tr.IsNull() ) - EO = *((Handle(SelectMgr_EntityOwner)*)&Tr); + EO = Handle(SelectMgr_EntityOwner)::DownCast (Tr); return EO; } @@ -1016,7 +1016,7 @@ void AIS_LocalContext::SetSelected(const Handle(AIS_InteractiveObject)& anIObj, SIOBJ->Init(); if(SIOBJ->More()){ Handle(SelectBasics_EntityOwner) BO = SIOBJ->Sensitive()->BaseSensitive()->OwnerId(); - EO = *((Handle(SelectMgr_EntityOwner)*)&BO); + EO = Handle(SelectMgr_EntityOwner)::DownCast (BO); } } if(EO.IsNull()) @@ -1054,7 +1054,7 @@ void AIS_LocalContext::AddOrRemoveSelected(const Handle(AIS_InteractiveObject)& SIOBJ->Init(); if(SIOBJ->More()){ Handle(SelectBasics_EntityOwner) BO = SIOBJ->Sensitive()->BaseSensitive()->OwnerId(); - EO = *((Handle(SelectMgr_EntityOwner)*)&BO); + EO = Handle(SelectMgr_EntityOwner)::DownCast (BO); } } if(EO.IsNull()) @@ -1242,7 +1242,7 @@ AIS_LocalContext::DetectedInteractive() const Handle(AIS_InteractiveObject) Iobj; if(IsValidIndex(mylastindex)){ Handle(SelectMgr_SelectableObject) SO = myMapOfOwner->FindKey(mylastindex)->Selectable(); - Iobj = *((Handle(AIS_InteractiveObject)*) &SO); + Iobj = Handle(AIS_InteractiveObject)::DownCast (SO); } return Iobj; } @@ -1420,7 +1420,7 @@ Handle(SelectMgr_EntityOwner) AIS_LocalContext::FindSelectedOwnerFromIO for(; anIter.More(); anIter.Next()){ const Handle(Standard_Transient)& Tr = anIter.Value(); if(!Tr.IsNull()){ - EO = *((Handle(SelectMgr_EntityOwner)*)&Tr); + EO = Handle(SelectMgr_EntityOwner)::DownCast (Tr); if(EO->HasSelectable()){ Handle(StdSelect_BRepOwner) BROwnr = Handle(StdSelect_BRepOwner)::DownCast(EO); if(BROwnr.IsNull() || !BROwnr->ComesFromDecomposition()){ diff --git a/src/AIS/AIS_MidPointRelation.cxx b/src/AIS/AIS_MidPointRelation.cxx index f17c0cfad3..89eac2cd9f 100644 --- a/src/AIS/AIS_MidPointRelation.cxx +++ b/src/AIS/AIS_MidPointRelation.cxx @@ -212,7 +212,7 @@ void AIS_MidPointRelation::ComputeSelection(const Handle(SelectMgr_Selection)& a else if ( curv->IsInstance(STANDARD_TYPE(Geom_Circle)) ) // case of circle { // segment on circle - Handle(Geom_Circle) thecirc = (Handle(Geom_Circle)&) curv; + Handle(Geom_Circle) thecirc = Handle(Geom_Circle)::DownCast (curv); Standard_Real udeb = ElCLib::Parameter(thecirc->Circ(),myFirstPnt1); Standard_Real ufin = ElCLib::Parameter(thecirc->Circ(),myFirstPnt2); Handle(Geom_TrimmedCurve) thecu = new Geom_TrimmedCurve(thecirc,udeb,ufin); @@ -223,7 +223,7 @@ void AIS_MidPointRelation::ComputeSelection(const Handle(SelectMgr_Selection)& a else if ( curv->IsInstance(STANDARD_TYPE(Geom_Ellipse)) ) // case of ellipse { // segment on ellipse - Handle(Geom_Ellipse) theEll = (Handle(Geom_Ellipse)&) curv; + Handle(Geom_Ellipse) theEll = Handle(Geom_Ellipse)::DownCast (curv); Standard_Real udeb = ElCLib::Parameter(theEll->Elips(),myFirstPnt1); Standard_Real ufin = ElCLib::Parameter(theEll->Elips(),myFirstPnt2); Handle(Geom_TrimmedCurve) thecu = new Geom_TrimmedCurve(theEll,udeb,ufin); @@ -247,7 +247,7 @@ void AIS_MidPointRelation::ComputeSelection(const Handle(SelectMgr_Selection)& a else if ( curv->IsInstance(STANDARD_TYPE(Geom_Circle)) ) // case of circle { // segment on circle - Handle(Geom_Circle) thecirc = (Handle(Geom_Circle)&) curv; + Handle(Geom_Circle) thecirc = Handle(Geom_Circle)::DownCast (curv); Standard_Real udeb = ElCLib::Parameter(thecirc->Circ(),mySecondPnt1); Standard_Real ufin = ElCLib::Parameter(thecirc->Circ(),mySecondPnt2); Handle(Geom_TrimmedCurve) thecu = new Geom_TrimmedCurve(thecirc,udeb,ufin); @@ -258,7 +258,7 @@ void AIS_MidPointRelation::ComputeSelection(const Handle(SelectMgr_Selection)& a else if ( curv->IsInstance(STANDARD_TYPE(Geom_Ellipse)) ) // case of ellipse { // segment on ellipse - Handle(Geom_Ellipse) theEll = (Handle(Geom_Ellipse)&) curv; + Handle(Geom_Ellipse) theEll = Handle(Geom_Ellipse)::DownCast (curv); Standard_Real udeb = ElCLib::Parameter(theEll->Elips(),mySecondPnt1); Standard_Real ufin = ElCLib::Parameter(theEll->Elips(),mySecondPnt2); Handle(Geom_TrimmedCurve) thecu = new Geom_TrimmedCurve(theEll,udeb,ufin); @@ -302,7 +302,7 @@ void AIS_MidPointRelation::ComputeEdgeFromPnt(const Handle(Prs3d_Presentation)& if ( !isInfinite ) ComputePointsOnLine(ptat1,ptat2,first); else { - const gp_Lin& line = ((Handle(Geom_Line)&) geom)->Lin(); + const gp_Lin& line = Handle(Geom_Line)::DownCast (geom)->Lin(); ComputePointsOnLine(line,first); } if ( first ) DsgPrs_MidPointPresentation::Add(aprs,myDrawer,ax,myMidPoint,myPosition, @@ -312,7 +312,7 @@ void AIS_MidPointRelation::ComputeEdgeFromPnt(const Handle(Prs3d_Presentation)& } else if ( geom->IsInstance(STANDARD_TYPE(Geom_Circle)) ) { - const Handle(Geom_Circle)& geom_cir = (Handle(Geom_Circle)&) geom; + Handle(Geom_Circle) geom_cir (Handle(Geom_Circle)::DownCast (geom)); gp_Circ circ (geom_cir->Circ()); ComputePointsOnCirc(circ,ptat1,ptat2,first); if ( first ) DsgPrs_MidPointPresentation::Add(aprs,myDrawer,circ,myMidPoint,myPosition, @@ -322,7 +322,7 @@ void AIS_MidPointRelation::ComputeEdgeFromPnt(const Handle(Prs3d_Presentation)& } else if ( geom->IsInstance(STANDARD_TYPE(Geom_Ellipse)) ) { - const Handle(Geom_Ellipse)& geom_ell = (Handle(Geom_Ellipse)&) geom; + Handle(Geom_Ellipse) geom_ell (Handle(Geom_Ellipse)::DownCast (geom)); gp_Elips elips (geom_ell->Elips()); ComputePointsOnElips(elips,ptat1,ptat2,first); if ( first ) DsgPrs_MidPointPresentation::Add(aprs,myDrawer,elips,myMidPoint,myPosition, diff --git a/src/AIS/AIS_ParallelRelation.cxx b/src/AIS/AIS_ParallelRelation.cxx index 0a9fbe7fd0..f1c60acb78 100644 --- a/src/AIS/AIS_ParallelRelation.cxx +++ b/src/AIS/AIS_ParallelRelation.cxx @@ -248,7 +248,7 @@ void AIS_ParallelRelation::ComputeTwoEdgesParallel(const Handle(Prs3d_Presentati if (geom1->IsInstance(STANDARD_TYPE(Geom_Ellipse))) { - const Handle(Geom_Ellipse)& geom_el1 = (Handle(Geom_Ellipse)&) geom1; + Handle(Geom_Ellipse) geom_el1 (Handle(Geom_Ellipse)::DownCast (geom1)); // construct lines through focuses gp_Ax1 elAx = geom_el1->XAxis(); l1 = gp_Lin(elAx); @@ -260,14 +260,14 @@ void AIS_ParallelRelation::ComputeTwoEdgesParallel(const Handle(Prs3d_Presentati } else if (geom1->IsInstance(STANDARD_TYPE(Geom_Line))) { - const Handle(Geom_Line)& geom_lin1 = (Handle(Geom_Line)&) geom1; + Handle(Geom_Line) geom_lin1 (Handle(Geom_Line)::DownCast (geom1)); l1 = geom_lin1->Lin(); } else return; if (geom2->IsInstance(STANDARD_TYPE(Geom_Ellipse))) { - const Handle(Geom_Ellipse)& geom_el2 = (Handle(Geom_Ellipse)&) geom2; + Handle(Geom_Ellipse) geom_el2 (Handle(Geom_Ellipse)::DownCast (geom2)); // construct lines through focuses gp_Ax1 elAx = geom_el2->XAxis(); l2 = gp_Lin(elAx); @@ -279,7 +279,7 @@ void AIS_ParallelRelation::ComputeTwoEdgesParallel(const Handle(Prs3d_Presentati } else if (geom2->IsInstance(STANDARD_TYPE(Geom_Line))) { - const Handle(Geom_Line)& geom_lin2 = (Handle(Geom_Line)&) geom2; + Handle(Geom_Line) geom_lin2 (Handle(Geom_Line)::DownCast (geom2)); l2 = geom_lin2->Lin(); } else return; diff --git a/src/AIS/AIS_PerpendicularRelation.cxx b/src/AIS/AIS_PerpendicularRelation.cxx index d964b2f147..b636bddc17 100644 --- a/src/AIS/AIS_PerpendicularRelation.cxx +++ b/src/AIS/AIS_PerpendicularRelation.cxx @@ -212,7 +212,7 @@ void AIS_PerpendicularRelation::ComputeTwoEdgesPerpendicular(const Handle(Prs3d_ Handle(Geom_Line) geom_lin2; if ( geom1->IsInstance(STANDARD_TYPE(Geom_Ellipse)) ) { - const Handle(Geom_Ellipse)& geom_el = (Handle(Geom_Ellipse)&) geom1; + Handle(Geom_Ellipse) geom_el (Handle(Geom_Ellipse)::DownCast (geom1)); // construct lines through focuses gp_Ax1 elAx = geom_el->XAxis(); gp_Lin ll (elAx); @@ -225,13 +225,13 @@ void AIS_PerpendicularRelation::ComputeTwoEdgesPerpendicular(const Handle(Prs3d_ } else if ( geom1->IsInstance(STANDARD_TYPE(Geom_Line)) ) { - geom_lin1 = (Handle(Geom_Line)&) geom1; + geom_lin1 = Handle(Geom_Line)::DownCast (geom1); } else return; if (geom2->IsInstance(STANDARD_TYPE(Geom_Ellipse))) { - const Handle(Geom_Ellipse)& geom_el = (Handle(Geom_Ellipse)&) geom2; + Handle(Geom_Ellipse) geom_el (Handle(Geom_Ellipse)::DownCast (geom2)); // construct lines through focuses gp_Ax1 elAx = geom_el->XAxis(); gp_Lin ll (elAx); @@ -244,7 +244,7 @@ void AIS_PerpendicularRelation::ComputeTwoEdgesPerpendicular(const Handle(Prs3d_ } else if ( geom2->IsInstance(STANDARD_TYPE(Geom_Line)) ) { - geom_lin2 = (Handle(Geom_Line)&) geom2; + geom_lin2 = Handle(Geom_Line)::DownCast (geom2); } else return; @@ -255,9 +255,9 @@ void AIS_PerpendicularRelation::ComputeTwoEdgesPerpendicular(const Handle(Prs3d_ // 2d lines => projection of 3d on current plane Handle(Geom2d_Curve) aGeom2dCurve = GeomAPI::To2d(geom_lin1,myPlane->Pln()); - Handle(Geom2d_Line) lin1_2d = (Handle(Geom2d_Line)&) aGeom2dCurve ; + Handle(Geom2d_Line) lin1_2d = Handle(Geom2d_Line)::DownCast (aGeom2dCurve) ; aGeom2dCurve = GeomAPI::To2d(geom_lin2,myPlane->Pln()); - Handle(Geom2d_Line) lin2_2d = (Handle(Geom2d_Line)&) aGeom2dCurve ; + Handle(Geom2d_Line) lin2_2d = Handle(Geom2d_Line)::DownCast (aGeom2dCurve) ; IntAna2d_AnaIntersection inter(lin1_2d->Lin2d(),lin2_2d->Lin2d()); if (!inter.IsDone()) return; if (!inter.NbPoints()) return; diff --git a/src/AIS/AIS_Plane.cxx b/src/AIS/AIS_Plane.cxx index a72c8f2570..ecadb66dd4 100644 --- a/src/AIS/AIS_Plane.cxx +++ b/src/AIS/AIS_Plane.cxx @@ -251,7 +251,7 @@ void AIS_Plane::Compute(const Handle(PrsMgr_PresentationManager3d)& , { ComputeFrame(); const Handle(Geom_Plane)& pl = myComponent; - const Handle(Geom_Plane)& thegoodpl = Handle(Geom_Plane)::DownCast(pl->Translated(pl->Location(),myCenter)); + Handle(Geom_Plane) thegoodpl (Handle(Geom_Plane)::DownCast(pl->Translated(pl->Location(),myCenter))); GeomAdaptor_Surface surf(thegoodpl); StdPrs_Plane::Add(aPresentation,surf,myDrawer); } @@ -531,8 +531,7 @@ void AIS_Plane::ComputeFrame() pl->D0 (U, V, myCenter); } else { - const Handle(Geom_Plane)& thegoodpl = - Handle(Geom_Plane)::DownCast(pl->Translated(pl->Location(),myCenter)); + Handle(Geom_Plane) thegoodpl (Handle(Geom_Plane)::DownCast(pl->Translated(pl->Location(),myCenter))); ElSLib::Parameters(thegoodpl->Pln(),myPmin,U,V); U = 2.4*Abs(U); diff --git a/src/AIS/AIS_Relation.cxx b/src/AIS/AIS_Relation.cxx index c8185d0af8..2b771b4c72 100644 --- a/src/AIS/AIS_Relation.cxx +++ b/src/AIS/AIS_Relation.cxx @@ -101,7 +101,7 @@ void AIS_Relation::ComputeProjEdgePresentation(const Handle(Prs3d_Presentation)& // Calcul de la presentation de l'edge if (ProjCurv->IsInstance(STANDARD_TYPE(Geom_Line)) ) { - const Handle(Geom_Line) & gl = (Handle(Geom_Line)&) ProjCurv; + Handle(Geom_Line) gl (Handle(Geom_Line)::DownCast (ProjCurv)); if ( !isInfinite) { pf = ElCLib::Parameter(gl->Lin(),FirstP); pl = ElCLib::Parameter(gl->Lin(),LastP); @@ -114,7 +114,7 @@ void AIS_Relation::ComputeProjEdgePresentation(const Handle(Prs3d_Presentation)& } } else if (ProjCurv->IsInstance(STANDARD_TYPE(Geom_Circle)) ) { - const Handle(Geom_Circle) & gc = (Handle(Geom_Circle)&) ProjCurv; + Handle(Geom_Circle) gc (Handle(Geom_Circle)::DownCast (ProjCurv)); pf = ElCLib::Parameter(gc->Circ(),FirstP); pl = ElCLib::Parameter(gc->Circ(),LastP); BRepBuilderAPI_MakeEdge MakEd(gc->Circ(),pf, pl); diff --git a/src/AIS/AIS_Selection.cxx b/src/AIS/AIS_Selection.cxx index 0ea8f3af6f..cc0583a447 100644 --- a/src/AIS/AIS_Selection.cxx +++ b/src/AIS/AIS_Selection.cxx @@ -79,7 +79,7 @@ Handle(AIS_Selection) AIS_Selection::Selection(const Standard_CString aName) // Standard_Boolean found(Standard_False); for(Standard_Integer I =1; I<= AIS_Sel_GetSelections().Length();I++){ curobj = AIS_Sel_GetSelections().Value(I); - Sel = *((Handle(AIS_Selection)*)&curobj); + Sel = Handle(AIS_Selection)::DownCast (curobj); if(Sel->myName.IsEqual(aName)) return Sel; } @@ -274,7 +274,7 @@ Standard_Integer AIS_Selection::Index(const Standard_CString aName) Handle (Standard_Transient) curobj; for(Standard_Integer I =1; I<= AIS_Sel_GetSelections().Length();I++){ curobj = AIS_Sel_GetSelections().Value(I); - if((*((Handle(AIS_Selection)*)&curobj))->myName.IsEqual(aName)) + if(Handle(AIS_Selection)::DownCast (curobj)->myName.IsEqual(aName)) return I; } return 0; diff --git a/src/AIS/AIS_SymmetricRelation.cxx b/src/AIS/AIS_SymmetricRelation.cxx index 0f51dce1bb..b3eff3dff1 100644 --- a/src/AIS/AIS_SymmetricRelation.cxx +++ b/src/AIS/AIS_SymmetricRelation.cxx @@ -241,7 +241,7 @@ void AIS_SymmetricRelation::ComputeSelection(const Handle(SelectMgr_Selection)& // Handle(Geom_Circle) geom_circ1 = (Handle(Geom_Circle)&) BRep_Tool::Curve(TopoDS::Edge(myFShape),F,L); //JR/Hp Handle(Geom_Curve) aGeomCurve = BRep_Tool::Curve(TopoDS::Edge(myFShape),F,L); - Handle(Geom_Circle) geom_circ1 = (Handle(Geom_Circle)&) aGeomCurve ; + Handle(Geom_Circle) geom_circ1 = Handle(Geom_Circle)::DownCast (aGeomCurve) ; // Handle(Geom_Circle) geom_circ1 = (const Handle(Geom_Circle)&) BRep_Tool::Curve(TopoDS::Edge(myFShape),F,L); gp_Circ circ1(geom_circ1->Circ()); gp_Pnt OffsetPnt(myPosition.X(),myPosition.Y(),myPosition.Z()); @@ -417,13 +417,13 @@ void AIS_SymmetricRelation::ComputeTwoEdgesSymmetric(const Handle(Prs3d_Presenta myAxisDirAttach = laxis.Direction(); if(cu1.GetType() == GeomAbs_Line){ - const Handle(Geom_Line)& geom_lin1 = (Handle(Geom_Line)&) geom1; + Handle(Geom_Line) geom_lin1 (Handle(Geom_Line)::DownCast (geom1)); gp_Lin l1(geom_lin1->Lin()); myFDirAttach = l1.Direction(); } gp_Circ circ; if(cu1.GetType() == GeomAbs_Circle){ - const Handle(Geom_Circle)& geom_cir1 = (Handle(Geom_Circle)&) geom1; + Handle(Geom_Circle) geom_cir1 (Handle(Geom_Circle)::DownCast (geom1)); gp_Circ c(geom_cir1->Circ()); circ = c; } @@ -444,13 +444,13 @@ void AIS_SymmetricRelation::ComputeTwoEdgesSymmetric(const Handle(Prs3d_Presenta */ Standard_Boolean idem = Standard_False; if (isInfinite1 && isInfinite2) { // geom1 et geom2 sont des lignes - const gp_Lin& line2 = ((Handle(Geom_Line)&) geom2)->Lin(); + const gp_Lin& line2 = Handle(Geom_Line)::DownCast (geom2)->Lin(); if (myAutomaticPosition) { - myFAttach = ((Handle(Geom_Line)&) geom1)->Lin().Location(); + myFAttach = Handle(Geom_Line)::DownCast (geom1)->Lin().Location(); mySAttach = ElCLib::Value(ElCLib::Parameter(line2,myFAttach),line2); } else { - const gp_Lin& line1 = ((Handle(Geom_Line)&) geom1)->Lin(); + const gp_Lin& line1 = Handle(Geom_Line)::DownCast (geom1)->Lin(); myFAttach = ElCLib::Value(ElCLib::Parameter(line1,myPosition),line1); mySAttach = ElCLib::Value(ElCLib::Parameter(line2,myFAttach),line2); } @@ -486,12 +486,12 @@ void AIS_SymmetricRelation::ComputeTwoEdgesSymmetric(const Handle(Prs3d_Presenta } else if (isInfinite1) {// geom1 et geom2 sont des lignes mySAttach = ptat21; - const gp_Lin& line1 = ((Handle(Geom_Line)&) geom1)->Lin(); + const gp_Lin& line1 = Handle(Geom_Line)::DownCast (geom1)->Lin(); myFAttach = ElCLib::Value(ElCLib::Parameter(line1,mySAttach),line1); } else if (isInfinite2) {// geom1 et geom2 sont des lignes myFAttach = ptat11; - const gp_Lin& line2 = ((Handle(Geom_Line)&) geom2)->Lin(); + const gp_Lin& line2 = Handle(Geom_Line)::DownCast (geom2)->Lin(); mySAttach = ElCLib::Value(ElCLib::Parameter(line2,myFAttach),line2); } @@ -505,7 +505,7 @@ void AIS_SymmetricRelation::ComputeTwoEdgesSymmetric(const Handle(Prs3d_Presenta gp_Pnt PjFAttach = ElCLib::Value(ElCLib::Parameter(laxis,myFAttach),laxis); if (PjFAttach.IsEqual(myFAttach,Precision::Confusion())){ - const Handle(Geom_Line)& geom_lin2 = (Handle(Geom_Line)&) geom2; + Handle(Geom_Line) geom_lin2 (Handle(Geom_Line)::DownCast (geom2)); gp_Lin l2(geom_lin2->Lin()); myFDirAttach = l2.Direction(); gp_Pnt PntTempo; diff --git a/src/AIS/AIS_TangentRelation.cxx b/src/AIS/AIS_TangentRelation.cxx index e6565331aa..24c987b9eb 100644 --- a/src/AIS/AIS_TangentRelation.cxx +++ b/src/AIS/AIS_TangentRelation.cxx @@ -204,25 +204,25 @@ static Standard_Boolean ComputeTangencyPoint(const Handle(Geom_Curve)& GC1, gp_Vec aVector1,aVector2; if (GC1->IsInstance(STANDARD_TYPE(Geom_Circle))) { - const Handle(Geom_Circle)& circle = (Handle(Geom_Circle)&) GC1; + Handle(Geom_Circle) circle (Handle(Geom_Circle)::DownCast (GC1)); Standard_Real par_inter = ElCLib::Parameter(circle->Circ(), P1); ElCLib::D1(par_inter,circle->Circ(),P1,aVector1); } else if (GC1->IsInstance(STANDARD_TYPE(Geom_Ellipse))) { - const Handle(Geom_Ellipse)& ellipse = (Handle(Geom_Ellipse)&) GC1; + Handle(Geom_Ellipse) ellipse (Handle(Geom_Ellipse)::DownCast (GC1)); Standard_Real par_inter = ElCLib::Parameter(ellipse->Elips(), P1); ElCLib::D1(par_inter,ellipse->Elips(),P1,aVector1); } if (GC2->IsInstance(STANDARD_TYPE(Geom_Circle))) { - const Handle(Geom_Circle)& circle = (Handle(Geom_Circle)&) GC2; + Handle(Geom_Circle) circle (Handle(Geom_Circle)::DownCast (GC2)); Standard_Real par_inter = ElCLib::Parameter(circle->Circ(), P2); ElCLib::D1(par_inter,circle->Circ(),P2,aVector2); } else if (GC2->IsInstance(STANDARD_TYPE(Geom_Ellipse))) { - const Handle(Geom_Ellipse)& ellipse = (Handle(Geom_Ellipse)&) GC2; + Handle(Geom_Ellipse) ellipse (Handle(Geom_Ellipse)::DownCast (GC2)); Standard_Real par_inter = ElCLib::Parameter(ellipse->Elips(), P2); ElCLib::D1(par_inter,ellipse->Elips(),P2,aVector2); } @@ -333,8 +333,8 @@ void AIS_TangentRelation::ComputeTwoEdgesTangent(const Handle(Prs3d_Presentation { case 12: // circle line { - const Handle(Geom_Line)& line = (Handle(Geom_Line)&) copy1; - const Handle(Geom_Circle)& circle = (Handle(Geom_Circle)&) copy2; + Handle(Geom_Line) line (Handle(Geom_Line)::DownCast (copy1)); + Handle(Geom_Circle) circle (Handle(Geom_Circle)::DownCast (copy2)); if ( !found ) { @@ -355,8 +355,8 @@ void AIS_TangentRelation::ComputeTwoEdgesTangent(const Handle(Prs3d_Presentation break; case 21: // circle line { - const Handle(Geom_Circle)& circle = (Handle(Geom_Circle)&) copy1; - const Handle(Geom_Line)& line = (Handle(Geom_Line)&) copy2; + Handle(Geom_Circle) circle (Handle(Geom_Circle)::DownCast (copy1)); + Handle(Geom_Line) line (Handle(Geom_Line)::DownCast (copy2)); if (!found) { @@ -378,8 +378,8 @@ void AIS_TangentRelation::ComputeTwoEdgesTangent(const Handle(Prs3d_Presentation // jfa 19/10/2000 begin case 13: // line ellipse { - const Handle(Geom_Line)& line = (Handle(Geom_Line)&) copy1; - const Handle(Geom_Ellipse)& ellipse = (Handle(Geom_Ellipse)&) copy2; + Handle(Geom_Line) line (Handle(Geom_Line)::DownCast (copy1)); + Handle(Geom_Ellipse) ellipse (Handle(Geom_Ellipse)::DownCast (copy2)); if (!found) { @@ -399,8 +399,8 @@ void AIS_TangentRelation::ComputeTwoEdgesTangent(const Handle(Prs3d_Presentation break; case 31: // ellipse line { - const Handle(Geom_Ellipse)& ellipse = (Handle(Geom_Ellipse)&) copy1; - const Handle(Geom_Line)& line = (Handle(Geom_Line)&) copy2; + Handle(Geom_Ellipse) ellipse (Handle(Geom_Ellipse)::DownCast (copy1)); + Handle(Geom_Line) line (Handle(Geom_Line)::DownCast (copy2)); if (!found) { @@ -420,8 +420,8 @@ void AIS_TangentRelation::ComputeTwoEdgesTangent(const Handle(Prs3d_Presentation break; case 22: // circle circle { - const Handle(Geom_Circle)& circle1 = (Handle(Geom_Circle)&) copy1; - const Handle(Geom_Circle)& circle2 = (Handle(Geom_Circle)&) copy2; + Handle(Geom_Circle) circle1 (Handle(Geom_Circle)::DownCast (copy1)); + Handle(Geom_Circle) circle2 (Handle(Geom_Circle)::DownCast (copy2)); Standard_Real R1 = circle1->Radius(); Standard_Real R2 = circle2->Radius(); myLength = Max(R1,R2)/5.0; @@ -462,8 +462,8 @@ void AIS_TangentRelation::ComputeTwoEdgesTangent(const Handle(Prs3d_Presentation break; case 23: // circle ellipse { - const Handle(Geom_Circle)& circle = (Handle(Geom_Circle)&) copy1; - const Handle(Geom_Ellipse)& ellipse = (Handle(Geom_Ellipse)&) copy2; + Handle(Geom_Circle) circle (Handle(Geom_Circle)::DownCast (copy1)); + Handle(Geom_Ellipse) ellipse (Handle(Geom_Ellipse)::DownCast (copy2)); Standard_Real R1 = circle->Radius(); Standard_Real R2 = ellipse->MajorRadius(); myLength = Max(R1,R2)/5.0; @@ -492,8 +492,8 @@ void AIS_TangentRelation::ComputeTwoEdgesTangent(const Handle(Prs3d_Presentation break; case 32: // ellipse circle { - const Handle(Geom_Ellipse)& ellipse = (Handle(Geom_Ellipse)&) copy1; - const Handle(Geom_Circle)& circle = (Handle(Geom_Circle)&) copy2; + Handle(Geom_Ellipse) ellipse (Handle(Geom_Ellipse)::DownCast (copy1)); + Handle(Geom_Circle) circle (Handle(Geom_Circle)::DownCast (copy2)); Standard_Real R1 = ellipse->MajorRadius(); Standard_Real R2 = circle->Radius(); myLength = Max(R1,R2)/5.0; @@ -522,8 +522,8 @@ void AIS_TangentRelation::ComputeTwoEdgesTangent(const Handle(Prs3d_Presentation break; case 33: // ellipse ellipse { - const Handle(Geom_Ellipse)& ellipse1 = (Handle(Geom_Ellipse)&) copy1; - const Handle(Geom_Ellipse)& ellipse2 = (Handle(Geom_Ellipse)&) copy2; + Handle(Geom_Ellipse) ellipse1 (Handle(Geom_Ellipse)::DownCast (copy1)); + Handle(Geom_Ellipse) ellipse2 (Handle(Geom_Ellipse)::DownCast (copy2)); Standard_Real R1 = ellipse1->MajorRadius(); Standard_Real R2 = ellipse2->MajorRadius(); myLength = Max(R1,R2)/5.0; diff --git a/src/AIS/AIS_TypeFilter.cxx b/src/AIS/AIS_TypeFilter.cxx index deaedcf6e3..1e4b16e5e4 100644 --- a/src/AIS/AIS_TypeFilter.cxx +++ b/src/AIS/AIS_TypeFilter.cxx @@ -27,7 +27,7 @@ Standard_Boolean AIS_TypeFilter::IsOk(const Handle(SelectMgr_EntityOwner)& anObj //#ifndef OCCT_DEBUG Handle(SelectMgr_SelectableObject) aSelectableObject = anObj->Selectable() ; - return ((Handle(AIS_InteractiveObject)&) aSelectableObject)->Type()== myKind; + return Handle(AIS_InteractiveObject)::DownCast (aSelectableObject)->Type()== myKind; //#else // return ((Handle(AIS_InteractiveObject)&)anObj->Selectable())->Type()== myKind; //#endif diff --git a/src/AppDef/AppDef_MultiPointConstraint.cxx b/src/AppDef/AppDef_MultiPointConstraint.cxx index f397fcd12a..90731d59ee 100644 --- a/src/AppDef/AppDef_MultiPointConstraint.cxx +++ b/src/AppDef/AppDef_MultiPointConstraint.cxx @@ -24,10 +24,10 @@ #include -#define tabTang (*(Handle(TColgp_HArray1OfVec)*)&ttabTang) -#define tabCurv (*(Handle(TColgp_HArray1OfVec)*)&ttabCurv) -#define tabTang2d (*(Handle(TColgp_HArray1OfVec2d)*)&ttabTang2d) -#define tabCurv2d (*(Handle(TColgp_HArray1OfVec2d)*)&ttabCurv2d) +#define tabTang Handle(TColgp_HArray1OfVec)::DownCast (ttabTang) +#define tabCurv Handle(TColgp_HArray1OfVec)::DownCast (ttabCurv) +#define tabTang2d Handle(TColgp_HArray1OfVec2d)::DownCast (ttabTang2d) +#define tabCurv2d Handle(TColgp_HArray1OfVec2d)::DownCast (ttabCurv2d) diff --git a/src/AppDef/AppDef_Variational.cxx b/src/AppDef/AppDef_Variational.cxx index 25a3184bae..0788f51ea5 100644 --- a/src/AppDef/AppDef_Variational.cxx +++ b/src/AppDef/AppDef_Variational.cxx @@ -2722,7 +2722,7 @@ void AppDef_Variational::AssemblingConstraints(const Handle(FEmTool_Curve)& Curv Standard_Real t, R1, R2; Handle(PLib_Base) myBase = Curve->Base(); - Handle(PLib_HermitJacobi) myHermitJacobi = (*((Handle(PLib_HermitJacobi)*)&myBase)); + Handle(PLib_HermitJacobi) myHermitJacobi = Handle(PLib_HermitJacobi)::DownCast (myBase); Standard_Integer Order = myHermitJacobi->NivConstr() + 1; Standard_Real UFirst, ULast, coeff, c0, mfact, mfact1; diff --git a/src/AppParCurves/AppParCurves_MultiPoint.cxx b/src/AppParCurves/AppParCurves_MultiPoint.cxx index 96964b6679..f18aedd0c1 100644 --- a/src/AppParCurves/AppParCurves_MultiPoint.cxx +++ b/src/AppParCurves/AppParCurves_MultiPoint.cxx @@ -18,8 +18,8 @@ #include -#define tabPoint (*(Handle(TColgp_HArray1OfPnt)*)&ttabPoint) -#define tabPoint2d (*(Handle(TColgp_HArray1OfPnt2d)*)&ttabPoint2d) +#define tabPoint Handle(TColgp_HArray1OfPnt)::DownCast (ttabPoint) +#define tabPoint2d Handle(TColgp_HArray1OfPnt2d)::DownCast (ttabPoint2d) AppParCurves_MultiPoint::AppParCurves_MultiPoint() {} diff --git a/src/BOPTest/BOPTest_LowCommands.cxx b/src/BOPTest/BOPTest_LowCommands.cxx index 205fe0587d..ff16fcd83d 100644 --- a/src/BOPTest/BOPTest_LowCommands.cxx +++ b/src/BOPTest/BOPTest_LowCommands.cxx @@ -302,7 +302,7 @@ Handle(Geom2d_Curve) CurveOnSurface(const TopoDS_Edge& E, while (itcr.More()) { const Handle(BRep_CurveRepresentation)& cr = itcr.Value(); if (cr->IsCurveOnSurface(S,l)) { - const Handle(BRep_GCurve)& GC = *((Handle(BRep_GCurve)*)&cr); + Handle(BRep_GCurve) GC (Handle(BRep_GCurve)::DownCast (cr)); GC->Range(First,Last); if (GC->IsCurveOnClosedSurface() && Eisreversed) return GC->PCurve2(); diff --git a/src/BOPTools/BOPTools_AlgoTools2D.cxx b/src/BOPTools/BOPTools_AlgoTools2D.cxx index c371bd7603..b951a201a3 100644 --- a/src/BOPTools/BOPTools_AlgoTools2D.cxx +++ b/src/BOPTools/BOPTools_AlgoTools2D.cxx @@ -793,7 +793,7 @@ Handle(Geom2d_Curve) BRep_Tool_CurveOnSurface while (itcr.More()) { const Handle(BRep_CurveRepresentation)& cr = itcr.Value(); if (cr->IsCurveOnSurface(S,loc)) { - const Handle(BRep_GCurve)& GC = *((Handle(BRep_GCurve)*)&cr); + Handle(BRep_GCurve) GC (Handle(BRep_GCurve)::DownCast (cr)); GC->Range(First,Last); if (GC->IsCurveOnClosedSurface() && Eisreversed) return GC->PCurve2(); @@ -837,7 +837,7 @@ Handle(Geom2d_Curve) BRep_Tool_CurveOnSurface if (!LC.IsIdentity()) { const gp_Trsf& T = LC.Transformation(); Handle(Geom_Geometry) GPT = GP->Transformed(T); - Plane = *((Handle(Geom_Plane)*)&GPT); + Plane = Handle(Geom_Plane)::DownCast (GPT); } GeomAdaptor_Surface& GAS = HS->ChangeSurface(); GAS.Load(Plane); @@ -856,7 +856,7 @@ Handle(Geom2d_Curve) BRep_Tool_CurveOnSurface if (pc->DynamicType() == STANDARD_TYPE(Geom2d_TrimmedCurve)) { Handle(Geom2d_TrimmedCurve) TC = - (*((Handle(Geom2d_TrimmedCurve)*)&pc)); + Handle(Geom2d_TrimmedCurve)::DownCast (pc); pc = TC->BasisCurve(); } First = f; Last = l; diff --git a/src/BOPTools/BOPTools_AlgoTools_1.cxx b/src/BOPTools/BOPTools_AlgoTools_1.cxx index 10efe77184..68b4669218 100644 --- a/src/BOPTools/BOPTools_AlgoTools_1.cxx +++ b/src/BOPTools/BOPTools_AlgoTools_1.cxx @@ -491,7 +491,7 @@ void CheckEdge (const TopoDS_Edge& Ed, // aOrV=aV.Orientation(); if (aOrV==TopAbs_FORWARD || aOrV==TopAbs_REVERSED) { - const Handle(BRep_GCurve)& aGC=*((Handle(BRep_GCurve)*)&aCR); + Handle(BRep_GCurve) aGC (Handle(BRep_GCurve)::DownCast (aCR)); if (aOrV==TopAbs_FORWARD) { aPC=aC->Value(aGC->First()); @@ -725,8 +725,7 @@ void CorrectEdgeTolerance (const TopoDS_Edge& myShape, } if (!myCref.IsNull()) { - const Handle(BRep_GCurve)& GCref = - *((Handle(BRep_GCurve)*)&myCref); + Handle(BRep_GCurve) GCref (Handle(BRep_GCurve)::DownCast (myCref)); Standard_Real First,Last; GCref->Range(First,Last); if (Last<=First) { @@ -786,7 +785,7 @@ void CorrectEdgeTolerance (const TopoDS_Edge& myShape, const Handle(BRep_CurveRepresentation)& cr = itcr.Value(); if (cr != myCref && cr->IsCurveOnSurface(Su,L)) { pcurvefound = Standard_True; - const Handle(BRep_GCurve)& GC = *((Handle(BRep_GCurve)*)&cr); + Handle(BRep_GCurve) GC (Handle(BRep_GCurve)::DownCast (cr)); Standard_Real f,l; GC->Range(f,l); if (SameRange && (f != First || l != Last)) { diff --git a/src/BRep/BRep_Tool.cxx b/src/BRep/BRep_Tool.cxx index b20853c158..2db772b26b 100644 --- a/src/BRep/BRep_Tool.cxx +++ b/src/BRep/BRep_Tool.cxx @@ -93,7 +93,7 @@ Handle(Geom_Surface) BRep_Tool::Surface(const TopoDS_Face& F) Handle(Geom_Geometry) S1; if (!L.IsIdentity()) { S1 = S->Copy(); - S = *((Handle(Geom_Surface)*)&S1); + S = Handle(Geom_Surface)::DownCast (S1); S->Transform(L.Transformation()); } return S; @@ -157,7 +157,7 @@ const Handle(Geom_Curve)& BRep_Tool::Curve(const TopoDS_Edge& E, while (itcr.More()) { const Handle(BRep_CurveRepresentation)& cr = itcr.Value(); if (cr->IsCurve3D()) { - const Handle(BRep_Curve3D)& GC = *((Handle(BRep_Curve3D)*)&cr); + Handle(BRep_Curve3D) GC (Handle(BRep_Curve3D)::DownCast (cr)); L = E.Location() * GC->Location(); GC->Range(First,Last); return GC->Curve3D(); @@ -185,7 +185,7 @@ Handle(Geom_Curve) BRep_Tool::Curve(const TopoDS_Edge& E, Handle(Geom_Geometry) C1; if ( !L.IsIdentity() ) { C1 = C->Copy(); - C = *((Handle(Geom_Curve)*)&C1); + C = Handle(Geom_Curve)::DownCast (C1); C->Transform(L.Transformation()); } } @@ -236,7 +236,7 @@ const Handle(Poly_Polygon3D)& BRep_Tool::Polygon3D(const TopoDS_Edge& E, while (itcr.More()) { const Handle(BRep_CurveRepresentation)& cr = itcr.Value(); if (cr->IsPolygon3D()) { - const Handle(BRep_Polygon3D)& GC = *((Handle(BRep_Polygon3D)*)&cr); + Handle(BRep_Polygon3D) GC (Handle(BRep_Polygon3D)::DownCast (cr)); L = E.Location() * GC->Location(); return GC->Polygon3D(); } @@ -298,7 +298,7 @@ Handle(Geom2d_Curve) BRep_Tool::CurveOnSurface(const TopoDS_Edge& E, while (itcr.More()) { const Handle(BRep_CurveRepresentation)& cr = itcr.Value(); if (cr->IsCurveOnSurface(S,loc)) { - const Handle(BRep_GCurve)& GC = *((Handle(BRep_GCurve)*)&cr); + Handle(BRep_GCurve) GC (Handle(BRep_GCurve)::DownCast (cr)); GC->Range(First,Last); if (GC->IsCurveOnClosedSurface() && Eisreversed) return GC->PCurve2(); @@ -344,7 +344,7 @@ Handle(Geom2d_Curve) BRep_Tool::CurveOnSurface(const TopoDS_Edge& E, { const gp_Trsf& T = aCurveLocation.Transformation(); Handle(Geom_Geometry) GC3d = C3d->Transformed(T); - C3d = *((Handle(Geom_Curve)*)&GC3d); + C3d = Handle(Geom_Curve)::DownCast (GC3d); f = C3d->TransformedParameter(f, T); l = C3d->TransformedParameter(l, T); } @@ -365,7 +365,7 @@ Handle(Geom2d_Curve) BRep_Tool::CurveOnSurface(const TopoDS_Edge& E, if (pc->DynamicType() == STANDARD_TYPE(Geom2d_TrimmedCurve)) { Handle(Geom2d_TrimmedCurve) TC = - (*((Handle(Geom2d_TrimmedCurve)*)&pc)); + Handle(Geom2d_TrimmedCurve)::DownCast (pc); pc = TC->BasisCurve(); } @@ -394,7 +394,7 @@ void BRep_Tool::CurveOnSurface(const TopoDS_Edge& E, while (itcr.More()) { const Handle(BRep_CurveRepresentation)& cr = itcr.Value(); if (cr->IsCurveOnSurface()) { - const Handle(BRep_GCurve)& GC = *((Handle(BRep_GCurve)*)&cr); + Handle(BRep_GCurve) GC (Handle(BRep_GCurve)::DownCast (cr)); C = GC->PCurve(); S = GC->Surface(); L = E.Location() * GC->Location(); @@ -432,7 +432,7 @@ void BRep_Tool::CurveOnSurface(const TopoDS_Edge& E, while (itcr.More()) { const Handle(BRep_CurveRepresentation)& cr = itcr.Value(); if (cr->IsCurveOnSurface()) { - const Handle(BRep_GCurve)& GC = *((Handle(BRep_GCurve)*)&cr); + Handle(BRep_GCurve) GC (Handle(BRep_GCurve)::DownCast (cr)); i++; if (i > Index) break; if (i == Index) { @@ -533,8 +533,7 @@ void BRep_Tool::PolygonOnSurface(const TopoDS_Edge& E, while (itcr.More()) { const Handle(BRep_CurveRepresentation)& cr = itcr.Value(); if (cr->IsPolygonOnSurface()) { - const Handle(BRep_PolygonOnSurface)& PS = - *((Handle(BRep_PolygonOnSurface)*)&cr); + Handle(BRep_PolygonOnSurface) PS (Handle(BRep_PolygonOnSurface)::DownCast (cr)); P = PS->Polygon(); S = PS->Surface(); L = E.Location() * PS->Location(); @@ -568,8 +567,7 @@ void BRep_Tool::PolygonOnSurface(const TopoDS_Edge& E, while (itcr.More()) { const Handle(BRep_CurveRepresentation)& cr = itcr.Value(); if (cr->IsPolygonOnSurface()) { - const Handle(BRep_PolygonOnSurface)& PS = - *((Handle(BRep_PolygonOnSurface)*)&cr); + Handle(BRep_PolygonOnSurface) PS (Handle(BRep_PolygonOnSurface)::DownCast (cr)); i++; if (i > Index) break; if (i == Index) { @@ -640,8 +638,7 @@ BRep_Tool::PolygonOnTriangulation(const TopoDS_Edge& E, while (itcr.More()) { const Handle(BRep_CurveRepresentation)& cr = itcr.Value(); if (cr->IsPolygonOnTriangulation()) { - const Handle(BRep_PolygonOnTriangulation)& PT = - *((Handle(BRep_PolygonOnTriangulation)*)&cr); + Handle(BRep_PolygonOnTriangulation) PT (Handle(BRep_PolygonOnTriangulation)::DownCast (cr)); P = PT->PolygonOnTriangulation(); T = PT->Triangulation(); L = E.Location() * PT->Location(); @@ -676,8 +673,7 @@ BRep_Tool::PolygonOnTriangulation(const TopoDS_Edge& E, while (itcr.More()) { const Handle(BRep_CurveRepresentation)& cr = itcr.Value(); if (cr->IsPolygonOnTriangulation()) { - const Handle(BRep_PolygonOnTriangulation)& PT = - *((Handle(BRep_PolygonOnTriangulation)*)&cr); + Handle(BRep_PolygonOnTriangulation) PT (Handle(BRep_PolygonOnTriangulation)::DownCast (cr)); i++; if (i > Index) break; if (i == Index) { @@ -830,7 +826,7 @@ void BRep_Tool::Range(const TopoDS_Edge& E, while (itcr.More()) { const Handle(BRep_CurveRepresentation)& cr = itcr.Value(); if (cr->IsCurve3D()) { - const Handle(BRep_Curve3D)& CR = *((Handle(BRep_Curve3D)*)&cr); + Handle(BRep_Curve3D) CR (Handle(BRep_Curve3D)::DownCast (cr)); if (!CR->Curve3D().IsNull()) { First = CR->First(); Last = CR->Last(); @@ -838,7 +834,7 @@ void BRep_Tool::Range(const TopoDS_Edge& E, } } else if (cr->IsCurveOnSurface()) { - const Handle(BRep_GCurve)& CR = *((Handle(BRep_GCurve)*)&cr); + Handle(BRep_GCurve) CR (Handle(BRep_GCurve)::DownCast (cr)); First = CR->First(); Last = CR->Last(); break; @@ -867,7 +863,7 @@ void BRep_Tool::Range(const TopoDS_Edge& E, while (itcr.More()) { const Handle(BRep_CurveRepresentation)& cr = itcr.Value(); if (cr->IsCurveOnSurface(S,l)) { - (*((Handle(BRep_GCurve)*)&cr))->Range(First,Last); + Handle(BRep_GCurve)::DownCast (cr)->Range(First,Last); break; } itcr.Next(); @@ -915,9 +911,9 @@ void BRep_Tool::UVPoints(const TopoDS_Edge& E, const Handle(BRep_CurveRepresentation)& cr = itcr.Value(); if (cr->IsCurveOnSurface(S,l)) { if (cr->IsCurveOnClosedSurface() && Eisreversed) - (*((Handle(BRep_CurveOnClosedSurface)*)&cr))->UVPoints2(PFirst,PLast); + Handle(BRep_CurveOnClosedSurface)::DownCast (cr)->UVPoints2(PFirst,PLast); else - (*((Handle(BRep_CurveOnSurface)*)&cr))->UVPoints(PFirst,PLast); + Handle(BRep_CurveOnSurface)::DownCast (cr)->UVPoints(PFirst,PLast); return; } itcr.Next(); @@ -1005,10 +1001,10 @@ void BRep_Tool::SetUVPoints(const TopoDS_Edge& E, const Handle(BRep_CurveRepresentation)& cr = itcr.Value(); if (cr->IsCurveOnSurface(S,l)) { if (cr->IsCurveOnClosedSurface() && Eisreversed) - (*((Handle(BRep_CurveOnClosedSurface)*) &cr))-> + Handle(BRep_CurveOnClosedSurface)::DownCast (cr)-> SetUVPoints2(PFirst,PLast); else - (*((Handle(BRep_CurveOnSurface)*) &cr))-> + Handle(BRep_CurveOnSurface)::DownCast (cr)-> SetUVPoints(PFirst,PLast); } itcr.Next(); diff --git a/src/BRepCheck/BRepCheck_Edge.cxx b/src/BRepCheck/BRepCheck_Edge.cxx index e726349cfb..a23283df9f 100644 --- a/src/BRepCheck/BRepCheck_Edge.cxx +++ b/src/BRepCheck/BRepCheck_Edge.cxx @@ -175,7 +175,7 @@ void BRepCheck_Edge::Minimum() } if (!myCref.IsNull()) { - const Handle(BRep_GCurve)& GCref = *((Handle(BRep_GCurve)*)&myCref); + Handle(BRep_GCurve) GCref (Handle(BRep_GCurve)::DownCast (myCref)); Standard_Real First,Last; GCref->Range(First,Last); if (Last<=First) { @@ -285,7 +285,7 @@ void BRepCheck_Edge::InContext(const TopoDS_Shape& S) const Handle(BRep_CurveRepresentation)& cr = itcr.Value(); if (cr != myCref && cr->IsCurveOnSurface(Su,L)) { pcurvefound = Standard_True; - const Handle(BRep_GCurve)& GC = *((Handle(BRep_GCurve)*)&cr); + Handle(BRep_GCurve) GC (Handle(BRep_GCurve)::DownCast (cr)); Standard_Real f,l; GC->Range(f,l); Standard_Real ff = f, ll = l; @@ -601,8 +601,7 @@ BRepCheck_Status BRepCheck_Edge:: } const Handle(BRep_CurveRepresentation) aCR = anITCR.Value(); - const Handle(BRep_PolygonOnTriangulation)& aPT = - Handle(BRep_PolygonOnTriangulation)::DownCast(aCR); + Handle(BRep_PolygonOnTriangulation) aPT (Handle(BRep_PolygonOnTriangulation)::DownCast(aCR)); const TopLoc_Location aLL = theEdge.Location() * aPT->Location(); diff --git a/src/BRepCheck/BRepCheck_Vertex.cxx b/src/BRepCheck/BRepCheck_Vertex.cxx index d7a9cf72f3..304ec00861 100644 --- a/src/BRepCheck/BRepCheck_Vertex.cxx +++ b/src/BRepCheck/BRepCheck_Vertex.cxx @@ -174,7 +174,7 @@ void BRepCheck_Vertex::InContext(const TopoDS_Shape& S) itpr.Next(); } if (orv == TopAbs_FORWARD || orv == TopAbs_REVERSED) { - const Handle(BRep_GCurve)& GC = *((Handle(BRep_GCurve)*)&cr); + Handle(BRep_GCurve) GC (Handle(BRep_GCurve)::DownCast (cr)); if (orv == TopAbs_FORWARD || multiple) { Controlp = C->Value(GC->First()); Controlp.Transform(L.Transformation()); diff --git a/src/BRepFeat/BRepFeat_MakeDPrism.cxx b/src/BRepFeat/BRepFeat_MakeDPrism.cxx index 775d3e8488..06f62bd878 100644 --- a/src/BRepFeat/BRepFeat_MakeDPrism.cxx +++ b/src/BRepFeat/BRepFeat_MakeDPrism.cxx @@ -1336,12 +1336,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(); } @@ -1354,8 +1354,8 @@ Standard_Boolean ToFuse(const TopoDS_Face& F1, if (typS1 == STANDARD_TYPE(Geom_Plane)) { S1 = BRep_Tool::Surface(F1); // to apply the location. S2 = BRep_Tool::Surface(F2); - 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()); if (pl1.Position().IsCoplanar(pl2.Position(),tollin,tolang)) { ValRet = Standard_True; diff --git a/src/BRepFeat/BRepFeat_MakePrism.cxx b/src/BRepFeat/BRepFeat_MakePrism.cxx index 99f237e6c0..51382daa30 100644 --- a/src/BRepFeat/BRepFeat_MakePrism.cxx +++ b/src/BRepFeat/BRepFeat_MakePrism.cxx @@ -1258,12 +1258,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(); } @@ -1276,8 +1276,8 @@ Standard_Boolean ToFuse(const TopoDS_Face& F1, if (typS1 == STANDARD_TYPE(Geom_Plane)) { S1 = BRep_Tool::Surface(F1); // to apply the location. S2 = BRep_Tool::Surface(F2); - 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()); if (pl1.Position().IsCoplanar(pl2.Position(),tollin,tolang)) { ValRet = Standard_True; diff --git a/src/BRepFeat/BRepFeat_MakeRevol.cxx b/src/BRepFeat/BRepFeat_MakeRevol.cxx index b93279d07c..39976e3d67 100644 --- a/src/BRepFeat/BRepFeat_MakeRevol.cxx +++ b/src/BRepFeat/BRepFeat_MakeRevol.cxx @@ -961,12 +961,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(); } @@ -979,8 +979,8 @@ Standard_Boolean ToFuse(const TopoDS_Face& F1, if (typS1 == STANDARD_TYPE(Geom_Plane)) { S1 = BRep_Tool::Surface(F1); // to apply the location. S2 = BRep_Tool::Surface(F2); - 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()); if (pl1.Position().IsCoplanar(pl2.Position(),tollin,tolang)) { ValRet = Standard_True; diff --git a/src/BRepFill/BRepFill_Pipe.cxx b/src/BRepFill/BRepFill_Pipe.cxx index 3f17c63711..6dd7d4466d 100644 --- a/src/BRepFill/BRepFill_Pipe.cxx +++ b/src/BRepFill/BRepFill_Pipe.cxx @@ -917,13 +917,13 @@ void BRepFill_Pipe::DefineRealSegmax() C->DynamicType() == STANDARD_TYPE(Geom_OffsetCurve)) { if (C->DynamicType() == STANDARD_TYPE(Geom_TrimmedCurve)) - C = (*((Handle(Geom_TrimmedCurve)*)&C))->BasisCurve(); + C = Handle(Geom_TrimmedCurve)::DownCast (C)->BasisCurve(); if (C->DynamicType() == STANDARD_TYPE(Geom_OffsetCurve)) - C = (*((Handle(Geom_OffsetCurve)*)&C))->BasisCurve(); + C = Handle(Geom_OffsetCurve)::DownCast (C)->BasisCurve(); } if (C->DynamicType() == STANDARD_TYPE(Geom_BSplineCurve)) { - const Handle(Geom_BSplineCurve)& BC = *((Handle(Geom_BSplineCurve)*)&C); + Handle(Geom_BSplineCurve) BC (Handle(Geom_BSplineCurve)::DownCast (C)); Standard_Integer NbKnots = BC->NbKnots(); Standard_Integer RealNbKnots = NbKnots; if (first > BC->FirstParameter()) diff --git a/src/BRepFill/BRepFill_Sweep.cxx b/src/BRepFill/BRepFill_Sweep.cxx index d35de2d78d..8f1674f332 100644 --- a/src/BRepFill/BRepFill_Sweep.cxx +++ b/src/BRepFill/BRepFill_Sweep.cxx @@ -260,7 +260,7 @@ static Handle(Geom2d_Curve) Couture(const TopoDS_Edge& E, while (itcr.More()) { Handle(BRep_CurveRepresentation)& cr = itcr.Value(); if (cr->IsCurveOnSurface(S,l)) { - Handle(BRep_GCurve)& GC = *((Handle(BRep_GCurve)*)&cr); + Handle(BRep_GCurve)& GC = Handle(BRep_GCurve)::DownCast (cr); if (GC->IsCurveOnClosedSurface() && Eisreversed) return GC->PCurve2(); else @@ -3379,7 +3379,7 @@ void BRepFill_Sweep::RebuildTopOrBottomEdge(const TopoDS_Edge& aNewEdge, const Handle(BRep_CurveRepresentation)& CurveRep = itrep.Value(); if (CurveRep->IsCurveOnSurface()) { - const Handle(BRep_GCurve)& GC = *((Handle(BRep_GCurve)*)&CurveRep); + Handle(BRep_GCurve) GC (Handle(BRep_GCurve)::DownCast (CurveRep)); Handle(Geom2d_Curve) aPCurve = GC->PCurve(); Handle(Geom_Surface) aSurf = GC->Surface(); TopLoc_Location aLoc = aNewEdge.Location() * GC->Location(); diff --git a/src/BRepGProp/BRepGProp_EdgeTool.cxx b/src/BRepGProp/BRepGProp_EdgeTool.cxx index 4d6280bd46..f243338f9c 100644 --- a/src/BRepGProp/BRepGProp_EdgeTool.cxx +++ b/src/BRepGProp/BRepGProp_EdgeTool.cxx @@ -42,7 +42,7 @@ Standard_Integer BRepGProp_EdgeTool::IntegrationOrder(const BRepAdaptor_Curve& { const GeomAdaptor_Curve& GAC = BAC.Curve(); const Handle(Geom_Curve)& GC = GAC.Curve(); - const Handle(Geom_BezierCurve)& GBZC = (*((Handle(Geom_BezierCurve)*)&GC)); + Handle(Geom_BezierCurve) GBZC (Handle(Geom_BezierCurve)::DownCast (GC)); Standard_Integer n = 2*(GBZC->NbPoles()) - 1; return n; } @@ -51,7 +51,7 @@ Standard_Integer BRepGProp_EdgeTool::IntegrationOrder(const BRepAdaptor_Curve& { const GeomAdaptor_Curve& GAC = BAC.Curve(); const Handle(Geom_Curve)& GC = GAC.Curve(); - const Handle(Geom_BSplineCurve)& GBSC = (*((Handle(Geom_BSplineCurve)*)&GC)); + Handle(Geom_BSplineCurve) GBSC (Handle(Geom_BSplineCurve)::DownCast (GC)); Standard_Integer n = 2*(GBSC->NbPoles()) - 1; return n; } diff --git a/src/BRepGProp/BRepGProp_Face.cxx b/src/BRepGProp/BRepGProp_Face.cxx index d694054391..a9486dcc76 100644 --- a/src/BRepGProp/BRepGProp_Face.cxx +++ b/src/BRepGProp/BRepGProp_Face.cxx @@ -617,7 +617,7 @@ void BRepGProp_Face::GetUKnots GeomAdaptor_Curve aCurve; Handle(Geom_Surface) aSurf = mySurface.Surface().Surface(); - aCurve.Load((*((Handle(Geom_SurfaceOfLinearExtrusion)*)&aSurf))->BasisCurve()); + aCurve.Load(Handle(Geom_SurfaceOfLinearExtrusion)::DownCast (aSurf)->BasisCurve()); isCBSpline = aCurve.GetType() == GeomAbs_BSplineCurve; } } @@ -643,7 +643,7 @@ void BRepGProp_Face::GetUKnots Handle(Geom_Surface) aSurf = mySurface.Surface().Surface(); Handle(Geom_BSplineCurve) aBSplCurve; - aCurve.Load((*((Handle(Geom_SurfaceOfLinearExtrusion)*)&aSurf))->BasisCurve()); + aCurve.Load(Handle(Geom_SurfaceOfLinearExtrusion)::DownCast (aSurf)->BasisCurve()); aBSplCurve = aCurve.BSpline(); aNbKnots = aBSplCurve->NbKnots(); aKnots = new TColStd_HArray1OfReal(1, aNbKnots); diff --git a/src/BRepLib/BRepLib.cxx b/src/BRepLib/BRepLib.cxx index bb2d97b2df..d9934bf3db 100644 --- a/src/BRepLib/BRepLib.cxx +++ b/src/BRepLib/BRepLib.cxx @@ -976,7 +976,7 @@ void BRepLib::SameParameter(const TopoDS_Edge& AnEdge, Handle(Standard_Type) TheType = C3d->DynamicType(); if( TheType == STANDARD_TYPE(Geom_TrimmedCurve)) { - const Handle(Geom_Curve)& gtC = (*((Handle(Geom_TrimmedCurve)*)&C3d))->BasisCurve(); + Handle(Geom_Curve) gtC (Handle(Geom_TrimmedCurve)::DownCast (C3d)->BasisCurve()); m_TrimmedPeriodical = gtC->IsPeriodic(); } // modified by NIZHNY-OCC486 Tue Aug 27 17:15:17 2002 . @@ -1323,7 +1323,7 @@ void BRepLib::UpdateTolerances(const TopoDS_Shape& aShape, aB.SetVoid(); BRepBndLib::Add(curf,aB); if (S->DynamicType() == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) { - S = (*((Handle(Geom_RectangularTrimmedSurface)*)&S))->BasisSurface(); + S = Handle(Geom_RectangularTrimmedSurface)::DownCast (S)->BasisSurface(); } GeomAdaptor_Surface AS(S); switch (AS.GetType()) { @@ -1820,7 +1820,7 @@ void BRepLib::SortFaces (const TopoDS_Shape& Sh, S = BRep_Tool::Surface(F, l); if (!S.IsNull()) { if (S->DynamicType() == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) { - S = (*((Handle(Geom_RectangularTrimmedSurface)*)&S))->BasisSurface(); + S = Handle(Geom_RectangularTrimmedSurface)::DownCast (S)->BasisSurface(); } GeomAdaptor_Surface AS(S); switch (AS.GetType()) { @@ -1878,7 +1878,7 @@ void BRepLib::ReverseSortFaces (const TopoDS_Shape& Sh, S = BRep_Tool::Surface(F, l); if (!S.IsNull()) { if (S->DynamicType() == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) { - S = (*((Handle(Geom_RectangularTrimmedSurface)*)&S))->BasisSurface(); + S = Handle(Geom_RectangularTrimmedSurface)::DownCast (S)->BasisSurface(); } GeomAdaptor_Surface AS(S); switch (AS.GetType()) { diff --git a/src/BRepLib/BRepLib_FuseEdges.cxx b/src/BRepLib/BRepLib_FuseEdges.cxx index 00eb929949..9bb7d4071d 100644 --- a/src/BRepLib/BRepLib_FuseEdges.cxx +++ b/src/BRepLib/BRepLib_FuseEdges.cxx @@ -161,7 +161,7 @@ static void BCSmoothing(Handle(Geom_BSplineCurve)& theC, static void MakeClosedCurve(Handle(Geom_Curve)& C, const gp_Pnt& PF, Standard_Real& f, Standard_Real& l) { - Handle(Geom_BSplineCurve) aBC = (*((Handle(Geom_BSplineCurve)*)&C)); + Handle(Geom_BSplineCurve) aBC = Handle(Geom_BSplineCurve)::DownCast (C); GeomAbs_Shape aCont = aBC->Continuity(); //Find new origin aBC->SetPeriodic(); @@ -462,7 +462,7 @@ void BRepLib_FuseEdges::BuildListResultEdges() // if the curve is trimmed we get the basis curve to fit the new vertices // otherwise the makeedge will fail. if (C->DynamicType() == STANDARD_TYPE(Geom_TrimmedCurve)) { - C = (*((Handle(Geom_TrimmedCurve)*)&C))->BasisCurve(); + C = Handle(Geom_TrimmedCurve)::DownCast (C)->BasisCurve(); } if(myConcatBSpl) { @@ -776,7 +776,7 @@ Standard_Boolean BRepLib_FuseEdges::SameSupport(const TopoDS_Edge& E1, if (!loc.IsIdentity()) { Handle(Geom_Geometry) GG1 = C1->Transformed(loc.Transformation()); - C1 = *((Handle(Geom_Curve)*)&GG1); + C1 = Handle(Geom_Curve)::DownCast (GG1); } C2 = BRep_Tool::Curve(E2,loc,f2,l2); //modified by NIZNHY-PKV Mon Nov 15 16:24:38 1999 @@ -785,19 +785,19 @@ Standard_Boolean BRepLib_FuseEdges::SameSupport(const TopoDS_Edge& E1, if (!loc.IsIdentity()) { Handle(Geom_Geometry) GG2 = C2->Transformed(loc.Transformation()); - C2 = *((Handle(Geom_Curve)*)&GG2); + C2 = Handle(Geom_Curve)::DownCast (GG2); } 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(); } @@ -820,8 +820,8 @@ Standard_Boolean BRepLib_FuseEdges::SameSupport(const TopoDS_Edge& E1, const Standard_Real tollin = Precision::Confusion(); const Standard_Real tolang = Precision::Angular(); 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()); gp_Dir dir1(li1.Direction()); gp_Dir dir2(li2.Direction()); @@ -840,8 +840,8 @@ Standard_Boolean BRepLib_FuseEdges::SameSupport(const TopoDS_Edge& E1, return Standard_False; } else if (typC1 == STANDARD_TYPE(Geom_Circle)) { - gp_Circ ci1 = (*((Handle(Geom_Circle)*)&C1))->Circ(); - gp_Circ ci2 = (*((Handle(Geom_Circle)*)&C2))->Circ(); + gp_Circ ci1 = Handle(Geom_Circle)::DownCast (C1)->Circ(); + gp_Circ ci2 = Handle(Geom_Circle)::DownCast (C2)->Circ(); if (Abs(ci1.Radius()-ci2.Radius()) <= tollin && ci1.Location().SquareDistance(ci2.Location()) <= tollin*tollin && ci1.Axis().IsParallel(ci2.Axis(),tolang) ) { @@ -851,8 +851,8 @@ Standard_Boolean BRepLib_FuseEdges::SameSupport(const TopoDS_Edge& E1, return Standard_False; } else if (typC1 == STANDARD_TYPE(Geom_Ellipse)) { - gp_Elips ci1 = (*((Handle(Geom_Ellipse)*)&C1))->Elips(); - gp_Elips ci2 = (*((Handle(Geom_Ellipse)*)&C2))->Elips(); + gp_Elips ci1 = Handle(Geom_Ellipse)::DownCast (C1)->Elips(); + gp_Elips ci2 = Handle(Geom_Ellipse)::DownCast (C2)->Elips(); if (Abs(ci1.MajorRadius()-ci2.MajorRadius()) <= tollin && Abs(ci1.MinorRadius()-ci2.MinorRadius()) <= tollin && @@ -889,8 +889,8 @@ Standard_Boolean BRepLib_FuseEdges::SameSupport(const TopoDS_Edge& E1, return Standard_False; } - Handle(Geom_BSplineCurve) B1 = *((Handle(Geom_BSplineCurve)*)&C1); - Handle(Geom_BSplineCurve) B2 = *((Handle(Geom_BSplineCurve)*)&C2); + Handle(Geom_BSplineCurve) B1 = Handle(Geom_BSplineCurve)::DownCast (C1); + Handle(Geom_BSplineCurve) B2 = Handle(Geom_BSplineCurve)::DownCast (C2); Standard_Integer nbpoles = B1->NbPoles(); if (nbpoles != B2->NbPoles()) { @@ -962,8 +962,8 @@ Standard_Boolean BRepLib_FuseEdges::SameSupport(const TopoDS_Edge& E1, return Standard_False; } - Handle(Geom_BezierCurve) B1 = *((Handle(Geom_BezierCurve)*)&C1); - Handle(Geom_BezierCurve) B2 = *((Handle(Geom_BezierCurve)*)&C2); + Handle(Geom_BezierCurve) B1 = Handle(Geom_BezierCurve)::DownCast (C1); + Handle(Geom_BezierCurve) B2 = Handle(Geom_BezierCurve)::DownCast (C2); Standard_Integer nbpoles = B1->NbPoles(); if (nbpoles != B2->NbPoles()) { @@ -1114,16 +1114,16 @@ Standard_Boolean BRepLib_FuseEdges::UpdatePCurve(const TopoDS_Edge& theOldEdge, Handle(Geom2d_Curve) Curv2dR = BRep_Tool::CurveOnSurface(aFEdge, aFFace,cf,cl); if (Curv2d->DynamicType() == STANDARD_TYPE(Geom2d_TrimmedCurve)) - Curv2d = (*((Handle(Geom2d_TrimmedCurve)*)&Curv2d))->BasisCurve(); + Curv2d = Handle(Geom2d_TrimmedCurve)::DownCast (Curv2d)->BasisCurve(); if (Curv2dR->DynamicType() == STANDARD_TYPE(Geom2d_TrimmedCurve)) - Curv2dR = (*((Handle(Geom2d_TrimmedCurve)*)&Curv2dR))->BasisCurve(); + Curv2dR = Handle(Geom2d_TrimmedCurve)::DownCast (Curv2dR)->BasisCurve(); B.UpdateEdge (theNewEdge,Curv2d,Curv2dR,Surf,loc,BRep_Tool::Tolerance(theNewEdge)); } else { // update the new edge if (Curv2d->DynamicType() == STANDARD_TYPE(Geom2d_TrimmedCurve)) - Curv2d = (*((Handle(Geom2d_TrimmedCurve)*)&Curv2d))->BasisCurve(); + Curv2d = Handle(Geom2d_TrimmedCurve)::DownCast (Curv2d)->BasisCurve(); Standard_Real f, l; f = Curv2d->FirstParameter(); l = Curv2d->LastParameter(); diff --git a/src/BRepMAT2d/BRepMAT2d_Explorer.cxx b/src/BRepMAT2d/BRepMAT2d_Explorer.cxx index 42c38e040b..0f5ef89e41 100644 --- a/src/BRepMAT2d/BRepMAT2d_Explorer.cxx +++ b/src/BRepMAT2d/BRepMAT2d_Explorer.cxx @@ -570,7 +570,7 @@ GeomAbs_CurveType GetCurveType(const Handle(Geom2d_Curve)& theC2d) GeomAbs_CurveType aTypeCurve = GeomAbs_OtherCurve; Handle(Standard_Type) TheType = theC2d->DynamicType(); if ( TheType == STANDARD_TYPE(Geom2d_TrimmedCurve)) { - TheType = (*((Handle(Geom2d_TrimmedCurve)*)&theC2d))->BasisCurve()->DynamicType(); + TheType = Handle(Geom2d_TrimmedCurve)::DownCast (theC2d)->BasisCurve()->DynamicType(); } if ( TheType == STANDARD_TYPE(Geom2d_Circle)) { diff --git a/src/BRepOffset/BRepOffset_Inter2d.cxx b/src/BRepOffset/BRepOffset_Inter2d.cxx index ee39bcc952..7534583c33 100644 --- a/src/BRepOffset/BRepOffset_Inter2d.cxx +++ b/src/BRepOffset/BRepOffset_Inter2d.cxx @@ -847,7 +847,7 @@ static Standard_Boolean ExtendPCurve(const Handle(Geom2d_Curve)& aPCurve, { NewPCurve = aPCurve; if (NewPCurve->IsInstance(STANDARD_TYPE(Geom2d_TrimmedCurve))) - NewPCurve = (*((Handle(Geom2d_TrimmedCurve)*)&NewPCurve))->BasisCurve(); + NewPCurve = Handle(Geom2d_TrimmedCurve)::DownCast (NewPCurve)->BasisCurve(); Standard_Real FirstPar = NewPCurve->FirstParameter(); Standard_Real LastPar = NewPCurve->LastParameter(); @@ -857,7 +857,7 @@ static Standard_Boolean ExtendPCurve(const Handle(Geom2d_Curve)& aPCurve, { if (NewPCurve->IsInstance(STANDARD_TYPE(Geom2d_BezierCurve))) { - Handle(Geom2d_BezierCurve) aBezier = *((Handle(Geom2d_BezierCurve)*)&NewPCurve); + Handle(Geom2d_BezierCurve) aBezier = Handle(Geom2d_BezierCurve)::DownCast (NewPCurve); if (aBezier->NbPoles() == 2) { TColgp_Array1OfPnt2d thePoles(1,2); @@ -869,7 +869,7 @@ static Standard_Boolean ExtendPCurve(const Handle(Geom2d_Curve)& aPCurve, } else if (NewPCurve->IsInstance(STANDARD_TYPE(Geom2d_BSplineCurve))) { - Handle(Geom2d_BSplineCurve) aBSpline = *((Handle(Geom2d_BSplineCurve)*)&NewPCurve); + Handle(Geom2d_BSplineCurve) aBSpline = Handle(Geom2d_BSplineCurve)::DownCast (NewPCurve); if (aBSpline->NbKnots() == 2 && aBSpline->NbPoles() == 2) { TColgp_Array1OfPnt2d thePoles(1,2); @@ -1190,7 +1190,7 @@ static void ExtentEdge(const TopoDS_Edge& E,TopoDS_Edge& NE, const Standard_Real else if (MinSurf->IsInstance(STANDARD_TYPE(Geom_CylindricalSurface)) || MinSurf->IsInstance(STANDARD_TYPE(Geom_ConicalSurface))) { - Handle(Geom2d_Line) theLine = *((Handle(Geom2d_Line)*)&MinPC); + Handle(Geom2d_Line) theLine = Handle(Geom2d_Line)::DownCast (MinPC); gp_Dir2d LineDir = theLine->Direction(); if (LineDir.IsParallel( gp::DY2d(), Precision::Angular() )) IsLine = Standard_True; @@ -1251,13 +1251,13 @@ static void ExtentEdge(const TopoDS_Edge& E,TopoDS_Edge& NE, const Standard_Real if (theCurve->IsInstance(STANDARD_TYPE(Geom2d_Line)) && theSurf->IsKind(STANDARD_TYPE(Geom_BoundedSurface))) { - gp_Dir2d theDir = (*((Handle(Geom2d_Line)*)&theCurve))->Direction(); + gp_Dir2d theDir = Handle(Geom2d_Line)::DownCast (theCurve)->Direction(); if (theDir.IsParallel(gp::DX2d(), Precision::Angular()) || theDir.IsParallel(gp::DY2d(), Precision::Angular())) { Standard_Real U1, U2, V1, V2; theSurf->Bounds(U1, U2, V1, V2); - gp_Pnt2d Origin = (*((Handle(Geom2d_Line)*)&theCurve))->Location(); + gp_Pnt2d Origin = Handle(Geom2d_Line)::DownCast (theCurve)->Location(); if (Abs(Origin.X()-U1) <= Precision::Confusion() || Abs(Origin.X()-U2) <= Precision::Confusion() || Abs(Origin.Y()-V1) <= Precision::Confusion() || diff --git a/src/BRepOffset/BRepOffset_Offset.cxx b/src/BRepOffset/BRepOffset_Offset.cxx index c566583139..ef738d20ab 100644 --- a/src/BRepOffset/BRepOffset_Offset.cxx +++ b/src/BRepOffset/BRepOffset_Offset.cxx @@ -580,7 +580,7 @@ void BRepOffset_Offset::Init(const TopoDS_Face& Face, } if (TheSurf->DynamicType() == STANDARD_TYPE(Geom_ConicalSurface)) { - gp_Cone theCone = (*((Handle(Geom_ConicalSurface)*)&TheSurf))->Cone(); + gp_Cone theCone = Handle(Geom_ConicalSurface)::DownCast (TheSurf)->Cone(); gp_Pnt apex = theCone.Apex(); Standard_Real Uapex, Vapex; ElSLib::Parameters( theCone, apex, Uapex, Vapex ); @@ -604,7 +604,7 @@ void BRepOffset_Offset::Init(const TopoDS_Face& Face, Handle(Geom_Curve) uiso = TheSurf->UIso( uf1 ); if (BRepOffset_Tool::Gabarit( uiso ) > TolApex) { - Handle(Geom_Surface) BasisSurf = (*((Handle(Geom_OffsetSurface)*)&TheSurf))->BasisSurface(); + Handle(Geom_Surface) BasisSurf = Handle(Geom_OffsetSurface)::DownCast (TheSurf)->BasisSurface(); gp_Pnt Papex, Pfirst, Pquart, Pmid; Papex = BasisSurf->Value( uf1, vf1 ); Pfirst = TheSurf->Value( uf1, vf1 ); @@ -621,7 +621,7 @@ void BRepOffset_Offset::Init(const TopoDS_Face& Face, if (OffsetOutside) { TheSurf = new Geom_RectangularTrimmedSurface(TheSurf, uf1, uf2, vf1, vf2); - GeomLib::ExtendSurfByLength(*((Handle(Geom_BoundedSurface)*)&TheSurf), length, 1, + GeomLib::ExtendSurfByLength(Handle(Geom_BoundedSurface)::DownCast (TheSurf), length, 1, Standard_True, Standard_False); Standard_Real u1, u2, v1, v2; TheSurf->Bounds( u1, u2, v1, v2 ); @@ -643,7 +643,7 @@ void BRepOffset_Offset::Init(const TopoDS_Face& Face, Handle(Geom_Curve) uiso = TheSurf->UIso( uf2 ); if (BRepOffset_Tool::Gabarit( uiso ) > TolApex) { - Handle(Geom_Surface) BasisSurf = (*((Handle(Geom_OffsetSurface)*)&TheSurf))->BasisSurface(); + Handle(Geom_Surface) BasisSurf = Handle(Geom_OffsetSurface)::DownCast (TheSurf)->BasisSurface(); gp_Pnt Papex, Pfirst, Pquart, Pmid; Papex = BasisSurf->Value( uf2, vf1 ); Pfirst = TheSurf->Value( uf2, vf1 ); @@ -660,7 +660,7 @@ void BRepOffset_Offset::Init(const TopoDS_Face& Face, if (OffsetOutside) { TheSurf = new Geom_RectangularTrimmedSurface(TheSurf, uf1, uf2, vf1, vf2); - GeomLib::ExtendSurfByLength(*((Handle(Geom_BoundedSurface)*)&TheSurf), length, 1, + GeomLib::ExtendSurfByLength(Handle(Geom_BoundedSurface)::DownCast (TheSurf), length, 1, Standard_True, Standard_True); Standard_Real u1, u2, v1, v2; TheSurf->Bounds( u1, u2, v1, v2 ); @@ -682,7 +682,7 @@ void BRepOffset_Offset::Init(const TopoDS_Face& Face, Handle(Geom_Curve) viso = TheSurf->VIso( vf1 ); if (BRepOffset_Tool::Gabarit( viso ) > TolApex) { - Handle(Geom_Surface) BasisSurf = (*((Handle(Geom_OffsetSurface)*)&TheSurf))->BasisSurface(); + Handle(Geom_Surface) BasisSurf = Handle(Geom_OffsetSurface)::DownCast (TheSurf)->BasisSurface(); gp_Pnt Papex, Pfirst, Pquart, Pmid; Papex = BasisSurf->Value( uf1, vf1 ); Pfirst = TheSurf->Value( uf1, vf1 ); @@ -699,7 +699,7 @@ void BRepOffset_Offset::Init(const TopoDS_Face& Face, if (OffsetOutside) { TheSurf = new Geom_RectangularTrimmedSurface(TheSurf, uf1, uf2, vf1, vf2); - GeomLib::ExtendSurfByLength(*((Handle(Geom_BoundedSurface)*)&TheSurf), length, 1, + GeomLib::ExtendSurfByLength(Handle(Geom_BoundedSurface)::DownCast (TheSurf), length, 1, Standard_False, Standard_False); Standard_Real u1, u2, v1, v2; TheSurf->Bounds( u1, u2, v1, v2 ); @@ -723,7 +723,7 @@ void BRepOffset_Offset::Init(const TopoDS_Face& Face, Handle(Geom_Curve) viso = TheSurf->VIso( vf2 ); if (BRepOffset_Tool::Gabarit( viso ) > TolApex) { - Handle(Geom_Surface) BasisSurf = (*((Handle(Geom_OffsetSurface)*)&TheSurf))->BasisSurface(); + Handle(Geom_Surface) BasisSurf = Handle(Geom_OffsetSurface)::DownCast (TheSurf)->BasisSurface(); gp_Pnt Papex, Pfirst, Pquart, Pmid; Papex = BasisSurf->Value( uf1, vf2 ); Pfirst = TheSurf->Value( uf1, vf2 ); @@ -740,7 +740,7 @@ void BRepOffset_Offset::Init(const TopoDS_Face& Face, if (OffsetOutside) { TheSurf = new Geom_RectangularTrimmedSurface(TheSurf, uf1, uf2, vf1, vf2); - GeomLib::ExtendSurfByLength(*((Handle(Geom_BoundedSurface)*)&TheSurf), length, 1, + GeomLib::ExtendSurfByLength(Handle(Geom_BoundedSurface)::DownCast (TheSurf), length, 1, Standard_False, Standard_True); Standard_Real u1, u2, v1, v2; TheSurf->Bounds( u1, u2, v1, v2 ); diff --git a/src/BRepOffset/BRepOffset_Tool.cxx b/src/BRepOffset/BRepOffset_Tool.cxx index b84c773fe1..c6bb537836 100644 --- a/src/BRepOffset/BRepOffset_Tool.cxx +++ b/src/BRepOffset/BRepOffset_Tool.cxx @@ -253,7 +253,7 @@ static void PutInBounds (const TopoDS_Face& F, Handle (Geom_Surface) S = BRep_Tool::Surface(F,L); if (S->IsInstance(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) { - S = (*(Handle(Geom_RectangularTrimmedSurface)*)&S)->BasisSurface(); + S = Handle(Geom_RectangularTrimmedSurface)::DownCast (S)->BasisSurface(); } //--------------- // Recadre en U. @@ -368,7 +368,7 @@ static void BuildPCurves (const TopoDS_Edge& E, Handle( Geom_Surface ) theSurf = BRep_Tool::Surface( F ); Handle( Standard_Type ) typS = theSurf->DynamicType(); if (typS == STANDARD_TYPE(Geom_OffsetSurface)) - typS = (*((Handle(Geom_OffsetSurface)*)&theSurf))->BasisSurface()->DynamicType(); + typS = Handle(Geom_OffsetSurface)::DownCast (theSurf)->BasisSurface()->DynamicType(); if (typS == STANDARD_TYPE(Geom_BezierSurface) || typS == STANDARD_TYPE(Geom_BSplineSurface)) { gp_Pnt fpoint = AC.Value( AC.FirstParameter() ); @@ -902,18 +902,18 @@ static Standard_Boolean AreConnex(const TopoDS_Wire& W1, Standard_Real f, l; Handle(Geom_Curve) C1 = BRep_Tool::Curve( E1, f, l ); if (C1->IsInstance(STANDARD_TYPE(Geom_TrimmedCurve))) - C1 = (*((Handle(Geom_TrimmedCurve)*)&C1))->BasisCurve(); + C1 = Handle(Geom_TrimmedCurve)::DownCast (C1)->BasisCurve(); Handle(Geom_Curve) C2 = BRep_Tool::Curve( E2, f, l ); if (C2->IsInstance(STANDARD_TYPE(Geom_TrimmedCurve))) - C2 = (*((Handle(Geom_TrimmedCurve)*)&C2))->BasisCurve(); + C2 = Handle(Geom_TrimmedCurve)::DownCast (C2)->BasisCurve(); if (C1->IsInstance(STANDARD_TYPE(Geom_Line)) && C2->IsInstance(STANDARD_TYPE(Geom_Line))) { - Handle(Geom_Line) L1 = *((Handle(Geom_Line)*) &C1); + Handle(Geom_Line) L1 = Handle(Geom_Line)::DownCast (C1); gp_Ax1 Axis1 = L1->Position(); - Handle(Geom_Line) L2 = *((Handle(Geom_Line)*) &C2); + Handle(Geom_Line) L2 = Handle(Geom_Line)::DownCast (C2); gp_Ax1 Axis2 = L2->Position(); if (! Axis1.IsParallel( Axis2, Precision::Angular() )) return Standard_False; @@ -959,11 +959,11 @@ static Standard_Boolean BSplineEdges(const TopoDS_Edge& E1, Handle(Geom_Curve) C1 = BRep_Tool::Curve( E1, first1, last1 ); if (C1->IsInstance(STANDARD_TYPE(Geom_TrimmedCurve))) - C1 = (*((Handle(Geom_TrimmedCurve)*)&C1))->BasisCurve(); + C1 = Handle(Geom_TrimmedCurve)::DownCast (C1)->BasisCurve(); Handle(Geom_Curve) C2 = BRep_Tool::Curve( E2, first2, last2 ); if (C2->IsInstance(STANDARD_TYPE(Geom_TrimmedCurve))) - C2 = (*((Handle(Geom_TrimmedCurve)*)&C2))->BasisCurve(); + C2 = Handle(Geom_TrimmedCurve)::DownCast (C2)->BasisCurve(); if (!C1->IsInstance(STANDARD_TYPE(Geom_BSplineCurve)) || !C2->IsInstance(STANDARD_TYPE(Geom_BSplineCurve))) @@ -1082,11 +1082,11 @@ static Handle(Geom2d_Curve) ConcatPCurves(const TopoDS_Edge& E1, PCurve1 = BRep_Tool::CurveOnSurface( E1, F, first1, last1 ); if (PCurve1->IsInstance(STANDARD_TYPE(Geom2d_TrimmedCurve))) - PCurve1 = (*((Handle(Geom2d_TrimmedCurve)*)&PCurve1))->BasisCurve(); + PCurve1 = Handle(Geom2d_TrimmedCurve)::DownCast (PCurve1)->BasisCurve(); PCurve2 = BRep_Tool::CurveOnSurface( E2, F, first2, last2 ); if (PCurve2->IsInstance(STANDARD_TYPE(Geom2d_TrimmedCurve))) - PCurve2 = (*((Handle(Geom2d_TrimmedCurve)*)&PCurve2))->BasisCurve(); + PCurve2 = Handle(Geom2d_TrimmedCurve)::DownCast (PCurve2)->BasisCurve(); if (PCurve1 == PCurve2) { @@ -1104,35 +1104,35 @@ static Handle(Geom2d_Curve) ConcatPCurves(const TopoDS_Edge& E1, P2 = PCurve2->Value( last2 ); if (PCurve1->IsInstance(STANDARD_TYPE(Geom2d_Line))) { - Handle(Geom2d_Line) Lin1 = *((Handle(Geom2d_Line)*) &PCurve1); + Handle(Geom2d_Line) Lin1 = Handle(Geom2d_Line)::DownCast (PCurve1); gp_Lin2d theLin = Lin1->Lin2d(); first2 = ElCLib::Parameter( theLin, P1 ); last2 = ElCLib::Parameter( theLin, P2 ); } else if (PCurve1->IsInstance(STANDARD_TYPE(Geom2d_Circle))) { - Handle(Geom2d_Circle) Circ1 = *((Handle(Geom2d_Circle)*) &PCurve1); + Handle(Geom2d_Circle) Circ1 = Handle(Geom2d_Circle)::DownCast (PCurve1); gp_Circ2d theCirc = Circ1->Circ2d(); first2 = ElCLib::Parameter( theCirc, P1 ); last2 = ElCLib::Parameter( theCirc, P2 ); } else if (PCurve1->IsInstance(STANDARD_TYPE(Geom2d_Ellipse))) { - Handle(Geom2d_Ellipse) Ell1 = *((Handle(Geom2d_Ellipse)*) &PCurve1); + Handle(Geom2d_Ellipse) Ell1 = Handle(Geom2d_Ellipse)::DownCast (PCurve1); gp_Elips2d theElips = Ell1->Elips2d(); first2 = ElCLib::Parameter( theElips, P1 ); last2 = ElCLib::Parameter( theElips, P2 ); } else if (PCurve1->IsInstance(STANDARD_TYPE(Geom2d_Parabola))) { - Handle(Geom2d_Parabola) Parab1 = *((Handle(Geom2d_Parabola)*) &PCurve1); + Handle(Geom2d_Parabola) Parab1 = Handle(Geom2d_Parabola)::DownCast (PCurve1); gp_Parab2d theParab = Parab1->Parab2d(); first2 = ElCLib::Parameter( theParab, P1 ); last2 = ElCLib::Parameter( theParab, P2 ); } else if (PCurve1->IsInstance(STANDARD_TYPE(Geom2d_Hyperbola))) { - Handle(Geom2d_Hyperbola) Hypr1 = *((Handle(Geom2d_Hyperbola)*) &PCurve1); + Handle(Geom2d_Hyperbola) Hypr1 = Handle(Geom2d_Hyperbola)::DownCast (PCurve1); gp_Hypr2d theHypr = Hypr1->Hypr2d(); first2 = ElCLib::Parameter( theHypr, P1 ); last2 = ElCLib::Parameter( theHypr, P2 ); @@ -1187,11 +1187,11 @@ static TopoDS_Edge Glue(const TopoDS_Edge& E1, C1 = BRep_Tool::Curve( E1, first1, last1 ); if (C1->IsInstance(STANDARD_TYPE(Geom_TrimmedCurve))) - C1 = (*((Handle(Geom_TrimmedCurve)*)&C1))->BasisCurve(); + C1 = Handle(Geom_TrimmedCurve)::DownCast (C1)->BasisCurve(); C2 = BRep_Tool::Curve( E2, first2, last2 ); if (C2->IsInstance(STANDARD_TYPE(Geom_TrimmedCurve))) - C2 = (*((Handle(Geom_TrimmedCurve)*)&C2))->BasisCurve(); + C2 = Handle(Geom_TrimmedCurve)::DownCast (C2)->BasisCurve(); if (C1 == C2) { @@ -1302,7 +1302,7 @@ static Standard_Boolean CheckIntersFF(const BOPDS_PDS& pDS, Handle(Geom_Surface) aSurf = BRep_Tool::Surface(F1); if (aSurf->IsInstance(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) - aSurf = (*((Handle(Geom_RectangularTrimmedSurface)*)&aSurf))->BasisSurface(); + aSurf = Handle(Geom_RectangularTrimmedSurface)::DownCast (aSurf)->BasisSurface(); if (aSurf->IsInstance(STANDARD_TYPE(Geom_Plane))) isPlane1 = Standard_True; else if (aSurf->IsKind(STANDARD_TYPE(Geom_ElementarySurface))) @@ -1310,7 +1310,7 @@ static Standard_Boolean CheckIntersFF(const BOPDS_PDS& pDS, aSurf = BRep_Tool::Surface(F2); if (aSurf->IsInstance(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) - aSurf = (*((Handle(Geom_RectangularTrimmedSurface)*)&aSurf))->BasisSurface(); + aSurf = Handle(Geom_RectangularTrimmedSurface)::DownCast (aSurf)->BasisSurface(); if (aSurf->IsInstance(STANDARD_TYPE(Geom_Plane))) isPlane2 = Standard_True; else if (aSurf->IsKind(STANDARD_TYPE(Geom_ElementarySurface))) @@ -1708,7 +1708,7 @@ void BRepOffset_Tool::Inter3D(const TopoDS_Face& F1, Handle(Geom_Surface) aSurf = BRep_Tool::Surface(cpF1); if (aSurf->IsInstance(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) - aSurf = (*((Handle(Geom_RectangularTrimmedSurface)*)&aSurf))->BasisSurface(); + aSurf = Handle(Geom_RectangularTrimmedSurface)::DownCast (aSurf)->BasisSurface(); if (aSurf->IsInstance(STANDARD_TYPE(Geom_Plane))) addPCurve1 = Standard_False; else if (aSurf->IsKind(STANDARD_TYPE(Geom_ElementarySurface))) @@ -1716,7 +1716,7 @@ void BRepOffset_Tool::Inter3D(const TopoDS_Face& F1, aSurf = BRep_Tool::Surface(cpF2); if (aSurf->IsInstance(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) - aSurf = (*((Handle(Geom_RectangularTrimmedSurface)*)&aSurf))->BasisSurface(); + aSurf = Handle(Geom_RectangularTrimmedSurface)::DownCast (aSurf)->BasisSurface(); if (aSurf->IsInstance(STANDARD_TYPE(Geom_Plane))) addPCurve2 = Standard_False; else if (aSurf->IsKind(STANDARD_TYPE(Geom_ElementarySurface))) @@ -2027,14 +2027,14 @@ void BRepOffset_Tool::InterOrExtent(const TopoDS_Face& F1, if (S1->DynamicType() == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) { Handle(Geom_RectangularTrimmedSurface) RTS ; - RTS = *((Handle(Geom_RectangularTrimmedSurface)*) &S1); + RTS = Handle(Geom_RectangularTrimmedSurface)::DownCast (S1); if (RTS->BasisSurface()->DynamicType() == STANDARD_TYPE(Geom_Plane)) { S1 = RTS->BasisSurface(); } } if (S2->DynamicType() == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) { Handle(Geom_RectangularTrimmedSurface) RTS ; - RTS = *((Handle(Geom_RectangularTrimmedSurface)*) &S2); + RTS = Handle(Geom_RectangularTrimmedSurface)::DownCast (S2); if (RTS->BasisSurface()->DynamicType() == STANDARD_TYPE(Geom_Plane)) { S2 = RTS->BasisSurface(); } @@ -2582,7 +2582,7 @@ static void MakeFace(const Handle(Geom_Surface)& S, Standard_Boolean IsSuclosed = S->IsUClosed(), IsSvclosed = S->IsVClosed(); if (S->DynamicType() == STANDARD_TYPE(Geom_OffsetSurface)) { - Handle(Geom_Surface) BasisSurf = (*((Handle(Geom_OffsetSurface)*)&S))->BasisSurface(); + Handle(Geom_Surface) BasisSurf = Handle(Geom_OffsetSurface)::DownCast (S)->BasisSurface(); IsSuclosed = BasisSurf->IsUClosed(); IsSvclosed = BasisSurf->IsVClosed(); } @@ -2601,10 +2601,10 @@ static void MakeFace(const Handle(Geom_Surface)& S, Standard_Boolean vmindegen = isVminDegen, vmaxdegen = isVmaxDegen; Handle(Geom_Surface) theSurf = S; if (S->DynamicType() == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) - theSurf = (*(Handle(Geom_RectangularTrimmedSurface)*)&S)->BasisSurface(); + theSurf = Handle(Geom_RectangularTrimmedSurface)::DownCast (S)->BasisSurface(); if (theSurf->DynamicType() == STANDARD_TYPE(Geom_ConicalSurface)) { - Handle(Geom_ConicalSurface) ConicalS = *((Handle(Geom_ConicalSurface)*) &theSurf); + Handle(Geom_ConicalSurface) ConicalS = Handle(Geom_ConicalSurface)::DownCast (theSurf); gp_Cone theCone = ConicalS->Cone(); gp_Pnt theApex = theCone.Apex(); Standard_Real Uapex, Vapex; @@ -2837,7 +2837,7 @@ static Standard_Boolean EnlargeGeometry(Handle(Geom_Surface)& S, Standard_Boolean SurfaceChange = Standard_False; if ( S->DynamicType() == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) { - Handle(Geom_Surface) BS = (*((Handle(Geom_RectangularTrimmedSurface)*)&S))->BasisSurface(); + Handle(Geom_Surface) BS = Handle(Geom_RectangularTrimmedSurface)::DownCast (S)->BasisSurface(); EnlargeGeometry(BS,U1,U2,V1,V2,IsV1degen,IsV2degen, uf1,uf2,vf1,vf2,GlobalEnlargeU,GlobalEnlargeVfirst,GlobalEnlargeVlast); if (!GlobalEnlargeVfirst) @@ -2845,14 +2845,14 @@ static Standard_Boolean EnlargeGeometry(Handle(Geom_Surface)& S, if (!GlobalEnlargeVlast) V2 = vf2; if (!GlobalEnlargeVfirst || !GlobalEnlargeVlast) - //(*((Handle(Geom_RectangularTrimmedSurface)*)&S))->SetTrim( U1, U2, V1, V2 ); + //Handle(Geom_RectangularTrimmedSurface)::DownCast (S)->SetTrim( U1, U2, V1, V2 ); S = new Geom_RectangularTrimmedSurface( BS, U1, U2, V1, V2 ); else S = BS; SurfaceChange = Standard_True; } else if (S->DynamicType() == STANDARD_TYPE(Geom_OffsetSurface)) { - Handle(Geom_Surface) Surf = (*((Handle(Geom_OffsetSurface)*)&S))->BasisSurface(); + Handle(Geom_Surface) Surf = Handle(Geom_OffsetSurface)::DownCast (S)->BasisSurface(); SurfaceChange = EnlargeGeometry(Surf,U1,U2,V1,V2,IsV1degen,IsV2degen, uf1,uf2,vf1,vf2,GlobalEnlargeU,GlobalEnlargeVfirst,GlobalEnlargeVlast); Handle(Geom_OffsetSurface)::DownCast(S)->SetBasisSurface(Surf); @@ -2919,16 +2919,16 @@ static Standard_Boolean EnlargeGeometry(Handle(Geom_Surface)& S, if (enlargeU) { if (enlargeUfirst) - GeomLib::ExtendSurfByLength( *((Handle(Geom_BoundedSurface)*)&S), du, 1, Standard_True, Standard_False ); + GeomLib::ExtendSurfByLength( Handle(Geom_BoundedSurface)::DownCast (S), du, 1, Standard_True, Standard_False ); if (enlargeUlast) - GeomLib::ExtendSurfByLength( *((Handle(Geom_BoundedSurface)*)&S), du, 1, Standard_True, Standard_True ); + GeomLib::ExtendSurfByLength( Handle(Geom_BoundedSurface)::DownCast (S), du, 1, Standard_True, Standard_True ); } if (enlargeV) { if (enlargeVfirst) - GeomLib::ExtendSurfByLength( *((Handle(Geom_BoundedSurface)*)&S), dv, 1, Standard_False, Standard_False ); + GeomLib::ExtendSurfByLength( Handle(Geom_BoundedSurface)::DownCast (S), dv, 1, Standard_False, Standard_False ); if (enlargeVlast) - GeomLib::ExtendSurfByLength( *((Handle(Geom_BoundedSurface)*)&S), dv, 1, Standard_False, Standard_True ); + GeomLib::ExtendSurfByLength( Handle(Geom_BoundedSurface)::DownCast (S), dv, 1, Standard_False, Standard_True ); } S->Bounds( U1, U2, V1, V2 ); SurfaceChange = Standard_True; @@ -2985,16 +2985,16 @@ static Standard_Boolean EnlargeGeometry(Handle(Geom_Surface)& S, if (enlargeU) { if (enlargeUfirst && uf1-u1 < duf) - GeomLib::ExtendSurfByLength( *((Handle(Geom_BoundedSurface)*)&S), du, 1, Standard_True, Standard_False ); + GeomLib::ExtendSurfByLength( Handle(Geom_BoundedSurface)::DownCast (S), du, 1, Standard_True, Standard_False ); if (enlargeUlast && u2-uf2 < duf) - GeomLib::ExtendSurfByLength( *((Handle(Geom_BoundedSurface)*)&S), du, 1, Standard_True, Standard_True ); + GeomLib::ExtendSurfByLength( Handle(Geom_BoundedSurface)::DownCast (S), du, 1, Standard_True, Standard_True ); } if (enlargeV) { if (enlargeVfirst && vf1-v1 < dvf) - GeomLib::ExtendSurfByLength( *((Handle(Geom_BoundedSurface)*)&S), dv, 1, Standard_False, Standard_False ); + GeomLib::ExtendSurfByLength( Handle(Geom_BoundedSurface)::DownCast (S), dv, 1, Standard_False, Standard_False ); if (enlargeVlast && v2-vf2 < dvf) - GeomLib::ExtendSurfByLength( *((Handle(Geom_BoundedSurface)*)&S), dv, 1, Standard_False, Standard_True ); + GeomLib::ExtendSurfByLength( Handle(Geom_BoundedSurface)::DownCast (S), dv, 1, Standard_False, Standard_True ); } S->Bounds( U1, U2, V1, V2 ); @@ -3116,7 +3116,7 @@ void BRepOffset_Tool::CheckBounds(const TopoDS_Face& F, Handle(Geom_Surface) theSurf = BRep_Tool::Surface(F); if (theSurf->DynamicType() == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) - theSurf = (*((Handle(Geom_RectangularTrimmedSurface)*)&theSurf))->BasisSurface(); + theSurf = Handle(Geom_RectangularTrimmedSurface)::DownCast (theSurf)->BasisSurface(); if (theSurf->DynamicType() == STANDARD_TYPE(Geom_SurfaceOfLinearExtrusion) || theSurf->DynamicType() == STANDARD_TYPE(Geom_SurfaceOfRevolution) || @@ -3136,11 +3136,11 @@ void BRepOffset_Tool::CheckBounds(const TopoDS_Face& F, Standard_Real fpar, lpar; Handle(Geom2d_Curve) aCurve = BRep_Tool::CurveOnSurface(anEdge, F, fpar, lpar); if (aCurve->DynamicType() == STANDARD_TYPE(Geom2d_TrimmedCurve)) - aCurve = (*((Handle(Geom2d_TrimmedCurve)*)&aCurve))->BasisCurve(); + aCurve = Handle(Geom2d_TrimmedCurve)::DownCast (aCurve)->BasisCurve(); Handle(Geom2d_Line) theLine; if (aCurve->DynamicType() == STANDARD_TYPE(Geom2d_Line)) - theLine = *((Handle(Geom2d_Line)*)&aCurve); + theLine = Handle(Geom2d_Line)::DownCast (aCurve); else if (aCurve->DynamicType() == STANDARD_TYPE(Geom2d_BezierCurve) || aCurve->DynamicType() == STANDARD_TYPE(Geom2d_BSplineCurve)) { @@ -3269,10 +3269,10 @@ Standard_Boolean BRepOffset_Tool::EnLargeFace //Special treatment for conical surfaces Handle(Geom_Surface) theSurf = S; if (S->DynamicType() == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) - theSurf = (*(Handle(Geom_RectangularTrimmedSurface)*)&S)->BasisSurface(); + theSurf = Handle(Geom_RectangularTrimmedSurface)::DownCast (S)->BasisSurface(); if (theSurf->DynamicType() == STANDARD_TYPE(Geom_ConicalSurface)) { - Handle(Geom_ConicalSurface) ConicalS = *((Handle(Geom_ConicalSurface)*) &theSurf); + Handle(Geom_ConicalSurface) ConicalS = Handle(Geom_ConicalSurface)::DownCast (theSurf); gp_Cone theCone = ConicalS->Cone(); gp_Pnt theApex = theCone.Apex(); Standard_Real Uapex, Vapex; diff --git a/src/BRepOffsetAPI/BRepOffsetAPI_DraftAngle.cxx b/src/BRepOffsetAPI/BRepOffsetAPI_DraftAngle.cxx index 357e7d34e9..06ac3b3e96 100644 --- a/src/BRepOffsetAPI/BRepOffsetAPI_DraftAngle.cxx +++ b/src/BRepOffsetAPI/BRepOffsetAPI_DraftAngle.cxx @@ -79,7 +79,7 @@ BRepOffsetAPI_DraftAngle::BRepOffsetAPI_DraftAngle (const TopoDS_Shape& S) void BRepOffsetAPI_DraftAngle::Clear () { if (!myModification.IsNull()) { - (*((Handle(Draft_Modification)*)&myModification))->Clear(); + Handle(Draft_Modification)::DownCast (myModification)->Clear(); } } @@ -94,7 +94,7 @@ void BRepOffsetAPI_DraftAngle::Init (const TopoDS_Shape& S) myInitialShape = S; NotDone(); if (!myModification.IsNull()) { - (*((Handle(Draft_Modification)*)&myModification))->Init(S); + Handle(Draft_Modification)::DownCast (myModification)->Init(S); } else { myModification = new Draft_Modification(S); @@ -117,7 +117,7 @@ void BRepOffsetAPI_DraftAngle::Add(const TopoDS_Face& F, if ( Abs(Angle) <= 1.e-04 ) return; Standard_NullObject_Raise_if(myInitialShape.IsNull(),""); - (*((Handle(Draft_Modification)*)&myModification))->Add(F,D,Angle,Plane, Flag); + Handle(Draft_Modification)::DownCast (myModification)->Add(F,D,Angle,Plane, Flag); } @@ -129,7 +129,7 @@ void BRepOffsetAPI_DraftAngle::Add(const TopoDS_Face& F, Standard_Boolean BRepOffsetAPI_DraftAngle::AddDone () const { Standard_NullObject_Raise_if(myInitialShape.IsNull(),""); - return (*((Handle(Draft_Modification)*)&myModification)) + return Handle(Draft_Modification)::DownCast (myModification) ->ProblematicShape().IsNull(); } @@ -142,7 +142,7 @@ Standard_Boolean BRepOffsetAPI_DraftAngle::AddDone () const void BRepOffsetAPI_DraftAngle::Remove(const TopoDS_Face& F) { Standard_NullObject_Raise_if(myInitialShape.IsNull(),""); - (*((Handle(Draft_Modification)*)&myModification))->Remove(F); + Handle(Draft_Modification)::DownCast (myModification)->Remove(F); } @@ -154,7 +154,7 @@ void BRepOffsetAPI_DraftAngle::Remove(const TopoDS_Face& F) const TopoDS_Shape& BRepOffsetAPI_DraftAngle::ProblematicShape () const { Standard_NullObject_Raise_if(myInitialShape.IsNull(),""); - return (*((Handle(Draft_Modification)*)&myModification))->ProblematicShape(); + return Handle(Draft_Modification)::DownCast (myModification)->ProblematicShape(); } @@ -166,7 +166,7 @@ const TopoDS_Shape& BRepOffsetAPI_DraftAngle::ProblematicShape () const Draft_ErrorStatus BRepOffsetAPI_DraftAngle::Status () const { Standard_NullObject_Raise_if(myInitialShape.IsNull(),""); - return (*((Handle(Draft_Modification)*)&myModification))->Error(); + return Handle(Draft_Modification)::DownCast (myModification)->Error(); } @@ -179,7 +179,7 @@ const TopTools_ListOfShape& BRepOffsetAPI_DraftAngle::ConnectedFaces (const TopoDS_Face& F) const { Standard_NullObject_Raise_if(myInitialShape.IsNull(),""); - return (*((Handle(Draft_Modification)*)&myModification))->ConnectedFaces(F); + return Handle(Draft_Modification)::DownCast (myModification)->ConnectedFaces(F); } @@ -191,7 +191,7 @@ const TopTools_ListOfShape& BRepOffsetAPI_DraftAngle::ConnectedFaces const TopTools_ListOfShape& BRepOffsetAPI_DraftAngle::ModifiedFaces() const { Standard_NullObject_Raise_if(myInitialShape.IsNull(),""); - return (*((Handle(Draft_Modification)*)&myModification))->ModifiedFaces(); + return Handle(Draft_Modification)::DownCast (myModification)->ModifiedFaces(); } //======================================================================= @@ -203,7 +203,7 @@ const TopTools_ListOfShape& BRepOffsetAPI_DraftAngle::Generated(const TopoDS_Sha { myGenerated.Clear(); Standard_NullObject_Raise_if(myInitialShape.IsNull(),""); - Handle(Draft_Modification) DMod = (*((Handle(Draft_Modification)*)&myModification)); + Handle(Draft_Modification) DMod = Handle(Draft_Modification)::DownCast (myModification); if (S.ShapeType() == TopAbs_FACE) { Handle(Geom_Surface) Surf; @@ -227,7 +227,7 @@ const TopTools_ListOfShape& BRepOffsetAPI_DraftAngle::Modified(const TopoDS_Shap { myGenerated.Clear(); Standard_NullObject_Raise_if(myInitialShape.IsNull(),""); - Handle(Draft_Modification) DMod = (*((Handle(Draft_Modification)*)&myModification)); + Handle(Draft_Modification) DMod = Handle(Draft_Modification)::DownCast (myModification); if (S.ShapeType() == TopAbs_FACE) { Handle(Geom_Surface) Surf; @@ -254,8 +254,8 @@ const TopTools_ListOfShape& BRepOffsetAPI_DraftAngle::Modified(const TopoDS_Shap void BRepOffsetAPI_DraftAngle::Build() { - (*((Handle(Draft_Modification)*)&myModification))->Perform(); - if (!(*((Handle(Draft_Modification)*)&myModification))->IsDone()) { + Handle(Draft_Modification)::DownCast (myModification)->Perform(); + if (!Handle(Draft_Modification)::DownCast (myModification)->IsDone()) { NotDone(); } else { diff --git a/src/BRepOffsetAPI/BRepOffsetAPI_MiddlePath.cxx b/src/BRepOffsetAPI/BRepOffsetAPI_MiddlePath.cxx index a18ba9a326..aef4d6c897 100644 --- a/src/BRepOffsetAPI/BRepOffsetAPI_MiddlePath.cxx +++ b/src/BRepOffsetAPI/BRepOffsetAPI_MiddlePath.cxx @@ -70,17 +70,17 @@ static Standard_Boolean IsLinear(const TopoDS_Edge& anEdge, Standard_Real fpar, lpar; Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, fpar, lpar); if (aCurve->IsInstance(STANDARD_TYPE(Geom_TrimmedCurve))) - aCurve = ((Handle(Geom_TrimmedCurve)&) aCurve)->BasisCurve(); + aCurve = Handle(Geom_TrimmedCurve)::DownCast (aCurve)->BasisCurve(); gp_Pnt Pnt1, Pnt2; if (aCurve->IsKind(STANDARD_TYPE(Geom_Line))) { - aLine = ((Handle(Geom_Line)&) aCurve)->Lin(); + aLine = Handle(Geom_Line)::DownCast (aCurve)->Lin(); return Standard_True; } else if (aCurve->IsKind(STANDARD_TYPE(Geom_BezierCurve))) { - Handle(Geom_BezierCurve) theBezier = (Handle(Geom_BezierCurve)&) aCurve; + Handle(Geom_BezierCurve) theBezier = Handle(Geom_BezierCurve)::DownCast (aCurve); if (theBezier->NbPoles() == 2) { Pnt1 = theBezier->Pole(1); @@ -91,7 +91,7 @@ static Standard_Boolean IsLinear(const TopoDS_Edge& anEdge, } else if (aCurve->IsKind(STANDARD_TYPE(Geom_BSplineCurve))) { - Handle(Geom_BSplineCurve) theBSpline = (Handle(Geom_BSplineCurve)&) aCurve; + Handle(Geom_BSplineCurve) theBSpline = Handle(Geom_BSplineCurve)::DownCast (aCurve); if (theBSpline->NbPoles() == 2) { Pnt1 = theBSpline->Pole(1); @@ -838,7 +838,7 @@ void BRepOffsetAPI_MiddlePath::Build() Standard_Real fpar, lpar; Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, fpar, lpar); if (aCurve->IsInstance(STANDARD_TYPE(Geom_TrimmedCurve))) - aCurve = ((Handle(Geom_TrimmedCurve)&) aCurve)->BasisCurve(); + aCurve = Handle(Geom_TrimmedCurve)::DownCast (aCurve)->BasisCurve(); Pnt1 = aCurve->Value(fpar); Pnt2 = aCurve->Value(lpar); Handle(Geom_Circle) aCircle = Handle(Geom_Circle)::DownCast(aCurve); diff --git a/src/BRepTest/BRepTest_MatCommands.cxx b/src/BRepTest/BRepTest_MatCommands.cxx index c8ae4e4095..11083e44ee 100644 --- a/src/BRepTest/BRepTest_MatCommands.cxx +++ b/src/BRepTest/BRepTest_MatCommands.cxx @@ -199,10 +199,10 @@ void DrawCurve(const Handle(Geom2d_Curve)& aCurve, Draw_Color Couleur; if (type == STANDARD_TYPE(Geom2d_TrimmedCurve)) { - curve = (*(Handle(Geom2d_TrimmedCurve)*)&aCurve)->BasisCurve(); + curve = Handle(Geom2d_TrimmedCurve)::DownCast (aCurve)->BasisCurve(); type = curve->DynamicType(); if (type == STANDARD_TYPE(Bisector_BisecAna)) { - curve =(*(Handle(Bisector_BisecAna)*)&curve)->Geom2dCurve(); + curve =Handle(Bisector_BisecAna)::DownCast (curve)->Geom2dCurve(); type = curve->DynamicType(); } // PB of representation of semi_infinite curves. diff --git a/src/BinMDF/BinMDF_ADriverTable.cxx b/src/BinMDF/BinMDF_ADriverTable.cxx index f59eb2ff09..bd8511da05 100644 --- a/src/BinMDF/BinMDF_ADriverTable.cxx +++ b/src/BinMDF/BinMDF_ADriverTable.cxx @@ -54,8 +54,7 @@ void BinMDF_ADriverTable::AssignIds myMapId.Clear(); Standard_Integer i; for (i=1; i <= theTypes.Extent(); i++) { - const Handle(Standard_Type)& aType = - Handle(Standard_Type)::DownCast (theTypes(i)); + Handle(Standard_Type) aType (Handle(Standard_Type)::DownCast (theTypes(i))); if (myMap.IsBound (aType)) { myMapId.Bind (aType, i); } diff --git a/src/Bisector/Bisector_BisecAna.cxx b/src/Bisector/Bisector_BisecAna.cxx index 7255407ca8..9bd55d4bbf 100644 --- a/src/Bisector/Bisector_BisecAna.cxx +++ b/src/Bisector/Bisector_BisecAna.cxx @@ -822,7 +822,7 @@ void Bisector_BisecAna::Perform(const Handle(Geom2d_Curve)& afirstcurve , Handle(Standard_Type) type = afirstcurve->DynamicType(); if (type == STANDARD_TYPE(Geom2d_TrimmedCurve)) { - curve = (*(Handle(Geom2d_TrimmedCurve)*)&afirstcurve)->BasisCurve(); + curve = Handle(Geom2d_TrimmedCurve)::DownCast (afirstcurve)->BasisCurve(); } else { curve = afirstcurve; diff --git a/src/BndLib/BndLib_Add3dCurve.cxx b/src/BndLib/BndLib_Add3dCurve.cxx index 5940790d0a..c5fb584977 100644 --- a/src/BndLib/BndLib_Add3dCurve.cxx +++ b/src/BndLib/BndLib_Add3dCurve.cxx @@ -137,7 +137,7 @@ void BndLib_Add3dCurve::Add( const Adaptor3d_Curve& C, Abs(Bs->LastParameter() - U2) > Precision::Parametric(Tol)) { Handle(Geom_Geometry) G = Bs->Copy(); - Handle(Geom_BSplineCurve)& Bsaux = (*((Handle(Geom_BSplineCurve)*)&G)); + Handle(Geom_BSplineCurve)& Bsaux = Handle(Geom_BSplineCurve)::DownCast (G); Standard_Real u1 = U1, u2 = U2; //// modified by jgv, 24.10.01 for BUC61031 //// if (Bsaux->IsPeriodic()) diff --git a/src/ChFi3d/ChFi3d_Builder_0.cxx b/src/ChFi3d/ChFi3d_Builder_0.cxx index 6915f651f9..445f22acf8 100644 --- a/src/ChFi3d/ChFi3d_Builder_0.cxx +++ b/src/ChFi3d/ChFi3d_Builder_0.cxx @@ -1702,7 +1702,7 @@ void ChFi3d_ComputeArete(const ChFiDS_CommonPoint& P1, bs.Update(umin,vmin,umax,vmax); Standard_Boolean aIN = Standard_True; for(Standard_Integer ii = 1; ii <= 4 && aIN; ii++) { - if(bs.IsOut((*((Handle(Geom2d_BezierCurve)*) &Pcurv))->Pole(ii))) { + if(bs.IsOut(Handle(Geom2d_BezierCurve)::DownCast (Pcurv)->Pole(ii))) { aIN = Standard_False; TColgp_Array1OfPnt2d qoles(1,2); qoles(1)=UV1; @@ -2009,8 +2009,7 @@ static void QueryAddVertexInEdge(TopOpeBRepDS_ListOfInterference& LI, TopOpeBRepDS_ListIteratorOfListOfInterference it(LI); for (; it.More(); it.Next() ) { const Handle(TopOpeBRepDS_Interference)& cur = it.Value(); - const Handle(TopOpeBRepDS_CurvePointInterference)& cpi = - Handle(TopOpeBRepDS_CurvePointInterference)::DownCast(cur); + Handle(TopOpeBRepDS_CurvePointInterference) cpi (Handle(TopOpeBRepDS_CurvePointInterference)::DownCast(cur)); if(!cpi.IsNull()) { Standard_Integer newIV = cpi->Geometry(); TopOpeBRepDS_Kind kv = cpi->GeometryType(); diff --git a/src/DNaming/DNaming.cxx b/src/DNaming/DNaming.cxx index 9a7d3e809e..93a8898c8a 100644 --- a/src/DNaming/DNaming.cxx +++ b/src/DNaming/DNaming.cxx @@ -896,7 +896,7 @@ Standard_Boolean DNaming::ComputeSweepDir (const TopoDS_Shape& theShape, cout<<"Surface Dynamic TYPE = "<DynamicType() == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) - aSurf = ((Handle(Geom_RectangularTrimmedSurface)&) aSurf)->BasisSurface(); + aSurf = Handle(Geom_RectangularTrimmedSurface)::DownCast (aSurf)->BasisSurface(); aPlane = Handle(Geom_Plane)::DownCast(aSurf); } diff --git a/src/DrawDim/DrawDim_PlanarAngle.cxx b/src/DrawDim/DrawDim_PlanarAngle.cxx index adba0e3ab8..220796c223 100644 --- a/src/DrawDim/DrawDim_PlanarAngle.cxx +++ b/src/DrawDim/DrawDim_PlanarAngle.cxx @@ -119,14 +119,14 @@ void DrawDim_PlanarAngle::DrawOn(Draw_Display& dis) const if (!curve1->IsKind(STANDARD_TYPE(Geom_Line)) || !curve2->IsKind(STANDARD_TYPE(Geom_Line))) return; Handle(Geom2d_Geometry) L1 = GeomAPI::To2d (curve1,plane); if (L1->IsInstance(STANDARD_TYPE(Geom2d_TrimmedCurve))) { - L1 = ((Handle(Geom2d_TrimmedCurve)&) L1)->BasisCurve(); + L1 = Handle(Geom2d_TrimmedCurve)::DownCast (L1)->BasisCurve(); } - gp_Lin2d l1 = ((Handle(Geom2d_Line)&) L1)->Lin2d(); + gp_Lin2d l1 = Handle(Geom2d_Line)::DownCast (L1)->Lin2d(); Handle(Geom2d_Geometry) L2 = GeomAPI::To2d (curve2,plane); if (L2->IsInstance(STANDARD_TYPE(Geom2d_TrimmedCurve))) { - L2 = ((Handle(Geom2d_TrimmedCurve)&) L2)->BasisCurve(); + L2 = Handle(Geom2d_TrimmedCurve)::DownCast (L2)->BasisCurve(); } - gp_Lin2d l2 = ((Handle(Geom2d_Line)&) L2)->Lin2d(); + gp_Lin2d l2 = Handle(Geom2d_Line)::DownCast (L2)->Lin2d(); // IntAna2d_AnaIntersection inter; inter.Perform(l1,l2); @@ -139,7 +139,7 @@ void DrawDim_PlanarAngle::DrawOn(Draw_Display& dis) const // retour au plan Handle(Geom_Curve) C = GeomAPI::To3d (new Geom2d_Circle(c),plane); - gp_Circ circle = ((Handle(Geom_Circle)&) C)->Circ(); + gp_Circ circle = Handle(Geom_Circle)::DownCast (C)->Circ(); // Standard_Real p1=0., p2=0.; angle = Abs(angle); diff --git a/src/FEmTool/FEmTool_Curve.cxx b/src/FEmTool/FEmTool_Curve.cxx index eb55106565..a08d6b8298 100644 --- a/src/FEmTool/FEmTool_Curve.cxx +++ b/src/FEmTool/FEmTool_Curve.cxx @@ -77,7 +77,7 @@ FEmTool_Curve::FEmTool_Curve(const Standard_Integer Dimension, Standard_Real stenor = (myKnots->Value(IndexOfElement + 1) - myKnots->Value(IndexOfElement)) / 2., mfact; - Handle(PLib_HermitJacobi) myHermitJacobi = (*((Handle(PLib_HermitJacobi)*)&myBase)); + Handle(PLib_HermitJacobi) myHermitJacobi = Handle(PLib_HermitJacobi)::DownCast (myBase); i1 = iBase; i2 = iBase + (myHermitJacobi->NivConstr() + 1) * myDimension; @@ -117,7 +117,7 @@ FEmTool_Curve::FEmTool_Curve(const Standard_Integer Dimension, Standard_Real stenor = 2. / (myKnots->Value(IndexOfElement + 1) - myKnots->Value(IndexOfElement)), mfact; - Handle(PLib_HermitJacobi) myHermitJacobi = (*((Handle(PLib_HermitJacobi)*)&myBase)); + Handle(PLib_HermitJacobi) myHermitJacobi = Handle(PLib_HermitJacobi)::DownCast (myBase); i2 = Coeffs.LowerRow(); Standard_Integer i3 = i2 + myHermitJacobi->NivConstr() + 1; @@ -417,7 +417,7 @@ FEmTool_Curve::FEmTool_Curve(const Standard_Integer Dimension, (myBase->WorkDegree() + 1)*myDimension + 1; myBase->ReduceDegree(myDimension, deg, Tol, myCoeff.ChangeValue(Ptr), NewDegree, MaxError); - Handle(PLib_HermitJacobi) myHermitJacobi = (*((Handle(PLib_HermitJacobi)*)&myBase)); + Handle(PLib_HermitJacobi) myHermitJacobi = Handle(PLib_HermitJacobi)::DownCast (myBase); NewDegree = Max(NewDegree, 2 * myHermitJacobi->NivConstr() + 1); diff --git a/src/Geom/Geom_OsculatingSurface.cxx b/src/Geom/Geom_OsculatingSurface.cxx index a31398e1a8..48dd34369f 100644 --- a/src/Geom/Geom_OsculatingSurface.cxx +++ b/src/Geom/Geom_OsculatingSurface.cxx @@ -339,7 +339,7 @@ Standard_Boolean Geom_OsculatingSurface::UOscSurf if (myBasisSurf->IsKind(STANDARD_TYPE(Geom_BSplineSurface))) { Handle(Geom_BSplineSurface) BSur = - *((Handle(Geom_BSplineSurface)*)& myBasisSurf); + Handle(Geom_BSplineSurface)::DownCast (myBasisSurf); NbUK = BSur->NbUKnots(); NbVK = BSur->NbVKnots(); TColStd_Array1OfReal UKnots(1,NbUK); @@ -398,7 +398,7 @@ Standard_Boolean Geom_OsculatingSurface::VOscSurf if (myBasisSurf->IsKind(STANDARD_TYPE(Geom_BSplineSurface))) { Handle(Geom_BSplineSurface) BSur = - *((Handle(Geom_BSplineSurface)*)& myBasisSurf); + Handle(Geom_BSplineSurface)::DownCast (myBasisSurf); NbUK = BSur->NbUKnots(); NbVK = BSur->NbVKnots(); TColStd_Array1OfReal UKnots(1,NbUK); diff --git a/src/Geom2dAdaptor/Geom2dAdaptor_Curve.cxx b/src/Geom2dAdaptor/Geom2dAdaptor_Curve.cxx index e1869eb2e5..f544e31e73 100644 --- a/src/Geom2dAdaptor/Geom2dAdaptor_Curve.cxx +++ b/src/Geom2dAdaptor/Geom2dAdaptor_Curve.cxx @@ -53,7 +53,7 @@ #include #include -#define myBspl (*((Handle(Geom2d_BSplineCurve)*)&myCurve)) +#define myBspl Handle(Geom2d_BSplineCurve)::DownCast (myCurve) #define PosTol Precision::PConfusion()/2 static const int maxDerivOrder = 3; @@ -189,7 +189,7 @@ void Geom2dAdaptor_Curve::load(const Handle(Geom2d_Curve)& C, Handle(Standard_Type) TheType = C->DynamicType(); if ( TheType == STANDARD_TYPE(Geom2d_TrimmedCurve)) { - Load((*((Handle(Geom2d_TrimmedCurve)*)&C))->BasisCurve(), + Load(Handle(Geom2d_TrimmedCurve)::DownCast (C)->BasisCurve(), UFirst,ULast); } else if ( TheType == STANDARD_TYPE(Geom2d_Circle)) { @@ -245,7 +245,7 @@ GeomAbs_Shape Geom2dAdaptor_Curve::Continuity() const } else if (myCurve->DynamicType() == STANDARD_TYPE(Geom2d_OffsetCurve)){ GeomAbs_Shape S = - (*((Handle(Geom2d_OffsetCurve)*)&myCurve))->GetBasisCurveContinuity(); + Handle(Geom2d_OffsetCurve)::DownCast (myCurve)->GetBasisCurveContinuity(); switch(S){ case GeomAbs_CN: return GeomAbs_CN; case GeomAbs_C3: return GeomAbs_C2; @@ -1002,23 +1002,23 @@ Standard_Real Geom2dAdaptor_Curve::Resolution(const Standard_Real Ruv) const { case GeomAbs_Line : return Ruv; case GeomAbs_Circle: { - Standard_Real R = (*((Handle(Geom2d_Circle)*)&myCurve))->Circ2d().Radius(); + Standard_Real R = Handle(Geom2d_Circle)::DownCast (myCurve)->Circ2d().Radius(); if ( R > Ruv/2.) return 2*ASin(Ruv/(2*R)); else return 2*M_PI; } case GeomAbs_Ellipse: { - return Ruv / (*((Handle(Geom2d_Ellipse)*)&myCurve))->MajorRadius(); + return Ruv / Handle(Geom2d_Ellipse)::DownCast (myCurve)->MajorRadius(); } case GeomAbs_BezierCurve: { Standard_Real res; - (*((Handle(Geom2d_BezierCurve)*)&myCurve))->Resolution(Ruv,res); + Handle(Geom2d_BezierCurve)::DownCast (myCurve)->Resolution(Ruv,res); return res; } case GeomAbs_BSplineCurve: { Standard_Real res; - (*((Handle(Geom2d_BSplineCurve)*)&myCurve))->Resolution(Ruv,res); + Handle(Geom2d_BSplineCurve)::DownCast (myCurve)->Resolution(Ruv,res); return res; } default: @@ -1040,7 +1040,7 @@ Standard_Real Geom2dAdaptor_Curve::Resolution(const Standard_Real Ruv) const { gp_Lin2d Geom2dAdaptor_Curve::Line() const { Standard_NoSuchObject_Raise_if(myTypeCurve != GeomAbs_Line, ""); - return (*((Handle(Geom2d_Line)*)&myCurve))->Lin2d(); + return Handle(Geom2d_Line)::DownCast (myCurve)->Lin2d(); } //======================================================================= @@ -1051,7 +1051,7 @@ gp_Lin2d Geom2dAdaptor_Curve::Line() const gp_Circ2d Geom2dAdaptor_Curve::Circle() const { Standard_NoSuchObject_Raise_if(myTypeCurve != GeomAbs_Circle, ""); - return (*((Handle(Geom2d_Circle)*)&myCurve))->Circ2d(); + return Handle(Geom2d_Circle)::DownCast (myCurve)->Circ2d(); } //======================================================================= @@ -1062,7 +1062,7 @@ gp_Circ2d Geom2dAdaptor_Curve::Circle() const gp_Elips2d Geom2dAdaptor_Curve::Ellipse() const { Standard_NoSuchObject_Raise_if(myTypeCurve != GeomAbs_Ellipse, ""); - return (*((Handle(Geom2d_Ellipse)*)&myCurve))->Elips2d(); + return Handle(Geom2d_Ellipse)::DownCast (myCurve)->Elips2d(); } //======================================================================= @@ -1073,7 +1073,7 @@ gp_Elips2d Geom2dAdaptor_Curve::Ellipse() const gp_Hypr2d Geom2dAdaptor_Curve::Hyperbola() const { Standard_NoSuchObject_Raise_if(myTypeCurve != GeomAbs_Hyperbola, ""); - return (*((Handle(Geom2d_Hyperbola)*)&myCurve))->Hypr2d(); + return Handle(Geom2d_Hyperbola)::DownCast (myCurve)->Hypr2d(); } //======================================================================= @@ -1084,7 +1084,7 @@ gp_Hypr2d Geom2dAdaptor_Curve::Hyperbola() const gp_Parab2d Geom2dAdaptor_Curve::Parabola() const { Standard_NoSuchObject_Raise_if(myTypeCurve != GeomAbs_Parabola, ""); - return (*((Handle(Geom2d_Parabola)*)&myCurve))->Parab2d(); + return Handle(Geom2d_Parabola)::DownCast (myCurve)->Parab2d(); } //======================================================================= @@ -1095,9 +1095,9 @@ gp_Parab2d Geom2dAdaptor_Curve::Parabola() const Standard_Integer Geom2dAdaptor_Curve::Degree() const { if (myTypeCurve == GeomAbs_BezierCurve) - return (*((Handle(Geom2d_BezierCurve)*)&myCurve))->Degree(); + return Handle(Geom2d_BezierCurve)::DownCast (myCurve)->Degree(); else if (myTypeCurve == GeomAbs_BSplineCurve) - return (*((Handle(Geom2d_BSplineCurve)*)&myCurve))->Degree(); + return Handle(Geom2d_BSplineCurve)::DownCast (myCurve)->Degree(); else Standard_NoSuchObject::Raise(); // portage WNT @@ -1112,9 +1112,9 @@ Standard_Integer Geom2dAdaptor_Curve::Degree() const Standard_Boolean Geom2dAdaptor_Curve::IsRational() const { switch( myTypeCurve) { case GeomAbs_BSplineCurve: - return (*((Handle(Geom2d_BSplineCurve)*)&myCurve))->IsRational(); + return Handle(Geom2d_BSplineCurve)::DownCast (myCurve)->IsRational(); case GeomAbs_BezierCurve: - return (*((Handle(Geom2d_BezierCurve)*)&myCurve))->IsRational(); + return Handle(Geom2d_BezierCurve)::DownCast (myCurve)->IsRational(); default: return Standard_False; } @@ -1128,9 +1128,9 @@ Standard_Boolean Geom2dAdaptor_Curve::IsRational() const { Standard_Integer Geom2dAdaptor_Curve::NbPoles() const { if (myTypeCurve == GeomAbs_BezierCurve) - return (*((Handle(Geom2d_BezierCurve)*)&myCurve))->NbPoles(); + return Handle(Geom2d_BezierCurve)::DownCast (myCurve)->NbPoles(); else if (myTypeCurve == GeomAbs_BSplineCurve) - return (*((Handle(Geom2d_BSplineCurve)*)&myCurve))->NbPoles(); + return Handle(Geom2d_BSplineCurve)::DownCast (myCurve)->NbPoles(); else Standard_NoSuchObject::Raise(); // portage WNT @@ -1145,7 +1145,7 @@ Standard_Integer Geom2dAdaptor_Curve::NbPoles() const Standard_Integer Geom2dAdaptor_Curve::NbKnots() const { if ( myTypeCurve != GeomAbs_BSplineCurve) Standard_NoSuchObject::Raise("Geom2dAdaptor_Curve::NbKnots"); - return (*((Handle(Geom2d_BSplineCurve)*)&myCurve))->NbKnots(); + return Handle(Geom2d_BSplineCurve)::DownCast (myCurve)->NbKnots(); } @@ -1156,7 +1156,7 @@ Standard_Integer Geom2dAdaptor_Curve::NbKnots() const { Handle(Geom2d_BezierCurve) Geom2dAdaptor_Curve::Bezier() const { - return *((Handle(Geom2d_BezierCurve)*)&myCurve); + return Handle(Geom2d_BezierCurve)::DownCast (myCurve); } //======================================================================= @@ -1166,7 +1166,7 @@ Handle(Geom2d_BezierCurve) Geom2dAdaptor_Curve::Bezier() const Handle(Geom2d_BSplineCurve) Geom2dAdaptor_Curve::BSpline() const { - return *((Handle(Geom2d_BSplineCurve)*)&myCurve); + return Handle(Geom2d_BSplineCurve)::DownCast (myCurve); } static Standard_Integer nbPoints(const Handle(Geom2d_Curve)& theCurve) @@ -1178,22 +1178,22 @@ static Standard_Integer nbPoints(const Handle(Geom2d_Curve)& theCurve) nbs = 2; else if(theCurve->IsKind(STANDARD_TYPE( Geom2d_BezierCurve))) { - nbs = 3 + (*((Handle(Geom2d_BezierCurve)*)&theCurve))->NbPoles(); + nbs = 3 + Handle(Geom2d_BezierCurve)::DownCast (theCurve)->NbPoles(); } else if(theCurve->IsKind(STANDARD_TYPE( Geom2d_BSplineCurve))) { - nbs = (*((Handle(Geom2d_BSplineCurve)*)&theCurve))->NbKnots(); - nbs*= (*((Handle(Geom2d_BSplineCurve)*)&theCurve))->Degree(); + nbs = Handle(Geom2d_BSplineCurve)::DownCast (theCurve)->NbKnots(); + nbs*= Handle(Geom2d_BSplineCurve)::DownCast (theCurve)->Degree(); if(nbs < 2.0) nbs=2; } else if (theCurve->IsKind(STANDARD_TYPE(Geom2d_OffsetCurve))) { - Handle(Geom2d_Curve) aCurve = (*((Handle(Geom2d_OffsetCurve)*)&theCurve))->BasisCurve(); + Handle(Geom2d_Curve) aCurve = Handle(Geom2d_OffsetCurve)::DownCast (theCurve)->BasisCurve(); return Max(nbs, nbPoints(aCurve)); } else if (theCurve->IsKind(STANDARD_TYPE(Geom2d_TrimmedCurve))) { - Handle(Geom2d_Curve) aCurve = (*((Handle(Geom2d_TrimmedCurve)*)&theCurve))->BasisCurve(); + Handle(Geom2d_Curve) aCurve = Handle(Geom2d_TrimmedCurve)::DownCast (theCurve)->BasisCurve(); return Max(nbs, nbPoints(aCurve)); } if(nbs>300) diff --git a/src/GeomAdaptor/GeomAdaptor_Curve.cxx b/src/GeomAdaptor/GeomAdaptor_Curve.cxx index 5f9ea8d453..9757ac912c 100644 --- a/src/GeomAdaptor/GeomAdaptor_Curve.cxx +++ b/src/GeomAdaptor/GeomAdaptor_Curve.cxx @@ -51,7 +51,7 @@ #include #include -#define myBspl (*((Handle(Geom_BSplineCurve)*)&myCurve)) +#define myBspl Handle(Geom_BSplineCurve)::DownCast (myCurve) #define PosTol Precision::PConfusion()/2 static const int maxDerivOrder = 3; @@ -146,7 +146,7 @@ void GeomAdaptor_Curve::load(const Handle(Geom_Curve)& C, const Handle(Standard_Type)& TheType = C->DynamicType(); if ( TheType == STANDARD_TYPE(Geom_TrimmedCurve)) { - Load((*((Handle(Geom_TrimmedCurve)*)&C))->BasisCurve(),UFirst,ULast); + Load(Handle(Geom_TrimmedCurve)::DownCast (C)->BasisCurve(),UFirst,ULast); } else if ( TheType == STANDARD_TYPE(Geom_Circle)) { myTypeCurve = GeomAbs_Circle; @@ -201,7 +201,7 @@ GeomAbs_Shape GeomAdaptor_Curve::Continuity() const if (myCurve->IsKind(STANDARD_TYPE(Geom_OffsetCurve))) { const GeomAbs_Shape S = - (*((Handle(Geom_OffsetCurve)*)&myCurve))->GetBasisCurveContinuity(); + Handle(Geom_OffsetCurve)::DownCast (myCurve)->GetBasisCurveContinuity(); switch(S) { case GeomAbs_CN: return GeomAbs_CN; @@ -322,7 +322,7 @@ Standard_Integer GeomAdaptor_Curve::NbIntervals(const GeomAbs_Shape S) const default: BaseS = GeomAbs_CN; } GeomAdaptor_Curve C - ((*((Handle(Geom_OffsetCurve)*)&myCurve))->BasisCurve()); + (Handle(Geom_OffsetCurve)::DownCast (myCurve)->BasisCurve()); // akm 05/04/02 (OCC278) If our curve is trimmed we must recalculate // the number of intervals obtained from the basis to // vvv reflect parameter bounds @@ -460,7 +460,7 @@ void GeomAdaptor_Curve::Intervals(TColStd_Array1OfReal& T, default: BaseS = GeomAbs_CN; } GeomAdaptor_Curve C - ((*((Handle(Geom_OffsetCurve)*)&myCurve))->BasisCurve()); + (Handle(Geom_OffsetCurve)::DownCast (myCurve)->BasisCurve()); // akm 05/04/02 (OCC278) If our curve is trimmed we must recalculate // the array of intervals obtained from the basis to // vvv reflect parameter bounds @@ -946,23 +946,23 @@ Standard_Real GeomAdaptor_Curve::Resolution(const Standard_Real R3D) const case GeomAbs_Line : return R3D; case GeomAbs_Circle: { - Standard_Real R = (*((Handle(Geom_Circle)*)&myCurve))->Circ().Radius(); + Standard_Real R = Handle(Geom_Circle)::DownCast (myCurve)->Circ().Radius(); if ( R > R3D/2. ) return 2*ASin(R3D/(2*R)); else return 2*M_PI; } case GeomAbs_Ellipse: { - return R3D / (*((Handle(Geom_Ellipse)*)&myCurve))->MajorRadius(); + return R3D / Handle(Geom_Ellipse)::DownCast (myCurve)->MajorRadius(); } case GeomAbs_BezierCurve: { Standard_Real res; - (*((Handle(Geom_BezierCurve)*)&myCurve))->Resolution(R3D,res); + Handle(Geom_BezierCurve)::DownCast (myCurve)->Resolution(R3D,res); return res; } case GeomAbs_BSplineCurve: { Standard_Real res; - (*((Handle(Geom_BSplineCurve)*)&myCurve))->Resolution(R3D,res); + Handle(Geom_BSplineCurve)::DownCast (myCurve)->Resolution(R3D,res); return res; } default: @@ -984,7 +984,7 @@ Standard_Real GeomAdaptor_Curve::Resolution(const Standard_Real R3D) const gp_Lin GeomAdaptor_Curve::Line() const { Standard_NoSuchObject_Raise_if(myTypeCurve != GeomAbs_Line, ""); - return (*((Handle(Geom_Line)*)&myCurve))->Lin(); + return Handle(Geom_Line)::DownCast (myCurve)->Lin(); } //======================================================================= @@ -995,7 +995,7 @@ gp_Lin GeomAdaptor_Curve::Line() const gp_Circ GeomAdaptor_Curve::Circle() const { Standard_NoSuchObject_Raise_if(myTypeCurve != GeomAbs_Circle, ""); - return (*((Handle(Geom_Circle)*)&myCurve))->Circ(); + return Handle(Geom_Circle)::DownCast (myCurve)->Circ(); } //======================================================================= @@ -1006,7 +1006,7 @@ gp_Circ GeomAdaptor_Curve::Circle() const gp_Elips GeomAdaptor_Curve::Ellipse() const { Standard_NoSuchObject_Raise_if(myTypeCurve != GeomAbs_Ellipse, ""); - return (*((Handle(Geom_Ellipse)*)&myCurve))->Elips(); + return Handle(Geom_Ellipse)::DownCast (myCurve)->Elips(); } //======================================================================= @@ -1017,7 +1017,7 @@ gp_Elips GeomAdaptor_Curve::Ellipse() const gp_Hypr GeomAdaptor_Curve::Hyperbola() const { Standard_NoSuchObject_Raise_if(myTypeCurve != GeomAbs_Hyperbola, ""); - return (*((Handle(Geom_Hyperbola)*)&myCurve))->Hypr(); + return Handle(Geom_Hyperbola)::DownCast (myCurve)->Hypr(); } //======================================================================= @@ -1028,7 +1028,7 @@ gp_Hypr GeomAdaptor_Curve::Hyperbola() const gp_Parab GeomAdaptor_Curve::Parabola() const { Standard_NoSuchObject_Raise_if(myTypeCurve != GeomAbs_Parabola, ""); - return (*((Handle(Geom_Parabola)*)&myCurve))->Parab(); + return Handle(Geom_Parabola)::DownCast (myCurve)->Parab(); } //======================================================================= @@ -1039,9 +1039,9 @@ gp_Parab GeomAdaptor_Curve::Parabola() const Standard_Integer GeomAdaptor_Curve::Degree() const { if (myTypeCurve == GeomAbs_BezierCurve) - return (*((Handle(Geom_BezierCurve)*)&myCurve))->Degree(); + return Handle(Geom_BezierCurve)::DownCast (myCurve)->Degree(); else if (myTypeCurve == GeomAbs_BSplineCurve) - return (*((Handle(Geom_BSplineCurve)*)&myCurve))->Degree(); + return Handle(Geom_BSplineCurve)::DownCast (myCurve)->Degree(); else Standard_NoSuchObject::Raise(); // portage WNT @@ -1056,9 +1056,9 @@ Standard_Integer GeomAdaptor_Curve::Degree() const Standard_Boolean GeomAdaptor_Curve::IsRational() const { switch( myTypeCurve) { case GeomAbs_BSplineCurve: - return (*((Handle(Geom_BSplineCurve)*)&myCurve))->IsRational(); + return Handle(Geom_BSplineCurve)::DownCast (myCurve)->IsRational(); case GeomAbs_BezierCurve: - return (*((Handle(Geom_BezierCurve)*)&myCurve))->IsRational(); + return Handle(Geom_BezierCurve)::DownCast (myCurve)->IsRational(); default: return Standard_False; } @@ -1072,9 +1072,9 @@ Standard_Boolean GeomAdaptor_Curve::IsRational() const { Standard_Integer GeomAdaptor_Curve::NbPoles() const { if (myTypeCurve == GeomAbs_BezierCurve) - return (*((Handle(Geom_BezierCurve)*)&myCurve))->NbPoles(); + return Handle(Geom_BezierCurve)::DownCast (myCurve)->NbPoles(); else if (myTypeCurve == GeomAbs_BSplineCurve) - return (*((Handle(Geom_BSplineCurve)*)&myCurve))->NbPoles(); + return Handle(Geom_BSplineCurve)::DownCast (myCurve)->NbPoles(); else Standard_NoSuchObject::Raise(); // portage WNT @@ -1090,7 +1090,7 @@ Standard_Integer GeomAdaptor_Curve::NbKnots() const { if ( myTypeCurve != GeomAbs_BSplineCurve) Standard_NoSuchObject::Raise("GeomAdaptor_Curve::NbKnots"); - return (*((Handle(Geom_BSplineCurve)*)&myCurve))->NbKnots(); + return Handle(Geom_BSplineCurve)::DownCast (myCurve)->NbKnots(); } //======================================================================= @@ -1102,7 +1102,7 @@ Handle(Geom_BezierCurve) GeomAdaptor_Curve::Bezier() const { if ( myTypeCurve != GeomAbs_BezierCurve) Standard_NoSuchObject::Raise("GeomAdaptor_Curve::Bezier"); - return *((Handle(Geom_BezierCurve)*)&myCurve); + return Handle(Geom_BezierCurve)::DownCast (myCurve); } //======================================================================= @@ -1115,7 +1115,7 @@ Handle(Geom_BSplineCurve) GeomAdaptor_Curve::BSpline() const if ( myTypeCurve != GeomAbs_BSplineCurve) Standard_NoSuchObject::Raise("GeomAdaptor_Curve::BSpline"); - return *((Handle(Geom_BSplineCurve)*)&myCurve); + return Handle(Geom_BSplineCurve)::DownCast (myCurve); } diff --git a/src/GeomAdaptor/GeomAdaptor_Surface.cxx b/src/GeomAdaptor/GeomAdaptor_Surface.cxx index ee4e2d6cd7..d5589956b8 100644 --- a/src/GeomAdaptor/GeomAdaptor_Surface.cxx +++ b/src/GeomAdaptor/GeomAdaptor_Surface.cxx @@ -56,10 +56,10 @@ #include #include -#define myBspl (*((Handle(Geom_BSplineSurface)*)&mySurface)) -#define myExtSurf (*((Handle(Geom_SurfaceOfLinearExtrusion)*)&mySurface)) -#define myRevSurf (*((Handle(Geom_SurfaceOfRevolution)*)&mySurface)) -#define myOffSurf (*((Handle(Geom_OffsetSurface)*)&mySurface)) +#define myBspl Handle(Geom_BSplineSurface)::DownCast (mySurface) +#define myExtSurf Handle(Geom_SurfaceOfLinearExtrusion)::DownCast (mySurface) +#define myRevSurf Handle(Geom_SurfaceOfRevolution)::DownCast (mySurface) +#define myOffSurf Handle(Geom_OffsetSurface)::DownCast (mySurface) //======================================================================= //function : LocalContinuity @@ -131,7 +131,7 @@ void GeomAdaptor_Surface::load(const Handle(Geom_Surface)& S, if ( TheType == STANDARD_TYPE(Geom_BezierSurface)) mySurfaceType = GeomAbs_BezierSurface; else if (TheType == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) { - Load((*((Handle(Geom_RectangularTrimmedSurface)*)&S))->BasisSurface(), + Load(Handle(Geom_RectangularTrimmedSurface)::DownCast (S)->BasisSurface(), UFirst,ULast,VFirst,VLast); } else if ( TheType == STANDARD_TYPE(Geom_Plane)) @@ -150,7 +150,7 @@ void GeomAdaptor_Surface::load(const Handle(Geom_Surface)& S, mySurfaceType = GeomAbs_SurfaceOfExtrusion; else if ( TheType == STANDARD_TYPE(Geom_BSplineSurface)) { mySurfaceType = GeomAbs_BSplineSurface; - myBspl = *((Handle(Geom_BSplineSurface)*)&mySurface); + myBspl = Handle(Geom_BSplineSurface)::DownCast (mySurface); // Create cache for B-spline mySurfaceCache = new BSplSLib_Cache( myBspl->UDegree(), myBspl->IsUPeriodic(), myBspl->UKnotSequence(), @@ -206,7 +206,7 @@ GeomAbs_Shape GeomAdaptor_Surface::UContinuity() const case GeomAbs_SurfaceOfExtrusion: { GeomAdaptor_Curve GC - ((*((Handle(Geom_SurfaceOfLinearExtrusion)*)&mySurface))->BasisCurve(),myUFirst,myULast); + (Handle(Geom_SurfaceOfLinearExtrusion)::DownCast (mySurface)->BasisCurve(),myUFirst,myULast); return GC.Continuity(); } case GeomAbs_OtherSurface: @@ -259,7 +259,7 @@ GeomAbs_Shape GeomAdaptor_Surface::VContinuity() const case GeomAbs_SurfaceOfRevolution: { GeomAdaptor_Curve GC - ((*((Handle(Geom_SurfaceOfRevolution)*)&mySurface))->BasisCurve(),myVFirst,myVLast); + (Handle(Geom_SurfaceOfRevolution)::DownCast (mySurface)->BasisCurve(),myVFirst,myVLast); return GC.Continuity(); } case GeomAbs_OtherSurface: @@ -293,7 +293,7 @@ Standard_Integer GeomAdaptor_Surface::NbUIntervals(const GeomAbs_Shape S) const case GeomAbs_SurfaceOfExtrusion: { GeomAdaptor_Curve myBasisCurve - ((*((Handle(Geom_SurfaceOfLinearExtrusion)*)&mySurface))->BasisCurve(),myUFirst,myULast); + (Handle(Geom_SurfaceOfLinearExtrusion)::DownCast (mySurface)->BasisCurve(),myUFirst,myULast); if (myBasisCurve.GetType() == GeomAbs_BSplineCurve) return myBasisCurve.NbIntervals(S); break; @@ -311,7 +311,7 @@ Standard_Integer GeomAdaptor_Surface::NbUIntervals(const GeomAbs_Shape S) const case GeomAbs_C3: case GeomAbs_CN: break; } - GeomAdaptor_Surface Sur((*((Handle(Geom_OffsetSurface)*)&mySurface))->BasisSurface()); + GeomAdaptor_Surface Sur(Handle(Geom_OffsetSurface)::DownCast (mySurface)->BasisSurface()); return Sur.NbUIntervals(BaseS); } case GeomAbs_Plane: @@ -344,7 +344,7 @@ Standard_Integer GeomAdaptor_Surface::NbVIntervals(const GeomAbs_Shape S) const case GeomAbs_SurfaceOfRevolution: { GeomAdaptor_Curve myBasisCurve - ((*((Handle(Geom_SurfaceOfRevolution)*)&mySurface))->BasisCurve(),myVFirst,myVLast); + (Handle(Geom_SurfaceOfRevolution)::DownCast (mySurface)->BasisCurve(),myVFirst,myVLast); if (myBasisCurve.GetType() == GeomAbs_BSplineCurve) return myBasisCurve.NbIntervals(S); break; @@ -362,7 +362,7 @@ Standard_Integer GeomAdaptor_Surface::NbVIntervals(const GeomAbs_Shape S) const case GeomAbs_C3: case GeomAbs_CN: break; } - GeomAdaptor_Surface Sur((*((Handle(Geom_OffsetSurface)*)&mySurface))->BasisSurface()); + GeomAdaptor_Surface Sur(Handle(Geom_OffsetSurface)::DownCast (mySurface)->BasisSurface()); return Sur.NbVIntervals(BaseS); } case GeomAbs_Plane: @@ -399,7 +399,7 @@ void GeomAdaptor_Surface::UIntervals(TColStd_Array1OfReal& T, const GeomAbs_Shap case GeomAbs_SurfaceOfExtrusion: { GeomAdaptor_Curve myBasisCurve - ((*((Handle(Geom_SurfaceOfLinearExtrusion)*)&mySurface))->BasisCurve(),myUFirst,myULast); + (Handle(Geom_SurfaceOfLinearExtrusion)::DownCast (mySurface)->BasisCurve(),myUFirst,myULast); if (myBasisCurve.GetType() == GeomAbs_BSplineCurve) { myNbUIntervals = myBasisCurve.NbIntervals(S); @@ -420,7 +420,7 @@ void GeomAdaptor_Surface::UIntervals(TColStd_Array1OfReal& T, const GeomAbs_Shap case GeomAbs_C3: case GeomAbs_CN: break; } - GeomAdaptor_Surface Sur((*((Handle(Geom_OffsetSurface)*)&mySurface))->BasisSurface()); + GeomAdaptor_Surface Sur(Handle(Geom_OffsetSurface)::DownCast (mySurface)->BasisSurface()); myNbUIntervals = Sur.NbUIntervals(BaseS); Sur.UIntervals(T, BaseS); } @@ -460,7 +460,7 @@ void GeomAdaptor_Surface::VIntervals(TColStd_Array1OfReal& T, const GeomAbs_Shap case GeomAbs_SurfaceOfRevolution: { GeomAdaptor_Curve myBasisCurve - ((*((Handle(Geom_SurfaceOfRevolution)*)&mySurface))->BasisCurve(),myVFirst,myVLast); + (Handle(Geom_SurfaceOfRevolution)::DownCast (mySurface)->BasisCurve(),myVFirst,myVLast); if (myBasisCurve.GetType() == GeomAbs_BSplineCurve) { myNbVIntervals = myBasisCurve.NbIntervals(S); @@ -481,7 +481,7 @@ void GeomAdaptor_Surface::VIntervals(TColStd_Array1OfReal& T, const GeomAbs_Shap case GeomAbs_C3: case GeomAbs_CN: break; } - GeomAdaptor_Surface Sur((*((Handle(Geom_OffsetSurface)*)&mySurface))->BasisSurface()); + GeomAdaptor_Surface Sur(Handle(Geom_OffsetSurface)::DownCast (mySurface)->BasisSurface()); myNbVIntervals = Sur.NbVIntervals(BaseS); Sur.VIntervals(T, BaseS); } @@ -908,12 +908,12 @@ Standard_Real GeomAdaptor_Surface::UResolution(const Standard_Real R3d) const case GeomAbs_SurfaceOfExtrusion: { GeomAdaptor_Curve myBasisCurve - ((*((Handle(Geom_SurfaceOfLinearExtrusion)*)&mySurface))->BasisCurve(),myUFirst,myULast); + (Handle(Geom_SurfaceOfLinearExtrusion)::DownCast (mySurface)->BasisCurve(),myUFirst,myULast); return myBasisCurve.Resolution(R3d); } case GeomAbs_Torus: { - Handle(Geom_ToroidalSurface)& S = *((Handle(Geom_ToroidalSurface)*)&mySurface); + Handle(Geom_ToroidalSurface)& S = Handle(Geom_ToroidalSurface)::DownCast (mySurface); const Standard_Real R = S->MajorRadius() + S->MinorRadius(); if(R>Precision::Confusion()) Res = R3d/(2.*R); @@ -921,7 +921,7 @@ Standard_Real GeomAdaptor_Surface::UResolution(const Standard_Real R3d) const } case GeomAbs_Sphere: { - Handle(Geom_SphericalSurface)& S = *((Handle(Geom_SphericalSurface)*)&mySurface); + Handle(Geom_SphericalSurface)& S = Handle(Geom_SphericalSurface)::DownCast (mySurface); const Standard_Real R = S->Radius(); if(R>Precision::Confusion()) Res = R3d/(2.*R); @@ -929,7 +929,7 @@ Standard_Real GeomAdaptor_Surface::UResolution(const Standard_Real R3d) const } case GeomAbs_Cylinder: { - Handle(Geom_CylindricalSurface)& S = *((Handle(Geom_CylindricalSurface)*)&mySurface); + Handle(Geom_CylindricalSurface)& S = Handle(Geom_CylindricalSurface)::DownCast (mySurface); const Standard_Real R = S->Radius(); if(R>Precision::Confusion()) Res = R3d/(2.*R); @@ -941,11 +941,11 @@ Standard_Real GeomAdaptor_Surface::UResolution(const Standard_Real R3d) const // Pas vraiment borne => resolution inconnue return Precision::Parametric(R3d); } - Handle(Geom_ConicalSurface)& S = *((Handle(Geom_ConicalSurface)*)&mySurface); + Handle(Geom_ConicalSurface)& S = Handle(Geom_ConicalSurface)::DownCast (mySurface); Handle(Geom_Curve) C = S->VIso(myVLast); - const Standard_Real Rayon1 = (*((Handle(Geom_Circle)*)&C))->Radius(); + const Standard_Real Rayon1 = Handle(Geom_Circle)::DownCast (C)->Radius(); C = S->VIso(myVFirst); - const Standard_Real Rayon2 = (*((Handle(Geom_Circle)*)&C))->Radius(); + const Standard_Real Rayon2 = Handle(Geom_Circle)::DownCast (C)->Radius(); const Standard_Real R = (Rayon1 > Rayon2)? Rayon1 : Rayon2; return (R>Precision::Confusion()? (R3d / R) : 0.); } @@ -956,18 +956,18 @@ Standard_Real GeomAdaptor_Surface::UResolution(const Standard_Real R3d) const case GeomAbs_BezierSurface: { Standard_Real Ures,Vres; - (*((Handle(Geom_BezierSurface)*)&mySurface))->Resolution(R3d,Ures,Vres); + Handle(Geom_BezierSurface)::DownCast (mySurface)->Resolution(R3d,Ures,Vres); return Ures; } case GeomAbs_BSplineSurface: { Standard_Real Ures,Vres; - (*((Handle(Geom_BSplineSurface)*)&mySurface))->Resolution(R3d,Ures,Vres); + Handle(Geom_BSplineSurface)::DownCast (mySurface)->Resolution(R3d,Ures,Vres); return Ures; } case GeomAbs_OffsetSurface: { - Handle(Geom_Surface) base = (*((Handle(Geom_OffsetSurface)*)&mySurface))->BasisSurface(); + Handle(Geom_Surface) base = Handle(Geom_OffsetSurface)::DownCast (mySurface)->BasisSurface(); GeomAdaptor_Surface gabase(base,myUFirst,myULast,myVFirst,myVLast); return gabase.UResolution(R3d); } @@ -994,12 +994,12 @@ Standard_Real GeomAdaptor_Surface::VResolution(const Standard_Real R3d) const case GeomAbs_SurfaceOfRevolution: { GeomAdaptor_Curve myBasisCurve - ((*((Handle(Geom_SurfaceOfRevolution)*)&mySurface))->BasisCurve(),myUFirst,myULast); + (Handle(Geom_SurfaceOfRevolution)::DownCast (mySurface)->BasisCurve(),myUFirst,myULast); return myBasisCurve.Resolution(R3d); } case GeomAbs_Torus: { - Handle(Geom_ToroidalSurface)& S = *((Handle(Geom_ToroidalSurface)*)&mySurface); + Handle(Geom_ToroidalSurface)& S = Handle(Geom_ToroidalSurface)::DownCast (mySurface); const Standard_Real R = S->MinorRadius(); if(R>Precision::Confusion()) Res = R3d/(2.*R); @@ -1007,7 +1007,7 @@ Standard_Real GeomAdaptor_Surface::VResolution(const Standard_Real R3d) const } case GeomAbs_Sphere: { - Handle(Geom_SphericalSurface)& S = *((Handle(Geom_SphericalSurface)*)&mySurface); + Handle(Geom_SphericalSurface)& S = Handle(Geom_SphericalSurface)::DownCast (mySurface); const Standard_Real R = S->Radius(); if(R>Precision::Confusion()) Res = R3d/(2.*R); @@ -1023,18 +1023,18 @@ Standard_Real GeomAdaptor_Surface::VResolution(const Standard_Real R3d) const case GeomAbs_BezierSurface: { Standard_Real Ures,Vres; - (*((Handle(Geom_BezierSurface)*)&mySurface))->Resolution(R3d,Ures,Vres); + Handle(Geom_BezierSurface)::DownCast (mySurface)->Resolution(R3d,Ures,Vres); return Vres; } case GeomAbs_BSplineSurface: { Standard_Real Ures,Vres; - (*((Handle(Geom_BSplineSurface)*)&mySurface))->Resolution(R3d,Ures,Vres); + Handle(Geom_BSplineSurface)::DownCast (mySurface)->Resolution(R3d,Ures,Vres); return Vres; } case GeomAbs_OffsetSurface: { - Handle(Geom_Surface) base = (*((Handle(Geom_OffsetSurface)*)&mySurface))->BasisSurface(); + Handle(Geom_Surface) base = Handle(Geom_OffsetSurface)::DownCast (mySurface)->BasisSurface(); GeomAdaptor_Surface gabase(base,myUFirst,myULast,myVFirst,myVLast); return gabase.VResolution(R3d); } @@ -1056,7 +1056,7 @@ gp_Pln GeomAdaptor_Surface::Plane() const { if (mySurfaceType != GeomAbs_Plane) Standard_NoSuchObject::Raise("GeomAdaptor_Surface::Plane"); - return (*((Handle(Geom_Plane)*)&mySurface))->Pln(); + return Handle(Geom_Plane)::DownCast (mySurface)->Pln(); } //======================================================================= @@ -1068,7 +1068,7 @@ gp_Cylinder GeomAdaptor_Surface::Cylinder() const { if (mySurfaceType != GeomAbs_Cylinder) Standard_NoSuchObject::Raise("GeomAdaptor_Surface::Cylinder"); - return (*((Handle(Geom_CylindricalSurface)*)&mySurface))->Cylinder(); + return Handle(Geom_CylindricalSurface)::DownCast (mySurface)->Cylinder(); } //======================================================================= @@ -1080,7 +1080,7 @@ gp_Cone GeomAdaptor_Surface::Cone() const { if (mySurfaceType != GeomAbs_Cone) Standard_NoSuchObject::Raise("GeomAdaptor_Surface::Cone"); - return (*((Handle(Geom_ConicalSurface)*)&mySurface))->Cone(); + return Handle(Geom_ConicalSurface)::DownCast (mySurface)->Cone(); } //======================================================================= @@ -1092,7 +1092,7 @@ gp_Sphere GeomAdaptor_Surface::Sphere() const { if (mySurfaceType != GeomAbs_Sphere) Standard_NoSuchObject::Raise("GeomAdaptor_Surface::Sphere"); - return (*((Handle(Geom_SphericalSurface)*)&mySurface))->Sphere(); + return Handle(Geom_SphericalSurface)::DownCast (mySurface)->Sphere(); } //======================================================================= @@ -1104,7 +1104,7 @@ gp_Torus GeomAdaptor_Surface::Torus() const { if (mySurfaceType != GeomAbs_Torus) Standard_NoSuchObject::Raise("GeomAdaptor_Surface::Torus"); - return (*((Handle(Geom_ToroidalSurface)*)&mySurface))->Torus(); + return Handle(Geom_ToroidalSurface)::DownCast (mySurface)->Torus(); } //======================================================================= @@ -1115,13 +1115,13 @@ gp_Torus GeomAdaptor_Surface::Torus() const Standard_Integer GeomAdaptor_Surface::UDegree() const { if (mySurfaceType == GeomAbs_BSplineSurface) - return (*((Handle(Geom_BSplineSurface)*)&mySurface))->UDegree(); + return Handle(Geom_BSplineSurface)::DownCast (mySurface)->UDegree(); if ( mySurfaceType == GeomAbs_BezierSurface) - return (*((Handle(Geom_BezierSurface)*)&mySurface))->UDegree(); + return Handle(Geom_BezierSurface)::DownCast (mySurface)->UDegree(); if ( mySurfaceType == GeomAbs_SurfaceOfExtrusion) { GeomAdaptor_Curve myBasisCurve - ((*((Handle(Geom_SurfaceOfLinearExtrusion)*)&mySurface))->BasisCurve(),myUFirst,myULast); + (Handle(Geom_SurfaceOfLinearExtrusion)::DownCast (mySurface)->BasisCurve(),myUFirst,myULast); return myBasisCurve.Degree(); } Standard_NoSuchObject::Raise("GeomAdaptor_Surface::UDegree"); @@ -1136,13 +1136,13 @@ Standard_Integer GeomAdaptor_Surface::UDegree() const Standard_Integer GeomAdaptor_Surface::NbUPoles() const { if (mySurfaceType == GeomAbs_BSplineSurface) - return (*((Handle(Geom_BSplineSurface)*)&mySurface))->NbUPoles(); + return Handle(Geom_BSplineSurface)::DownCast (mySurface)->NbUPoles(); if ( mySurfaceType == GeomAbs_BezierSurface) - return (*((Handle(Geom_BezierSurface)*)&mySurface))->NbUPoles(); + return Handle(Geom_BezierSurface)::DownCast (mySurface)->NbUPoles(); if ( mySurfaceType == GeomAbs_SurfaceOfExtrusion) { GeomAdaptor_Curve myBasisCurve - ((*((Handle(Geom_SurfaceOfLinearExtrusion)*)&mySurface))->BasisCurve(),myUFirst,myULast); + (Handle(Geom_SurfaceOfLinearExtrusion)::DownCast (mySurface)->BasisCurve(),myUFirst,myULast); return myBasisCurve.NbPoles(); } Standard_NoSuchObject::Raise("GeomAdaptor_Surface::NbUPoles"); @@ -1157,13 +1157,13 @@ Standard_Integer GeomAdaptor_Surface::NbUPoles() const Standard_Integer GeomAdaptor_Surface::VDegree() const { if (mySurfaceType == GeomAbs_BSplineSurface) - return (*((Handle(Geom_BSplineSurface)*)&mySurface))->VDegree(); + return Handle(Geom_BSplineSurface)::DownCast (mySurface)->VDegree(); if ( mySurfaceType == GeomAbs_BezierSurface) - return (*((Handle(Geom_BezierSurface)*)&mySurface))->VDegree(); + return Handle(Geom_BezierSurface)::DownCast (mySurface)->VDegree(); if ( mySurfaceType == GeomAbs_SurfaceOfRevolution) { GeomAdaptor_Curve myBasisCurve - ((*((Handle(Geom_SurfaceOfRevolution)*)&mySurface))->BasisCurve(),myUFirst,myULast); + (Handle(Geom_SurfaceOfRevolution)::DownCast (mySurface)->BasisCurve(),myUFirst,myULast); return myBasisCurve.Degree(); } Standard_NoSuchObject::Raise("GeomAdaptor_Surface::VDegree"); @@ -1178,13 +1178,13 @@ Standard_Integer GeomAdaptor_Surface::VDegree() const Standard_Integer GeomAdaptor_Surface::NbVPoles() const { if (mySurfaceType == GeomAbs_BSplineSurface) - return (*((Handle(Geom_BSplineSurface)*)&mySurface))->NbVPoles(); + return Handle(Geom_BSplineSurface)::DownCast (mySurface)->NbVPoles(); if ( mySurfaceType == GeomAbs_BezierSurface) - return (*((Handle(Geom_BezierSurface)*)&mySurface))->NbVPoles(); + return Handle(Geom_BezierSurface)::DownCast (mySurface)->NbVPoles(); if ( mySurfaceType == GeomAbs_SurfaceOfRevolution) { GeomAdaptor_Curve myBasisCurve - ((*((Handle(Geom_SurfaceOfRevolution)*)&mySurface))->BasisCurve(),myUFirst,myULast); + (Handle(Geom_SurfaceOfRevolution)::DownCast (mySurface)->BasisCurve(),myUFirst,myULast); return myBasisCurve.NbPoles(); } Standard_NoSuchObject::Raise("GeomAdaptor_Surface::NbVPoles"); @@ -1199,11 +1199,11 @@ Standard_Integer GeomAdaptor_Surface::NbVPoles() const Standard_Integer GeomAdaptor_Surface::NbUKnots() const { if (mySurfaceType == GeomAbs_BSplineSurface) - return (*((Handle(Geom_BSplineSurface)*)&mySurface))->NbUKnots(); + return Handle(Geom_BSplineSurface)::DownCast (mySurface)->NbUKnots(); if ( mySurfaceType == GeomAbs_SurfaceOfExtrusion) { GeomAdaptor_Curve myBasisCurve - ((*((Handle(Geom_SurfaceOfLinearExtrusion)*)&mySurface))->BasisCurve(),myUFirst,myULast); + (Handle(Geom_SurfaceOfLinearExtrusion)::DownCast (mySurface)->BasisCurve(),myUFirst,myULast); return myBasisCurve.NbKnots(); } Standard_NoSuchObject::Raise("GeomAdaptor_Surface::NbUKnots"); @@ -1218,7 +1218,7 @@ Standard_Integer GeomAdaptor_Surface::NbUKnots() const Standard_Integer GeomAdaptor_Surface::NbVKnots() const { if (mySurfaceType == GeomAbs_BSplineSurface) - return (*((Handle(Geom_BSplineSurface)*)&mySurface))->NbVKnots(); + return Handle(Geom_BSplineSurface)::DownCast (mySurface)->NbVKnots(); Standard_NoSuchObject::Raise("GeomAdaptor_Surface::NbVKnots"); return 0; } @@ -1230,9 +1230,9 @@ Standard_Integer GeomAdaptor_Surface::NbVKnots() const Standard_Boolean GeomAdaptor_Surface::IsURational() const { if (mySurfaceType == GeomAbs_BSplineSurface) - return (*((Handle(Geom_BSplineSurface)*)&mySurface))->IsURational(); + return Handle(Geom_BSplineSurface)::DownCast (mySurface)->IsURational(); if (mySurfaceType == GeomAbs_BezierSurface) - return (*((Handle(Geom_BezierSurface)*)&mySurface))->IsURational(); + return Handle(Geom_BezierSurface)::DownCast (mySurface)->IsURational(); return Standard_False; } @@ -1244,9 +1244,9 @@ Standard_Boolean GeomAdaptor_Surface::IsURational() const Standard_Boolean GeomAdaptor_Surface::IsVRational() const { if (mySurfaceType == GeomAbs_BSplineSurface) - return (*((Handle(Geom_BSplineSurface)*)&mySurface))->IsVRational(); + return Handle(Geom_BSplineSurface)::DownCast (mySurface)->IsVRational(); if (mySurfaceType == GeomAbs_BezierSurface) - return (*((Handle(Geom_BezierSurface)*)&mySurface))->IsVRational(); + return Handle(Geom_BezierSurface)::DownCast (mySurface)->IsVRational(); return Standard_False; } @@ -1259,7 +1259,7 @@ Handle(Geom_BezierSurface) GeomAdaptor_Surface::Bezier() const { if (mySurfaceType != GeomAbs_BezierSurface) Standard_NoSuchObject::Raise("GeomAdaptor_Surface::Bezier"); - return *((Handle(Geom_BezierSurface)*)&mySurface); + return Handle(Geom_BezierSurface)::DownCast (mySurface); } //======================================================================= @@ -1271,7 +1271,7 @@ Handle(Geom_BSplineSurface) GeomAdaptor_Surface::BSpline() const { if (mySurfaceType != GeomAbs_BSplineSurface) Standard_NoSuchObject::Raise("GeomAdaptor_Surface::BSpline"); - return *((Handle(Geom_BSplineSurface)*)&mySurface); + return Handle(Geom_BSplineSurface)::DownCast (mySurface); } //======================================================================= @@ -1283,7 +1283,7 @@ gp_Ax1 GeomAdaptor_Surface::AxeOfRevolution() const { if (mySurfaceType != GeomAbs_SurfaceOfRevolution) Standard_NoSuchObject::Raise("GeomAdaptor_Surface::AxeOfRevolution"); - return (*((Handle(Geom_SurfaceOfRevolution)*)&mySurface))->Axis(); + return Handle(Geom_SurfaceOfRevolution)::DownCast (mySurface)->Axis(); } //======================================================================= @@ -1295,7 +1295,7 @@ gp_Dir GeomAdaptor_Surface::Direction() const { if (mySurfaceType != GeomAbs_SurfaceOfExtrusion) Standard_NoSuchObject::Raise("GeomAdaptor_Surface::Direction"); - return (*((Handle(Geom_SurfaceOfLinearExtrusion)*)&mySurface))->Direction(); + return Handle(Geom_SurfaceOfLinearExtrusion)::DownCast (mySurface)->Direction(); } //======================================================================= @@ -1307,9 +1307,9 @@ Handle(Adaptor3d_HCurve) GeomAdaptor_Surface::BasisCurve() const { Handle(Geom_Curve) C; if (mySurfaceType == GeomAbs_SurfaceOfExtrusion) - C = (*((Handle(Geom_SurfaceOfLinearExtrusion)*)&mySurface))->BasisCurve(); + C = Handle(Geom_SurfaceOfLinearExtrusion)::DownCast (mySurface)->BasisCurve(); else if (mySurfaceType == GeomAbs_SurfaceOfRevolution) - C = (*((Handle(Geom_SurfaceOfRevolution)*)&mySurface))->BasisCurve(); + C = Handle(Geom_SurfaceOfRevolution)::DownCast (mySurface)->BasisCurve(); else Standard_NoSuchObject::Raise("GeomAdaptor_Surface::BasisCurve"); return Handle(GeomAdaptor_HCurve)(new GeomAdaptor_HCurve(C)); @@ -1325,7 +1325,7 @@ Handle(Adaptor3d_HSurface) GeomAdaptor_Surface::BasisSurface() const if (mySurfaceType != GeomAbs_OffsetSurface) Standard_NoSuchObject::Raise("GeomAdaptor_Surface::BasisSurface"); return new GeomAdaptor_HSurface - ((*((Handle(Geom_OffsetSurface)*)&mySurface))->BasisSurface(), + (Handle(Geom_OffsetSurface)::DownCast (mySurface)->BasisSurface(), myUFirst,myULast,myVFirst,myVLast); } @@ -1338,7 +1338,7 @@ Standard_Real GeomAdaptor_Surface::OffsetValue() const { if (mySurfaceType != GeomAbs_OffsetSurface) Standard_NoSuchObject::Raise("GeomAdaptor_Surface::BasisSurface"); - return (*((Handle(Geom_OffsetSurface)*)&mySurface))->Offset(); + return Handle(Geom_OffsetSurface)::DownCast (mySurface)->Offset(); } //======================================================================= diff --git a/src/GeomConvert/GeomConvert_1.cxx b/src/GeomConvert/GeomConvert_1.cxx index 6903378173..049f7fbc00 100644 --- a/src/GeomConvert/GeomConvert_1.cxx +++ b/src/GeomConvert/GeomConvert_1.cxx @@ -355,7 +355,7 @@ Handle(Geom_BSplineSurface) GeomConvert::SurfaceToBSplineSurface Handle(Geom_Surface) S; Handle(Geom_OffsetSurface) OffsetSur; if (Sr->IsKind(STANDARD_TYPE(Geom_OffsetSurface))) { - OffsetSur = *((Handle(Geom_OffsetSurface)*)& Sr); + OffsetSur = Handle(Geom_OffsetSurface)::DownCast (Sr); S = OffsetSur->Surface(); if (!S.IsNull()) { // Convert the equivalent surface. return SurfaceToBSplineSurface(S); diff --git a/src/GeomFill/GeomFill_BoundWithSurf.cxx b/src/GeomFill/GeomFill_BoundWithSurf.cxx index 643371476c..b94d862e92 100644 --- a/src/GeomFill/GeomFill_BoundWithSurf.cxx +++ b/src/GeomFill/GeomFill_BoundWithSurf.cxx @@ -175,7 +175,7 @@ void GeomFill_BoundWithSurf::Reparametrize(const Standard_Real First, HasDF,HasDL,DF,DL, Rev,30); myPar = new Law_BSpFunc(); - (*((Handle(Law_BSpFunc)*) &myPar))->SetCurve(curve); + Handle(Law_BSpFunc)::DownCast (myPar)->SetCurve(curve); } //======================================================================= diff --git a/src/GeomFill/GeomFill_ConstrainedFilling.cxx b/src/GeomFill/GeomFill_ConstrainedFilling.cxx index b0f7b5fcda..51d5b90a92 100644 --- a/src/GeomFill/GeomFill_ConstrainedFilling.cxx +++ b/src/GeomFill/GeomFill_ConstrainedFilling.cxx @@ -395,8 +395,8 @@ void GeomFill_ConstrainedFilling::Init(const Handle(GeomFill_Boundary)& B1, if(!CheckTgte(i)) { Handle(Law_Function) fu1,fu2; ptch->Func(fu1,fu2); - fu1 = Law::MixBnd(*((Handle(Law_Linear)*) &fu1)); - fu2 = Law::MixBnd(*((Handle(Law_Linear)*) &fu2)); + fu1 = Law::MixBnd(Handle(Law_Linear)::DownCast (fu1)); + fu2 = Law::MixBnd(Handle(Law_Linear)::DownCast (fu2)); ptch->Func(fu1,fu2); break; } @@ -476,8 +476,8 @@ void GeomFill_ConstrainedFilling::Init(const Handle(GeomFill_Boundary)& B1, if(!CheckTgte(i)) { Handle(Law_Function) fu1,fu2; ptch->Func(fu1,fu2); - Handle(Law_Function) ffu1 = Law::MixBnd(*((Handle(Law_Linear)*) &fu1)); - Handle(Law_Function) ffu2 = Law::MixBnd(*((Handle(Law_Linear)*) &fu2)); + Handle(Law_Function) ffu1 = Law::MixBnd(Handle(Law_Linear)::DownCast (fu1)); + Handle(Law_Function) ffu2 = Law::MixBnd(Handle(Law_Linear)::DownCast (fu2)); ptch->SetFunc(ffu1,ffu2); break; } diff --git a/src/GeomFill/GeomFill_Profiler.cxx b/src/GeomFill/GeomFill_Profiler.cxx index 0aa34487e5..c30431e129 100644 --- a/src/GeomFill/GeomFill_Profiler.cxx +++ b/src/GeomFill/GeomFill_Profiler.cxx @@ -142,7 +142,7 @@ void GeomFill_Profiler::AddCurve(const Handle(Geom_Curve)& Curve) //// modified by jgv, 19.01.05 for OCC7354 //// Handle(Geom_Curve) theCurve = Curve; if (theCurve->IsInstance(STANDARD_TYPE(Geom_TrimmedCurve))) - theCurve = (*((Handle(Geom_TrimmedCurve)*)&theCurve))->BasisCurve(); + theCurve = Handle(Geom_TrimmedCurve)::DownCast (theCurve)->BasisCurve(); if (theCurve->IsKind(STANDARD_TYPE(Geom_Conic))) { GeomConvert_ApproxCurve appr(Curve, Precision::Confusion(), GeomAbs_C1, 16, 14); diff --git a/src/GeomFill/GeomFill_SimpleBound.cxx b/src/GeomFill/GeomFill_SimpleBound.cxx index 3eb8f098a6..487d2ee2a0 100644 --- a/src/GeomFill/GeomFill_SimpleBound.cxx +++ b/src/GeomFill/GeomFill_SimpleBound.cxx @@ -77,7 +77,7 @@ void GeomFill_SimpleBound::Reparametrize(const Standard_Real First, HasDF,HasDL,DF,DL, Rev,30); myPar = new Law_BSpFunc(); - (*((Handle(Law_BSpFunc)*) &myPar))->SetCurve(curve); + Handle(Law_BSpFunc)::DownCast (myPar)->SetCurve(curve); } //======================================================================= diff --git a/src/GeomFill/GeomFill_Sweep.cxx b/src/GeomFill/GeomFill_Sweep.cxx index 7c4bed32d6..6922ec799b 100644 --- a/src/GeomFill/GeomFill_Sweep.cxx +++ b/src/GeomFill/GeomFill_Sweep.cxx @@ -325,8 +325,7 @@ GeomFill_Sweep::GeomFill_Sweep(const Handle(GeomFill_LocationLaw)& Location, myCurve2d = new (TColGeom2d_HArray1OfCurve) (1, 2); CError = new (TColStd_HArray2OfReal) (1,2, 1,2); - const Handle(Geom_BSplineSurface)& BSplSurf = - Handle(Geom_BSplineSurface)::DownCast(mySurface); + Handle(Geom_BSplineSurface) BSplSurf (Handle(Geom_BSplineSurface)::DownCast(mySurface)); gp_Dir2d D(0., 1.); gp_Pnt2d P(BSplSurf->UKnot(1), 0); diff --git a/src/GeomInt/GeomInt_LineConstructor.cxx b/src/GeomInt/GeomInt_LineConstructor.cxx index bc32606753..f35b14c9fd 100644 --- a/src/GeomInt/GeomInt_LineConstructor.cxx +++ b/src/GeomInt/GeomInt_LineConstructor.cxx @@ -145,7 +145,7 @@ void GeomInt_LineConstructor::Perform(const Handle(IntPatch_Line)& L) const IntPatch_IType typl = L->ArcType(); if(typl == IntPatch_Analytic) { Standard_Real u1,v1,u2,v2; - Handle(IntPatch_ALine)& ALine = *((Handle(IntPatch_ALine) *)&L); + Handle(IntPatch_ALine)& ALine = Handle(IntPatch_ALine)::DownCast (L); seqp.Clear(); nbvtx = GeomInt_LineTool::NbVertex(L); for(i=1;iArcType(); - Handle(IntPatch_GLine)& aGLine=*((Handle(IntPatch_GLine) *)&aLine); + Handle(IntPatch_GLine)& aGLine=Handle(IntPatch_GLine)::DownCast (aLine); // bRejected=RejectMicroCircle(aGLine, aType, aTol); if (bRejected) { diff --git a/src/GeomLib/GeomLib.cxx b/src/GeomLib/GeomLib.cxx index 2908a169d1..dc3ec85842 100644 --- a/src/GeomLib/GeomLib.cxx +++ b/src/GeomLib/GeomLib.cxx @@ -1057,10 +1057,8 @@ void GeomLib::BuildCurve3d(const Standard_Real Tolerance, Standard_Integer curve_not_computed = 1 ; MaxDeviation = 0.0e0 ; AverageDeviation = 0.0e0 ; - const Handle(GeomAdaptor_HSurface) & geom_adaptor_surface_ptr = - Handle(GeomAdaptor_HSurface)::DownCast(Curve.GetSurface()) ; - const Handle(Geom2dAdaptor_HCurve) & geom_adaptor_curve_ptr = - Handle(Geom2dAdaptor_HCurve)::DownCast(Curve.GetCurve()) ; + Handle(GeomAdaptor_HSurface) geom_adaptor_surface_ptr (Handle(GeomAdaptor_HSurface)::DownCast(Curve.GetSurface()) ); + Handle(Geom2dAdaptor_HCurve) geom_adaptor_curve_ptr (Handle(Geom2dAdaptor_HCurve)::DownCast(Curve.GetCurve()) ); if (! geom_adaptor_curve_ptr.IsNull() && ! geom_adaptor_surface_ptr.IsNull()) { diff --git a/src/GeometryTest/GeometryTest_CurveCommands.cxx b/src/GeometryTest/GeometryTest_CurveCommands.cxx index 74e64f4a08..03004ffd08 100644 --- a/src/GeometryTest/GeometryTest_CurveCommands.cxx +++ b/src/GeometryTest/GeometryTest_CurveCommands.cxx @@ -1341,7 +1341,7 @@ static Standard_Integer mypoints (Draw_Interpretor& di, Standard_Integer /*n*/, Handle(Geom_Curve) C = DrawTrSurf::GetCurve(a[2]); defl = Draw::Atof(a[3]); - const Handle(Geom_BSplineCurve)& aBS = Handle(Geom_BSplineCurve)::DownCast(C); + Handle(Geom_BSplineCurve) aBS (Handle(Geom_BSplineCurve)::DownCast(C)); if(aBS.IsNull()) return 1; diff --git a/src/HLRBRep/HLRBRep.cxx b/src/HLRBRep/HLRBRep.cxx index c3b10080fb..80e09a7cd5 100644 --- a/src/HLRBRep/HLRBRep.cxx +++ b/src/HLRBRep/HLRBRep.cxx @@ -91,7 +91,7 @@ TopoDS_Edge HLRBRep::MakeEdge (const HLRBRep_Curve& ec, Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, fpar, lpar); if (aCurve->DynamicType() == STANDARD_TYPE(Geom_TrimmedCurve)) aCurve = (Handle(Geom_TrimmedCurve)::DownCast(aCurve))->BasisCurve(); - const Handle(Geom_BSplineCurve)& BSplCurve = Handle(Geom_BSplineCurve)::DownCast(aCurve); + Handle(Geom_BSplineCurve) BSplCurve (Handle(Geom_BSplineCurve)::DownCast(aCurve)); Handle(Geom_BSplineCurve) theCurve = Handle(Geom_BSplineCurve)::DownCast(BSplCurve->Copy()); if (theCurve->IsPeriodic() && !GAcurve.IsClosed()) { diff --git a/src/IntPatch/IntPatch_ImpImpIntersection_0.gxx b/src/IntPatch/IntPatch_ImpImpIntersection_0.gxx index 957fd4ecdc..741fc34ad2 100644 --- a/src/IntPatch/IntPatch_ImpImpIntersection_0.gxx +++ b/src/IntPatch/IntPatch_ImpImpIntersection_0.gxx @@ -530,10 +530,10 @@ void PutPointsOnLine(const Handle(Adaptor3d_HSurface)& S1, solpnt.SetArc(OnFirst,currentarc, currentparameter, Transline,Transarc); if (TheType == IntPatch_Analytic) { - (*((Handle(IntPatch_ALine)*)&lin))->AddVertex(solpnt); + Handle(IntPatch_ALine)::DownCast (lin)->AddVertex(solpnt); } else { - (*((Handle(IntPatch_GLine)*)&lin))->AddVertex(solpnt); + Handle(IntPatch_GLine)::DownCast (lin)->AddVertex(solpnt); } Done(i) = 1; @@ -564,10 +564,10 @@ void PutPointsOnLine(const Handle(Adaptor3d_HSurface)& S1, solpnt.SetArc(OnFirst,currentarc,currentparameter, Transline,Transarc); if (TheType == IntPatch_Analytic) { - (*((Handle(IntPatch_ALine)*)&lin))->AddVertex(solpnt); + Handle(IntPatch_ALine)::DownCast (lin)->AddVertex(solpnt); } else { - (*((Handle(IntPatch_GLine)*)&lin))->AddVertex(solpnt); + Handle(IntPatch_GLine)::DownCast (lin)->AddVertex(solpnt); } Done(k) = 1; } @@ -639,18 +639,18 @@ Standard_Boolean MultiplePoint (const IntPatch_SequenceOfPathPointOfTheSOnBound const Handle(IntPatch_Line)& slinValueii = slin.Value(ii); TheType = slinValueii->ArcType(); if (TheType == IntPatch_Analytic) { - nbvtx = (*((Handle(IntPatch_ALine)*)&slinValueii))->NbVertex(); + nbvtx = Handle(IntPatch_ALine)::DownCast (slinValueii)->NbVertex(); } else { - nbvtx = (*((Handle(IntPatch_GLine)*)&slinValueii))->NbVertex(); + nbvtx = Handle(IntPatch_GLine)::DownCast (slinValueii)->NbVertex(); } jj = 1; while (jj <= nbvtx) { if (TheType == IntPatch_Analytic) { - intpt = (*((Handle(IntPatch_ALine)*)&slinValueii))->Vertex(jj); + intpt = Handle(IntPatch_ALine)::DownCast (slinValueii)->Vertex(jj); } else { - intpt = (*((Handle(IntPatch_GLine)*)&slinValueii))->Vertex(jj); + intpt = Handle(IntPatch_GLine)::DownCast (slinValueii)->Vertex(jj); } if (intpt.IsMultiple() && (( OnFirst && !intpt.IsOnDomS1()) || @@ -696,10 +696,10 @@ Standard_Boolean MultiplePoint (const IntPatch_SequenceOfPathPointOfTheSOnBound if (TheType == IntPatch_Analytic) { - (*((Handle(IntPatch_ALine)*)&slinValueii))->Replace(jj,intpt); + Handle(IntPatch_ALine)::DownCast (slinValueii)->Replace(jj,intpt); } else { - (*((Handle(IntPatch_GLine)*)&slinValueii))->Replace(jj,intpt); + Handle(IntPatch_GLine)::DownCast (slinValueii)->Replace(jj,intpt); } localdone(Index) = 1; if (goon) { @@ -726,10 +726,10 @@ Standard_Boolean MultiplePoint (const IntPatch_SequenceOfPathPointOfTheSOnBound intpt.SetArc(OnFirst,currentarc,currentparameter, Transline,Transarc); if (TheType == IntPatch_Analytic) { - (*((Handle(IntPatch_ALine)*)&slinValueii))->AddVertex(intpt); + Handle(IntPatch_ALine)::DownCast (slinValueii)->AddVertex(intpt); } else { - (*((Handle(IntPatch_GLine)*)&slinValueii))->AddVertex(intpt); + Handle(IntPatch_GLine)::DownCast (slinValueii)->AddVertex(intpt); } UsedLine(ii) = 1; Retvalue = Standard_True; @@ -799,18 +799,18 @@ Standard_Boolean PointOnSecondDom (const IntPatch_SequenceOfPathPointOfTheSOnBou TheType = lin->ArcType(); if (TheType == IntPatch_Analytic) { - nbvtx = (*((Handle(IntPatch_ALine)*)&lin))->NbVertex(); + nbvtx = Handle(IntPatch_ALine)::DownCast (lin)->NbVertex(); } else { - nbvtx = (*((Handle(IntPatch_GLine)*)&lin))->NbVertex(); + nbvtx = Handle(IntPatch_GLine)::DownCast (lin)->NbVertex(); } jj = 1; while (jj <= nbvtx) { if (TheType == IntPatch_Analytic) { - intpt = (*((Handle(IntPatch_ALine)*)&lin))->Vertex(jj); + intpt = Handle(IntPatch_ALine)::DownCast (lin)->Vertex(jj); } else { - intpt = (*((Handle(IntPatch_GLine)*)&lin))->Vertex(jj); + intpt = Handle(IntPatch_GLine)::DownCast (lin)->Vertex(jj); } if (!intpt.IsOnDomS2()) { if (currentpointonrst.Value().Distance(intpt.Value()) <= @@ -839,10 +839,10 @@ Standard_Boolean PointOnSecondDom (const IntPatch_SequenceOfPathPointOfTheSOnBou intpt.SetArc(Standard_False,currentarc,currentparameter, Transline,Transarc); if (TheType == IntPatch_Analytic) { - (*((Handle(IntPatch_ALine)*)&lin))->Replace(jj,intpt); + Handle(IntPatch_ALine)::DownCast (lin)->Replace(jj,intpt); } else { - (*((Handle(IntPatch_GLine)*)&lin))->Replace(jj,intpt); + Handle(IntPatch_GLine)::DownCast (lin)->Replace(jj,intpt); } Done(Index) = 1; @@ -869,10 +869,10 @@ Standard_Boolean PointOnSecondDom (const IntPatch_SequenceOfPathPointOfTheSOnBou intpt.SetArc(Standard_False,currentarc,currentparameter, Transline,Transarc); if (TheType == IntPatch_Analytic) { - (*((Handle(IntPatch_ALine)*)&lin))->AddVertex(intpt); + Handle(IntPatch_ALine)::DownCast (lin)->AddVertex(intpt); } else { - (*((Handle(IntPatch_GLine)*)&lin))->AddVertex(intpt); + Handle(IntPatch_GLine)::DownCast (lin)->AddVertex(intpt); } Done(k) = 1; } @@ -891,10 +891,10 @@ Standard_Boolean PointOnSecondDom (const IntPatch_SequenceOfPathPointOfTheSOnBou jj = jj+1; } if (TheType == IntPatch_Analytic) { - nbvtx = (*((Handle(IntPatch_ALine)*)&lin))->NbVertex(); + nbvtx = Handle(IntPatch_ALine)::DownCast (lin)->NbVertex(); } else { - nbvtx = (*((Handle(IntPatch_GLine)*)&lin))->NbVertex(); + nbvtx = Handle(IntPatch_GLine)::DownCast (lin)->NbVertex(); } } return Retvalue; @@ -934,18 +934,18 @@ Standard_Boolean FindLine (gp_Pnt& Psurf, typarc = lin->ArcType(); if (typarc == IntPatch_Analytic) { Standard_Boolean foo; - lower = (*((Handle(IntPatch_ALine)*)&lin))->FirstParameter(foo); - upper = (*((Handle(IntPatch_ALine)*)&lin))->LastParameter(foo); + lower = Handle(IntPatch_ALine)::DownCast (lin)->FirstParameter(foo); + upper = Handle(IntPatch_ALine)::DownCast (lin)->LastParameter(foo); } else { - if ((*((Handle(IntPatch_GLine)*)&lin))->HasFirstPoint()) { - lower = (*((Handle(IntPatch_GLine)*)&lin))->FirstPoint().ParameterOnLine(); + if (Handle(IntPatch_GLine)::DownCast (lin)->HasFirstPoint()) { + lower = Handle(IntPatch_GLine)::DownCast (lin)->FirstPoint().ParameterOnLine(); } else { lower = RealFirst(); } - if ((*((Handle(IntPatch_GLine)*)&lin))->HasLastPoint()) { - upper = (*((Handle(IntPatch_GLine)*)&lin))->LastPoint().ParameterOnLine(); + if (Handle(IntPatch_GLine)::DownCast (lin)->HasLastPoint()) { + upper = Handle(IntPatch_GLine)::DownCast (lin)->LastPoint().ParameterOnLine(); } else { upper = RealLast(); @@ -955,9 +955,9 @@ Standard_Boolean FindLine (gp_Pnt& Psurf, switch (typarc) { case IntPatch_Lin : { - para = ElCLib::Parameter((*((Handle(IntPatch_GLine)*)&lin))->Line(),Psurf); + para = ElCLib::Parameter(Handle(IntPatch_GLine)::DownCast (lin)->Line(),Psurf); if (para <= upper && para >= lower) { - pt = ElCLib::Value(para,(*((Handle(IntPatch_GLine)*)&lin))->Line()); + pt = ElCLib::Value(para,Handle(IntPatch_GLine)::DownCast (lin)->Line()); dist = Psurf.Distance(pt); if (dist< distmin) { distmin = dist; @@ -969,11 +969,11 @@ Standard_Boolean FindLine (gp_Pnt& Psurf, break; case IntPatch_Circle : { - para = ElCLib::Parameter((*((Handle(IntPatch_GLine)*)&lin))->Circle(),Psurf); + para = ElCLib::Parameter(Handle(IntPatch_GLine)::DownCast (lin)->Circle(),Psurf); if ((para <= upper && para >= lower) || (para + 2.*M_PI <=upper && para + 2.*M_PI >= lower) || (para - 2.*M_PI <=upper && para - 2.*M_PI >= lower)) { - pt = ElCLib::Value(para,(*((Handle(IntPatch_GLine)*)&lin))->Circle()); + pt = ElCLib::Value(para,Handle(IntPatch_GLine)::DownCast (lin)->Circle()); dist = Psurf.Distance(pt); if (dist< distmin) { distmin = dist; @@ -985,11 +985,11 @@ Standard_Boolean FindLine (gp_Pnt& Psurf, break; case IntPatch_Ellipse : { - para = ElCLib::Parameter((*((Handle(IntPatch_GLine)*)&lin))->Ellipse(),Psurf); + para = ElCLib::Parameter(Handle(IntPatch_GLine)::DownCast (lin)->Ellipse(),Psurf); if ((para <= upper && para >= lower) || (para + 2.*M_PI <=upper && para + 2.*M_PI >= lower) || (para - 2.*M_PI <=upper && para - 2.*M_PI >= lower)) { - pt = ElCLib::Value(para,(*((Handle(IntPatch_GLine)*)&lin))->Ellipse()); + pt = ElCLib::Value(para,Handle(IntPatch_GLine)::DownCast (lin)->Ellipse()); dist = Psurf.Distance(pt); if (dist< distmin) { distmin = dist; @@ -1003,9 +1003,9 @@ Standard_Boolean FindLine (gp_Pnt& Psurf, { #if 0 - para = ElCLib::Parameter((*((Handle(IntPatch_GLine)*)&lin))->Parabola(),Psurf); + para = ElCLib::Parameter(Handle(IntPatch_GLine)::DownCast (lin)->Parabola(),Psurf); if (para <= upper && para >= lower) { - pt = ElCLib::Value(para,(*((Handle(IntPatch_GLine)*)&lin))->Parabola()); + pt = ElCLib::Value(para,Handle(IntPatch_GLine)::DownCast (lin)->Parabola()); dist = Psurf.Distance(pt); if (dist< distmin) { distmin = dist; @@ -1018,7 +1018,7 @@ Standard_Boolean FindLine (gp_Pnt& Psurf, //-- de la meilleure facon de calculer (axe X ou axe Y). Bilan : Si la parabole est tres //-- pointue (focal de l'ordre de 1e-2 et si le point est a un parametre grand, ca foire. ) //-- On ne peut pas modifier faciolement ds ElCLib car on ne passe pas la focale. ... - const gp_Parab& Parab=(*((Handle(IntPatch_GLine)*)&lin))->Parabola(); + const gp_Parab& Parab=Handle(IntPatch_GLine)::DownCast (lin)->Parabola(); para = ElCLib::Parameter(Parab,Psurf); if (para <= upper && para >= lower) { Standard_Integer amelioration=0; @@ -1059,9 +1059,9 @@ Standard_Boolean FindLine (gp_Pnt& Psurf, break; case IntPatch_Hyperbola : { - para = ElCLib::Parameter((*((Handle(IntPatch_GLine)*)&lin))->Hyperbola(),Psurf); + para = ElCLib::Parameter(Handle(IntPatch_GLine)::DownCast (lin)->Hyperbola(),Psurf); if (para <= upper && para >= lower) { - pt = ElCLib::Value(para,(*((Handle(IntPatch_GLine)*)&lin))->Hyperbola()); + pt = ElCLib::Value(para,Handle(IntPatch_GLine)::DownCast (lin)->Hyperbola()); dist = Psurf.Distance(pt); if (dist< distmin) { distmin = dist; @@ -1074,7 +1074,7 @@ Standard_Boolean FindLine (gp_Pnt& Psurf, case IntPatch_Analytic : { - const Handle(IntPatch_ALine)& alin = (*((Handle(IntPatch_ALine)*)&lin)); + Handle(IntPatch_ALine) alin (Handle(IntPatch_ALine)::DownCast (lin)); Standard_Boolean ok = alin->FindParameter(Psurf,para); if (ok) { pt = alin->Value(para); @@ -1238,28 +1238,28 @@ Standard_Boolean SingleLine (const gp_Pnt& Psurf, switch (typarc) { case IntPatch_Lin : - parproj = ElCLib::Parameter((*((Handle(IntPatch_GLine)*)&lin))->Line(),Psurf); - ElCLib::D1(parproj,(*((Handle(IntPatch_GLine)*)&lin))->Line(),ptproj,tgint); + parproj = ElCLib::Parameter(Handle(IntPatch_GLine)::DownCast (lin)->Line(),Psurf); + ElCLib::D1(parproj,Handle(IntPatch_GLine)::DownCast (lin)->Line(),ptproj,tgint); break; case IntPatch_Circle : - parproj = ElCLib::Parameter((*((Handle(IntPatch_GLine)*)&lin))->Circle(),Psurf); - ElCLib::D1(parproj,(*((Handle(IntPatch_GLine)*)&lin))->Circle(),ptproj,tgint); + parproj = ElCLib::Parameter(Handle(IntPatch_GLine)::DownCast (lin)->Circle(),Psurf); + ElCLib::D1(parproj,Handle(IntPatch_GLine)::DownCast (lin)->Circle(),ptproj,tgint); break; case IntPatch_Ellipse : - parproj = ElCLib::Parameter((*((Handle(IntPatch_GLine)*)&lin))->Ellipse(),Psurf); - ElCLib::D1(parproj,(*((Handle(IntPatch_GLine)*)&lin))->Ellipse(),ptproj,tgint); + parproj = ElCLib::Parameter(Handle(IntPatch_GLine)::DownCast (lin)->Ellipse(),Psurf); + ElCLib::D1(parproj,Handle(IntPatch_GLine)::DownCast (lin)->Ellipse(),ptproj,tgint); break; case IntPatch_Parabola : - parproj = ElCLib::Parameter((*((Handle(IntPatch_GLine)*)&lin))->Parabola(),Psurf); - ElCLib::D1(parproj,(*((Handle(IntPatch_GLine)*)&lin))->Parabola(),ptproj,tgint); + parproj = ElCLib::Parameter(Handle(IntPatch_GLine)::DownCast (lin)->Parabola(),Psurf); + ElCLib::D1(parproj,Handle(IntPatch_GLine)::DownCast (lin)->Parabola(),ptproj,tgint); break; case IntPatch_Hyperbola : - parproj = ElCLib::Parameter((*((Handle(IntPatch_GLine)*)&lin))->Hyperbola(),Psurf); - ElCLib::D1(parproj,(*((Handle(IntPatch_GLine)*)&lin))->Hyperbola(),ptproj,tgint); + parproj = ElCLib::Parameter(Handle(IntPatch_GLine)::DownCast (lin)->Hyperbola(),Psurf); + ElCLib::D1(parproj,Handle(IntPatch_GLine)::DownCast (lin)->Hyperbola(),ptproj,tgint); break; case IntPatch_Analytic : { - const Handle(IntPatch_ALine)& alin = (*((Handle(IntPatch_ALine)*)&lin)); + Handle(IntPatch_ALine) alin (Handle(IntPatch_ALine)::DownCast (lin)); Standard_Boolean ok = alin->FindParameter(Psurf,parproj); if (ok) { gp_Pnt ptbid; @@ -1460,36 +1460,36 @@ void ProcessSegments (const IntPatch_SequenceOfSegmentOfTheSOnBounds& listedg, const Handle(IntPatch_Line)& slinj = slin(j); typ = slinj->ArcType(); if (typ == IntPatch_Analytic) { - Nbpts = (*((Handle(IntPatch_ALine)*)&slinj))->NbVertex(); + Nbpts = Handle(IntPatch_ALine)::DownCast (slinj)->NbVertex(); } else if (typ == IntPatch_Restriction) { - Nbpts = (*((Handle(IntPatch_RLine)*)&slinj))->NbVertex(); + Nbpts = Handle(IntPatch_RLine)::DownCast (slinj)->NbVertex(); } else { - Nbpts = (*((Handle(IntPatch_GLine)*)&slinj))->NbVertex(); + Nbpts = Handle(IntPatch_GLine)::DownCast (slinj)->NbVertex(); } for (k=1; k<=Nbpts;k++) { if (typ == IntPatch_Analytic) { - ptvtx = (*((Handle(IntPatch_ALine)*)&slinj))->Vertex(k); + ptvtx = Handle(IntPatch_ALine)::DownCast (slinj)->Vertex(k); } else if (typ == IntPatch_Restriction) { - ptvtx = (*((Handle(IntPatch_RLine)*)&slinj))->Vertex(k); + ptvtx = Handle(IntPatch_RLine)::DownCast (slinj)->Vertex(k); } else { - ptvtx = (*((Handle(IntPatch_GLine)*)&slinj))->Vertex(k); + ptvtx = Handle(IntPatch_GLine)::DownCast (slinj)->Vertex(k); } if (EdgeDegenere==Standard_False && dofirst) { if (ptvtx.Value().Distance(PStartf.Value()) <=TolArc) { ptvtx.SetMultiple(Standard_True); if (typ == IntPatch_Analytic) { - (*((Handle(IntPatch_ALine)*)&slinj))->Replace(k,ptvtx); + Handle(IntPatch_ALine)::DownCast (slinj)->Replace(k,ptvtx); } else if (typ == IntPatch_Restriction) { - (*((Handle(IntPatch_RLine)*)&slinj))->Replace(k,ptvtx); + Handle(IntPatch_RLine)::DownCast (slinj)->Replace(k,ptvtx); } else { - (*((Handle(IntPatch_GLine)*)&slinj))->Replace(k,ptvtx); + Handle(IntPatch_GLine)::DownCast (slinj)->Replace(k,ptvtx); } newptvtx = ptvtx; newptvtx.SetParameter(paramf); @@ -1547,13 +1547,13 @@ void ProcessSegments (const IntPatch_SequenceOfSegmentOfTheSOnBounds& listedg, if (ptvtx.Value().Distance(PStartl.Value()) <=TolArc) { ptvtx.SetMultiple(Standard_True); if (typ == IntPatch_Analytic) { - (*((Handle(IntPatch_ALine)*)&slinj))->Replace(k,ptvtx); + Handle(IntPatch_ALine)::DownCast (slinj)->Replace(k,ptvtx); } else if (typ == IntPatch_Restriction) { - (*((Handle(IntPatch_RLine)*)&slinj))->Replace(k,ptvtx); + Handle(IntPatch_RLine)::DownCast (slinj)->Replace(k,ptvtx); } else { - (*((Handle(IntPatch_GLine)*)&slinj))->Replace(k,ptvtx); + Handle(IntPatch_GLine)::DownCast (slinj)->Replace(k,ptvtx); } newptvtx = ptvtx; @@ -1858,27 +1858,27 @@ void ProcessRLine (IntPatch_SequenceOfLine& slin, Nbpt = seq_Pnt3d.Length(); // important que ce soit ici typ2 = slinj->ArcType(); if (typ2 != IntPatch_Restriction) { - //-- arcref = (*((Handle(IntPatch_RLine)*)&slini))->Arc(); - //-- OnFirst = (*((Handle(IntPatch_RLine)*)&slini))->IsOnFirstSurface(); + //-- arcref = Handle(IntPatch_RLine)::DownCast (slini)->Arc(); + //-- OnFirst = Handle(IntPatch_RLine)::DownCast (slini)->IsOnFirstSurface(); //-- DES CHOSES A FAIRE ICI - if((*((Handle(IntPatch_RLine)*)&slini))->IsArcOnS1()) { + if(Handle(IntPatch_RLine)::DownCast (slini)->IsArcOnS1()) { OnFirst=Standard_True; - arcref= (*((Handle(IntPatch_RLine)*)&slini))->ArcOnS1(); + arcref= Handle(IntPatch_RLine)::DownCast (slini)->ArcOnS1(); } - else if((*((Handle(IntPatch_RLine)*)&slini))->IsArcOnS2()) { - arcref= (*((Handle(IntPatch_RLine)*)&slini))->ArcOnS2(); + else if(Handle(IntPatch_RLine)::DownCast (slini)->IsArcOnS2()) { + arcref= Handle(IntPatch_RLine)::DownCast (slini)->ArcOnS2(); OnFirst=Standard_False; } - if ((*((Handle(IntPatch_RLine)*)&slini))->HasFirstPoint()) { - paramf = (*((Handle(IntPatch_RLine)*)&slini))->FirstPoint().ParameterOnLine(); + if (Handle(IntPatch_RLine)::DownCast (slini)->HasFirstPoint()) { + paramf = Handle(IntPatch_RLine)::DownCast (slini)->FirstPoint().ParameterOnLine(); } else { // cout << "Pas de param debut sur rst solution" << endl; paramf = RealFirst(); } - if ((*((Handle(IntPatch_RLine)*)&slini))->HasLastPoint()) { - paraml = (*((Handle(IntPatch_RLine)*)&slini))->LastPoint().ParameterOnLine(); + if (Handle(IntPatch_RLine)::DownCast (slini)->HasLastPoint()) { + paraml = Handle(IntPatch_RLine)::DownCast (slini)->LastPoint().ParameterOnLine(); } else { // cout << "Pas de param debut sur rst solution" << endl; @@ -1886,10 +1886,10 @@ void ProcessRLine (IntPatch_SequenceOfLine& slin, } if (typ2 == IntPatch_Analytic) { - Nbvtx = (*((Handle(IntPatch_ALine)*)&slinj))->NbVertex(); + Nbvtx = Handle(IntPatch_ALine)::DownCast (slinj)->NbVertex(); } else { - Nbvtx = (*((Handle(IntPatch_GLine)*)&slinj))->NbVertex(); + Nbvtx = Handle(IntPatch_GLine)::DownCast (slinj)->NbVertex(); } @@ -1909,10 +1909,10 @@ void ProcessRLine (IntPatch_SequenceOfLine& slin, for (k=1; EdgeDegenere==Standard_False && k<=Nbvtx; k++) { if (typ2 == IntPatch_Analytic) { - Ptvtx = (*((Handle(IntPatch_ALine)*)&slinj))->Vertex(k); + Ptvtx = Handle(IntPatch_ALine)::DownCast (slinj)->Vertex(k); } else { - Ptvtx = (*((Handle(IntPatch_GLine)*)&slinj))->Vertex(k); + Ptvtx = Handle(IntPatch_GLine)::DownCast (slinj)->Vertex(k); } if ((OnFirst && !Ptvtx.IsOnDomS1()) || (!OnFirst && !Ptvtx.IsOnDomS2())) { @@ -1960,15 +1960,15 @@ void ProcessRLine (IntPatch_SequenceOfLine& slin, for (int ri=1; ri<=Nblin; ri++) { const Handle(IntPatch_Line)& slinri = slin(ri); if (slinri->ArcType() == IntPatch_Restriction) { - if(OnFirst && (*((Handle(IntPatch_RLine)*)&slinri))->IsArcOnS1()) { - if(arcref == (*((Handle(IntPatch_RLine)*)&slinri))->ArcOnS1()) { - (*((Handle(IntPatch_RLine)*)&slinri))->AddVertex(newptvtx); + if(OnFirst && Handle(IntPatch_RLine)::DownCast (slinri)->IsArcOnS1()) { + if(arcref == Handle(IntPatch_RLine)::DownCast (slinri)->ArcOnS1()) { + Handle(IntPatch_RLine)::DownCast (slinri)->AddVertex(newptvtx); //printf("\n ImpImpIntersection_0.gxx CAS1 \n"); } } - else if(OnFirst==Standard_False && (*((Handle(IntPatch_RLine)*)&slinri))->IsArcOnS2()) { - if(arcref == (*((Handle(IntPatch_RLine)*)&slinri))->ArcOnS2()) { - (*((Handle(IntPatch_RLine)*)&slinri))->AddVertex(newptvtx); + else if(OnFirst==Standard_False && Handle(IntPatch_RLine)::DownCast (slinri)->IsArcOnS2()) { + if(arcref == Handle(IntPatch_RLine)::DownCast (slinri)->ArcOnS2()) { + Handle(IntPatch_RLine)::DownCast (slinri)->AddVertex(newptvtx); //printf("\n ImpImpIntersection_0.gxx CAS2 \n"); } } @@ -1988,10 +1988,10 @@ void ProcessRLine (IntPatch_SequenceOfLine& slin, newptvtx.SetMultiple(Standard_True); if (typ2 == IntPatch_Analytic) { - (*((Handle(IntPatch_ALine)*)&slinj))->Replace(k,Ptvtx); + Handle(IntPatch_ALine)::DownCast (slinj)->Replace(k,Ptvtx); } else { - (*((Handle(IntPatch_GLine)*)&slinj))->Replace(k,Ptvtx); + Handle(IntPatch_GLine)::DownCast (slinj)->Replace(k,Ptvtx); } if (Ptvtx.IsOnDomS1() || Ptvtx.IsOnDomS2()) { @@ -2039,7 +2039,7 @@ void ProcessRLine (IntPatch_SequenceOfLine& slin, } } //-- if (Ptvtx.IsOnDomS1() || Ptvtx.IsOnDomS2()) - (*((Handle(IntPatch_RLine)*)&slini))->AddVertex(newptvtx); + Handle(IntPatch_RLine)::DownCast (slini)->AddVertex(newptvtx); } //-- if (keeppoint) } //-- if ((OnFirst && !Ptvtx.IsOnDomS1())||(!OnFirst && !Ptvtx.IsOnDomS2())) diff --git a/src/IntPatch/IntPatch_ImpImpIntersection_4.gxx b/src/IntPatch/IntPatch_ImpImpIntersection_4.gxx index 398a33e6c7..b9e7530019 100644 --- a/src/IntPatch/IntPatch_ImpImpIntersection_4.gxx +++ b/src/IntPatch/IntPatch_ImpImpIntersection_4.gxx @@ -2893,8 +2893,7 @@ Standard_Boolean IntCyCyTrim( const IntSurf_Quadric& theQuad1, { for(Standard_Integer aNbLin = 1; aNbLin <= theSlin.Length(); aNbLin++) { - const Handle(IntPatch_WLine)& aWLine1 = - Handle(IntPatch_WLine)::DownCast(theSlin.Value(aNbLin)); + Handle(IntPatch_WLine) aWLine1 (Handle(IntPatch_WLine)::DownCast(theSlin.Value(aNbLin))); const IntSurf_PntOn2S& aPntFWL1 = aWLine1->Point(1); const IntSurf_PntOn2S& aPntLWL1 = aWLine1->Point(aWLine1->NbPnts()); diff --git a/src/IntPatch/IntPatch_ImpPrmIntersection.cxx b/src/IntPatch/IntPatch_ImpPrmIntersection.cxx index 4f9c2b0f06..916f6b8afe 100644 --- a/src/IntPatch/IntPatch_ImpPrmIntersection.cxx +++ b/src/IntPatch/IntPatch_ImpPrmIntersection.cxx @@ -966,7 +966,7 @@ void IntPatch_ImpPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur for (Standard_Integer j=1; j<=Nblines-1; j++) { dofirst = dolast = Standard_False; const Handle(IntPatch_Line)& slinj = slin(j); - const Handle(IntPatch_WLine)& wlin1 = *((Handle(IntPatch_WLine)*)&slinj); + Handle(IntPatch_WLine) wlin1 (Handle(IntPatch_WLine)::DownCast (slinj)); if (wlin1->HasFirstPoint()) { ptdeb = wlin1->FirstPoint(indfirst); if (ptdeb.IsTangencyPoint()) { @@ -983,7 +983,7 @@ void IntPatch_ImpPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur if (dofirst || dolast) { for (Standard_Integer k=j+1; k<=Nblines;k++) { const Handle(IntPatch_Line)& slink = slin(k); - const Handle(IntPatch_WLine)& wlin2 = *((Handle(IntPatch_WLine)*)&slink); + Handle(IntPatch_WLine) wlin2 (Handle(IntPatch_WLine)::DownCast (slink)); if (wlin2->HasFirstPoint()) { ptbis = wlin2->FirstPoint(ind2); if (ptbis.IsTangencyPoint()) { @@ -1281,27 +1281,27 @@ void IntPatch_ImpPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur const Handle(IntPatch_Line)& slinj = slin(j); typ = slinj->ArcType(); if (typ == IntPatch_Walking) { - Nbpts = (*((Handle(IntPatch_WLine)*)&slinj))->NbVertex(); + Nbpts = Handle(IntPatch_WLine)::DownCast (slinj)->NbVertex(); } else { - Nbpts = (*((Handle(IntPatch_RLine)*)&slinj))->NbVertex(); + Nbpts = Handle(IntPatch_RLine)::DownCast (slinj)->NbVertex(); } for (Standard_Integer k=1; k<=Nbpts;k++) { if (typ == IntPatch_Walking) { - ptdeb = (*((Handle(IntPatch_WLine)*)&slinj))->Vertex(k); + ptdeb = Handle(IntPatch_WLine)::DownCast (slinj)->Vertex(k); } else { - ptdeb = (*((Handle(IntPatch_RLine)*)&slinj))->Vertex(k); + ptdeb = Handle(IntPatch_RLine)::DownCast (slinj)->Vertex(k); } if (dofirst) { if (ptdeb.Value().Distance(PStartf.Value()) <=TolArc) { ptdeb.SetMultiple(Standard_True); if (typ == IntPatch_Walking) { - (*((Handle(IntPatch_WLine)*)&slinj))->Replace(k,ptdeb); + Handle(IntPatch_WLine)::DownCast (slinj)->Replace(k,ptdeb); } else { - (*((Handle(IntPatch_RLine)*)&slinj))->Replace(k,ptdeb); + Handle(IntPatch_RLine)::DownCast (slinj)->Replace(k,ptdeb); } ptdeb.SetParameter(paramf); rline->AddVertex(ptdeb); @@ -1314,19 +1314,19 @@ void IntPatch_ImpPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur if (dolast) { if(dofirst) { //-- on recharge le ptdeb if (typ == IntPatch_Walking) { - ptdeb = (*((Handle(IntPatch_WLine)*)&slinj))->Vertex(k); + ptdeb = Handle(IntPatch_WLine)::DownCast (slinj)->Vertex(k); } else { - ptdeb = (*((Handle(IntPatch_RLine)*)&slinj))->Vertex(k); + ptdeb = Handle(IntPatch_RLine)::DownCast (slinj)->Vertex(k); } } if (ptdeb.Value().Distance(PStartl.Value()) <=TolArc) { ptdeb.SetMultiple(Standard_True); if (typ == IntPatch_Walking) { - (*((Handle(IntPatch_WLine)*)&slinj))->Replace(k,ptdeb); + Handle(IntPatch_WLine)::DownCast (slinj)->Replace(k,ptdeb); } else { - (*((Handle(IntPatch_RLine)*)&slinj))->Replace(k,ptdeb); + Handle(IntPatch_RLine)::DownCast (slinj)->Replace(k,ptdeb); } ptdeb.SetParameter(paraml); rline->AddVertex(ptdeb); @@ -2244,7 +2244,7 @@ static void PutIntVertices(Handle(IntPatch_Line)& Line, if(nbp < 3) return; - Handle(IntPatch_WLine)& WLine = (*((Handle(IntPatch_WLine)*)&Line)); + Handle(IntPatch_WLine)& WLine = Handle(IntPatch_WLine)::DownCast (Line); Standard_Integer ip = 0, iv = 0; gp_Pnt aPnt; IntPatch_Point thePnt; @@ -2388,7 +2388,7 @@ static Standard_Boolean DecomposeResult(const Handle(IntPatch_Line)& theLine, return Standard_False; } - const Handle(IntPatch_WLine)& aWLine = (*((Handle(IntPatch_WLine)*)&theLine)); + Handle(IntPatch_WLine) aWLine (Handle(IntPatch_WLine)::DownCast (theLine)); const Handle(IntSurf_LineOn2S)& aSLine = aWLine->Curve(); if(aSLine->NbPoints() <= 2) diff --git a/src/IntPatch/IntPatch_Intersection.cxx b/src/IntPatch/IntPatch_Intersection.cxx index c9a02f4e20..a9ceb7696b 100644 --- a/src/IntPatch/IntPatch_Intersection.cxx +++ b/src/IntPatch/IntPatch_Intersection.cxx @@ -104,7 +104,7 @@ static void JoinWLines(IntPatch_SequenceOfLine& theSlin, for(Standard_Integer aNumOfLine1 = 1; aNumOfLine1 <= theSlin.Length(); aNumOfLine1++) { - const Handle(IntPatch_WLine)& aWLine1 = Handle(IntPatch_WLine)::DownCast(theSlin.Value(aNumOfLine1)); + Handle(IntPatch_WLine) aWLine1 (Handle(IntPatch_WLine)::DownCast(theSlin.Value(aNumOfLine1))); if(aWLine1.IsNull()) {//We must have failed to join not-point-lines @@ -130,7 +130,7 @@ static void JoinWLines(IntPatch_SequenceOfLine& theSlin, Standard_Boolean hasBeenRemoved = Standard_False; for(Standard_Integer aNumOfLine2 = aNumOfLine1 + 1; aNumOfLine2 <= theSlin.Length(); aNumOfLine2++) { - const Handle(IntPatch_WLine)& aWLine2 = Handle(IntPatch_WLine)::DownCast(theSlin.Value(aNumOfLine2)); + Handle(IntPatch_WLine) aWLine2 (Handle(IntPatch_WLine)::DownCast(theSlin.Value(aNumOfLine2))); const Standard_Integer aNbPntsWL1 = aWLine1->NbPnts(); const Standard_Integer aNbPntsWL2 = aWLine2->NbPnts(); @@ -518,7 +518,7 @@ static void FUN_GetUiso(const Handle(Geom_Surface)& GS, } else//OffsetSurface { - const Handle(Geom_OffsetSurface) gos = *(Handle(Geom_OffsetSurface)*)&GS; + const Handle(Geom_OffsetSurface) gos = Handle(Geom_OffsetSurface)::DownCast (GS); const Handle(Geom_Surface) bs = gos->BasisSurface(); Handle(Geom_Curve) gcbs = bs->UIso(U); GeomAdaptor_Curve gac(gcbs); @@ -588,7 +588,7 @@ static void FUN_GetViso(const Handle(Geom_Surface)& GS, } else//OffsetSurface { - const Handle(Geom_OffsetSurface) gos = *(Handle(Geom_OffsetSurface)*)&GS; + const Handle(Geom_OffsetSurface) gos = Handle(Geom_OffsetSurface)::DownCast (GS); const Handle(Geom_Surface) bs = gos->BasisSurface(); Handle(Geom_Curve) gcbs = bs->VIso(V); GeomAdaptor_Curve gac(gcbs); @@ -663,7 +663,7 @@ static void FUN_PL_Intersection(const Handle(Adaptor3d_HSurface)& S1, else if(!S1->IsVPeriodic() && !S1->IsVClosed()) { if(T1 != GeomAbs_OffsetSurface) C1 = gs1->UIso(MS1[0]); else { - const Handle(Geom_OffsetSurface) gos = *(Handle(Geom_OffsetSurface)*)&gs1; + const Handle(Geom_OffsetSurface) gos = Handle(Geom_OffsetSurface)::DownCast (gs1); const Handle(Geom_Surface) bs = gos->BasisSurface(); C1 = bs->UIso(MS1[0]); } @@ -673,7 +673,7 @@ static void FUN_PL_Intersection(const Handle(Adaptor3d_HSurface)& S1, if(!S1->IsUPeriodic() && !S1->IsUClosed()) { if(T1 != GeomAbs_OffsetSurface) C1 = gs1->VIso(MS1[1]); else { - const Handle(Geom_OffsetSurface) gos = *(Handle(Geom_OffsetSurface)*)&gs1; + const Handle(Geom_OffsetSurface) gos = Handle(Geom_OffsetSurface)::DownCast (gs1); const Handle(Geom_Surface) bs = gos->BasisSurface(); C1 = bs->VIso(MS1[1]); } @@ -684,7 +684,7 @@ static void FUN_PL_Intersection(const Handle(Adaptor3d_HSurface)& S1, else if(!S2->IsVPeriodic() && !S2->IsVClosed()) { if(T2 != GeomAbs_OffsetSurface) C2 = gs2->UIso(MS2[0]); else { - const Handle(Geom_OffsetSurface) gos = *(Handle(Geom_OffsetSurface)*)&gs2; + const Handle(Geom_OffsetSurface) gos = Handle(Geom_OffsetSurface)::DownCast (gs2); const Handle(Geom_Surface) bs = gos->BasisSurface(); C2 = bs->UIso(MS2[0]); } @@ -694,7 +694,7 @@ static void FUN_PL_Intersection(const Handle(Adaptor3d_HSurface)& S1, if(!S2->IsUPeriodic() && !S2->IsUClosed()) { if(T2 != GeomAbs_OffsetSurface) C2 = gs2->VIso(MS2[1]); else { - const Handle(Geom_OffsetSurface) gos = *(Handle(Geom_OffsetSurface)*)&gs2; + const Handle(Geom_OffsetSurface) gos = Handle(Geom_OffsetSurface)::DownCast (gs2); const Handle(Geom_Surface) bs = gos->BasisSurface(); C2 = bs->VIso(MS2[1]); } @@ -760,9 +760,9 @@ static void FUN_PL_Intersection(const Handle(Adaptor3d_HSurface)& S1, GeomProjLib::ProjectOnPlane(C2,GPln,gp_Dir(DV),Standard_True); if(C1Prj.IsNull() || C2Prj.IsNull()) return; Handle(Geom2d_Curve) C1Prj2d = - GeomProjLib::Curve2d(C1Prj,*(Handle(Geom_Surface) *)&GPln); + GeomProjLib::Curve2d(C1Prj,Handle(Geom_Surface)::DownCast (GPln)); Handle(Geom2d_Curve) C2Prj2d = - GeomProjLib::Curve2d(C2Prj,*(Handle(Geom_Surface) *)&GPln); + GeomProjLib::Curve2d(C2Prj,Handle(Geom_Surface)::DownCast (GPln)); Geom2dAPI_InterCurveCurve ICC(C1Prj2d,C2Prj2d,1.0e-7); if(ICC.NbPoints() > 0 ) { @@ -864,14 +864,14 @@ static void FUN_TrimBothSurf(const Handle(Adaptor3d_HSurface)& S1, if(T1 != GeomAbs_OffsetSurface){ visoS1 = gs1->VIso(VM1); uisoS1 = gs1->UIso(UM1); } else { - const Handle(Geom_OffsetSurface) gos = *(Handle(Geom_OffsetSurface)*)&gs1; + const Handle(Geom_OffsetSurface) gos = Handle(Geom_OffsetSurface)::DownCast (gs1); const Handle(Geom_Surface) bs = gos->BasisSurface(); visoS1 = bs->VIso(VM1); uisoS1 = bs->UIso(UM1); } if(T2 != GeomAbs_OffsetSurface){ visoS2 = gs2->VIso(VM2); uisoS2 = gs2->UIso(UM2); } else { - const Handle(Geom_OffsetSurface) gos = *(Handle(Geom_OffsetSurface)*)&gs2; + const Handle(Geom_OffsetSurface) gos = Handle(Geom_OffsetSurface)::DownCast (gs2); const Handle(Geom_Surface) bs = gos->BasisSurface(); visoS2 = bs->VIso(VM2); uisoS2 = bs->UIso(UM2); } @@ -1451,7 +1451,7 @@ void IntPatch_Intersection::ParamParamPerfom(const Handle(Adaptor3d_HSurface)& { gp_Lin lin(sop.Value(ip),gp_Dir(v)); Handle(IntPatch_GLine) gl = new IntPatch_GLine(lin,Standard_False); - slin.Append(*(Handle(IntPatch_Line) *)&gl); + slin.Append(Handle(IntPatch_Line)::DownCast (gl)); } done = Standard_True; @@ -1635,7 +1635,7 @@ void IntPatch_Intersection:: { gp_Lin lin(sop.Value(ip),gp_Dir(v)); Handle(IntPatch_GLine) gl = new IntPatch_GLine(lin,Standard_False); - slin.Append(*(Handle(IntPatch_Line) *)&gl); + slin.Append(Handle(IntPatch_Line)::DownCast (gl)); } done = Standard_True; @@ -1901,7 +1901,7 @@ void IntPatch_Intersection::Dump(const Standard_Integer , else if(IType == IntPatch_Restriction) { nbr++; Handle(IntPatch_RLine)& rlin = - *((Handle(IntPatch_RLine) *)&line); + Handle(IntPatch_RLine)::DownCast (line); if(rlin->IsArcOnS1()) nbr1++; if(rlin->IsArcOnS2()) nbr2++; } @@ -1938,7 +1938,7 @@ void IntPatch_Intersection::Dump(const Standard_Integer , const Handle(IntPatch_Line)& LineK = LineConstructor.Line(k); if (LineK->ArcType() == IntPatch_Analytic) { Handle(IntPatch_ALine)& alin = - *((Handle(IntPatch_ALine) *)&LineK); + Handle(IntPatch_ALine)::DownCast (LineK); nbvtx=alin->NbVertex(); nbva+=nbvtx; nba++; for(v=1;v<=nbvtx;v++) { @@ -1947,7 +1947,7 @@ void IntPatch_Intersection::Dump(const Standard_Integer , } else if (LineK->ArcType() == IntPatch_Restriction) { Handle(IntPatch_RLine)& rlin = - *((Handle(IntPatch_RLine) *)&LineK); + Handle(IntPatch_RLine)::DownCast (LineK); nbvtx=rlin->NbVertex(); nbvr+=nbvtx; nbr++; for(v=1;v<=nbvtx;v++) { @@ -1956,7 +1956,7 @@ void IntPatch_Intersection::Dump(const Standard_Integer , } else if (LineK->ArcType() == IntPatch_Walking) { Handle(IntPatch_WLine)& wlin = - *((Handle(IntPatch_WLine) *)&LineK); + Handle(IntPatch_WLine)::DownCast (LineK); nbvtx=wlin->NbVertex(); nbvw+=nbvtx; nbw++; for(v=1;v<=nbvtx;v++) { @@ -1965,7 +1965,7 @@ void IntPatch_Intersection::Dump(const Standard_Integer , } else { Handle(IntPatch_GLine)& glin = - *((Handle(IntPatch_GLine) *)&LineK); + Handle(IntPatch_GLine)::DownCast (LineK); nbvtx=glin->NbVertex(); nbvg+=nbvtx; nbg++; for(v=1;v<=nbvtx;v++) { diff --git a/src/IntPatch/IntPatch_LineConstructor.cxx b/src/IntPatch/IntPatch_LineConstructor.cxx index c388b2afb7..fa0191bca2 100644 --- a/src/IntPatch/IntPatch_LineConstructor.cxx +++ b/src/IntPatch/IntPatch_LineConstructor.cxx @@ -199,7 +199,7 @@ static Standard_Real LocalFirstParameter (const Handle(IntPatch_Line)& L) switch (typl) { case IntPatch_Analytic: { - Handle(IntPatch_ALine)& alin = *((Handle(IntPatch_ALine) *)&L); + Handle(IntPatch_ALine)& alin = Handle(IntPatch_ALine)::DownCast (L); if (alin->HasFirstPoint()) { firstp = alin->FirstPoint().ParameterOnLine(); } @@ -215,7 +215,7 @@ static Standard_Real LocalFirstParameter (const Handle(IntPatch_Line)& L) case IntPatch_Restriction: { - Handle(IntPatch_RLine)& rlin = *((Handle(IntPatch_RLine) *)&L); + Handle(IntPatch_RLine)& rlin = Handle(IntPatch_RLine)::DownCast (L); if (rlin->HasFirstPoint()) { firstp = rlin->FirstPoint().ParameterOnLine(); } @@ -227,7 +227,7 @@ static Standard_Real LocalFirstParameter (const Handle(IntPatch_Line)& L) case IntPatch_Walking: { - Handle(IntPatch_WLine)& wlin = *((Handle(IntPatch_WLine) *) &L); + Handle(IntPatch_WLine)& wlin = Handle(IntPatch_WLine)::DownCast (L); if (wlin->HasFirstPoint()) { firstp = wlin->FirstPoint().ParameterOnLine(); } @@ -239,7 +239,7 @@ static Standard_Real LocalFirstParameter (const Handle(IntPatch_Line)& L) default: { - Handle(IntPatch_GLine)& glin = *((Handle(IntPatch_GLine) *)&L); + Handle(IntPatch_GLine)& glin = Handle(IntPatch_GLine)::DownCast (L); if (glin->HasFirstPoint()) { firstp = glin->FirstPoint().ParameterOnLine(); } @@ -278,7 +278,7 @@ static Standard_Real LocalLastParameter (const Handle(IntPatch_Line)& L) switch (typl) { case IntPatch_Analytic: { - Handle(IntPatch_ALine)& alin = *((Handle(IntPatch_ALine) *)&L); + Handle(IntPatch_ALine)& alin = Handle(IntPatch_ALine)::DownCast (L); if (alin->HasLastPoint()) { lastp = alin->LastPoint().ParameterOnLine(); @@ -295,7 +295,7 @@ static Standard_Real LocalLastParameter (const Handle(IntPatch_Line)& L) case IntPatch_Restriction: { - Handle(IntPatch_RLine)& rlin = *((Handle(IntPatch_RLine) *)&L); + Handle(IntPatch_RLine)& rlin = Handle(IntPatch_RLine)::DownCast (L); if (rlin->HasLastPoint()) { lastp = rlin->LastPoint().ParameterOnLine(); @@ -307,7 +307,7 @@ static Standard_Real LocalLastParameter (const Handle(IntPatch_Line)& L) } case IntPatch_Walking: { - Handle(IntPatch_WLine)& wlin = *((Handle(IntPatch_WLine) *)&L); + Handle(IntPatch_WLine)& wlin = Handle(IntPatch_WLine)::DownCast (L); if (wlin->HasLastPoint()) { lastp = wlin->LastPoint().ParameterOnLine(); @@ -320,7 +320,7 @@ static Standard_Real LocalLastParameter (const Handle(IntPatch_Line)& L) default: { - Handle(IntPatch_GLine)& glin = *((Handle(IntPatch_GLine) *)&L); + Handle(IntPatch_GLine)& glin = Handle(IntPatch_GLine)::DownCast (L); if (glin->HasLastPoint()) { lastp = glin->LastPoint().ParameterOnLine(); @@ -562,7 +562,7 @@ static void AddLine(const Handle(IntPatch_Line)& L, IntPatch_IType typl = L->ArcType(); switch (typl) { case IntPatch_Analytic: { - Handle(IntPatch_ALine)& ALine = *((Handle(IntPatch_ALine) *)&L); + Handle(IntPatch_ALine)& ALine = Handle(IntPatch_ALine)::DownCast (L); Handle(IntPatch_ALine) alig; if(L->TransitionOnS1() == IntSurf_Undecided) alig = new IntPatch_ALine(ALine->Curve(),L->IsTangent()); @@ -582,7 +582,7 @@ static void AddLine(const Handle(IntPatch_Line)& L, break; } case IntPatch_Walking: { //-- **************************************** - Handle(IntPatch_WLine)& WLine = *((Handle(IntPatch_WLine) *)&L); + Handle(IntPatch_WLine)& WLine = Handle(IntPatch_WLine)::DownCast (L); const Handle(IntSurf_LineOn2S)& Lori = WLine->Curve(); Handle(IntSurf_LineOn2S) LineOn2S = new IntSurf_LineOn2S(); Standard_Integer ParamMinOnLine = (Standard_Integer) WLine->Vertex(i).ParameterOnLine(); @@ -623,7 +623,7 @@ static void AddLine(const Handle(IntPatch_Line)& L, break; } case IntPatch_Restriction: { - Handle(IntPatch_RLine)& RLine = *((Handle(IntPatch_RLine) *)&L); + Handle(IntPatch_RLine)& RLine = Handle(IntPatch_RLine)::DownCast (L); IndexLastVertex=2; IndexFirstVertex=1; Handle(IntPatch_RLine) rlig; @@ -661,7 +661,7 @@ static void AddLine(const Handle(IntPatch_Line)& L, case IntPatch_Hyperbola: case IntPatch_Circle: case IntPatch_Ellipse: { - Handle(IntPatch_GLine)& GLine = *((Handle(IntPatch_GLine) *)&L); + Handle(IntPatch_GLine)& GLine = Handle(IntPatch_GLine)::DownCast (L); Handle(IntPatch_GLine) glig; switch (typl) { case IntPatch_Lin: @@ -1195,7 +1195,7 @@ void IntPatch_LineConstructor::Perform(const IntPatch_SequenceOfLine& slinref, if(typl == IntPatch_Analytic) { Standard_Real u1,v1,u2,v2; Handle(IntPatch_ALine)& ALine - = *((Handle(IntPatch_ALine) *)&L); + = Handle(IntPatch_ALine)::DownCast (L); slin.Clear(); nbvtx = ALine->NbVertex(); //-- ------------------------------------------------------------------- @@ -1248,7 +1248,7 @@ void IntPatch_LineConstructor::Perform(const IntPatch_SequenceOfLine& slinref, else if(typl == IntPatch_Walking) { Standard_Real u1,v1,u2,v2; Handle(IntPatch_WLine)& WLine - = *((Handle(IntPatch_WLine) *)&L); + = Handle(IntPatch_WLine)::DownCast (L); slin.Clear(); nbvtx = WLine->NbVertex(); //-- ------------------------------------------------------------------- @@ -1408,7 +1408,7 @@ void IntPatch_LineConstructor::Perform(const IntPatch_SequenceOfLine& slinref, else if (typl != IntPatch_Restriction) { // JAG 01.07.96 Standard_Real u1,v1,u2,v2; Handle(IntPatch_GLine)& GLine - = *((Handle(IntPatch_GLine) *)&L); + = Handle(IntPatch_GLine)::DownCast (L); slin.Clear(); nbvtx = GLine->NbVertex(); //-- ------------------------------------------------------------------- @@ -1540,7 +1540,7 @@ void IntPatch_LineConstructor::Perform(const IntPatch_SequenceOfLine& slinref, } else { //-- Restriction Handle(IntPatch_RLine)& RLine - = *((Handle(IntPatch_RLine) *)&L); + = Handle(IntPatch_RLine)::DownCast (L); slin.Clear(); Standard_Integer NbVtx = RLine->NbVertex(); Standard_Boolean RestOnS1 = RLine->IsArcOnS1(); diff --git a/src/IntPatch/IntPatch_PrmPrmIntersection.cxx b/src/IntPatch/IntPatch_PrmPrmIntersection.cxx index 8d07c7b2df..5b0fef3936 100644 --- a/src/IntPatch/IntPatch_PrmPrmIntersection.cxx +++ b/src/IntPatch/IntPatch_PrmPrmIntersection.cxx @@ -1621,7 +1621,7 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& IntPatch_IType aType = aSLine->ArcType(); if( aType != IntPatch_Walking) continue; - const Handle(IntPatch_WLine)& aWLine = (*((Handle(IntPatch_WLine)*)&aSLine)); + Handle(IntPatch_WLine) aWLine (Handle(IntPatch_WLine)::DownCast (aSLine)); Standard_Integer tnbV = aWLine->NbVertex(); Standard_Integer tiV; for( tiV = 1; tiV <= tnbV; tiV++ ) { @@ -1645,7 +1645,7 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& if( VDMin != 0 ) { const Handle(IntPatch_Line)& aSLine = SLin.Value(WLDMin); - const Handle(IntPatch_WLine)& aWLine = (*((Handle(IntPatch_WLine)*)&aSLine)); + Handle(IntPatch_WLine) aWLine (Handle(IntPatch_WLine)::DownCast (aSLine)); Standard_Integer tiVpar = (Standard_Integer)aWLine->Vertex(VDMin).ParameterOnLine(); Standard_Integer ciVpar = (Standard_Integer)wline->Vertex(ciV).ParameterOnLine(); Standard_Real u11 = 0., u12 = 0., v11 = 0., v12 = 0.; @@ -2441,7 +2441,7 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur IntPatch_IType aType = aSLine->ArcType(); if( aType != IntPatch_Walking) continue; - const Handle(IntPatch_WLine)& aWLine = (*((Handle(IntPatch_WLine)*)&aSLine)); + Handle(IntPatch_WLine) aWLine (Handle(IntPatch_WLine)::DownCast (aSLine)); Standard_Integer tnbV = aWLine->NbVertex(); Standard_Integer tiV; for( tiV = 1; tiV <= tnbV; tiV++ ) @@ -2469,7 +2469,7 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur if( VDMin != 0 ) { const Handle(IntPatch_Line)& aSLine = SLin.Value(WLDMin); - const Handle(IntPatch_WLine)& aWLine = (*((Handle(IntPatch_WLine)*)&aSLine)); + Handle(IntPatch_WLine) aWLine (Handle(IntPatch_WLine)::DownCast (aSLine)); Standard_Integer tiVpar = (Standard_Integer)aWLine->Vertex(VDMin).ParameterOnLine(); Standard_Integer ciVpar = (Standard_Integer)wline->Vertex(ciV).ParameterOnLine(); Standard_Real u11 = 0., u12 = 0., v11 = 0., v12 = 0.; diff --git a/src/IntPatch/IntPatch_RstInt.cxx b/src/IntPatch/IntPatch_RstInt.cxx index 2b34977076..bae5084e5c 100644 --- a/src/IntPatch/IntPatch_RstInt.cxx +++ b/src/IntPatch/IntPatch_RstInt.cxx @@ -286,8 +286,8 @@ static Standard_Boolean FindParameter(const Handle(IntPatch_Line)& L, // Dans le cas d une ligne de cheminement, il faudrait voir la projection // et le calcul de la tangente. - const Handle(IntPatch_RLine)& rlin = (*((Handle(IntPatch_RLine)*)&L)); //-- aucune verification n est - const Handle(IntPatch_WLine)& wlin = (*((Handle(IntPatch_WLine)*)&L)); //-- faite au cast. + Handle(IntPatch_RLine) rlin (Handle(IntPatch_RLine)::DownCast (L)); //-- aucune verification n est + Handle(IntPatch_WLine) wlin (Handle(IntPatch_WLine)::DownCast (L)); //-- faite au cast. gp_Pnt ptbid; gp_Vec d1u,d1v; gp_Pnt2d p2d; @@ -462,8 +462,8 @@ void IntPatch_RstInt::PutVertexOnLine (Handle(IntPatch_Line)& L, Standard_Integer i,j,k; TColgp_SequenceOfPnt locpt; TColgp_SequenceOfPnt2d locpt2; - const Handle(IntPatch_RLine)& rlin = (*((Handle(IntPatch_RLine)*)&L)); //-- aucune verification n est - const Handle(IntPatch_WLine)& wlin = (*((Handle(IntPatch_WLine)*)&L)); //-- faite au cast. + Handle(IntPatch_RLine) rlin (Handle(IntPatch_RLine)::DownCast (L)); //-- aucune verification n est + Handle(IntPatch_WLine) wlin (Handle(IntPatch_WLine)::DownCast (L)); //-- faite au cast. Standard_Integer Nbvtx =0; Standard_Integer Nbptlin =0; Standard_Real tolPLin = Surf->UResolution(Precision::Confusion()); diff --git a/src/IntTools/IntTools_EdgeEdge.cxx b/src/IntTools/IntTools_EdgeEdge.cxx index 580a271736..6f44247662 100644 --- a/src/IntTools/IntTools_EdgeEdge.cxx +++ b/src/IntTools/IntTools_EdgeEdge.cxx @@ -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; diff --git a/src/IntTools/IntTools_FaceFace.cxx b/src/IntTools/IntTools_FaceFace.cxx index 40cebc23b5..07854603a2 100644 --- a/src/IntTools/IntTools_FaceFace.cxx +++ b/src/IntTools/IntTools_FaceFace.cxx @@ -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); // diff --git a/src/LocOpe/LocOpe_FindEdges.cxx b/src/LocOpe/LocOpe_FindEdges.cxx index ffb99f0c34..4c0237b909 100644 --- a/src/LocOpe/LocOpe_FindEdges.cxx +++ b/src/LocOpe/LocOpe_FindEdges.cxx @@ -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; diff --git a/src/LocOpe/LocOpe_Generator.cxx b/src/LocOpe/LocOpe_Generator.cxx index d2088d5840..4afda272f7 100644 --- a/src/LocOpe/LocOpe_Generator.cxx +++ b/src/LocOpe/LocOpe_Generator.cxx @@ -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()); diff --git a/src/LocOpe/LocOpe_Spliter.cxx b/src/LocOpe/LocOpe_Spliter.cxx index 5a4b757dd5..51d1585a69 100644 --- a/src/LocOpe/LocOpe_Spliter.cxx +++ b/src/LocOpe/LocOpe_Spliter.cxx @@ -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) { diff --git a/src/LocOpe/LocOpe_WiresOnShape.cxx b/src/LocOpe/LocOpe_WiresOnShape.cxx index 013428bcdc..edc1af194a 100644 --- a/src/LocOpe/LocOpe_WiresOnShape.cxx +++ b/src/LocOpe/LocOpe_WiresOnShape.cxx @@ -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)) { diff --git a/src/PCDM/PCDM.cxx b/src/PCDM/PCDM.cxx index 0fec97ca60..a9ff522008 100644 --- a/src/PCDM/PCDM.cxx +++ b/src/PCDM/PCDM.cxx @@ -71,7 +71,7 @@ Handle(Storage_Schema) PCDM::Schema(const TCollection_ExtendedString& aSchemaNam Standard_NoSuchObject::Raise(aMsg); } Handle(Standard_Transient) t = Plugin::Load(UTL::GUID(UTL::Value(r,aSchemaName))); - return *((Handle(Storage_Schema)*)&t); + return Handle(Storage_Schema)::DownCast (t); } diff --git a/src/PCDM/PCDM_RetrievalDriver.cxx b/src/PCDM/PCDM_RetrievalDriver.cxx index c019708001..6bd0395f04 100644 --- a/src/PCDM/PCDM_RetrievalDriver.cxx +++ b/src/PCDM/PCDM_RetrievalDriver.cxx @@ -173,7 +173,7 @@ void PCDM_RetrievalDriver::Read(const TCollection_ExtendedString& theFileName, Standard_Failure::Raise(aMsg); } Handle(Standard_Persistent) theObject=theDocument->Object(); - Handle(PCDM_Document) thePDocument = *((Handle(PCDM_Document)*)&theObject); + Handle(PCDM_Document) thePDocument = Handle(PCDM_Document)::DownCast (theObject); { diff --git a/src/Prs3d/Prs3d_ShapeTool.cxx b/src/Prs3d/Prs3d_ShapeTool.cxx index cb67429d5b..96feda1158 100644 --- a/src/Prs3d/Prs3d_ShapeTool.cxx +++ b/src/Prs3d/Prs3d_ShapeTool.cxx @@ -146,7 +146,7 @@ Standard_Boolean Prs3d_ShapeTool::IsPlanarFace() const if (TheType == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) { Handle(Geom_RectangularTrimmedSurface) - RTS = *((Handle(Geom_RectangularTrimmedSurface)*)&S); + RTS = Handle(Geom_RectangularTrimmedSurface)::DownCast (S); TheType = RTS->BasisSurface()->DynamicType(); } return (TheType == STANDARD_TYPE(Geom_Plane)); diff --git a/src/PrsMgr/PrsMgr_Presentation.cxx b/src/PrsMgr/PrsMgr_Presentation.cxx index 33d6c609fa..8514341f80 100644 --- a/src/PrsMgr/PrsMgr_Presentation.cxx +++ b/src/PrsMgr/PrsMgr_Presentation.cxx @@ -307,7 +307,7 @@ void PrsMgr_Presentation::Compute (const Handle(Graphic3d_DataStructureManager)& const Handle(Graphic3d_Structure)& theStructToFill) { theStructToFill->Clear(); - const Handle(Prs3d_Presentation)& aPrs = *((Handle(Prs3d_Presentation)* )&theStructToFill); + Handle(Prs3d_Presentation) aPrs (Handle(Prs3d_Presentation)::DownCast (theStructToFill)); myPresentableObject->Compute (Projector (theProjector), aPrs); } @@ -356,7 +356,7 @@ void PrsMgr_Presentation::Compute (const Handle(Graphic3d_DataStructureManager)& const Handle(Graphic3d_Structure)& theStructToFill) { // recompute HLR after transformation in all the case - Handle(Prs3d_Presentation) aPrs = *((Handle(Prs3d_Presentation)*)&theStructToFill); + Handle(Prs3d_Presentation) aPrs = Handle(Prs3d_Presentation)::DownCast (theStructToFill); theStructToFill->Clear(); myPresentableObject->Compute (Projector (theProjector), theTrsf, aPrs); } @@ -367,7 +367,7 @@ void PrsMgr_Presentation::Compute (const Handle(Graphic3d_DataStructureManager)& //======================================================================= Handle(Prs3d_Projector) PrsMgr_Presentation::Projector (const Handle(Graphic3d_DataStructureManager)& theProjector) { - const Handle(Graphic3d_Camera)& aCamera = Handle(Visual3d_View)::DownCast (theProjector)->Camera(); + Handle(Graphic3d_Camera) aCamera (Handle(Visual3d_View)::DownCast (theProjector)->Camera()); const gp_Dir aDir = aCamera->Direction().Reversed(); const gp_Pnt anAt = aCamera->Center(); const gp_Dir anUp = aCamera->Up(); diff --git a/src/QABugs/QABugs_1.cxx b/src/QABugs/QABugs_1.cxx index def28eaa62..c5644ca91a 100644 --- a/src/QABugs/QABugs_1.cxx +++ b/src/QABugs/QABugs_1.cxx @@ -325,7 +325,7 @@ static Standard_Integer OCC10bug (Draw_Interpretor& di, Standard_Integer argc, c // un AIS_PlaneTrihedron if (aShape->Type()==AIS_KOI_Datum && aShape->Signature()==4) { // On downcast aShape de AIS_InteractiveObject a AIS_PlaneTrihedron - theAISPlaneTri = *(Handle(AIS_PlaneTrihedron)*) &aShape; + theAISPlaneTri = Handle(AIS_PlaneTrihedron)::DownCast (aShape); theAISPlaneTri->SetLength(Length); diff --git a/src/QABugs/QABugs_16.cxx b/src/QABugs/QABugs_16.cxx index 852a840420..ce65c74798 100644 --- a/src/QABugs/QABugs_16.cxx +++ b/src/QABugs/QABugs_16.cxx @@ -290,7 +290,7 @@ static Standard_Integer OCC218bug (Draw_Interpretor& di, Standard_Integer argc, // un AIS_PlaneTrihedron if (aShape->Type()==AIS_KOI_Datum && aShape->Signature()==4) { // On downcast aShape de AIS_InteractiveObject a AIS_PlaneTrihedron - theAISPlaneTri = *(Handle(AIS_PlaneTrihedron)*) &aShape; + theAISPlaneTri = Handle(AIS_PlaneTrihedron)::DownCast (aShape); theAISPlaneTri->SetXLabel(Xlabel); theAISPlaneTri->SetYLabel(Ylabel); diff --git a/src/RWStepAP214/RWStepAP214_GeneralModule.cxx b/src/RWStepAP214/RWStepAP214_GeneralModule.cxx index 5f89ee2a05..e263b228f6 100644 --- a/src/RWStepAP214/RWStepAP214_GeneralModule.cxx +++ b/src/RWStepAP214/RWStepAP214_GeneralModule.cxx @@ -18,7 +18,7 @@ #include //#define DeclareAndCast(atype,result,start) \ NON car Name -// Handle(atype) result = *((Handle(atype)*) &start) +// Handle(atype) result = Handle(atype)::DownCast (start) #include #include diff --git a/src/RWStepAP214/RWStepAP214_ReadWriteModule.cxx b/src/RWStepAP214/RWStepAP214_ReadWriteModule.cxx index 4cd96cea7c..0255255cdc 100644 --- a/src/RWStepAP214/RWStepAP214_ReadWriteModule.cxx +++ b/src/RWStepAP214/RWStepAP214_ReadWriteModule.cxx @@ -25,7 +25,7 @@ #define DeclareAndCast(atype,result,start) \ -Handle(atype) result = *((Handle(atype)*) &start) +Handle(atype) result = Handle(atype)::DownCast (start) #include #include diff --git a/src/SelectMgr/SelectMgr_SelectionManager.cxx b/src/SelectMgr/SelectMgr_SelectionManager.cxx index 1138f572bf..4e7c93ea32 100644 --- a/src/SelectMgr/SelectMgr_SelectionManager.cxx +++ b/src/SelectMgr/SelectMgr_SelectionManager.cxx @@ -491,7 +491,7 @@ Standard_Boolean SelectMgr_SelectionManager::IsActivated (const Handle(SelectMgr { for (TColStd_MapIteratorOfMapOfTransient aSelectorIter (mySelectors); aSelectorIter.More(); aSelectorIter.Next()) { - const Handle(SelectMgr_ViewerSelector)& aSelector = Handle(SelectMgr_ViewerSelector)::DownCast (aSelectorIter.Key()); + Handle(SelectMgr_ViewerSelector) aSelector (Handle(SelectMgr_ViewerSelector)::DownCast (aSelectorIter.Key())); if (aSelector->Status (aSelection) == SelectMgr_SOS_Activated) return Standard_True; } @@ -692,7 +692,7 @@ void SelectMgr_SelectionManager::RecomputeSelection (const Handle(SelectMgr_Sele for (TColStd_MapIteratorOfMapOfTransient aSelectorIter (mySelectors); aSelectorIter.More(); aSelectorIter.Next()) { - const Handle(SelectMgr_ViewerSelector)& aCurSelector = Handle(SelectMgr_ViewerSelector)::DownCast (aSelectorIter.Key()); + Handle(SelectMgr_ViewerSelector) aCurSelector (Handle(SelectMgr_ViewerSelector)::DownCast (aSelectorIter.Key())); if (aCurSelector->Status (aSelection) == SelectMgr_SOS_Activated) { ClearSelectionStructures (theObject, aSelMode, aCurSelector); @@ -747,7 +747,7 @@ void SelectMgr_SelectionManager::Update (const Handle(SelectMgr_SelectableObject for (TColStd_MapIteratorOfMapOfTransient aSelectorIter (mySelectors); aSelectorIter.More(); aSelectorIter.Next()) { - const Handle(SelectMgr_ViewerSelector)& aSelector = Handle(SelectMgr_ViewerSelector)::DownCast (aSelectorIter.Key()); + Handle(SelectMgr_ViewerSelector) aSelector (Handle(SelectMgr_ViewerSelector)::DownCast (aSelectorIter.Key())); Update (theObject, aSelector, Standard_False); } } diff --git a/src/SelectMgr/SelectMgr_SensitiveEntitySet.cxx b/src/SelectMgr/SelectMgr_SensitiveEntitySet.cxx index 32326e0cbc..0b8bfd30b3 100644 --- a/src/SelectMgr/SelectMgr_SensitiveEntitySet.cxx +++ b/src/SelectMgr/SelectMgr_SensitiveEntitySet.cxx @@ -106,8 +106,7 @@ Standard_Real SelectMgr_SensitiveEntitySet::Center (const Standard_Integer theIn { const Handle(SelectBasics_SensitiveEntity)& aBasicEntity = GetSensitiveById (theIndex)->BaseSensitive(); - const Handle(Select3D_SensitiveEntity)& aSensitive = - Handle(Select3D_SensitiveEntity)::DownCast (aBasicEntity); + Handle(Select3D_SensitiveEntity) aSensitive (Handle(Select3D_SensitiveEntity)::DownCast (aBasicEntity)); const gp_Pnt aCenter = aSensitive->CenterOfGeometry(); Standard_Real aCenterCoord = 0.0; aCenterCoord = theAxis == 0 ? aCenter.X() : diff --git a/src/SelectMgr/SelectMgr_ViewerSelector.cxx b/src/SelectMgr/SelectMgr_ViewerSelector.cxx index 5b41ac7aec..d264e443a7 100644 --- a/src/SelectMgr/SelectMgr_ViewerSelector.cxx +++ b/src/SelectMgr/SelectMgr_ViewerSelector.cxx @@ -264,8 +264,7 @@ void SelectMgr_ViewerSelector::checkOverlap (const Handle(SelectBasics_Sensitive const Standard_Integer theEntityIdx, SelectMgr_SelectingVolumeManager& theMgr) { - const Handle(SelectMgr_EntityOwner)& anOwner = - Handle(SelectMgr_EntityOwner)::DownCast (theEntity->OwnerId()); + Handle(SelectMgr_EntityOwner) anOwner (Handle(SelectMgr_EntityOwner)::DownCast (theEntity->OwnerId())); SelectBasics_PickResult aPickResult; if (theEntity->Matches (theMgr, aPickResult)) @@ -490,7 +489,7 @@ Handle(SelectMgr_EntityOwner) SelectMgr_ViewerSelector { Standard_Integer RankInMap = myIndexes->Value (myCurRank); const Handle(SelectBasics_EntityOwner)& toto = mystored.FindKey(RankInMap); - Handle(SelectMgr_EntityOwner) Ownr = *((Handle(SelectMgr_EntityOwner)*) &toto); + Handle(SelectMgr_EntityOwner) Ownr = Handle(SelectMgr_EntityOwner)::DownCast (toto); return Ownr; } @@ -521,7 +520,7 @@ Handle(SelectMgr_EntityOwner) SelectMgr_ViewerSelector if(More()){ Standard_Integer RankInMap = myIndexes->Value (myIndexes->Lower()); const Handle(SelectBasics_EntityOwner)& toto = mystored.FindKey(RankInMap); - Handle(SelectMgr_EntityOwner) Ownr = *((Handle(SelectMgr_EntityOwner)*) &toto); + Handle(SelectMgr_EntityOwner) Ownr = Handle(SelectMgr_EntityOwner)::DownCast (toto); return Ownr; } diff --git a/src/ShapeAnalysis/ShapeAnalysis_Curve.cxx b/src/ShapeAnalysis/ShapeAnalysis_Curve.cxx index 54bb54e20d..7062de7ba5 100644 --- a/src/ShapeAnalysis/ShapeAnalysis_Curve.cxx +++ b/src/ShapeAnalysis/ShapeAnalysis_Curve.cxx @@ -776,7 +776,7 @@ static void AppendControlPoles (TColgp_SequenceOfPnt& seq, seq.Append(curve->Value(M_PI)); } else if ( curve->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) { //DeclareAndCast(Geom_TrimmedCurve, Trimmed, curve); - Handle(Geom_TrimmedCurve) Trimmed = *((Handle(Geom_TrimmedCurve) *) &curve); + Handle(Geom_TrimmedCurve) Trimmed = Handle(Geom_TrimmedCurve)::DownCast (curve); // AppendControlPoles(seq,Trimmed->BasisCurve()); Handle(Geom_Curve) aBaseCrv = Trimmed->BasisCurve(); Standard_Boolean done = Standard_False; @@ -811,14 +811,14 @@ static void AppendControlPoles (TColgp_SequenceOfPnt& seq, } } else if ( curve->IsKind(STANDARD_TYPE(Geom_OffsetCurve))) { //DeclareAndCast(Geom_OffsetCurve, OffsetC, curve); - Handle(Geom_OffsetCurve) OffsetC = *((Handle(Geom_OffsetCurve) *) &curve); + Handle(Geom_OffsetCurve) OffsetC = Handle(Geom_OffsetCurve)::DownCast (curve); // AppendControlPoles(seq,OffsetC->BasisCurve()); seq.Append(curve->Value(curve->FirstParameter())); seq.Append(curve->Value((curve->FirstParameter() + curve->LastParameter())/2.)); seq.Append(curve->Value(curve->LastParameter())); } else if ( curve->IsKind(STANDARD_TYPE(Geom_BSplineCurve))) { //DeclareAndCast(Geom_BSplineCurve, BSpline, curve); - Handle(Geom_BSplineCurve) BSpline = *((Handle(Geom_BSplineCurve) *) &curve); + Handle(Geom_BSplineCurve) BSpline = Handle(Geom_BSplineCurve)::DownCast (curve); TColgp_Array1OfPnt Poles(1,BSpline->NbPoles()); BSpline->Poles(Poles); for(Standard_Integer i = 1; i <= BSpline->NbPoles(); i++) @@ -826,7 +826,7 @@ static void AppendControlPoles (TColgp_SequenceOfPnt& seq, } else if ( curve->IsKind(STANDARD_TYPE(Geom_BezierCurve))) { //DeclareAndCast(Geom_BezierCurve, Bezier, curve); //Handle(Geom_BezierCurve) Bezier = Handle(Geom_BezierCurve)::DownCast(curve); - Handle(Geom_BezierCurve) Bezier = *((Handle(Geom_BezierCurve) *) &curve); + Handle(Geom_BezierCurve) Bezier = Handle(Geom_BezierCurve)::DownCast (curve); TColgp_Array1OfPnt Poles(1,Bezier->NbPoles()); Bezier->Poles(Poles); for(Standard_Integer i = 1; i <= Bezier->NbPoles(); i++) @@ -915,7 +915,7 @@ Standard_Boolean ShapeAnalysis_Curve::IsPlanar (const TColgp_Array1OfPnt& pnts, if (curve->IsKind(STANDARD_TYPE(Geom_Line))) { //DeclareAndCast(Geom_Line, Line, curve); - Handle(Geom_Line) Line = *((Handle(Geom_Line) *) &curve); + Handle(Geom_Line) Line = Handle(Geom_Line)::DownCast (curve); gp_XYZ N1 = Line->Position().Direction().XYZ(); if (noNorm) { Normal = GetAnyNormal(N1); @@ -926,7 +926,7 @@ Standard_Boolean ShapeAnalysis_Curve::IsPlanar (const TColgp_Array1OfPnt& pnts, if (curve->IsKind(STANDARD_TYPE(Geom_Conic))) { //DeclareAndCast(Geom_Conic, Conic, curve); - Handle(Geom_Conic) Conic = *((Handle(Geom_Conic) *) &curve); + Handle(Geom_Conic) Conic = Handle(Geom_Conic)::DownCast (curve); gp_XYZ N1 = Conic->Axis().Direction().XYZ(); if (noNorm) { Normal = N1; @@ -938,19 +938,19 @@ Standard_Boolean ShapeAnalysis_Curve::IsPlanar (const TColgp_Array1OfPnt& pnts, if (curve->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) { //DeclareAndCast(Geom_TrimmedCurve, Trimmed, curve); - Handle(Geom_TrimmedCurve) Trimmed = *((Handle(Geom_TrimmedCurve) *) &curve); + Handle(Geom_TrimmedCurve) Trimmed = Handle(Geom_TrimmedCurve)::DownCast (curve); return IsPlanar(Trimmed->BasisCurve(),Normal,precision); } if (curve->IsKind(STANDARD_TYPE(Geom_OffsetCurve))) { //DeclareAndCast(Geom_OffsetCurve, OffsetC, curve); - Handle(Geom_OffsetCurve) OffsetC = *((Handle(Geom_OffsetCurve) *) &curve); + Handle(Geom_OffsetCurve) OffsetC = Handle(Geom_OffsetCurve)::DownCast (curve); return IsPlanar(OffsetC->BasisCurve(),Normal,precision); } if (curve->IsKind(STANDARD_TYPE(Geom_BSplineCurve))) { //DeclareAndCast(Geom_BSplineCurve, BSpline, curve); - Handle(Geom_BSplineCurve) BSpline = *((Handle(Geom_BSplineCurve) *) &curve); + Handle(Geom_BSplineCurve) BSpline = Handle(Geom_BSplineCurve)::DownCast (curve); TColgp_Array1OfPnt Poles(1,BSpline->NbPoles()); BSpline->Poles(Poles); return IsPlanar(Poles,Normal,precision); @@ -958,7 +958,7 @@ Standard_Boolean ShapeAnalysis_Curve::IsPlanar (const TColgp_Array1OfPnt& pnts, if (curve->IsKind(STANDARD_TYPE(Geom_BezierCurve))) { //DeclareAndCast(Geom_BezierCurve, Bezier, curve); - Handle(Geom_BezierCurve) Bezier = *((Handle(Geom_BezierCurve) *) &curve); + Handle(Geom_BezierCurve) Bezier = Handle(Geom_BezierCurve)::DownCast (curve); TColgp_Array1OfPnt Poles(1,Bezier->NbPoles()); Bezier->Poles(Poles); return IsPlanar(Poles,Normal,precision); @@ -966,7 +966,7 @@ Standard_Boolean ShapeAnalysis_Curve::IsPlanar (const TColgp_Array1OfPnt& pnts, if (curve->IsKind(STANDARD_TYPE(ShapeExtend_ComplexCurve))) { //DeclareAndCast(ShapeExtend_ComplexCurve, Complex, curve); - Handle(ShapeExtend_ComplexCurve) Complex = *((Handle(ShapeExtend_ComplexCurve) *) &curve); + Handle(ShapeExtend_ComplexCurve) Complex = Handle(ShapeExtend_ComplexCurve)::DownCast (curve); TColgp_SequenceOfPnt sequence; Standard_Integer i; // svv Jan11 2000 : porting on DEC for (i = 1; i <= Complex->NbCurves(); i++) diff --git a/src/StdSelect/StdSelect_BRepSelectionTool.cxx b/src/StdSelect/StdSelect_BRepSelectionTool.cxx index c214fa81d3..80da39fef9 100644 --- a/src/StdSelect/StdSelect_BRepSelectionTool.cxx +++ b/src/StdSelect/StdSelect_BRepSelectionTool.cxx @@ -81,7 +81,7 @@ void StdSelect_BRepSelectionTool::preBuildBVH (const Handle(SelectMgr_Selection) if (aSensitive->IsInstance ("Select3D_SensitiveGroup")) { - const Handle(Select3D_SensitiveGroup)& aGroup = Handle(Select3D_SensitiveGroup)::DownCast (aSensitive); + Handle(Select3D_SensitiveGroup) aGroup (Handle(Select3D_SensitiveGroup)::DownCast (aSensitive)); const Select3D_EntitySequence& aSubEntities = aGroup->GetEntities(); for (Select3D_EntitySequenceIter aSubEntitiesIter (aSubEntities); aSubEntitiesIter.More(); aSubEntitiesIter.Next()) { diff --git a/src/StdSelect/StdSelect_EdgeFilter.cxx b/src/StdSelect/StdSelect_EdgeFilter.cxx index e984dc56a6..796885b02c 100644 --- a/src/StdSelect/StdSelect_EdgeFilter.cxx +++ b/src/StdSelect/StdSelect_EdgeFilter.cxx @@ -64,7 +64,7 @@ Standard_Boolean StdSelect_EdgeFilter::IsOk(const Handle(SelectMgr_EntityOwner)& { if (Handle(StdSelect_BRepOwner)::DownCast(EO).IsNull()) return Standard_False; - const TopoDS_Shape& sh = ((Handle(StdSelect_BRepOwner)&)EO)->Shape(); + const TopoDS_Shape& sh = Handle(StdSelect_BRepOwner)::DownCast (EO)->Shape(); if(sh.ShapeType()!= TopAbs_EDGE) return Standard_False; switch(mytype){ diff --git a/src/StdSelect/StdSelect_FaceFilter.cxx b/src/StdSelect/StdSelect_FaceFilter.cxx index b913a7eee8..dfef5a0db2 100644 --- a/src/StdSelect/StdSelect_FaceFilter.cxx +++ b/src/StdSelect/StdSelect_FaceFilter.cxx @@ -51,7 +51,7 @@ Standard_Boolean StdSelect_FaceFilter:: IsOk(const Handle(SelectMgr_EntityOwner)& EO) const { if (Handle(StdSelect_BRepOwner)::DownCast(EO).IsNull()) return Standard_False; - const TopoDS_Shape& anobj= ((Handle(StdSelect_BRepOwner)&)EO)->Shape(); + const TopoDS_Shape& anobj= Handle(StdSelect_BRepOwner)::DownCast (EO)->Shape(); if(anobj.ShapeType()!= TopAbs_FACE)return Standard_False; switch(mytype) { case StdSelect_AnyFace: diff --git a/src/StdSelect/StdSelect_ViewerSelector3d.cxx b/src/StdSelect/StdSelect_ViewerSelector3d.cxx index 2493640be7..a645173faf 100644 --- a/src/StdSelect/StdSelect_ViewerSelector3d.cxx +++ b/src/StdSelect/StdSelect_ViewerSelector3d.cxx @@ -517,16 +517,15 @@ void StdSelect_ViewerSelector3d::ComputeSensitivePrs (const Handle(SelectMgr_Sel //========================================================== else if (Ent->DynamicType()==STANDARD_TYPE(Select3D_SensitiveTriangulation)) { - const Handle(Poly_Triangulation)& PT = - (*((Handle(Select3D_SensitiveTriangulation)*) &Ent))->Triangulation(); + Handle(Poly_Triangulation) PT (Handle(Select3D_SensitiveTriangulation)::DownCast (Ent)->Triangulation()); const Poly_Array1OfTriangle& triangles = PT->Triangles(); const TColgp_Array1OfPnt& Nodes = PT->Nodes(); Standard_Integer n[3]; TopLoc_Location iloc, bidloc; - if ((*((Handle(Select3D_SensitiveTriangulation)*) &Ent))->HasInitLocation()) - bidloc = (*((Handle(Select3D_SensitiveTriangulation)*) &Ent))->GetInitLocation(); + if (Handle(Select3D_SensitiveTriangulation)::DownCast (Ent)->HasInitLocation()) + bidloc = Handle(Select3D_SensitiveTriangulation)::DownCast (Ent)->GetInitLocation(); if (bidloc.IsIdentity()) iloc = theLoc; diff --git a/src/StepToGeom/StepToGeom_MakeBoundedCurve.cxx b/src/StepToGeom/StepToGeom_MakeBoundedCurve.cxx index 5588b0e9e3..7780d1fd0f 100644 --- a/src/StepToGeom/StepToGeom_MakeBoundedCurve.cxx +++ b/src/StepToGeom/StepToGeom_MakeBoundedCurve.cxx @@ -49,16 +49,16 @@ Standard_Boolean StepToGeom_MakeBoundedCurve::Convert if (SC->IsKind(STANDARD_TYPE(StepGeom_BSplineCurveWithKnotsAndRationalBSplineCurve))) { const Handle(StepGeom_BSplineCurveWithKnotsAndRationalBSplineCurve) Bspli = Handle(StepGeom_BSplineCurveWithKnotsAndRationalBSplineCurve)::DownCast(SC); - return StepToGeom_MakeBSplineCurve::Convert(Bspli,*((Handle(Geom_BSplineCurve)*)&CC)); + return StepToGeom_MakeBSplineCurve::Convert(Bspli,Handle(Geom_BSplineCurve)::DownCast (CC)); } if (SC->IsKind(STANDARD_TYPE(StepGeom_BSplineCurveWithKnots))) { const Handle(StepGeom_BSplineCurveWithKnots) Bspli = Handle(StepGeom_BSplineCurveWithKnots)::DownCast(SC); - return StepToGeom_MakeBSplineCurve::Convert(Bspli,*((Handle(Geom_BSplineCurve)*)&CC)); + return StepToGeom_MakeBSplineCurve::Convert(Bspli,Handle(Geom_BSplineCurve)::DownCast (CC)); } if (SC->IsKind(STANDARD_TYPE(StepGeom_TrimmedCurve))) { const Handle(StepGeom_TrimmedCurve) L = Handle(StepGeom_TrimmedCurve)::DownCast(SC); - return StepToGeom_MakeTrimmedCurve::Convert(L,*((Handle(Geom_TrimmedCurve)*)&CC)); + return StepToGeom_MakeTrimmedCurve::Convert(L,Handle(Geom_TrimmedCurve)::DownCast (CC)); } // STEP BezierCurve, UniformCurve and QuasiUniformCurve are transformed into // STEP BSplineCurve before being mapped onto CAS.CADE/SF @@ -82,7 +82,7 @@ Standard_Boolean StepToGeom_MakeBoundedCurve::Convert Knots->SetValue(2, 1.); BSPL->SetKnotMultiplicities(Kmult); BSPL->SetKnots(Knots); - return StepToGeom_MakeBSplineCurve::Convert(BSPL,*((Handle(Geom_BSplineCurve)*)&CC)); + return StepToGeom_MakeBSplineCurve::Convert(BSPL,Handle(Geom_BSplineCurve)::DownCast (CC)); } if (SC->IsKind(STANDARD_TYPE(StepGeom_UniformCurve))) { const Handle(StepGeom_UniformCurve) UC = Handle(StepGeom_UniformCurve)::DownCast(SC); @@ -105,7 +105,7 @@ Standard_Boolean StepToGeom_MakeBoundedCurve::Convert } BSPL->SetKnotMultiplicities(Kmult); BSPL->SetKnots(Knots); - return StepToGeom_MakeBSplineCurve::Convert(BSPL,*((Handle(Geom_BSplineCurve)*)&CC)); + return StepToGeom_MakeBSplineCurve::Convert(BSPL,Handle(Geom_BSplineCurve)::DownCast (CC)); } if (SC->IsKind(STANDARD_TYPE(StepGeom_QuasiUniformCurve))) { const Handle(StepGeom_QuasiUniformCurve) QUC = @@ -131,7 +131,7 @@ Standard_Boolean StepToGeom_MakeBoundedCurve::Convert Kmult->SetValue(nbK, BSPL->Degree() + 1); BSPL->SetKnotMultiplicities(Kmult); BSPL->SetKnots(Knots); - return StepToGeom_MakeBSplineCurve::Convert(BSPL,*((Handle(Geom_BSplineCurve)*)&CC)); + return StepToGeom_MakeBSplineCurve::Convert(BSPL,Handle(Geom_BSplineCurve)::DownCast (CC)); } if (SC->IsKind(STANDARD_TYPE(StepGeom_UniformCurveAndRationalBSplineCurve))) { const Handle(StepGeom_UniformCurveAndRationalBSplineCurve) RUC = @@ -153,7 +153,7 @@ Standard_Boolean StepToGeom_MakeBoundedCurve::Convert RBSPL->Init(RUC->Name(), aDegree, RUC->ControlPointsList(), RUC->CurveForm(), RUC->ClosedCurve(), RUC->SelfIntersect(), Kmult, Knots, StepGeom_ktUnspecified, RUC->WeightsData()); - return StepToGeom_MakeBSplineCurve::Convert(RBSPL,*((Handle(Geom_BSplineCurve)*)&CC)); + return StepToGeom_MakeBSplineCurve::Convert(RBSPL,Handle(Geom_BSplineCurve)::DownCast (CC)); } if (SC->IsKind(STANDARD_TYPE(StepGeom_QuasiUniformCurveAndRationalBSplineCurve))) { const Handle(StepGeom_QuasiUniformCurveAndRationalBSplineCurve) RQUC = @@ -177,11 +177,11 @@ Standard_Boolean StepToGeom_MakeBoundedCurve::Convert RBSPL->Init(RQUC->Name(), aDegree, RQUC->ControlPointsList(), RQUC->CurveForm(), RQUC->ClosedCurve(), RQUC->SelfIntersect(), Kmult, Knots, StepGeom_ktUnspecified, RQUC->WeightsData()); - return StepToGeom_MakeBSplineCurve::Convert(RBSPL,*((Handle(Geom_BSplineCurve)*)&CC)); + return StepToGeom_MakeBSplineCurve::Convert(RBSPL,Handle(Geom_BSplineCurve)::DownCast (CC)); } if (SC->IsKind(STANDARD_TYPE(StepGeom_Polyline))) { //:n6 abv 15 Feb 99 const Handle(StepGeom_Polyline) PL = Handle(StepGeom_Polyline)::DownCast (SC); - return StepToGeom_MakePolyline::Convert(PL,*((Handle(Geom_BSplineCurve)*)&CC)); + return StepToGeom_MakePolyline::Convert(PL,Handle(Geom_BSplineCurve)::DownCast (CC)); } return Standard_False; } diff --git a/src/StepToGeom/StepToGeom_MakeBoundedCurve2d.cxx b/src/StepToGeom/StepToGeom_MakeBoundedCurve2d.cxx index 1fb976ffa8..68b96e4618 100644 --- a/src/StepToGeom/StepToGeom_MakeBoundedCurve2d.cxx +++ b/src/StepToGeom/StepToGeom_MakeBoundedCurve2d.cxx @@ -35,20 +35,20 @@ Standard_Boolean StepToGeom_MakeBoundedCurve2d::Convert (const Handle(StepGeom_B if (SC->IsKind(STANDARD_TYPE(StepGeom_BSplineCurveWithKnotsAndRationalBSplineCurve))) { const Handle(StepGeom_BSplineCurveWithKnotsAndRationalBSplineCurve) Bspli = Handle(StepGeom_BSplineCurveWithKnotsAndRationalBSplineCurve)::DownCast(SC); - return StepToGeom_MakeBSplineCurve2d::Convert(Bspli,*((Handle(Geom2d_BSplineCurve)*)&CC)); + return StepToGeom_MakeBSplineCurve2d::Convert(Bspli,Handle(Geom2d_BSplineCurve)::DownCast (CC)); } if (SC->IsKind(STANDARD_TYPE(StepGeom_BSplineCurveWithKnots))) { const Handle(StepGeom_BSplineCurveWithKnots) Bspli = Handle(StepGeom_BSplineCurveWithKnots)::DownCast(SC); - return StepToGeom_MakeBSplineCurve2d::Convert(Bspli,*((Handle(Geom2d_BSplineCurve)*)&CC)); + return StepToGeom_MakeBSplineCurve2d::Convert(Bspli,Handle(Geom2d_BSplineCurve)::DownCast (CC)); } if (SC->IsKind(STANDARD_TYPE(StepGeom_TrimmedCurve))) { const Handle(StepGeom_TrimmedCurve) TC = Handle(StepGeom_TrimmedCurve)::DownCast(SC); - return StepToGeom_MakeTrimmedCurve2d::Convert(TC,*((Handle(Geom2d_BSplineCurve)*)&CC)); + return StepToGeom_MakeTrimmedCurve2d::Convert(TC,Handle(Geom2d_BSplineCurve)::DownCast (CC)); } if (SC->IsKind(STANDARD_TYPE(StepGeom_Polyline))) { //:n6 abv 15 Feb 99 const Handle(StepGeom_Polyline) PL = Handle(StepGeom_Polyline)::DownCast(SC); - return StepToGeom_MakePolyline2d::Convert(PL,*((Handle(Geom2d_BSplineCurve)*)&CC)); + return StepToGeom_MakePolyline2d::Convert(PL,Handle(Geom2d_BSplineCurve)::DownCast (CC)); } return Standard_False; } diff --git a/src/StepToGeom/StepToGeom_MakeBoundedSurface.cxx b/src/StepToGeom/StepToGeom_MakeBoundedSurface.cxx index a0ee4cb35d..99528ebbb5 100644 --- a/src/StepToGeom/StepToGeom_MakeBoundedSurface.cxx +++ b/src/StepToGeom/StepToGeom_MakeBoundedSurface.cxx @@ -52,17 +52,17 @@ Standard_Boolean StepToGeom_MakeBoundedSurface::Convert (const Handle(StepGeom_B if (SS->IsKind(STANDARD_TYPE(StepGeom_BSplineSurfaceWithKnotsAndRationalBSplineSurface))) { const Handle(StepGeom_BSplineSurfaceWithKnotsAndRationalBSplineSurface) BS = Handle(StepGeom_BSplineSurfaceWithKnotsAndRationalBSplineSurface)::DownCast(SS); - return StepToGeom_MakeBSplineSurface::Convert(BS,*((Handle(Geom_BSplineSurface)*)&CS)); + return StepToGeom_MakeBSplineSurface::Convert(BS,Handle(Geom_BSplineSurface)::DownCast (CS)); } if (SS->IsKind(STANDARD_TYPE(StepGeom_BSplineSurfaceWithKnots))) { const Handle(StepGeom_BSplineSurfaceWithKnots) BS = Handle(StepGeom_BSplineSurfaceWithKnots)::DownCast(SS); - return StepToGeom_MakeBSplineSurface::Convert(BS,*((Handle(Geom_BSplineSurface)*)&CS)); + return StepToGeom_MakeBSplineSurface::Convert(BS,Handle(Geom_BSplineSurface)::DownCast (CS)); } if (SS->IsKind(STANDARD_TYPE(StepGeom_RectangularTrimmedSurface))) { const Handle(StepGeom_RectangularTrimmedSurface) Sur = Handle(StepGeom_RectangularTrimmedSurface)::DownCast(SS); - return StepToGeom_MakeRectangularTrimmedSurface::Convert(Sur,*((Handle(Geom_RectangularTrimmedSurface)*)&CS)); + return StepToGeom_MakeRectangularTrimmedSurface::Convert(Sur,Handle(Geom_RectangularTrimmedSurface)::DownCast (CS)); } // STEP BezierSurface, UniformSurface and QuasiUniformSurface are transformed // into STEP BSplineSurface before being mapped onto CAS.CADE/SF @@ -93,7 +93,7 @@ Standard_Boolean StepToGeom_MakeBoundedSurface::Convert (const Handle(StepGeom_B BSPL->SetVMultiplicities(VKmult); BSPL->SetUKnots(UKnots); BSPL->SetVKnots(VKnots); - return StepToGeom_MakeBSplineSurface::Convert(BSPL,*((Handle(Geom_BSplineSurface)*)&CS)); + return StepToGeom_MakeBSplineSurface::Convert(BSPL,Handle(Geom_BSplineSurface)::DownCast (CS)); } if (SS->IsKind(STANDARD_TYPE(StepGeom_UniformSurface))) { const Handle(StepGeom_UniformSurface) US = Handle(StepGeom_UniformSurface)::DownCast(SS); @@ -125,7 +125,7 @@ Standard_Boolean StepToGeom_MakeBoundedSurface::Convert (const Handle(StepGeom_B } BSPL->SetVMultiplicities(VKmult); BSPL->SetVKnots(VKnots); - return StepToGeom_MakeBSplineSurface::Convert(BSPL,*((Handle(Geom_BSplineSurface)*)&CS)); + return StepToGeom_MakeBSplineSurface::Convert(BSPL,Handle(Geom_BSplineSurface)::DownCast (CS)); } if (SS->IsKind(STANDARD_TYPE(StepGeom_QuasiUniformSurface))) { const Handle(StepGeom_QuasiUniformSurface) QUS = @@ -162,7 +162,7 @@ Standard_Boolean StepToGeom_MakeBoundedSurface::Convert (const Handle(StepGeom_B VKmult->SetValue(nbKV, BSPL->VDegree() + 1); BSPL->SetVMultiplicities(VKmult); BSPL->SetVKnots(VKnots); - return StepToGeom_MakeBSplineSurface::Convert(BSPL,*((Handle(Geom_BSplineSurface)*)&CS)); + return StepToGeom_MakeBSplineSurface::Convert(BSPL,Handle(Geom_BSplineSurface)::DownCast (CS)); } if (SS->IsKind(STANDARD_TYPE(StepGeom_UniformSurfaceAndRationalBSplineSurface))) { const Handle(StepGeom_UniformSurfaceAndRationalBSplineSurface) RUS = @@ -191,7 +191,7 @@ Standard_Boolean StepToGeom_MakeBoundedSurface::Convert (const Handle(StepGeom_B RUS->UClosed(), RUS->VClosed(), RUS->SelfIntersect(), UKmult, VKmult, UKnots, VKnots, StepGeom_ktUnspecified, RUS->WeightsData()); - return StepToGeom_MakeBSplineSurface::Convert(RBSPL,*((Handle(Geom_BSplineSurface)*)&CS)); + return StepToGeom_MakeBSplineSurface::Convert(RBSPL,Handle(Geom_BSplineSurface)::DownCast (CS)); } if (SS->IsKind(STANDARD_TYPE(StepGeom_QuasiUniformSurfaceAndRationalBSplineSurface))) { const Handle(StepGeom_QuasiUniformSurfaceAndRationalBSplineSurface) RQUS = @@ -223,7 +223,7 @@ Standard_Boolean StepToGeom_MakeBoundedSurface::Convert (const Handle(StepGeom_B RQUS->SurfaceForm(), RQUS->UClosed(), RQUS->VClosed(), RQUS->SelfIntersect(), UKmult, VKmult, UKnots, VKnots, StepGeom_ktUnspecified, RQUS->WeightsData()); - return StepToGeom_MakeBSplineSurface::Convert(RBSPL,*((Handle(Geom_BSplineSurface)*)&CS)); + return StepToGeom_MakeBSplineSurface::Convert(RBSPL,Handle(Geom_BSplineSurface)::DownCast (CS)); } /* //:S4136: ass-tol2.stp #9861 // UPDATE FMA 15-03-96 diff --git a/src/StepToGeom/StepToGeom_MakeConic.cxx b/src/StepToGeom/StepToGeom_MakeConic.cxx index dd46f5c048..9051eb59bc 100644 --- a/src/StepToGeom/StepToGeom_MakeConic.cxx +++ b/src/StepToGeom/StepToGeom_MakeConic.cxx @@ -37,19 +37,19 @@ Standard_Boolean StepToGeom_MakeConic::Convert { if (SC->IsKind(STANDARD_TYPE(StepGeom_Circle))) { const Handle(StepGeom_Circle) Cir = Handle(StepGeom_Circle)::DownCast(SC); - return StepToGeom_MakeCircle::Convert(Cir,*((Handle(Geom_Circle)*)&CC)); + return StepToGeom_MakeCircle::Convert(Cir,Handle(Geom_Circle)::DownCast (CC)); } if (SC->IsKind(STANDARD_TYPE(StepGeom_Ellipse))) { const Handle(StepGeom_Ellipse) Ell = Handle(StepGeom_Ellipse)::DownCast(SC); - return StepToGeom_MakeEllipse::Convert(Ell,*((Handle(Geom_Ellipse)*)&CC)); + return StepToGeom_MakeEllipse::Convert(Ell,Handle(Geom_Ellipse)::DownCast (CC)); } if (SC->IsKind(STANDARD_TYPE(StepGeom_Hyperbola))) { const Handle(StepGeom_Hyperbola) Hyp = Handle(StepGeom_Hyperbola)::DownCast(SC); - return StepToGeom_MakeHyperbola::Convert(Hyp,*((Handle(Geom_Hyperbola)*)&CC)); + return StepToGeom_MakeHyperbola::Convert(Hyp,Handle(Geom_Hyperbola)::DownCast (CC)); } if (SC->IsKind(STANDARD_TYPE(StepGeom_Parabola))) { const Handle(StepGeom_Parabola) Par = Handle(StepGeom_Parabola)::DownCast(SC); - return StepToGeom_MakeParabola::Convert(Par,*((Handle(Geom_Parabola)*)&CC)); + return StepToGeom_MakeParabola::Convert(Par,Handle(Geom_Parabola)::DownCast (CC)); } // Attention : Other conic shall be implemented ! return Standard_False; diff --git a/src/StepToGeom/StepToGeom_MakeConic2d.cxx b/src/StepToGeom/StepToGeom_MakeConic2d.cxx index e02d53522e..4384fad889 100644 --- a/src/StepToGeom/StepToGeom_MakeConic2d.cxx +++ b/src/StepToGeom/StepToGeom_MakeConic2d.cxx @@ -37,19 +37,19 @@ Standard_Boolean StepToGeom_MakeConic2d::Convert { if (SC->IsKind(STANDARD_TYPE(StepGeom_Circle))) { const Handle(StepGeom_Circle) Cir = Handle(StepGeom_Circle)::DownCast(SC); - return StepToGeom_MakeCircle2d::Convert(Cir,*((Handle(Geom2d_Circle)*)&CC)); + return StepToGeom_MakeCircle2d::Convert(Cir,Handle(Geom2d_Circle)::DownCast (CC)); } if (SC->IsKind(STANDARD_TYPE(StepGeom_Ellipse))) { const Handle(StepGeom_Ellipse) Ell = Handle(StepGeom_Ellipse)::DownCast(SC); - return StepToGeom_MakeEllipse2d::Convert(Ell,*((Handle(Geom2d_Ellipse)*)&CC)); + return StepToGeom_MakeEllipse2d::Convert(Ell,Handle(Geom2d_Ellipse)::DownCast (CC)); } if (SC->IsKind(STANDARD_TYPE(StepGeom_Hyperbola))) { const Handle(StepGeom_Hyperbola) Hyp = Handle(StepGeom_Hyperbola)::DownCast(SC); - return StepToGeom_MakeHyperbola2d::Convert(Hyp,*((Handle(Geom2d_Hyperbola)*)&CC)); + return StepToGeom_MakeHyperbola2d::Convert(Hyp,Handle(Geom2d_Hyperbola)::DownCast (CC)); } if (SC->IsKind(STANDARD_TYPE(StepGeom_Parabola))) { const Handle(StepGeom_Parabola) Par = Handle(StepGeom_Parabola)::DownCast(SC); - return StepToGeom_MakeParabola2d::Convert(Par,*((Handle(Geom2d_Parabola)*)&CC)); + return StepToGeom_MakeParabola2d::Convert(Par,Handle(Geom2d_Parabola)::DownCast (CC)); } // Attention : Other conic shall be implemented ! return Standard_False; diff --git a/src/StepToGeom/StepToGeom_MakeCurve.cxx b/src/StepToGeom/StepToGeom_MakeCurve.cxx index fbef671e8d..71d960473b 100644 --- a/src/StepToGeom/StepToGeom_MakeCurve.cxx +++ b/src/StepToGeom/StepToGeom_MakeCurve.cxx @@ -53,19 +53,19 @@ Standard_Boolean StepToGeom_MakeCurve::Convert (const Handle(StepGeom_Curve)& SC } if (SC->IsKind(STANDARD_TYPE(StepGeom_Line))) { const Handle(StepGeom_Line) L = Handle(StepGeom_Line)::DownCast(SC); - return StepToGeom_MakeLine::Convert(L,*((Handle(Geom_Line)*)&CC)); + return StepToGeom_MakeLine::Convert(L,Handle(Geom_Line)::DownCast (CC)); } if (SC->IsKind(STANDARD_TYPE(StepGeom_TrimmedCurve))) { const Handle(StepGeom_TrimmedCurve) TC = Handle(StepGeom_TrimmedCurve)::DownCast(SC); - return StepToGeom_MakeTrimmedCurve::Convert(TC,*((Handle(Geom_TrimmedCurve)*)&CC)); + return StepToGeom_MakeTrimmedCurve::Convert(TC,Handle(Geom_TrimmedCurve)::DownCast (CC)); } if (SC->IsKind(STANDARD_TYPE(StepGeom_Conic))) { const Handle(StepGeom_Conic) CO = Handle(StepGeom_Conic)::DownCast(SC); - return StepToGeom_MakeConic::Convert(CO,*((Handle(Geom_Conic)*)&CC)); + return StepToGeom_MakeConic::Convert(CO,Handle(Geom_Conic)::DownCast (CC)); } if (SC->IsKind(STANDARD_TYPE(StepGeom_BoundedCurve))) { const Handle(StepGeom_BoundedCurve) BC = Handle(StepGeom_BoundedCurve)::DownCast(SC); - return StepToGeom_MakeBoundedCurve::Convert(BC,*((Handle(Geom_BoundedCurve)*)&CC)); + return StepToGeom_MakeBoundedCurve::Convert(BC,Handle(Geom_BoundedCurve)::DownCast (CC)); } if (SC->IsKind(STANDARD_TYPE(StepGeom_CurveReplica))) { //:n7 abv 16 Feb 99 const Handle(StepGeom_CurveReplica) CR = Handle(StepGeom_CurveReplica)::DownCast(SC); diff --git a/src/StepToGeom/StepToGeom_MakeCurve2d.cxx b/src/StepToGeom/StepToGeom_MakeCurve2d.cxx index 112a3366ac..1e989dde51 100644 --- a/src/StepToGeom/StepToGeom_MakeCurve2d.cxx +++ b/src/StepToGeom/StepToGeom_MakeCurve2d.cxx @@ -43,15 +43,15 @@ Standard_Boolean StepToGeom_MakeCurve2d::Convert (const Handle(StepGeom_Curve)& { if (SC->IsKind(STANDARD_TYPE(StepGeom_Line))) { const Handle(StepGeom_Line) L = Handle(StepGeom_Line)::DownCast(SC); - return StepToGeom_MakeLine2d::Convert(L,*((Handle(Geom2d_Line)*)&CC)); + return StepToGeom_MakeLine2d::Convert(L,Handle(Geom2d_Line)::DownCast (CC)); } if (SC->IsKind(STANDARD_TYPE(StepGeom_Conic))) { const Handle(StepGeom_Conic) L = Handle(StepGeom_Conic)::DownCast(SC); - return StepToGeom_MakeConic2d::Convert(L,*((Handle(Geom2d_Conic)*)&CC)); + return StepToGeom_MakeConic2d::Convert(L,Handle(Geom2d_Conic)::DownCast (CC)); } if (SC->IsKind(STANDARD_TYPE(StepGeom_BoundedCurve))) { const Handle(StepGeom_BoundedCurve) L = Handle(StepGeom_BoundedCurve)::DownCast(SC); - return StepToGeom_MakeBoundedCurve2d::Convert(L,*((Handle(Geom2d_BoundedCurve)*)&CC)); + return StepToGeom_MakeBoundedCurve2d::Convert(L,Handle(Geom2d_BoundedCurve)::DownCast (CC)); } if (SC->IsKind(STANDARD_TYPE(StepGeom_CurveReplica))) { //:n7 abv 16 Feb 99 const Handle(StepGeom_CurveReplica) CR = Handle(StepGeom_CurveReplica)::DownCast(SC); diff --git a/src/StepToGeom/StepToGeom_MakeElementarySurface.cxx b/src/StepToGeom/StepToGeom_MakeElementarySurface.cxx index 753172d1b7..fb07d1c955 100644 --- a/src/StepToGeom/StepToGeom_MakeElementarySurface.cxx +++ b/src/StepToGeom/StepToGeom_MakeElementarySurface.cxx @@ -38,23 +38,23 @@ Standard_Boolean StepToGeom_MakeElementarySurface::Convert (const Handle(StepGeo { if (SS->IsKind(STANDARD_TYPE(StepGeom_Plane))) { const Handle(StepGeom_Plane) Sur = Handle(StepGeom_Plane)::DownCast(SS); - return StepToGeom_MakePlane::Convert(Sur,*((Handle(Geom_Plane)*)&CS)); + return StepToGeom_MakePlane::Convert(Sur,Handle(Geom_Plane)::DownCast (CS)); } if (SS->IsKind(STANDARD_TYPE(StepGeom_CylindricalSurface))) { const Handle(StepGeom_CylindricalSurface) Sur = Handle(StepGeom_CylindricalSurface)::DownCast(SS); - return StepToGeom_MakeCylindricalSurface::Convert(Sur,*((Handle(Geom_CylindricalSurface)*)&CS)); + return StepToGeom_MakeCylindricalSurface::Convert(Sur,Handle(Geom_CylindricalSurface)::DownCast (CS)); } if (SS->IsKind(STANDARD_TYPE(StepGeom_ConicalSurface))) { const Handle(StepGeom_ConicalSurface) Sur = Handle(StepGeom_ConicalSurface)::DownCast(SS); - return StepToGeom_MakeConicalSurface::Convert(Sur,*((Handle(Geom_ConicalSurface)*)&CS)); + return StepToGeom_MakeConicalSurface::Convert(Sur,Handle(Geom_ConicalSurface)::DownCast (CS)); } if (SS->IsKind(STANDARD_TYPE(StepGeom_SphericalSurface))) { const Handle(StepGeom_SphericalSurface) Sur = Handle(StepGeom_SphericalSurface)::DownCast(SS); - return StepToGeom_MakeSphericalSurface::Convert(Sur,*((Handle(Geom_SphericalSurface)*)&CS)); + return StepToGeom_MakeSphericalSurface::Convert(Sur,Handle(Geom_SphericalSurface)::DownCast (CS)); } if (SS->IsKind(STANDARD_TYPE(StepGeom_ToroidalSurface))) { const Handle(StepGeom_ToroidalSurface) Sur = Handle(StepGeom_ToroidalSurface)::DownCast(SS); - return StepToGeom_MakeToroidalSurface::Convert(Sur,*((Handle(Geom_ToroidalSurface)*)&CS)); + return StepToGeom_MakeToroidalSurface::Convert(Sur,Handle(Geom_ToroidalSurface)::DownCast (CS)); } return Standard_False; } diff --git a/src/StepToGeom/StepToGeom_MakeSurface.cxx b/src/StepToGeom/StepToGeom_MakeSurface.cxx index 080d9d712e..4ce83ab685 100644 --- a/src/StepToGeom/StepToGeom_MakeSurface.cxx +++ b/src/StepToGeom/StepToGeom_MakeSurface.cxx @@ -63,18 +63,18 @@ Standard_Boolean StepToGeom_MakeSurface::Convert (const Handle(StepGeom_Surface) OCC_CATCH_SIGNALS if (SS->IsKind(STANDARD_TYPE(StepGeom_BoundedSurface))) { const Handle(StepGeom_BoundedSurface) S1 = Handle(StepGeom_BoundedSurface)::DownCast(SS); - return StepToGeom_MakeBoundedSurface::Convert(S1,*((Handle(Geom_BoundedSurface)*)&CS)); + return StepToGeom_MakeBoundedSurface::Convert(S1,Handle(Geom_BoundedSurface)::DownCast (CS)); } if (SS->IsKind(STANDARD_TYPE(StepGeom_ElementarySurface))) { const Handle(StepGeom_ElementarySurface) S1 = Handle(StepGeom_ElementarySurface)::DownCast(SS); if(S1->Position().IsNull()) return Standard_False; - return StepToGeom_MakeElementarySurface::Convert(S1,*((Handle(Geom_ElementarySurface)*)&CS)); + return StepToGeom_MakeElementarySurface::Convert(S1,Handle(Geom_ElementarySurface)::DownCast (CS)); } if (SS->IsKind(STANDARD_TYPE(StepGeom_SweptSurface))) { const Handle(StepGeom_SweptSurface) S1 = Handle(StepGeom_SweptSurface)::DownCast(SS); - return StepToGeom_MakeSweptSurface::Convert(S1,*((Handle(Geom_SweptSurface)*)&CS)); + return StepToGeom_MakeSweptSurface::Convert(S1,Handle(Geom_SweptSurface)::DownCast (CS)); } if (SS->IsKind(STANDARD_TYPE(StepGeom_OffsetSurface))) { //:d4 abv 12 Mar 98 const Handle(StepGeom_OffsetSurface) OS = Handle(StepGeom_OffsetSurface)::DownCast(SS); diff --git a/src/StepToGeom/StepToGeom_MakeSweptSurface.cxx b/src/StepToGeom/StepToGeom_MakeSweptSurface.cxx index 3272e5f20b..ff0685f0cc 100644 --- a/src/StepToGeom/StepToGeom_MakeSweptSurface.cxx +++ b/src/StepToGeom/StepToGeom_MakeSweptSurface.cxx @@ -33,11 +33,11 @@ Standard_Boolean StepToGeom_MakeSweptSurface::Convert (const Handle(StepGeom_Swe { if (SS->IsKind(STANDARD_TYPE(StepGeom_SurfaceOfLinearExtrusion))) { const Handle(StepGeom_SurfaceOfLinearExtrusion) Sur = Handle(StepGeom_SurfaceOfLinearExtrusion)::DownCast(SS); - return StepToGeom_MakeSurfaceOfLinearExtrusion::Convert(Sur,*((Handle(Geom_SurfaceOfLinearExtrusion)*)&CS)); + return StepToGeom_MakeSurfaceOfLinearExtrusion::Convert(Sur,Handle(Geom_SurfaceOfLinearExtrusion)::DownCast (CS)); } if (SS->IsKind(STANDARD_TYPE(StepGeom_SurfaceOfRevolution))) { const Handle(StepGeom_SurfaceOfRevolution) Sur = Handle(StepGeom_SurfaceOfRevolution)::DownCast(SS); - return StepToGeom_MakeSurfaceOfRevolution::Convert(Sur,*((Handle(Geom_SurfaceOfRevolution)*)&CS)); + return StepToGeom_MakeSurfaceOfRevolution::Convert(Sur,Handle(Geom_SurfaceOfRevolution)::DownCast (CS)); } return Standard_False; } diff --git a/src/TDF/TDF_ClosureTool.cxx b/src/TDF/TDF_ClosureTool.cxx index 79d95eee83..b0cea80f01 100644 --- a/src/TDF/TDF_ClosureTool.cxx +++ b/src/TDF/TDF_ClosureTool.cxx @@ -35,9 +35,9 @@ #include -#define DeclareAndSpeedCast(V,T,Vdown) Handle(T) Vdown = *((Handle(T)*)& V) +#define DeclareAndSpeedCast(V,T,Vdown) Handle(T) Vdown = Handle(T)::DownCast (V) #define DeclareConstAndSpeedCast(V,T,Vdown) const Handle(T)& Vdown = (Handle(T)&) V -#define SpeedCast(V,T,Vdown) Vdown = *((Handle(T)*)& V) +#define SpeedCast(V,T,Vdown) Vdown = Handle(T)::DownCast (V) //======================================================================= diff --git a/src/TDF/TDF_CopyTool.cxx b/src/TDF/TDF_CopyTool.cxx index 30687aeb7d..a636099e60 100644 --- a/src/TDF/TDF_CopyTool.cxx +++ b/src/TDF/TDF_CopyTool.cxx @@ -40,9 +40,9 @@ #include -#define DeclareAndSpeedCast(V,T,Vdown) Handle(T) Vdown = *((Handle(T)*)& V) +#define DeclareAndSpeedCast(V,T,Vdown) Handle(T) Vdown = Handle(T)::DownCast (V) #define DeclareConstAndSpeedCast(V,T,Vdown) const Handle(T)& Vdown = (Handle(T)&) V -#define SpeedCast(V,T,Vdown) Vdown = *((Handle(T)*)& V) +#define SpeedCast(V,T,Vdown) Vdown = Handle(T)::DownCast (V) //======================================================================= diff --git a/src/TDataStd/TDataStd_ByteArray.cxx b/src/TDataStd/TDataStd_ByteArray.cxx index ba66b32aa4..3d824ac345 100644 --- a/src/TDataStd/TDataStd_ByteArray.cxx +++ b/src/TDataStd/TDataStd_ByteArray.cxx @@ -238,7 +238,7 @@ Handle(TDF_DeltaOnModification) TDataStd_ByteArray::DeltaOnModification (const Handle(TDF_Attribute)& OldAttribute) const { if(myIsDelta) - return new TDataStd_DeltaOnModificationOfByteArray(*((Handle(TDataStd_ByteArray)*)&OldAttribute)); + return new TDataStd_DeltaOnModificationOfByteArray(Handle(TDataStd_ByteArray)::DownCast (OldAttribute)); else return new TDF_DefaultDeltaOnModification(OldAttribute); } diff --git a/src/TDataStd/TDataStd_DeltaOnModificationOfByteArray.cxx b/src/TDataStd/TDataStd_DeltaOnModificationOfByteArray.cxx index b694a54486..a94aad36b2 100644 --- a/src/TDataStd/TDataStd_DeltaOnModificationOfByteArray.cxx +++ b/src/TDataStd/TDataStd_DeltaOnModificationOfByteArray.cxx @@ -97,7 +97,7 @@ void TDataStd_DeltaOnModificationOfByteArray::Apply() { Handle(TDF_Attribute) TDFAttribute = Attribute(); - Handle(TDataStd_ByteArray) BackAtt = (*((Handle(TDataStd_ByteArray)*)&TDFAttribute)); + Handle(TDataStd_ByteArray) BackAtt = Handle(TDataStd_ByteArray)::DownCast (TDFAttribute); if(BackAtt.IsNull()) { #ifdef OCCT_DEBUG cout << "DeltaOnModificationOfByteArray::Apply: OldAtt is Null" <IsInstance(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) - surface = ((Handle(Geom_RectangularTrimmedSurface)&) surface)->BasisSurface(); + surface = Handle(Geom_RectangularTrimmedSurface)::DownCast (surface)->BasisSurface(); Handle(Geom_Plane) S = Handle(Geom_Plane)::DownCast(surface); if (!S.IsNull()) { G = S->Pln(); @@ -326,7 +326,7 @@ Standard_Boolean TDataXtd_Geometry::Cylinder(const Handle(TNaming_NamedShape)& N Handle(Geom_Surface) surface = BRep_Tool::Surface (face); if (!surface.IsNull()) { if (surface->IsInstance(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) - surface = ((Handle(Geom_RectangularTrimmedSurface)&) surface)->BasisSurface(); + surface = Handle(Geom_RectangularTrimmedSurface)::DownCast (surface)->BasisSurface(); Handle(Geom_CylindricalSurface) S = Handle(Geom_CylindricalSurface)::DownCast(surface); if (!S.IsNull()) { G = S->Cylinder(); @@ -401,7 +401,7 @@ TDataXtd_GeometryEnum TDataXtd_Geometry::Type (const Handle(TNaming_NamedShape) Handle(Geom_Surface) surface = BRep_Tool::Surface (face); if (!surface.IsNull()) { if (surface->IsInstance(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) { - surface = ((Handle(Geom_RectangularTrimmedSurface)&) surface)->BasisSurface(); + surface = Handle(Geom_RectangularTrimmedSurface)::DownCast (surface)->BasisSurface(); } if (surface->IsInstance(STANDARD_TYPE(Geom_CylindricalSurface))) { type = TDataXtd_CYLINDER; diff --git a/src/TDocStd/TDocStd_XLink.cxx b/src/TDocStd/TDocStd_XLink.cxx index 4ba6afd183..246afaa228 100644 --- a/src/TDocStd/TDocStd_XLink.cxx +++ b/src/TDocStd/TDocStd_XLink.cxx @@ -227,8 +227,7 @@ Handle(TDF_Attribute) TDocStd_XLink::BackupCopy() const void TDocStd_XLink::Restore(const Handle(TDF_Attribute)& anAttribute) { - const Handle(TDocStd_XLink)& xRef = - Handle(TDocStd_XLink)::DownCast(anAttribute); + Handle(TDocStd_XLink) xRef (Handle(TDocStd_XLink)::DownCast(anAttribute)); if (!xRef.IsNull()) { myDocEntry = xRef->DocumentEntry(); myLabelEntry = xRef->LabelEntry(); @@ -254,8 +253,7 @@ void TDocStd_XLink::Paste (const Handle(TDF_Attribute)& intoAttribute, const Handle(TDF_RelocationTable)& /*aRelocationTable*/) const { - const Handle(TDocStd_XLink)& xRef = - Handle(TDocStd_XLink)::DownCast(intoAttribute); + Handle(TDocStd_XLink) xRef (Handle(TDocStd_XLink)::DownCast(intoAttribute)); if (!xRef.IsNull()) { xRef->DocumentEntry(myDocEntry); xRef->LabelEntry(myLabelEntry); diff --git a/src/TNaming/TNaming_DeltaOnModification.cxx b/src/TNaming/TNaming_DeltaOnModification.cxx index 0ab91187e3..14b8c264e2 100644 --- a/src/TNaming/TNaming_DeltaOnModification.cxx +++ b/src/TNaming/TNaming_DeltaOnModification.cxx @@ -109,7 +109,7 @@ void TNaming_DeltaOnModification::Apply() { Handle(TDF_Attribute) TDFAttribute = Attribute(); - Handle(TNaming_NamedShape) NS = (*((Handle(TNaming_NamedShape)*)&TDFAttribute)); + Handle(TNaming_NamedShape) NS = Handle(TNaming_NamedShape)::DownCast (TDFAttribute); // If there is no attribute, reinsert the previous. Otherwise a new one diff --git a/src/TNaming/TNaming_NamedShape.cxx b/src/TNaming/TNaming_NamedShape.cxx index 2d0930b118..2edacafb65 100644 --- a/src/TNaming/TNaming_NamedShape.cxx +++ b/src/TNaming/TNaming_NamedShape.cxx @@ -422,7 +422,7 @@ Handle(TDF_DeltaOnModification) TNaming_NamedShape::DeltaOnModification (const Handle(TDF_Attribute)& anOldAttribute) const { - return new TNaming_DeltaOnModification(*((Handle(TNaming_NamedShape)*)&anOldAttribute)); + return new TNaming_DeltaOnModification(Handle(TNaming_NamedShape)::DownCast (anOldAttribute)); } //======================================================================= diff --git a/src/TNaming/TNaming_Selector.cxx b/src/TNaming/TNaming_Selector.cxx index bf7a7d6b49..02d17cb83b 100644 --- a/src/TNaming/TNaming_Selector.cxx +++ b/src/TNaming/TNaming_Selector.cxx @@ -153,7 +153,7 @@ static Standard_Boolean IsSpecificCase(const TDF_Label& F, const TopoDS_Shape& } for(;cit.More();cit.Next()) { - const Handle(TNaming_NamedShape)& NS = Handle(TNaming_NamedShape)::DownCast(cit.Value()); + Handle(TNaming_NamedShape) NS (Handle(TNaming_NamedShape)::DownCast(cit.Value())); if(!NS.IsNull()) { TopoDS_Shape aS = TNaming_Tool::CurrentShape(NS); if(aS.IsNull()) continue; diff --git a/src/TNaming/TNaming_Tool.cxx b/src/TNaming/TNaming_Tool.cxx index 4f778e6d51..74578c034b 100644 --- a/src/TNaming/TNaming_Tool.cxx +++ b/src/TNaming/TNaming_Tool.cxx @@ -587,7 +587,7 @@ void TNaming_Tool::FindShape(const TDF_LabelMap& Valid, #ifdef OCCT_DEBUG // Standard_Integer nbExtArgs = extArgs.Extent(); #endif - const Handle(TNaming_NamedShape)& anExtArg = Handle(TNaming_NamedShape)::DownCast(itr.Key()); + Handle(TNaming_NamedShape) anExtArg (Handle(TNaming_NamedShape)::DownCast(itr.Key())); const Handle(TNaming_NamedShape)& aCurrentExtArg = TNaming_Tool::CurrentNamedShape(anExtArg); if (!aCurrentExtArg.IsNull() && !aCurrentExtArg->IsEmpty()) extArgs.Append(aCurrentExtArg); diff --git a/src/TNaming/TNaming_Translator.cxx b/src/TNaming/TNaming_Translator.cxx index 9ff936ceeb..2e0730e81a 100644 --- a/src/TNaming/TNaming_Translator.cxx +++ b/src/TNaming/TNaming_Translator.cxx @@ -132,8 +132,8 @@ void TNaming_Translator::DumpMap(const Standard_Boolean isWrite) const T == STANDARD_TYPE (TopoDS_TCompSolid)|| T == STANDARD_TYPE (TopoDS_TCompound)) { if(isWrite) { - const Handle(TopoDS_TShape)& key = Handle(TopoDS_TShape)::DownCast(myMap.FindKey(i)); - const Handle(TopoDS_TShape)& item = Handle(TopoDS_TShape)::DownCast(myMap.FindFromIndex(i)); + Handle(TopoDS_TShape) key (Handle(TopoDS_TShape)::DownCast(myMap.FindKey(i))); + Handle(TopoDS_TShape) item (Handle(TopoDS_TShape)::DownCast(myMap.FindFromIndex(i))); TopoDS_Shape S1; S1.TShape(key); TopoDS_Shape S2; S2.TShape(item); BRepTools::Write(S1, keyname.Cat(i).ToCString()); diff --git a/src/TPrsStd/TPrsStd_ConstraintTools.cxx b/src/TPrsStd/TPrsStd_ConstraintTools.cxx index 75c82c27de..283506fec0 100644 --- a/src/TPrsStd/TPrsStd_ConstraintTools.cxx +++ b/src/TPrsStd/TPrsStd_ConstraintTools.cxx @@ -1076,11 +1076,11 @@ void TPrsStd_ConstraintTools::ComputeAngle (const Handle(TDataXtd_Constraint)& a } ais->SetMeasuredGeometry (TopoDS::Face (shape1), TopoDS::Face (shape2)); if (isplan) - ais->SetCustomPlane (((Handle(Geom_Plane)&) ageom3)->Pln()); + ais->SetCustomPlane (Handle(Geom_Plane)::DownCast (ageom3)->Pln()); else if (!isCurvilinear) { gp_Pln aPlane; - aPlane.SetAxis (((Handle(Geom_Line)&) ageom3)->Position()); + aPlane.SetAxis (Handle(Geom_Line)::DownCast (ageom3)->Position()); ais->SetCustomPlane (aPlane); } } @@ -1847,7 +1847,7 @@ void TPrsStd_ConstraintTools::ComputeOffset (const Handle(TDataXtd_Constraint)& // Works only with line !! //#ifndef OCCT_DEBUG Handle(Geom_Geometry) aGeomGeometry = CURVE.Curve().Curve()->Transformed(CURVE.Trsf()) ; - gp_Lin OLin = ((Handle(Geom_Line)&) aGeomGeometry)->Lin(); + gp_Lin OLin = Handle(Geom_Line)::DownCast (aGeomGeometry)->Lin(); //#else // gp_Lin OLin = ((Handle(Geom_Line)&) CURVE.Curve().Curve()->Transformed(CURVE.Trsf()))->Lin(); //#endif @@ -1855,7 +1855,7 @@ void TPrsStd_ConstraintTools::ComputeOffset (const Handle(TDataXtd_Constraint)& CURVE.Initialize (NE); //#ifndef OCCT_DEBUG aGeomGeometry = CURVE.Curve().Curve()->Transformed(CURVE.Trsf()) ; - gp_Lin NLin = ((Handle(Geom_Line)&)aGeomGeometry)->Lin(); + gp_Lin NLin = Handle(Geom_Line)::DownCast (aGeomGeometry)->Lin(); //#else // gp_Lin NLin = ((Handle(Geom_Line)&) CURVE.Curve().Curve()->Transformed(CURVE.Trsf()))->Lin(); //#endif @@ -1878,7 +1878,7 @@ void TPrsStd_ConstraintTools::ComputeOffset (const Handle(TDataXtd_Constraint)& if (CURVE.GetType() == GeomAbs_Circle) { //#ifndef OCCT_DEBUG Handle(Geom_Geometry) aGeomGeometry = CURVE.Curve().Curve()->Transformed(CURVE.Trsf()) ; - gp_Ax1 ax = ((Handle(Geom_Circle)&) aGeomGeometry)->Circ().Axis(); + gp_Ax1 ax = Handle(Geom_Circle)::DownCast (aGeomGeometry)->Circ().Axis(); //#else // gp_Ax1 ax = ((Handle(Geom_Circle)&) CURVE.Curve().Curve()->Transformed(CURVE.Trsf()))->Circ().Axis(); //#endif @@ -1904,7 +1904,7 @@ void TPrsStd_ConstraintTools::ComputeOffset (const Handle(TDataXtd_Constraint)& if (MkF.IsDone()) { //#ifndef OCCT_DEBUG Handle(Geom_Surface) aGeomSurface = BRep_Tool::Surface(MkF.Face()); - aplane = (Handle(Geom_Plane)&) aGeomSurface ; + aplane = Handle(Geom_Plane)::DownCast (aGeomSurface) ; //#else // aplane = ((Handle(Geom_Plane)&) BRep_Tool::Surface(MkF.Face())); //#endif diff --git a/src/TopOpeBRep/TopOpeBRep_LineInter.cxx b/src/TopOpeBRep/TopOpeBRep_LineInter.cxx index 46e3af386f..885d409f6e 100644 --- a/src/TopOpeBRep/TopOpeBRep_LineInter.cxx +++ b/src/TopOpeBRep/TopOpeBRep_LineInter.cxx @@ -116,13 +116,13 @@ void TopOpeBRep_LineInter::SetLine(const Handle(IntPatch_Line)& L, switch (type) { case IntPatch_Analytic : - myILA = *((Handle(IntPatch_ALine)*)&L); break; + myILA = Handle(IntPatch_ALine)::DownCast (L); break; case IntPatch_Restriction : - myILR = *((Handle(IntPatch_RLine)*)&L); break; + myILR = Handle(IntPatch_RLine)::DownCast (L); break; case IntPatch_Walking : - myILW = *((Handle(IntPatch_WLine)*)&L); break; + myILW = Handle(IntPatch_WLine)::DownCast (L); break; default : //"geometric" line - myILG = *((Handle(IntPatch_GLine)*)&L); break; + myILG = Handle(IntPatch_GLine)::DownCast (L); break; } // transform an analytic line to a walking line diff --git a/src/TopOpeBRepBuild/TopOpeBRepBuild_BuilderON.cxx b/src/TopOpeBRepBuild/TopOpeBRepBuild_BuilderON.cxx index 88b65762ce..c54d1f14dd 100644 --- a/src/TopOpeBRepBuild/TopOpeBRepBuild_BuilderON.cxx +++ b/src/TopOpeBRepBuild/TopOpeBRepBuild_BuilderON.cxx @@ -400,7 +400,7 @@ void TopOpeBRepBuild_BuilderON::GFillONPartsWES2(const Handle(TopOpeBRepDS_Inter { const Handle(TopOpeBRepDS_HDataStructure)& HDS=myPB->DataStructure(); const TopOpeBRepDS_DataStructure& BDS= HDS->DS(); - const Handle(TopOpeBRepDS_ShapeShapeInterference)& SSI=Handle(TopOpeBRepDS_ShapeShapeInterference)::DownCast(I); + Handle(TopOpeBRepDS_ShapeShapeInterference) SSI (Handle(TopOpeBRepDS_ShapeShapeInterference)::DownCast(I)); TopAbs_State TB1,TB2;myPG->StatesON(TB1,TB2); TopAbs_State TB=TB1; TopOpeBRepDS_Kind GT,ST;Standard_Integer GI,SI;FDS_data(SSI,GT,GI,ST,SI); const TopOpeBRepDS_Transition& TFE=SSI->Transition(); Standard_Boolean EGBoundFOR=SSI->GBound(); @@ -1179,7 +1179,7 @@ void TopOpeBRepBuild_BuilderON::GFillONPartsWES2(const Handle(TopOpeBRepDS_Inter Standard_Boolean ssif = Standard_False; Handle(TopOpeBRepDS_ShapeShapeInterference) ssie3; TopOpeBRepDS_ListIteratorOfListOfInterference itssi(BDS.ShapeInterferences(FCX)); for (;itssi.More();itssi.Next()) { - const Handle(TopOpeBRepDS_ShapeShapeInterference)& ssi = Handle(TopOpeBRepDS_ShapeShapeInterference)::DownCast(itssi.Value()); if (ssi.IsNull()) continue; + Handle(TopOpeBRepDS_ShapeShapeInterference) ssi (Handle(TopOpeBRepDS_ShapeShapeInterference)::DownCast(itssi.Value())); if (ssi.IsNull()) continue; TopOpeBRepDS_Kind GT1,ST1; Standard_Integer G1,S1; FDS_data(ssi,GT1,G1,ST1,S1); Standard_Boolean cond = (GT1 == TopOpeBRepDS_EDGE && ST1 == TopOpeBRepDS_FACE); cond = cond && (G1 == ie3); diff --git a/src/TopOpeBRepBuild/TopOpeBRepBuild_BuilderON2d.cxx b/src/TopOpeBRepBuild/TopOpeBRepBuild_BuilderON2d.cxx index fa825088db..2987afdfd4 100644 --- a/src/TopOpeBRepBuild/TopOpeBRepBuild_BuilderON2d.cxx +++ b/src/TopOpeBRepBuild/TopOpeBRepBuild_BuilderON2d.cxx @@ -106,7 +106,7 @@ void TopOpeBRepBuild_BuilderON::GFillONParts2dWES2(const Handle(TopOpeBRepDS_Int { const Handle(TopOpeBRepDS_HDataStructure)& HDS=myPB->DataStructure(); const TopOpeBRepDS_DataStructure& BDS= HDS->DS(); - const Handle(TopOpeBRepDS_ShapeShapeInterference)& SSI=Handle(TopOpeBRepDS_ShapeShapeInterference)::DownCast(I); + Handle(TopOpeBRepDS_ShapeShapeInterference) SSI (Handle(TopOpeBRepDS_ShapeShapeInterference)::DownCast(I)); TopAbs_State TB1,TB2;myPG->StatesON(TB1,TB2); TopOpeBRepDS_Kind GT,ST;Standard_Integer GI,SI;FDS_data(SSI,GT,GI,ST,SI); // const TopOpeBRepDS_Transition& TFE=SSI->Transition(); diff --git a/src/TopOpeBRepBuild/TopOpeBRepBuild_EdgeBuilder.cxx b/src/TopOpeBRepBuild/TopOpeBRepBuild_EdgeBuilder.cxx index da7edae5bb..06e56cab6b 100644 --- a/src/TopOpeBRepBuild/TopOpeBRepBuild_EdgeBuilder.cxx +++ b/src/TopOpeBRepBuild/TopOpeBRepBuild_EdgeBuilder.cxx @@ -120,7 +120,7 @@ void TopOpeBRepBuild_EdgeBuilder::NextVertex() const TopoDS_Shape& TopOpeBRepBuild_EdgeBuilder::Vertex() const { const Handle(TopOpeBRepBuild_Loop)& L = Loop(); - const Handle(TopOpeBRepBuild_Pave)& PV = *((Handle(TopOpeBRepBuild_Pave)*)&L); + Handle(TopOpeBRepBuild_Pave) PV (Handle(TopOpeBRepBuild_Pave)::DownCast (L)); const TopoDS_Shape& V = PV->Vertex(); return V; } @@ -133,7 +133,7 @@ const TopoDS_Shape& TopOpeBRepBuild_EdgeBuilder::Vertex() const Standard_Real TopOpeBRepBuild_EdgeBuilder::Parameter() const { const Handle(TopOpeBRepBuild_Loop)& L = Loop(); - const Handle(TopOpeBRepBuild_Pave)& PV = *((Handle(TopOpeBRepBuild_Pave)*)&L); + Handle(TopOpeBRepBuild_Pave) PV (Handle(TopOpeBRepBuild_Pave)::DownCast (L)); Standard_Real parV = PV->Parameter(); return parV; } diff --git a/src/TopOpeBRepBuild/TopOpeBRepBuild_FuseFace.cxx b/src/TopOpeBRepBuild/TopOpeBRepBuild_FuseFace.cxx index 415074b1ac..e4a372b080 100644 --- a/src/TopOpeBRepBuild/TopOpeBRepBuild_FuseFace.cxx +++ b/src/TopOpeBRepBuild/TopOpeBRepBuild_FuseFace.cxx @@ -1040,24 +1040,24 @@ Standard_Boolean SameSupport(const TopoDS_Edge& E1, C1 = BRep_Tool::Curve(E1,loc,f1,l1); if (!loc.IsIdentity()) { Handle(Geom_Geometry) GG1 = C1->Transformed(loc.Transformation()); - C1 = *((Handle(Geom_Curve)*)&GG1); + C1 = Handle(Geom_Curve)::DownCast (GG1); } C2 = BRep_Tool::Curve(E2,loc,f2,l2); if (!loc.IsIdentity()) { Handle(Geom_Geometry) GG2 = C2->Transformed(loc.Transformation()); - C2 = *((Handle(Geom_Curve)*)&GG2); + C2 = Handle(Geom_Curve)::DownCast (GG2); } 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(); } @@ -1080,8 +1080,8 @@ Standard_Boolean SameSupport(const TopoDS_Edge& E1, const Standard_Real tollin = Precision::Confusion(); const Standard_Real tolang = Precision::Angular(); 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 (Abs(li1.Angle(li2)) <= tolang && li1.Location().SquareDistance(li2.Location()) <= tollin*tollin) { @@ -1090,8 +1090,8 @@ Standard_Boolean SameSupport(const TopoDS_Edge& E1, return Standard_False; } else if (typC1 == STANDARD_TYPE(Geom_Circle)) { - gp_Circ ci1 = (*((Handle(Geom_Circle)*)&C1))->Circ(); - gp_Circ ci2 = (*((Handle(Geom_Circle)*)&C2))->Circ(); + gp_Circ ci1 = Handle(Geom_Circle)::DownCast (C1)->Circ(); + gp_Circ ci2 = Handle(Geom_Circle)::DownCast (C2)->Circ(); if (Abs(ci1.Radius()-ci2.Radius()) <= tollin && ci1.Location().SquareDistance(ci2.Location()) <= tollin*tollin) { // Point debut, calage dans periode, et detection meme sens @@ -1100,8 +1100,8 @@ Standard_Boolean SameSupport(const TopoDS_Edge& E1, return Standard_False; } else if (typC1 == STANDARD_TYPE(Geom_Ellipse)) { - gp_Elips ci1 = (*((Handle(Geom_Ellipse)*)&C1))->Elips(); - gp_Elips ci2 = (*((Handle(Geom_Ellipse)*)&C2))->Elips(); + gp_Elips ci1 = Handle(Geom_Ellipse)::DownCast (C1)->Elips(); + gp_Elips ci2 = Handle(Geom_Ellipse)::DownCast (C2)->Elips(); if (Abs(ci1.MajorRadius()-ci2.MajorRadius()) <= tollin && Abs(ci1.MinorRadius()-ci2.MinorRadius()) <= tollin && @@ -1112,8 +1112,8 @@ Standard_Boolean SameSupport(const TopoDS_Edge& E1, return Standard_False; } else if (typC1 == STANDARD_TYPE(Geom_BSplineCurve)) { - Handle(Geom_BSplineCurve) B1 = *((Handle(Geom_BSplineCurve)*)&C1); - Handle(Geom_BSplineCurve) B2 = *((Handle(Geom_BSplineCurve)*)&C2); + Handle(Geom_BSplineCurve) B1 = Handle(Geom_BSplineCurve)::DownCast (C1); + Handle(Geom_BSplineCurve) B2 = Handle(Geom_BSplineCurve)::DownCast (C2); Standard_Integer nbpoles = B1->NbPoles(); if (nbpoles != B2->NbPoles()) { @@ -1178,8 +1178,8 @@ Standard_Boolean SameSupport(const TopoDS_Edge& E1, return Standard_True; } else if (typC1 == STANDARD_TYPE(Geom_BezierCurve)) { - Handle(Geom_BezierCurve) B1 = *((Handle(Geom_BezierCurve)*)&C1); - Handle(Geom_BezierCurve) B2 = *((Handle(Geom_BezierCurve)*)&C2); + Handle(Geom_BezierCurve) B1 = Handle(Geom_BezierCurve)::DownCast (C1); + Handle(Geom_BezierCurve) B2 = Handle(Geom_BezierCurve)::DownCast (C2); Standard_Integer nbpoles = B1->NbPoles(); if (nbpoles != B2->NbPoles()) { diff --git a/src/TopOpeBRepBuild/TopOpeBRepBuild_KPart.cxx b/src/TopOpeBRepBuild/TopOpeBRepBuild_KPart.cxx index c0b139ea3d..39b31ff1d0 100644 --- a/src/TopOpeBRepBuild/TopOpeBRepBuild_KPart.cxx +++ b/src/TopOpeBRepBuild/TopOpeBRepBuild_KPart.cxx @@ -949,7 +949,7 @@ static Standard_Boolean allIonsectionedges(const Handle(TopOpeBRepDS_HDataStruct { TopOpeBRepDS_ListIteratorOfListOfInterference it1(HDS->DS().ShapeInterferences(f1)); for (; it1.More(); it1.Next()){ - const Handle(TopOpeBRepDS_ShapeShapeInterference)& SSI1 = Handle(TopOpeBRepDS_ShapeShapeInterference)::DownCast(it1.Value()); + Handle(TopOpeBRepDS_ShapeShapeInterference) SSI1 (Handle(TopOpeBRepDS_ShapeShapeInterference)::DownCast(it1.Value())); Standard_Integer G1 = SSI1->Geometry(); Standard_Boolean isgbound = SSI1->GBound(); const TopoDS_Shape& e1 = HDS->Shape(G1); diff --git a/src/TopOpeBRepBuild/TopOpeBRepBuild_Section.cxx b/src/TopOpeBRepBuild/TopOpeBRepBuild_Section.cxx index 0b829e0380..4b670891f9 100644 --- a/src/TopOpeBRepBuild/TopOpeBRepBuild_Section.cxx +++ b/src/TopOpeBRepBuild/TopOpeBRepBuild_Section.cxx @@ -544,7 +544,7 @@ void TopOpeBRepBuild_Builder::SplitSectionEdges() const TopOpeBRepDS_ListOfInterference& LI = BDS.ShapeInterferences(FF); Standard_Integer nLI = LI.Extent(); if (nLI == 0) continue; for (TopOpeBRepDS_ListIteratorOfListOfInterference ILI(LI); ILI.More(); ILI.Next() ) { - const Handle(TopOpeBRepDS_ShapeShapeInterference)& SSI = Handle(TopOpeBRepDS_ShapeShapeInterference)::DownCast(ILI.Value()); + Handle(TopOpeBRepDS_ShapeShapeInterference) SSI (Handle(TopOpeBRepDS_ShapeShapeInterference)::DownCast(ILI.Value())); if (SSI.IsNull()) continue; TopOpeBRepDS_Kind GT,ST;Standard_Integer GI,SI;FDS_data(SSI,GT,GI,ST,SI); if (ST != TopOpeBRepDS_FACE) continue; @@ -590,7 +590,7 @@ void TopOpeBRepBuild_Builder::SplitSectionEdges() const TopOpeBRepDS_ListOfInterference& LI = BDS.ShapeInterferences(FF); Standard_Integer nLI = LI.Extent(); if (nLI == 0) continue; for (TopOpeBRepDS_ListIteratorOfListOfInterference ILI(LI); ILI.More(); ILI.Next() ) { - const Handle(TopOpeBRepDS_ShapeShapeInterference)& SSI = Handle(TopOpeBRepDS_ShapeShapeInterference)::DownCast(ILI.Value()); + Handle(TopOpeBRepDS_ShapeShapeInterference) SSI (Handle(TopOpeBRepDS_ShapeShapeInterference)::DownCast(ILI.Value())); if (SSI.IsNull()) continue; TopOpeBRepDS_Kind GT,ST;Standard_Integer GI,SI;FDS_data(SSI,GT,GI,ST,SI); if (ST != TopOpeBRepDS_FACE) continue; diff --git a/src/TopOpeBRepBuild/TopOpeBRepBuild_Tools_1.cxx b/src/TopOpeBRepBuild/TopOpeBRepBuild_Tools_1.cxx index 80a12e89c6..afbaacc65a 100644 --- a/src/TopOpeBRepBuild/TopOpeBRepBuild_Tools_1.cxx +++ b/src/TopOpeBRepBuild/TopOpeBRepBuild_Tools_1.cxx @@ -193,7 +193,7 @@ void CorrectEdgeTolerance (const TopoDS_Edge& myShape, } if (!myCref.IsNull()) { - const Handle(BRep_GCurve)& GCref = *((Handle(BRep_GCurve)*)&myCref); + Handle(BRep_GCurve) GCref (Handle(BRep_GCurve)::DownCast (myCref)); Standard_Real First,Last; GCref->Range(First,Last); if (Last<=First) { @@ -245,7 +245,7 @@ void CorrectEdgeTolerance (const TopoDS_Edge& myShape, const Handle(BRep_CurveRepresentation)& cr = itcr.Value(); if (cr != myCref && cr->IsCurveOnSurface(Su,L)) { pcurvefound = Standard_True; - const Handle(BRep_GCurve)& GC = *((Handle(BRep_GCurve)*)&cr); + Handle(BRep_GCurve) GC (Handle(BRep_GCurve)::DownCast (cr)); Standard_Real f,l; GC->Range(f,l); if (SameRange && (f != First || l != Last)) { @@ -492,7 +492,7 @@ void CheckEdge (const TopoDS_Edge& Ed, const Standard_Real aMaxTol) TopAbs_Orientation orv = aVertex.Orientation(); if (orv == TopAbs_FORWARD || orv == TopAbs_REVERSED) { - const Handle(BRep_GCurve)& GC = *((Handle(BRep_GCurve)*)&cr); + Handle(BRep_GCurve) GC (Handle(BRep_GCurve)::DownCast (cr)); if (orv==TopAbs_FORWARD) Controlp = C->Value(GC->First()); diff --git a/src/TopOpeBRepBuild/TopOpeBRepBuild_WireEdgeSet.cxx b/src/TopOpeBRepBuild/TopOpeBRepBuild_WireEdgeSet.cxx index cf437e9e41..864c56d8b3 100644 --- a/src/TopOpeBRepBuild/TopOpeBRepBuild_WireEdgeSet.cxx +++ b/src/TopOpeBRepBuild/TopOpeBRepBuild_WireEdgeSet.cxx @@ -521,7 +521,7 @@ void TopOpeBRepBuild_WireEdgeSet::IsUVISO(const TopoDS_Edge& E,const TopoDS_Face Handle(Standard_Type) TheType = PC->DynamicType(); if (TheType == STANDARD_TYPE(Geom2d_Line)) { - const Handle(Geom2d_Line)& HL = *((Handle(Geom2d_Line)*)&PC); + Handle(Geom2d_Line) HL (Handle(Geom2d_Line)::DownCast (PC)); const gp_Dir2d& D = HL->Direction(); Standard_Real tol = Precision::Angular(); diff --git a/src/TopOpeBRepBuild/TopOpeBRepBuild_makefaces.cxx b/src/TopOpeBRepBuild/TopOpeBRepBuild_makefaces.cxx index 9aae4626e3..c6a11b9534 100644 --- a/src/TopOpeBRepBuild/TopOpeBRepBuild_makefaces.cxx +++ b/src/TopOpeBRepBuild/TopOpeBRepBuild_makefaces.cxx @@ -573,7 +573,7 @@ void TopOpeBRepBuild_Builder::GFABUMakeFaces(const TopoDS_Shape& FF,TopOpeBRepBu Standard_Boolean istrim = ( T == STANDARD_TYPE(Geom_RectangularTrimmedSurface) ); if (istrim) { Handle(Geom_RectangularTrimmedSurface) - hrts=*((Handle(Geom_RectangularTrimmedSurface)*)&Surf); + hrts=Handle(Geom_RectangularTrimmedSurface)::DownCast (Surf); Standard_Real oumin,oumax,ovmin,ovmax; hrts->Bounds(oumin,oumax,ovmin,ovmax); Standard_Real umin,umax,vmin,vmax; diff --git a/src/TopOpeBRepDS/TopOpeBRepDS_Check.cxx b/src/TopOpeBRepDS/TopOpeBRepDS_Check.cxx index e433a931ee..22b9af19d1 100644 --- a/src/TopOpeBRepDS/TopOpeBRepDS_Check.cxx +++ b/src/TopOpeBRepDS/TopOpeBRepDS_Check.cxx @@ -478,8 +478,7 @@ Standard_Boolean CheckEdgeParameter(const Handle(TopOpeBRepDS_HDataStructure)& m it1.Initialize(LI); while (it1.More() ) { const Handle(TopOpeBRepDS_Interference)& I1 = it1.Value(); - const Handle(TopOpeBRepDS_CurvePointInterference)& CPI = - Handle(TopOpeBRepDS_CurvePointInterference)::DownCast(I1); + Handle(TopOpeBRepDS_CurvePointInterference) CPI (Handle(TopOpeBRepDS_CurvePointInterference)::DownCast(I1)); if(!CPI.IsNull()) { Standard_Integer Param = //#ifdef OCCT_DEBUG diff --git a/src/TopOpeBRepDS/TopOpeBRepDS_Curve.cxx b/src/TopOpeBRepDS/TopOpeBRepDS_Curve.cxx index 59e251aa4e..42992936bb 100644 --- a/src/TopOpeBRepDS/TopOpeBRepDS_Curve.cxx +++ b/src/TopOpeBRepDS/TopOpeBRepDS_Curve.cxx @@ -269,7 +269,7 @@ const Handle(Geom2d_Curve)& TopOpeBRepDS_Curve::Curve1()const { if ( ! mySCI1.IsNull() ) { return - (*((Handle(TopOpeBRepDS_SurfaceCurveInterference)*)&mySCI1))->PCurve(); + Handle(TopOpeBRepDS_SurfaceCurveInterference)::DownCast (mySCI1)->PCurve(); } else { static Handle(Geom2d_Curve) STALOC_Geom2dCurveNull1; @@ -285,7 +285,7 @@ const Handle(Geom2d_Curve)& TopOpeBRepDS_Curve::Curve1()const void TopOpeBRepDS_Curve::Curve1(const Handle(Geom2d_Curve)& PC1) { if ( ! mySCI1.IsNull() ) { - (*((Handle(TopOpeBRepDS_SurfaceCurveInterference)*)&mySCI1))->PCurve(PC1); + Handle(TopOpeBRepDS_SurfaceCurveInterference)::DownCast (mySCI1)->PCurve(PC1); } } @@ -299,7 +299,7 @@ const Handle(Geom2d_Curve)& TopOpeBRepDS_Curve::Curve2()const { if ( ! mySCI2.IsNull() ) { return - (*((Handle(TopOpeBRepDS_SurfaceCurveInterference)*)&mySCI2))->PCurve(); + Handle(TopOpeBRepDS_SurfaceCurveInterference)::DownCast (mySCI2)->PCurve(); } else { static Handle(Geom2d_Curve) STALOC_Geom2dCurveNull2; @@ -315,7 +315,7 @@ const Handle(Geom2d_Curve)& TopOpeBRepDS_Curve::Curve2()const void TopOpeBRepDS_Curve::Curve2(const Handle(Geom2d_Curve)& PC2) { if ( ! mySCI2.IsNull() ) { - (*((Handle(TopOpeBRepDS_SurfaceCurveInterference)*)&mySCI2))->PCurve(PC2); + Handle(TopOpeBRepDS_SurfaceCurveInterference)::DownCast (mySCI2)->PCurve(PC2); } } diff --git a/src/TopOpeBRepDS/TopOpeBRepDS_Dumper.cxx b/src/TopOpeBRepDS/TopOpeBRepDS_Dumper.cxx index a8dfdc9499..fc92e15cd4 100644 --- a/src/TopOpeBRepDS/TopOpeBRepDS_Dumper.cxx +++ b/src/TopOpeBRepDS/TopOpeBRepDS_Dumper.cxx @@ -91,7 +91,7 @@ Standard_OStream& TopOpeBRepDS_Dumper::PrintType(const Handle(Geom_Curve)& else if (T==STANDARD_TYPE(Geom_Hyperbola)) OS<<"HYPERBOLA"; else if (T==STANDARD_TYPE(Geom_BezierCurve)) OS<<"BEZIER"; else if (T==STANDARD_TYPE(Geom_BSplineCurve)) - OS<<"BSPLINE("<<(*((Handle(Geom_BSplineCurve)*)&C))->Degree()<<")"; + OS<<"BSPLINE("<Degree()<<")"; else if (T==STANDARD_TYPE(Geom_TrimmedCurve)) {OS<<"TRIMMED ";PrintType(Handle(Geom_TrimmedCurve)::DownCast(C)->BasisCurve(),OS);} else if (T==STANDARD_TYPE(Geom_OffsetCurve)) OS<<"OFFSETCURVE"; @@ -126,7 +126,7 @@ Standard_OStream& TopOpeBRepDS_Dumper::PrintType(const Handle(Geom2d_Curve)& else if (T==STANDARD_TYPE(Geom2d_Hyperbola)) OS<<"HYPERBOLA"; else if (T==STANDARD_TYPE(Geom2d_BezierCurve)) OS<<"BEZIER"; else if (T==STANDARD_TYPE(Geom2d_BSplineCurve)) - OS<<"BSPLINE("<<(*((Handle(Geom2d_BSplineCurve)*)&C))->Degree()<<")"; + OS<<"BSPLINE("<Degree()<<")"; else if (T==STANDARD_TYPE(Geom2d_TrimmedCurve)) {OS<<"TRIMMED ";PrintType(Handle(Geom2d_TrimmedCurve)::DownCast(C)->BasisCurve(),OS);} else if (T==STANDARD_TYPE(Geom2d_OffsetCurve)) OS<<"OFFSETCURVE"; diff --git a/src/TopOpeBRepDS/TopOpeBRepDS_EIR.cxx b/src/TopOpeBRepDS/TopOpeBRepDS_EIR.cxx index faa5fcdd75..3e19087b2b 100644 --- a/src/TopOpeBRepDS/TopOpeBRepDS_EIR.cxx +++ b/src/TopOpeBRepDS/TopOpeBRepDS_EIR.cxx @@ -282,12 +282,12 @@ static void FUN_ReducerEdge3d(const Standard_Integer SIX, TopOpeBRepDS_DataStruc Standard_Boolean isevi = I1->IsKind(STANDARD_TYPE(TopOpeBRepDS_EdgeVertexInterference)); Standard_Boolean iscpi = I1->IsKind(STANDARD_TYPE(TopOpeBRepDS_CurvePointInterference)); if (isevi) { - const Handle(TopOpeBRepDS_EdgeVertexInterference)& EVI = Handle(TopOpeBRepDS_EdgeVertexInterference)::DownCast(I1); + Handle(TopOpeBRepDS_EdgeVertexInterference) EVI (Handle(TopOpeBRepDS_EdgeVertexInterference)::DownCast(I1)); newI = new TopOpeBRepDS_EdgeVertexInterference(T,TopOpeBRepDS_FACE,IB1,G1,EVI->GBound(), TopOpeBRepDS_UNSHGEOMETRY,EVI->Parameter()); } if (iscpi) { - const Handle(TopOpeBRepDS_CurvePointInterference)& CPI = Handle(TopOpeBRepDS_CurvePointInterference)::DownCast(I1); + Handle(TopOpeBRepDS_CurvePointInterference) CPI (Handle(TopOpeBRepDS_CurvePointInterference)::DownCast(I1)); newI = new TopOpeBRepDS_CurvePointInterference(T,TopOpeBRepDS_FACE,IB1,TopOpeBRepDS_POINT,G1,CPI->Parameter()); } @@ -384,7 +384,7 @@ static void FUN_ReducerSDEdge(const Standard_Integer SIX,const TopOpeBRepDS_Data } // it2 if (complex1d) { - const Handle(TopOpeBRepDS_EdgeVertexInterference)& EVI = Handle(TopOpeBRepDS_EdgeVertexInterference)::DownCast(I1); + Handle(TopOpeBRepDS_EdgeVertexInterference) EVI (Handle(TopOpeBRepDS_EdgeVertexInterference)::DownCast(I1)); TopOpeBRepDS_Config cEIX=BDS.SameDomainOri(SIX), c1=BDS.SameDomainOri(IB1); TopOpeBRepDS_Config Conf = (cEIX == c1) ? TopOpeBRepDS_SAMEORIENTED : TopOpeBRepDS_DIFFORIENTED; Handle(TopOpeBRepDS_Interference) newI = new TopOpeBRepDS_EdgeVertexInterference(T,TopOpeBRepDS_EDGE,IB1,G,EVI->GBound(),Conf,EVI->Parameter()); diff --git a/src/TopOpeBRepDS/TopOpeBRepDS_EXPORT.cxx b/src/TopOpeBRepDS/TopOpeBRepDS_EXPORT.cxx index a97ea30cc2..fe531f9817 100644 --- a/src/TopOpeBRepDS/TopOpeBRepDS_EXPORT.cxx +++ b/src/TopOpeBRepDS/TopOpeBRepDS_EXPORT.cxx @@ -2134,7 +2134,7 @@ Standard_EXPORT void FUN_ds_PointToVertex(const Handle(TopOpeBRepDS_HDataStructu for (TopOpeBRepDS_ListIteratorOfListOfInterference itl(loi); itl.More(); itl.Next()){ const Handle(TopOpeBRepDS_Interference)& I = itl.Value(); - const Handle(TopOpeBRepDS_CurvePointInterference)& CPI = Handle(TopOpeBRepDS_CurvePointInterference)::DownCast(I); + Handle(TopOpeBRepDS_CurvePointInterference) CPI (Handle(TopOpeBRepDS_CurvePointInterference)::DownCast(I)); if (CPI.IsNull()) continue; Standard_Real par = CPI->Parameter(); @@ -2481,8 +2481,8 @@ Standard_EXPORT Standard_Boolean FDS_LOIinfsup( FDS_Idata(I,tsb1,isb1,tsa1,isa1,GT1,G1,ST1,S1); if (tsb1 != TopAbs_FACE) continue; if (tsa1 != TopAbs_FACE) continue; - const Handle(TopOpeBRepDS_CurvePointInterference)& cpi = Handle(TopOpeBRepDS_CurvePointInterference)::DownCast(I); - const Handle(TopOpeBRepDS_EdgeVertexInterference)& evi = Handle(TopOpeBRepDS_EdgeVertexInterference)::DownCast(I); + Handle(TopOpeBRepDS_CurvePointInterference) cpi (Handle(TopOpeBRepDS_CurvePointInterference)::DownCast(I)); + Handle(TopOpeBRepDS_EdgeVertexInterference) evi (Handle(TopOpeBRepDS_EdgeVertexInterference)::DownCast(I)); if (cpi.IsNull() && evi.IsNull()) continue; LOIsansGDS.Append(I); break; diff --git a/src/TopOpeBRepDS/TopOpeBRepDS_FIR.cxx b/src/TopOpeBRepDS/TopOpeBRepDS_FIR.cxx index 5a5107c1bb..ac3d009a5a 100644 --- a/src/TopOpeBRepDS/TopOpeBRepDS_FIR.cxx +++ b/src/TopOpeBRepDS/TopOpeBRepDS_FIR.cxx @@ -118,8 +118,8 @@ Standard_Boolean FUN_findPonF(const TopoDS_Edge& E,const TopOpeBRepDS_DataStruct Standard_Boolean pardef = Standard_False; Handle(TopOpeBRepDS_Interference)& I = itI.Value(); FDS_data(I,GT1,G1,ST1,S1); - const Handle(TopOpeBRepDS_CurvePointInterference)& CPI = Handle(TopOpeBRepDS_CurvePointInterference)::DownCast(I); - const Handle(TopOpeBRepDS_ShapeShapeInterference)& SSI = Handle(TopOpeBRepDS_ShapeShapeInterference)::DownCast(I); + Handle(TopOpeBRepDS_CurvePointInterference) CPI (Handle(TopOpeBRepDS_CurvePointInterference)::DownCast(I)); + Handle(TopOpeBRepDS_ShapeShapeInterference) SSI (Handle(TopOpeBRepDS_ShapeShapeInterference)::DownCast(I)); if (!CPI.IsNull()) { par = CPI->Parameter(); pardef = Standard_True; } diff --git a/src/TopOpeBRepDS/TopOpeBRepDS_FaceInterferenceTool.cxx b/src/TopOpeBRepDS/TopOpeBRepDS_FaceInterferenceTool.cxx index 9f455af4e9..26c0ece265 100644 --- a/src/TopOpeBRepDS/TopOpeBRepDS_FaceInterferenceTool.cxx +++ b/src/TopOpeBRepDS/TopOpeBRepDS_FaceInterferenceTool.cxx @@ -199,7 +199,7 @@ TopOpeBRepDS_FaceInterferenceTool::TopOpeBRepDS_FaceInterferenceTool void TopOpeBRepDS_FaceInterferenceTool::Init (const TopoDS_Shape& FFI,const TopoDS_Shape& EE,const Standard_Boolean EEisnew,const Handle(TopOpeBRepDS_Interference)& Iin) { - const Handle(TopOpeBRepDS_ShapeShapeInterference)& I = Handle(TopOpeBRepDS_ShapeShapeInterference)::DownCast(Iin); if (I.IsNull()) return; + Handle(TopOpeBRepDS_ShapeShapeInterference) I (Handle(TopOpeBRepDS_ShapeShapeInterference)::DownCast(Iin)); if (I.IsNull()) return; const TopoDS_Face& FI = TopoDS::Face(FFI); const TopoDS_Edge& E = TopoDS::Edge(EE); #ifdef OCCT_DEBUG @@ -263,7 +263,7 @@ void TopOpeBRepDS_FaceInterferenceTool::Init void TopOpeBRepDS_FaceInterferenceTool::Add (const TopoDS_Shape& FFI,const TopoDS_Shape& FFT,const TopoDS_Shape& EE,const Standard_Boolean EEisnew,const Handle(TopOpeBRepDS_Interference)& Iin) { - const Handle(TopOpeBRepDS_ShapeShapeInterference)& I = Handle(TopOpeBRepDS_ShapeShapeInterference)::DownCast(Iin); if (I.IsNull()) return; + Handle(TopOpeBRepDS_ShapeShapeInterference) I (Handle(TopOpeBRepDS_ShapeShapeInterference)::DownCast(Iin)); if (I.IsNull()) return; const TopoDS_Face& FI = TopoDS::Face(FFI); const TopoDS_Face& FT = TopoDS::Face(FFT); const TopoDS_Edge& E = TopoDS::Edge(EE); diff --git a/src/TopOpeBRepDS/TopOpeBRepDS_GapFiller.cxx b/src/TopOpeBRepDS/TopOpeBRepDS_GapFiller.cxx index d93d8b7922..d62bbd8df0 100644 --- a/src/TopOpeBRepDS/TopOpeBRepDS_GapFiller.cxx +++ b/src/TopOpeBRepDS/TopOpeBRepDS_GapFiller.cxx @@ -359,7 +359,7 @@ static Standard_Boolean Normal(const Handle(TopOpeBRepDS_GapTool)& A, IC->GKGSKS(GK,IG,SK,IS); if (SK == TopOpeBRepDS_CURVE) { const TopOpeBRepDS_Curve& C = HDS->Curve(IS); - Standard_Real P = (*((Handle(TopOpeBRepDS_CurvePointInterference)*)&IC))->Parameter(); + Standard_Real P = Handle(TopOpeBRepDS_CurvePointInterference)::DownCast (IC)->Parameter(); TopoDS_Shape S1,S2; C.GetShapes(S1,S2); diff --git a/src/TopOpeBRepDS/TopOpeBRepDS_GapTool.cxx b/src/TopOpeBRepDS/TopOpeBRepDS_GapTool.cxx index f0c0fa9d09..0bce0f825f 100644 --- a/src/TopOpeBRepDS/TopOpeBRepDS_GapTool.cxx +++ b/src/TopOpeBRepDS/TopOpeBRepDS_GapTool.cxx @@ -219,7 +219,7 @@ Standard_Boolean TopOpeBRepDS_GapTool::ParameterOnEdge(const Handle(TopOpeBRepDS if (myInterToShape.IsBound(I)) { const TopoDS_Shape& S = myInterToShape(I); if (S.IsSame(E)) { - U = (*((Handle(TopOpeBRepDS_CurvePointInterference)*)&I))->Parameter(); + U = Handle(TopOpeBRepDS_CurvePointInterference)::DownCast (I)->Parameter(); return 1; } } @@ -229,7 +229,7 @@ Standard_Boolean TopOpeBRepDS_GapTool::ParameterOnEdge(const Handle(TopOpeBRepDS if (myInterToShape.IsBound(II)) { const TopoDS_Shape& S = myInterToShape(II); if (S.IsSame(E)) { - U = (*((Handle(TopOpeBRepDS_CurvePointInterference)*)&II))->Parameter(); + U = Handle(TopOpeBRepDS_CurvePointInterference)::DownCast (II)->Parameter(); return 1; } } @@ -251,7 +251,7 @@ void TopOpeBRepDS_GapTool::SetParameterOnEdge(const Handle(TopOpeBRepDS_Interfer if (myInterToShape.IsBound(I)) { const TopoDS_Shape& S = myInterToShape(I); if (S.IsSame(E)) { - (*((Handle(TopOpeBRepDS_CurvePointInterference)*)&I))->Parameter(U); + Handle(TopOpeBRepDS_CurvePointInterference)::DownCast (I)->Parameter(U); } } const TopOpeBRepDS_ListOfInterference& LI = myGToI(I->Geometry()); @@ -260,7 +260,7 @@ void TopOpeBRepDS_GapTool::SetParameterOnEdge(const Handle(TopOpeBRepDS_Interfer if (myInterToShape.IsBound(II)) { const TopoDS_Shape& S = myInterToShape(II); if (S.IsSame(E)) { - (*((Handle(TopOpeBRepDS_CurvePointInterference)*)&II))->Parameter(U); + Handle(TopOpeBRepDS_CurvePointInterference)::DownCast (II)->Parameter(U); } } } diff --git a/src/TopOpeBRepDS/TopOpeBRepDS_InterferenceTool.cxx b/src/TopOpeBRepDS/TopOpeBRepDS_InterferenceTool.cxx index 7b2815ea2e..6205621667 100644 --- a/src/TopOpeBRepDS/TopOpeBRepDS_InterferenceTool.cxx +++ b/src/TopOpeBRepDS/TopOpeBRepDS_InterferenceTool.cxx @@ -135,7 +135,7 @@ Handle(TopOpeBRepDS_Interference) TopOpeBRepDS_InterferenceTool::MakeFaceEdgeInt //======================================================================= Standard_Real TopOpeBRepDS_InterferenceTool::Parameter(const Handle(TopOpeBRepDS_Interference)& I) { - return (*((Handle(TopOpeBRepDS_CurvePointInterference)*)&I))->Parameter(); + return Handle(TopOpeBRepDS_CurvePointInterference)::DownCast (I)->Parameter(); } //======================================================================= @@ -144,5 +144,5 @@ Standard_Real TopOpeBRepDS_InterferenceTool::Parameter(const Handle(TopOpeBRepDS //======================================================================= void TopOpeBRepDS_InterferenceTool::Parameter(const Handle(TopOpeBRepDS_Interference)& I,const Standard_Real Par) { - (*((Handle(TopOpeBRepDS_CurvePointInterference)*)&I))->Parameter(Par); + Handle(TopOpeBRepDS_CurvePointInterference)::DownCast (I)->Parameter(Par); } diff --git a/src/TopOpeBRepDS/TopOpeBRepDS_PointIterator.cxx b/src/TopOpeBRepDS/TopOpeBRepDS_PointIterator.cxx index 19313bcca2..24dc6a3d5f 100644 --- a/src/TopOpeBRepDS/TopOpeBRepDS_PointIterator.cxx +++ b/src/TopOpeBRepDS/TopOpeBRepDS_PointIterator.cxx @@ -86,10 +86,10 @@ Standard_Real TopOpeBRepDS_PointIterator::Parameter()const const Handle(TopOpeBRepDS_Interference)& I = Value(); Handle(Standard_Type) T = I->DynamicType(); if ( T == STANDARD_TYPE(TopOpeBRepDS_CurvePointInterference) ) { - return (*((Handle(TopOpeBRepDS_CurvePointInterference)*)&I))->Parameter(); + return Handle(TopOpeBRepDS_CurvePointInterference)::DownCast (I)->Parameter(); } else if ( T == STANDARD_TYPE(TopOpeBRepDS_EdgeVertexInterference) ) { - return (*((Handle(TopOpeBRepDS_EdgeVertexInterference)*)&I))->Parameter(); + return Handle(TopOpeBRepDS_EdgeVertexInterference)::DownCast (I)->Parameter(); } else { Standard_ProgramError::Raise("TopOpeBRepDS_PointIterator::Parameter()"); @@ -127,7 +127,7 @@ Standard_Boolean TopOpeBRepDS_PointIterator::DiffOriented() const { const Handle(TopOpeBRepDS_Interference)& I = Value(); if ( I->DynamicType() == STANDARD_TYPE(TopOpeBRepDS_EdgeVertexInterference) ) { - return (*((Handle(TopOpeBRepDS_EdgeVertexInterference)*)&I)) + return Handle(TopOpeBRepDS_EdgeVertexInterference)::DownCast (I) ->Config() == TopOpeBRepDS_DIFFORIENTED; } else { @@ -146,7 +146,7 @@ Standard_Boolean TopOpeBRepDS_PointIterator::SameOriented() const { const Handle(TopOpeBRepDS_Interference)& I = Value(); if ( I->DynamicType() == STANDARD_TYPE(TopOpeBRepDS_EdgeVertexInterference) ) { - return (*((Handle(TopOpeBRepDS_EdgeVertexInterference)*)&I)) + return Handle(TopOpeBRepDS_EdgeVertexInterference)::DownCast (I) ->Config() == TopOpeBRepDS_SAMEORIENTED; } else { diff --git a/src/TopOpeBRepTool/TopOpeBRepTool_CurveTool.cxx b/src/TopOpeBRepTool/TopOpeBRepTool_CurveTool.cxx index ec14f4621e..a873c06513 100644 --- a/src/TopOpeBRepTool/TopOpeBRepTool_CurveTool.cxx +++ b/src/TopOpeBRepTool/TopOpeBRepTool_CurveTool.cxx @@ -341,9 +341,9 @@ Standard_Boolean TopOpeBRepTool_CurveTool::MakeCurves Standard_Integer iparmin = (Standard_Integer)parmin; Standard_Integer iparmax = (Standard_Integer)parmax; - Handle(Geom_BSplineCurve)& HC3D = *((Handle(Geom_BSplineCurve)*)&C3D); - Handle(Geom2d_BSplineCurve)& HPC1 = *((Handle(Geom2d_BSplineCurve)*)&PC1); - Handle(Geom2d_BSplineCurve)& HPC2 = *((Handle(Geom2d_BSplineCurve)*)&PC2); + Handle(Geom_BSplineCurve)& HC3D = Handle(Geom_BSplineCurve)::DownCast (C3D); + Handle(Geom2d_BSplineCurve)& HPC1 = Handle(Geom2d_BSplineCurve)::DownCast (PC1); + Handle(Geom2d_BSplineCurve)& HPC2 = Handle(Geom2d_BSplineCurve)::DownCast (PC2); //--------------------- IFV - "improving" initial curves #ifdef CurveImprovement @@ -678,7 +678,7 @@ Standard_Boolean TopOpeBRepTool_CurveTool::MakeCurves Standard_Boolean bf, bl; - const Handle(Geom_BSplineCurve)& Curve = Handle(Geom_BSplineCurve)::DownCast(C3Dnew); + Handle(Geom_BSplineCurve) Curve (Handle(Geom_BSplineCurve)::DownCast(C3Dnew)); if(!Curve.IsNull()) { GeomLib_CheckBSplineCurve cbsc(Curve, 1.e-7, 0.1); cbsc.NeedTangentFix(bf, bl); @@ -694,7 +694,7 @@ Standard_Boolean TopOpeBRepTool_CurveTool::MakeCurves cbsc.FixTangent(bf, bl); } - const Handle(Geom2d_BSplineCurve)& Curve2df = Handle(Geom2d_BSplineCurve)::DownCast(PC1new); + Handle(Geom2d_BSplineCurve) Curve2df (Handle(Geom2d_BSplineCurve)::DownCast(PC1new)); if(!Curve2df.IsNull()) { GeomLib_Check2dBSplineCurve cbsc2df(Curve2df, 1.e-7, 0.1); cbsc2df.NeedTangentFix(bf, bl); @@ -709,7 +709,7 @@ Standard_Boolean TopOpeBRepTool_CurveTool::MakeCurves cbsc2df.FixTangent(bf, bl); } - const Handle(Geom2d_BSplineCurve)& Curve2ds = Handle(Geom2d_BSplineCurve)::DownCast(PC2new); + Handle(Geom2d_BSplineCurve) Curve2ds (Handle(Geom2d_BSplineCurve)::DownCast(PC2new)); if(!Curve2ds.IsNull()) { GeomLib_Check2dBSplineCurve cbsc2ds(Curve2ds, 1.e-7, 0.1); cbsc2ds.NeedTangentFix(bf, bl); diff --git a/src/TopOpeBRepTool/TopOpeBRepTool_FuseEdges.cxx b/src/TopOpeBRepTool/TopOpeBRepTool_FuseEdges.cxx index 2d0ed32735..111d435b15 100644 --- a/src/TopOpeBRepTool/TopOpeBRepTool_FuseEdges.cxx +++ b/src/TopOpeBRepTool/TopOpeBRepTool_FuseEdges.cxx @@ -327,7 +327,7 @@ void TopOpeBRepTool_FuseEdges::BuildListResultEdges() // if the curve is trimmed we get the basis curve to fit the new vertices // otherwise the makeedge will fail. if (C->DynamicType() == STANDARD_TYPE(Geom_TrimmedCurve)) { - C = (*((Handle(Geom_TrimmedCurve)*)&C))->BasisCurve(); + C = Handle(Geom_TrimmedCurve)::DownCast (C)->BasisCurve(); } #ifdef OCCT_DEBUG @@ -618,7 +618,7 @@ Standard_Boolean TopOpeBRepTool_FuseEdges::SameSupport(const TopoDS_Edge& E1, if (!loc.IsIdentity()) { Handle(Geom_Geometry) GG1 = C1->Transformed(loc.Transformation()); - C1 = *((Handle(Geom_Curve)*)&GG1); + C1 = Handle(Geom_Curve)::DownCast (GG1); } C2 = BRep_Tool::Curve(E2,loc,f2,l2); //modified by NIZNHY-PKV Mon Nov 15 16:24:38 1999 @@ -627,19 +627,19 @@ Standard_Boolean TopOpeBRepTool_FuseEdges::SameSupport(const TopoDS_Edge& E1, if (!loc.IsIdentity()) { Handle(Geom_Geometry) GG2 = C2->Transformed(loc.Transformation()); - C2 = *((Handle(Geom_Curve)*)&GG2); + C2 = Handle(Geom_Curve)::DownCast (GG2); } 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(); } @@ -662,8 +662,8 @@ Standard_Boolean TopOpeBRepTool_FuseEdges::SameSupport(const TopoDS_Edge& E1, const Standard_Real tollin = Precision::Confusion(); const Standard_Real tolang = Precision::Angular(); 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()); gp_Dir dir1(li1.Direction()); gp_Dir dir2(li2.Direction()); @@ -682,8 +682,8 @@ Standard_Boolean TopOpeBRepTool_FuseEdges::SameSupport(const TopoDS_Edge& E1, return Standard_False; } else if (typC1 == STANDARD_TYPE(Geom_Circle)) { - gp_Circ ci1 = (*((Handle(Geom_Circle)*)&C1))->Circ(); - gp_Circ ci2 = (*((Handle(Geom_Circle)*)&C2))->Circ(); + gp_Circ ci1 = Handle(Geom_Circle)::DownCast (C1)->Circ(); + gp_Circ ci2 = Handle(Geom_Circle)::DownCast (C2)->Circ(); if (Abs(ci1.Radius()-ci2.Radius()) <= tollin && ci1.Location().SquareDistance(ci2.Location()) <= tollin*tollin && ci1.Axis().IsParallel(ci2.Axis(),tolang) ) { @@ -693,8 +693,8 @@ Standard_Boolean TopOpeBRepTool_FuseEdges::SameSupport(const TopoDS_Edge& E1, return Standard_False; } else if (typC1 == STANDARD_TYPE(Geom_Ellipse)) { - gp_Elips ci1 = (*((Handle(Geom_Ellipse)*)&C1))->Elips(); - gp_Elips ci2 = (*((Handle(Geom_Ellipse)*)&C2))->Elips(); + gp_Elips ci1 = Handle(Geom_Ellipse)::DownCast (C1)->Elips(); + gp_Elips ci2 = Handle(Geom_Ellipse)::DownCast (C2)->Elips(); if (Abs(ci1.MajorRadius()-ci2.MajorRadius()) <= tollin && Abs(ci1.MinorRadius()-ci2.MinorRadius()) <= tollin && @@ -714,8 +714,8 @@ Standard_Boolean TopOpeBRepTool_FuseEdges::SameSupport(const TopoDS_Edge& E1, return Standard_False; } - Handle(Geom_BSplineCurve) B1 = *((Handle(Geom_BSplineCurve)*)&C1); - Handle(Geom_BSplineCurve) B2 = *((Handle(Geom_BSplineCurve)*)&C2); + Handle(Geom_BSplineCurve) B1 = Handle(Geom_BSplineCurve)::DownCast (C1); + Handle(Geom_BSplineCurve) B2 = Handle(Geom_BSplineCurve)::DownCast (C2); Standard_Integer nbpoles = B1->NbPoles(); if (nbpoles != B2->NbPoles()) { @@ -787,8 +787,8 @@ Standard_Boolean TopOpeBRepTool_FuseEdges::SameSupport(const TopoDS_Edge& E1, return Standard_False; } - Handle(Geom_BezierCurve) B1 = *((Handle(Geom_BezierCurve)*)&C1); - Handle(Geom_BezierCurve) B2 = *((Handle(Geom_BezierCurve)*)&C2); + Handle(Geom_BezierCurve) B1 = Handle(Geom_BezierCurve)::DownCast (C1); + Handle(Geom_BezierCurve) B2 = Handle(Geom_BezierCurve)::DownCast (C2); Standard_Integer nbpoles = B1->NbPoles(); if (nbpoles != B2->NbPoles()) { @@ -939,16 +939,16 @@ Standard_Boolean TopOpeBRepTool_FuseEdges::UpdatePCurve(const TopoDS_Edge& theOl Handle(Geom2d_Curve) Curv2dR = BRep_Tool::CurveOnSurface(aFEdge, aFFace,cf,cl); if (Curv2d->DynamicType() == STANDARD_TYPE(Geom2d_TrimmedCurve)) - Curv2d = (*((Handle(Geom2d_TrimmedCurve)*)&Curv2d))->BasisCurve(); + Curv2d = Handle(Geom2d_TrimmedCurve)::DownCast (Curv2d)->BasisCurve(); if (Curv2dR->DynamicType() == STANDARD_TYPE(Geom2d_TrimmedCurve)) - Curv2dR = (*((Handle(Geom2d_TrimmedCurve)*)&Curv2dR))->BasisCurve(); + Curv2dR = Handle(Geom2d_TrimmedCurve)::DownCast (Curv2dR)->BasisCurve(); B.UpdateEdge (theNewEdge,Curv2d,Curv2dR,Surf,loc,BRep_Tool::Tolerance(theNewEdge)); } else { // update the new edge if (Curv2d->DynamicType() == STANDARD_TYPE(Geom2d_TrimmedCurve)) - Curv2d = (*((Handle(Geom2d_TrimmedCurve)*)&Curv2d))->BasisCurve(); + Curv2d = Handle(Geom2d_TrimmedCurve)::DownCast (Curv2d)->BasisCurve(); Standard_Real f, l; f = Curv2d->FirstParameter(); l = Curv2d->LastParameter(); diff --git a/src/TopOpeBRepTool/TopOpeBRepTool_ShapeTool.cxx b/src/TopOpeBRepTool/TopOpeBRepTool_ShapeTool.cxx index 80f07e50eb..dd708a897c 100644 --- a/src/TopOpeBRepTool/TopOpeBRepTool_ShapeTool.cxx +++ b/src/TopOpeBRepTool/TopOpeBRepTool_ShapeTool.cxx @@ -320,7 +320,7 @@ Standard_Real TopOpeBRepTool_ShapeTool::PeriodizeParameter Handle(Standard_Type) TheType = PC->DynamicType(); if (TheType == STANDARD_TYPE(Geom2d_Line)) { - const Handle(Geom2d_Line)& HL = *((Handle(Geom2d_Line)*)&PC); + Handle(Geom2d_Line) HL (Handle(Geom2d_Line)::DownCast (PC)); const gp_Dir2d& D = HL->Direction(); Standard_Real tol = Precision::Angular(); diff --git a/src/Units/Units_UnitsDictionary.cxx b/src/Units/Units_UnitsDictionary.cxx index 1ad280efe2..d3d75e6536 100644 --- a/src/Units/Units_UnitsDictionary.cxx +++ b/src/Units/Units_UnitsDictionary.cxx @@ -267,7 +267,7 @@ void Units_UnitsDictionary::Creates(const Standard_CString afilename) if(move) { Standard_Integer last = theunitssequence->Length(); unit = theunitssequence->Value(last); - shiftedunit = *(Handle(Units_ShiftedUnit)*)&unit; + shiftedunit = Handle(Units_ShiftedUnit)::DownCast (unit); shiftedunit->Move(move); } } diff --git a/src/Units/Units_UnitsSystem.cxx b/src/Units/Units_UnitsSystem.cxx index 064b765d89..08db60f5c8 100644 --- a/src/Units/Units_UnitsSystem.cxx +++ b/src/Units/Units_UnitsSystem.cxx @@ -402,7 +402,7 @@ Standard_Real Units_UnitsSystem::ConvertUserSystemValueToSI void Units_UnitsSystem::Dump() const { Handle(Standard_Transient) transient = This(); - Handle(Units_UnitsSystem) unitssystem = *(Handle(Units_UnitsSystem)*)&transient; + Handle(Units_UnitsSystem) unitssystem = Handle(Units_UnitsSystem)::DownCast (transient); Units_Explorer explorer(unitssystem); cout<<" UNITSSYSTEM : "<XStep (), YS = theGrid->YStep (); // project point on plane to grid local space @@ -215,7 +215,7 @@ Graphic3d_Vertex V3d_View::Compute (const Graphic3d_Vertex & AVertex) const Standard_Integer DN; Standard_Real Alpha; Handle(Aspect_CircularGrid) theGrid = - *(Handle(Aspect_CircularGrid) *) &MyGrid; + Handle(Aspect_CircularGrid)::DownCast (MyGrid); RS = theGrid->RadiusStep (); DN = theGrid->DivisionNumber (); Alpha = M_PI / Standard_Real (DN); diff --git a/src/ViewerTest/ViewerTest.cxx b/src/ViewerTest/ViewerTest.cxx index fc76b2f5ff..095acb9c89 100644 --- a/src/ViewerTest/ViewerTest.cxx +++ b/src/ViewerTest/ViewerTest.cxx @@ -387,7 +387,7 @@ Handle(ViewerTest_EventManager) ViewerTest::CurrentEventManager() Handle(ViewerTest_EventManager) EM; if(theEventMgrs.IsEmpty()) return EM; Handle(Standard_Transient) Tr = theEventMgrs.First(); - EM = *((Handle(ViewerTest_EventManager)*)&Tr); + EM = Handle(ViewerTest_EventManager)::DownCast (Tr); return EM; } @@ -440,7 +440,7 @@ Handle(AIS_Shape) GetAISShapeFromName(const char* name) if (!IO.IsNull()) { if(IO->Type()==AIS_KOI_Shape) { if(IO->Signature()==0){ - retsh = *((Handle(AIS_Shape)*)&IO); + retsh = Handle(AIS_Shape)::DownCast (IO); } else cout << "an Object which is not an AIS_Shape " @@ -4569,7 +4569,7 @@ TopoDS_Shape ViewerTest::PickShape(const TopAbs_ShapeEnum TheType, result = TheAISContext()->SelectedShape(); else{ Handle(AIS_InteractiveObject) IO = TheAISContext()->SelectedInteractive(); - result = (*((Handle(AIS_Shape)*) &IO))->Shape(); + result = Handle(AIS_Shape)::DownCast (IO)->Shape(); } } @@ -4636,7 +4636,7 @@ Standard_Boolean ViewerTest::PickShapes (const TopAbs_ShapeEnum TheType, thearr->SetValue(i,TheAISContext()->SelectedShape()); else{ Handle(AIS_InteractiveObject) IO = TheAISContext()->SelectedInteractive(); - thearr->SetValue(i,(*((Handle(AIS_Shape)*) &IO))->Shape()); + thearr->SetValue(i,Handle(AIS_Shape)::DownCast (IO)->Shape()); } } @@ -4765,7 +4765,7 @@ static int VPickSelected (Draw_Interpretor& , Standard_Integer theArgNb, const c else { Handle(AIS_InteractiveObject) IO = TheAISContext()->SelectedInteractive(); - aShape = (*((Handle(AIS_Shape)*) &IO))->Shape(); + aShape = Handle(AIS_Shape)::DownCast (IO)->Shape(); } TCollection_AsciiString aCurrentName = aName; @@ -4916,7 +4916,7 @@ static int VEraseType( Draw_Interpretor& , Standard_Integer argc, const char** a if(dimension_status == -1) TheAISContext()->Erase(curio,Standard_False); else { - AIS_KindOfDimension KOD = (*((Handle(AIS_Relation)*)&curio))->KindOfDimension(); + AIS_KindOfDimension KOD = Handle(AIS_Relation)::DownCast (curio)->KindOfDimension(); if ((dimension_status==0 && KOD == AIS_KOD_NONE)|| (dimension_status==1 && KOD != AIS_KOD_NONE)) TheAISContext()->Erase(curio,Standard_False); @@ -4949,7 +4949,7 @@ static int VDisplayType(Draw_Interpretor& , Standard_Integer argc, const char** if(dimension_status == -1) TheAISContext()->Display(curio,Standard_False); else { - AIS_KindOfDimension KOD = (*((Handle(AIS_Relation)*)&curio))->KindOfDimension(); + AIS_KindOfDimension KOD = Handle(AIS_Relation)::DownCast (curio)->KindOfDimension(); if ((dimension_status==0 && KOD == AIS_KOD_NONE)|| (dimension_status==1 && KOD != AIS_KOD_NONE)) TheAISContext()->Display(curio,Standard_False); diff --git a/src/ViewerTest/ViewerTest_ObjectCommands.cxx b/src/ViewerTest/ViewerTest_ObjectCommands.cxx index a0f3a6b360..62edac76cc 100644 --- a/src/ViewerTest/ViewerTest_ObjectCommands.cxx +++ b/src/ViewerTest/ViewerTest_ObjectCommands.cxx @@ -354,7 +354,7 @@ static int VSize (Draw_Interpretor& di, Standard_Integer argc, const char** argv // On downcast aShape de AIS_InteractiveObject a AIS_Trihedron // pour lui appliquer la methode SetSize() - Handle(AIS_Trihedron) aTrihedron = *(Handle(AIS_Trihedron)*) &aShape; + Handle(AIS_Trihedron) aTrihedron = Handle(AIS_Trihedron)::DownCast (aShape); // C'est bien un triedre,on chage sa valeur! aTrihedron->SetSize(value); @@ -415,7 +415,7 @@ static int VSize (Draw_Interpretor& di, Standard_Integer argc, const char** argv // On downcast aShape de AIS_InteractiveObject a AIS_Trihedron // pour lui appliquer la methode SetSize() - Handle(AIS_Trihedron) aTrihedron = *(Handle(AIS_Trihedron)*) &aShape; + Handle(AIS_Trihedron) aTrihedron = Handle(AIS_Trihedron)::DownCast (aShape); // C'est bien un triedre,on chage sa valeur aTrihedron->SetSize(value); @@ -475,7 +475,7 @@ static int VPlaneTrihedron (Draw_Interpretor& di, Standard_Integer argc, const c if (!ShapeA.IsNull() && ShapeA->Type()==AIS_KOI_Datum && ShapeA->Signature()==3 ) { // on le downcast - Handle(AIS_Trihedron) TrihedronA =((*(Handle(AIS_Trihedron)*)&ShapeA)); + Handle(AIS_Trihedron) TrihedronA =(Handle(AIS_Trihedron)::DownCast (ShapeA)); // on le charge dans le contexte et on active le mode Plane. TheAISContext()->Load(TrihedronA,0,Standard_False); TheAISContext()->Activate(TrihedronA,3); @@ -496,7 +496,7 @@ static int VPlaneTrihedron (Draw_Interpretor& di, Standard_Integer argc, const c theIOB = TheAISContext()->Interactive(); } // on le downcast - Handle(AIS_Plane) PlaneB =((*(Handle(AIS_Plane)*)&theIOB)); + Handle(AIS_Plane) PlaneB =(Handle(AIS_Plane)::DownCast (theIOB)); // Fermeture du contexte local. TheAISContext()->CloseLocalContext(myCurrentIndex); @@ -1796,15 +1796,15 @@ static int VLineBuilder(Draw_Interpretor& di, Standard_Integer argc, const char* } else {di <<"vline error: wrong type of 1st argument."<<"\n";return 1; } // Les deux parametres sont du bon type. On verifie que les points ne sont pas confondus - Handle(AIS_Point) theAISPointA= *(Handle(AIS_Point)*)& theShapeA; - Handle(AIS_Point) theAISPointB= *(Handle(AIS_Point)*)& theShapeB; + Handle(AIS_Point) theAISPointA= Handle(AIS_Point)::DownCast (theShapeA); + Handle(AIS_Point) theAISPointB= Handle(AIS_Point)::DownCast (theShapeB); Handle(Geom_Point ) myGeomPointBA= theAISPointA->Component(); - Handle(Geom_CartesianPoint ) myCartPointA= *((Handle(Geom_CartesianPoint)*)& myGeomPointBA); + Handle(Geom_CartesianPoint ) myCartPointA= Handle(Geom_CartesianPoint)::DownCast (myGeomPointBA); // Handle(Geom_CartesianPoint ) myCartPointA= *(Handle(Geom_CartesianPoint)*)& (theAISPointA->Component() ) ; Handle(Geom_Point ) myGeomPointB= theAISPointB->Component(); - Handle(Geom_CartesianPoint ) myCartPointB= *((Handle(Geom_CartesianPoint)*)& myGeomPointB); + Handle(Geom_CartesianPoint ) myCartPointB= Handle(Geom_CartesianPoint)::DownCast (myGeomPointB); // Handle(Geom_CartesianPoint ) myCartPointB= *(Handle(Geom_CartesianPoint)*)& (theAISPointB->Component() ) ; if (myCartPointB->X()==myCartPointA->X() && myCartPointB->Y()==myCartPointA->Y() && myCartPointB->Z()==myCartPointA->Z() ) { diff --git a/src/Visual3d/Visual3d_ViewManager.cxx b/src/Visual3d/Visual3d_ViewManager.cxx index f1bac40a9b..2b10c5aa9e 100644 --- a/src/Visual3d/Visual3d_ViewManager.cxx +++ b/src/Visual3d/Visual3d_ViewManager.cxx @@ -192,7 +192,7 @@ void Visual3d_ViewManager::ReCompute (const Handle(Graphic3d_Structure)& AStruct #ifdef DOWNCAST Handle(Visual3d_View) theView = Handle(Visual3d_View)::DownCast (AProjector); #else - Handle(Visual3d_View) theView = *(Handle(Visual3d_View) *) &AProjector; + Handle(Visual3d_View) theView = Handle(Visual3d_View)::DownCast (AProjector); #endif Standard_Integer ViewId = theView->Identification (); -- 2.20.1