From e91fd0250db20589a9f0dc45e59e8e05f6c36934 Mon Sep 17 00:00:00 2001 From: abv Date: Fri, 11 Mar 2016 07:23:55 +0300 Subject: [PATCH] 0027247: Eliminate remaining compiler warnings in MFC samples and with OCCT_DEBUG Unsafe and useless casts of handles are eliminated --- .../standard/01_Geometry/src/GeomSources.cpp | 26 +++++++++---------- .../src/ISession2D/ISession_Curve.cpp | 2 +- .../src/ISession2D/ISession_Curve.h | 2 +- .../src/ISession2D/ISession_Surface.cpp | 2 +- .../src/ISession2D/ISession_Surface.h | 2 +- samples/mfc/standard/06_Ocaf/src/OcafDoc.cpp | 4 +-- .../standard/06_Ocaf/src/TOcaf_Commands.cxx | 10 +++---- .../10_Convert/src/Convert_Presentation.cpp | 8 +++--- src/MAT2d/MAT2d_Tool2d.cxx | 2 +- .../TopOpeBRepBuild_PaveSet.cxx | 4 +-- 10 files changed, 31 insertions(+), 31 deletions(-) diff --git a/samples/mfc/standard/01_Geometry/src/GeomSources.cpp b/samples/mfc/standard/01_Geometry/src/GeomSources.cpp index b59cd3d12f..0c433bc1e2 100755 --- a/samples/mfc/standard/01_Geometry/src/GeomSources.cpp +++ b/samples/mfc/standard/01_Geometry/src/GeomSources.cpp @@ -531,7 +531,7 @@ void GeomSources::gpTest7(CGeometryDoc* aDoc) gp_Pnt2d P2(5.5,1); gp_Pnt2d P3(-2,2); - Handle(Geom2d_TrimmedCurve) C = + Handle(Geom2d_Curve) C = GCE2d_MakeArcOfCircle (P1,P2,P3).Value(); Standard_Real FirstParameter = C->FirstParameter(); @@ -569,7 +569,7 @@ C->D1(param,P,V); \n\ AddSeparator(aDoc,Message); //-------------------------------------------------------------- - DisplayCurve(aDoc,Handle(Geom2d_Curve)::DownCast(C)); + DisplayCurve(aDoc,C); Handle(ISession_Direction) aDirection = new ISession_Direction(P,V); aDoc->GetISessionContext()->Display(aDirection, Standard_False); @@ -844,7 +844,7 @@ void GeomSources::gpTest12(CGeometryDoc* aDoc) gp_Pnt N,Q,P(1,2,3); Standard_Real distance, radius = 5; - Handle(Geom_Circle) C = new Geom_Circle(gp::XOY(),radius); + Handle(Geom_Curve) C = new Geom_Circle(gp::XOY(),radius); GeomAPI_ProjectPointOnCurve PPC (P,C); N = PPC.NearestPoint(); Standard_Integer NbResults = PPC.NbPoints(); @@ -890,7 +890,7 @@ if(NbResults>0){ \n\ aString += Message2; DisplayPoint(aDoc,N,aString.ToCString(),false,0.5,0,-0.5); - DisplayCurve(aDoc,Handle(Geom_Curve)::DownCast(C),Quantity_NOC_YELLOW,false); + DisplayCurve(aDoc,C,Quantity_NOC_YELLOW,false); if(NbResults>0) { @@ -1052,8 +1052,8 @@ if (ICQ.IsDone()){ \n\ DisplaySurface(aDoc,aSurface); - Handle(Geom_Ellipse) anEllips = GC_MakeEllipse(EL).Value(); - DisplayCurve(aDoc,Handle(Geom_Curve)::DownCast(anEllips),Quantity_NOC_YELLOW,false); + Handle(Geom_Curve) anEllips = GC_MakeEllipse(EL).Value(); + DisplayCurve(aDoc,anEllips,Quantity_NOC_YELLOW,false); TCollection_AsciiString aString; @@ -1718,7 +1718,7 @@ gp_Ax2d C2DCircleXAxis = C2DCircle->XAxis(); \n\ Message += aC2DEntityTypeName; Message += " \n"; DisplayCurve(aDoc,circ2d,4,false); - DisplayCurve(aDoc,Handle(Geom_Curve)::DownCast(C3D),Quantity_NOC_YELLOW,false); + DisplayCurve(aDoc,C3D,Quantity_NOC_YELLOW,false); DisplayCurve(aDoc,C2D,5,false); Handle(ISession_Direction) aC3DCircleXAxisDirection = new ISession_Direction(C3DCircleXAxis.Location(),C3DCircleXAxis.Direction(),5.2); @@ -3103,7 +3103,7 @@ void GeomSources::gpTest40(CGeometryDoc* aDoc) array1.SetValue(4,gp_Pnt (-5,4,-7)); array1.SetValue(5,gp_Pnt (-3,5,-12)); - Handle(Geom_BSplineCurve) SPL1 = + Handle(Geom_Curve) SPL1 = GeomAPI_PointsToBSpline(array1).Curve(); GeomFill_Pipe aPipe(SPL1,1); @@ -3126,7 +3126,7 @@ void GeomSources::gpTest40(CGeometryDoc* aDoc) GC_MakeSegment(gp_Pnt(1,1,1),gp_Pnt(5,5,5)); Handle(Geom_TrimmedCurve) TC2 = GC_MakeSegment(gp_Pnt(1,1,0),gp_Pnt(4,5,6)); - GeomFill_Pipe aPipe3(Handle(Geom_Curve)::DownCast(SPL1),TC1,TC2); + GeomFill_Pipe aPipe3(SPL1,TC1,TC2); aPipe3.Perform(); Handle(Geom_Surface) aSurface3 = aPipe3.Surface(); Standard_CString aSurfaceEntityTypeName3="Not Computed"; @@ -3667,8 +3667,8 @@ void GeomSources::gpTest46(CGeometryDoc* aDoc) GeomFill_BSplineCurves aGeomFill1(SPL1,SPL2,Type); Handle(Geom_BSplineSurface) aGeomSurface = aGeomFill1.Surface(); - Handle(Geom_BSplineSurface) aTranslatedGeomSurface = - Handle(Geom_BSplineSurface)::DownCast(aGeomSurface->Copy()); + Handle(Geom_BoundedSurface) aTranslatedGeomSurface = + Handle(Geom_BoundedSurface)::DownCast(aGeomSurface->Copy()); Standard_Real extension = 3; Standard_Integer continuity = 2; @@ -3694,8 +3694,8 @@ GeomFill_FillingStyle Type = GeomFill_StretchStyle; \n\ GeomFill_BSplineCurves aGeomFill1(SPL1,SPL2,Type); \n\ Handle(Geom_BSplineSurface) aGeomSurface = aGeomFill1.Surface(); \n\ \n\ -Handle(Geom_BSplineSurface) aTranslatedGeomSurface = \n\ - Handle(Geom_BSplineSurface)::DownCast(aGeomSurface->Copy()); \n\ +Handle(Geom_BoundedSurface) aTranslatedGeomSurface = \n\ + Handle(Geom_BoundedSurface)::DownCast(aGeomSurface->Copy()); \n\ \n\ Standard_Real extension = 3; \n\ Standard_Integer continuity = 2; \n\ diff --git a/samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Curve.cpp b/samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Curve.cpp index cd4d879469..a712c3de19 100755 --- a/samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Curve.cpp +++ b/samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Curve.cpp @@ -19,7 +19,7 @@ static char THIS_FILE[]=__FILE__; ////////////////////////////////////////////////////////////////////// -ISession_Curve::ISession_Curve(Handle(Geom_Curve)& aCurve) +ISession_Curve::ISession_Curve(const Handle(Geom_Curve)& aCurve) :AIS_InteractiveObject(),myCurve(aCurve) { diff --git a/samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Curve.h b/samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Curve.h index 0c95380a25..54fc440888 100755 --- a/samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Curve.h +++ b/samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Curve.h @@ -17,7 +17,7 @@ DEFINE_STANDARD_HANDLE(ISession_Curve,AIS_InteractiveObject) class ISession_Curve : public AIS_InteractiveObject { public: - ISession_Curve(Handle(Geom_Curve)& aCurve); + ISession_Curve(const Handle(Geom_Curve)& aCurve); virtual ~ISession_Curve(); DEFINE_STANDARD_RTTIEXT(ISession_Curve,AIS_InteractiveObject) diff --git a/samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Surface.cpp b/samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Surface.cpp index 73eb1da913..8475fbc775 100755 --- a/samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Surface.cpp +++ b/samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Surface.cpp @@ -22,7 +22,7 @@ IMPLEMENT_STANDARD_RTTIEXT(ISession_Surface,AIS_InteractiveObject) // Construction/Destruction ////////////////////////////////////////////////////////////////////// -ISession_Surface::ISession_Surface(Handle(Geom_Surface)& aSurface) +ISession_Surface::ISession_Surface(const Handle(Geom_Surface)& aSurface) :AIS_InteractiveObject(),mySurface(aSurface) { } diff --git a/samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Surface.h b/samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Surface.h index 4cab1ba9fb..f31a7cd573 100755 --- a/samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Surface.h +++ b/samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Surface.h @@ -17,7 +17,7 @@ class ISession_Surface : public AIS_InteractiveObject { public: ISession_Surface(); - ISession_Surface(Handle(Geom_Surface)& aSurface); + ISession_Surface(const Handle(Geom_Surface)& aSurface); virtual ~ISession_Surface(); DEFINE_STANDARD_RTTIEXT(ISession_Surface,AIS_InteractiveObject) diff --git a/samples/mfc/standard/06_Ocaf/src/OcafDoc.cpp b/samples/mfc/standard/06_Ocaf/src/OcafDoc.cpp index 0ef62eddf5..5b6872df45 100755 --- a/samples/mfc/standard/06_Ocaf/src/OcafDoc.cpp +++ b/samples/mfc/standard/06_Ocaf/src/OcafDoc.cpp @@ -600,7 +600,7 @@ D->CommitCommand(); \n\ Sleep(1000); // Get the TOcafFunction_CutDriver using its Standard_GUID in the TFunction_DriverTable - Handle(TOcafFunction_CutDriver) myCutDriver; + Handle(TFunction_Driver) myCutDriver; if (TFunction_DriverTable::Get()->FindDriver(myDriverID, myCutDriver)) myCutDriver->Init(LabObject); @@ -643,7 +643,7 @@ TOcaf_Commands TSC(ToolLab); \n\ TSC.ModifyBox(m_x, m_y, m_z, m_w, m_l, m_h, Name); \n\ \n\ // Getting the TOcafFunction_CutDriver used to create the cut\n\ -Handle(TOcafFunction_CutDriver) myCutDriver; \n\ +Handle(TFunction_Driver) myCutDriver; \n\ TFunction_DriverTable::Get()->FindDriver(myDriverID, myCutDriver); \n\ \n\ // Recompute the cut if it must be (if an attribute was modified)\n\ diff --git a/samples/mfc/standard/06_Ocaf/src/TOcaf_Commands.cxx b/samples/mfc/standard/06_Ocaf/src/TOcaf_Commands.cxx index 7447a12526..1f956b6355 100755 --- a/samples/mfc/standard/06_Ocaf/src/TOcaf_Commands.cxx +++ b/samples/mfc/standard/06_Ocaf/src/TOcaf_Commands.cxx @@ -90,7 +90,7 @@ TDF_Label TOcaf_Commands::CreateBox(Standard_Real x, Standard_Real y, Standard_R // Initialize and execute the box driver (look at the "Execute()" code) Handle(TFunction_Logbook) log = TFunction_Logbook::Set(L); - Handle(TOcafFunction_BoxDriver) myBoxDriver; + Handle(TFunction_Driver) myBoxDriver; // Find the TOcafFunction_BoxDriver in the TFunction_DriverTable using its GUID if(!TFunction_DriverTable::Get()->FindDriver(TOcafFunction_BoxDriver::GetID(), myBoxDriver)) return L; @@ -145,7 +145,7 @@ TDF_Label TOcaf_Commands::CreateCyl(Standard_Real x, Standard_Real y, Standard_R // Initialize and execute the cylinder driver (look at the "Execute()" code) Handle(TFunction_Logbook) log = TFunction_Logbook::Set(L); - Handle(TOcafFunction_CylDriver) myCylDriver; + Handle(TFunction_Driver) myCylDriver; // Find the TOcafFunction_CylDriver in the TFunction_DriverTable using its GUID if(!TFunction_DriverTable::Get()->FindDriver(TOcafFunction_CylDriver::GetID(), myCylDriver)) return L; @@ -223,7 +223,7 @@ TDF_Label TOcaf_Commands::ModifyBox(Standard_Real x, Standard_Real y, Standard_R // Get the TFunction_FunctionDriver GUID used with the TFunction_Function Standard_GUID myDriverID=TFF->GetDriverGUID(); - Handle(TOcafFunction_BoxDriver) myBoxDriver; + Handle(TFunction_Driver) myBoxDriver; // Find the TOcafFunction_BoxDriver in the TFunction_DriverTable using its GUID TFunction_DriverTable::Get()->FindDriver(myDriverID, myBoxDriver); // Execute the cut if it must be (if an attribute changes) @@ -298,7 +298,7 @@ TDF_Label TOcaf_Commands::ModifyCyl(Standard_Real x, Standard_Real y, Standard_R // Get the TFunction_FunctionDriver GUID used with the TFunction_Function Standard_GUID myDriverID=TFF->GetDriverGUID(); - Handle(TOcafFunction_CylDriver) myCylDriver; + Handle(TFunction_Driver) myCylDriver; // Find the TOcafFunction_CylDriver in the TFunction_DriverTable using its GUID TFunction_DriverTable::Get()->FindDriver(myDriverID, myCylDriver); // Execute the cut if it must be (if an attribute changes) @@ -346,7 +346,7 @@ TDF_Label TOcaf_Commands::Cut(TDF_Label ObjectLab, TDF_Label ToolObjectLab) // Initialize and execute the cut driver (look at the "Execute()" code) Handle(TFunction_Logbook) log = TFunction_Logbook::Set(L); - Handle(TOcafFunction_CutDriver) myCutDriver; + Handle(TFunction_Driver) myCutDriver; // Find the TOcafFunction_CutDriver in the TFunction_DriverTable using its GUID if(!TFunction_DriverTable::Get()->FindDriver(TOcafFunction_CutDriver::GetID(), myCutDriver)) return L; diff --git a/samples/mfc/standard/10_Convert/src/Convert_Presentation.cpp b/samples/mfc/standard/10_Convert/src/Convert_Presentation.cpp index 2724bb9b82..d657a00222 100755 --- a/samples/mfc/standard/10_Convert/src/Convert_Presentation.cpp +++ b/samples/mfc/standard/10_Convert/src/Convert_Presentation.cpp @@ -135,9 +135,9 @@ void Convert_Presentation::drawCurveAndItsBSpline(Handle(Geom_Curve) theCurve, if (WAIT_A_LITTLE) return; - Handle(Geom_BSplineCurve) aBSpline = GeomConvert::CurveToBSplineCurve(theCurve); + Handle(Geom_Curve) aBSpline = GeomConvert::CurveToBSplineCurve(theCurve); - drawCurve (Handle(Geom_Curve)::DownCast(aBSpline), BSplineColor); + drawCurve (aBSpline, BSplineColor); } @@ -367,8 +367,8 @@ void Convert_Presentation::sampleRevolSurface() aPoles(3) = gp_Pnt(350, 150, 0); aWeights(3) =120; aPoles(4) = gp_Pnt(500, 500, 0); aWeights(4) = 1; - Handle(Geom_BezierCurve) aBezierCurve = new Geom_BezierCurve(aPoles, aWeights); - drawCurve(Handle(Geom_Curve)::DownCast(aBezierCurve)); + Handle(Geom_Curve) aBezierCurve = new Geom_BezierCurve(aPoles, aWeights); + drawCurve(aBezierCurve); // creating a surface of revolution of the bezier curve around Y axis gp_Ax1 anAx(gp_Pnt(0,0,0), gp_Dir(0,1,0)); diff --git a/src/MAT2d/MAT2d_Tool2d.cxx b/src/MAT2d/MAT2d_Tool2d.cxx index 96e6e84856..0175199994 100644 --- a/src/MAT2d/MAT2d_Tool2d.cxx +++ b/src/MAT2d/MAT2d_Tool2d.cxx @@ -1078,7 +1078,7 @@ void MAT2d_Tool2d::Dump(const Standard_Integer bisector, if(bisector == -1) return; if(bisector > theNumberOfBisectors) return; - Handle(Geom2d_Curve) thebisector = Handle(Geom2d_Curve)::DownCast(GeomBis(bisector).Value()); + Handle(Geom2d_Curve) thebisector = GeomBis(bisector).Value(); MAT2d_DrawCurve(thebisector,3); diff --git a/src/TopOpeBRepBuild/TopOpeBRepBuild_PaveSet.cxx b/src/TopOpeBRepBuild/TopOpeBRepBuild_PaveSet.cxx index 91e855996f..301ca54a7b 100644 --- a/src/TopOpeBRepBuild/TopOpeBRepBuild_PaveSet.cxx +++ b/src/TopOpeBRepBuild/TopOpeBRepBuild_PaveSet.cxx @@ -280,8 +280,8 @@ void TopOpeBRepBuild_PaveSet::Prepare() myVerticesIt.Initialize(myVertices); if ( MoreLoop() ) cout<<"--- PaveSet : Prepare"<Vertex()); Standard_Real p = PV->Parameter(); Standard_Boolean b = PV->IsShape(); -- 2.20.1