From: azv Date: Thu, 20 Dec 2018 03:51:35 +0000 (+0300) Subject: [Code coverage GeomAlgoAPI]: Remove unused method in PointBuilder X-Git-Tag: End2018~25 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=2320112a05c1aff9f08cbde6a6d46af0dd1683e4;p=modules%2Fshaper.git [Code coverage GeomAlgoAPI]: Remove unused method in PointBuilder --- 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); };