From 2320112a05c1aff9f08cbde6a6d46af0dd1683e4 Mon Sep 17 00:00:00 2001 From: azv Date: Thu, 20 Dec 2018 06:51:35 +0300 Subject: [PATCH] [Code coverage GeomAlgoAPI]: Remove unused method in PointBuilder --- src/GeomAlgoAPI/GeomAlgoAPI_PointBuilder.cpp | 68 +++++--------------- src/GeomAlgoAPI/GeomAlgoAPI_PointBuilder.h | 8 --- 2 files changed, 15 insertions(+), 61 deletions(-) diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_PointBuilder.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_PointBuilder.cpp index ce7be932c..d217e8e2b 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_PointBuilder.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_PointBuilder.cpp @@ -148,14 +148,11 @@ std::shared_ptr GeomAlgoAPI_PointBuilder::vertexByProjection( GeomAPI_ProjectPointOnCurve aProjection(aPnt, aCurve); - if (aProjection.NbPoints() == 0) { - return aVertex; + if (aProjection.NbPoints() != 0) { + gp_Pnt aNearestPoint = aProjection.NearestPoint(); + aVertex.reset(new GeomAPI_Vertex(aNearestPoint.X(), aNearestPoint.Y(), aNearestPoint.Z())); } - gp_Pnt aNearestPoint = aProjection.NearestPoint(); - - aVertex.reset(new GeomAPI_Vertex(aNearestPoint.X(), aNearestPoint.Y(), aNearestPoint.Z())); - return aVertex; } @@ -166,21 +163,16 @@ std::shared_ptr GeomAlgoAPI_PointBuilder::vertexByProjection( { std::shared_ptr aVertex; - if(!theVertex.get() || !theFace.get() || !theFace->isPlanar()) { - return aVertex; - } - - std::shared_ptr aProjPnt = theVertex->point(); - std::shared_ptr aProjPln = theFace->getPlane(); + if (theVertex.get() && theFace.get() && theFace->isPlanar()) { + std::shared_ptr aProjPnt = theVertex->point(); + std::shared_ptr aProjPln = theFace->getPlane(); - std::shared_ptr aPnt = aProjPln->project(aProjPnt); + std::shared_ptr aPnt = aProjPln->project(aProjPnt); - if(!aPnt.get()) { - return aVertex; + if (aPnt.get()) + aVertex.reset(new GeomAPI_Vertex(aPnt->x(), aPnt->y(), aPnt->z())); } - aVertex.reset(new GeomAPI_Vertex(aPnt->x(), aPnt->y(), aPnt->z())); - return aVertex; } @@ -191,45 +183,15 @@ std::shared_ptr GeomAlgoAPI_PointBuilder::vertexByIntersection( { std::shared_ptr aVertex; - if(!theEdge1.get() || !theEdge2.get() || !theEdge1->isLine() || !theEdge2->isLine()) { - return aVertex; - } - - std::shared_ptr aLin1 = theEdge1->line(); - std::shared_ptr aLin2 = theEdge2->line(); - - std::shared_ptr aPnt = aLin1->intersect(aLin2); - - if(!aPnt.get()) { - return aVertex; - } - - aVertex.reset(new GeomAPI_Vertex(aPnt->x(), aPnt->y(), aPnt->z())); - - return aVertex; -} - -//================================================================================================== -std::shared_ptr GeomAlgoAPI_PointBuilder::vertexByIntersection( - const std::shared_ptr theEdge, - const std::shared_ptr theFace) -{ - std::shared_ptr aVertex; - - if(!theEdge.get() || !theFace.get() || !theEdge->isLine() || !theFace->isPlanar()) { - return aVertex; - } - - std::shared_ptr aLin = theEdge->line(); - std::shared_ptr aPln = theFace->getPlane(); + if (theEdge1.get() && theEdge2.get() && theEdge1->isLine() && theEdge2->isLine()) { + std::shared_ptr aLin1 = theEdge1->line(); + std::shared_ptr aLin2 = theEdge2->line(); - std::shared_ptr aPnt = aPln->intersect(aLin); + std::shared_ptr aPnt = aLin1->intersect(aLin2); - if(!aPnt.get()) { - return aVertex; + if (aPnt.get()) + aVertex.reset(new GeomAPI_Vertex(aPnt->x(), aPnt->y(), aPnt->z())); } - aVertex.reset(new GeomAPI_Vertex(aPnt->x(), aPnt->y(), aPnt->z())); - return aVertex; } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_PointBuilder.h b/src/GeomAlgoAPI/GeomAlgoAPI_PointBuilder.h index f75ecd2ab..5ce0f9976 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_PointBuilder.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_PointBuilder.h @@ -80,14 +80,6 @@ public: vertexByIntersection(const std::shared_ptr theEdge1, const std::shared_ptr theEdge2); - /// \brief Creates vertex by intersection line and plane. - /// \param[in] theEdge linear edge. - /// \param[in] theFace planar face. - /// \return created vertex. - static std::shared_ptr - vertexByIntersection(const std::shared_ptr theEdge, - const std::shared_ptr theFace); - /// Return point by shape vertex static std::shared_ptr point(const std::shared_ptr theVertex); }; -- 2.39.2