X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomAPI%2FGeomAPI_Vertex.cpp;h=b22c4a7bb49532360f465f8a9a267e612165e54f;hb=4df4bd61da1ea5d357671c819a8ced6ec9ba77ac;hp=3c9e0a0b23a48f1090be2bed1d1036009e121821;hpb=43b4fbcf272a8d73b7d12e129f441ba78e57c64f;p=modules%2Fshaper.git diff --git a/src/GeomAPI/GeomAPI_Vertex.cpp b/src/GeomAPI/GeomAPI_Vertex.cpp index 3c9e0a0b2..b22c4a7bb 100644 --- a/src/GeomAPI/GeomAPI_Vertex.cpp +++ b/src/GeomAPI/GeomAPI_Vertex.cpp @@ -1,8 +1,22 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D - -// File: GeomAPI_Vertex.cpp -// Created: 24 Jul 2014 -// Author: Artem ZHIDKOV +// Copyright (C) 2014-2017 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or +// email : webmaster.salome@opencascade.com +// #include #include @@ -12,6 +26,7 @@ #include #include #include +#include #include #include @@ -27,6 +42,14 @@ GeomAPI_Vertex::GeomAPI_Vertex(const std::shared_ptr& theShape) } } +GeomAPI_Vertex::GeomAPI_Vertex(double theX, double theY, double theZ) +{ + TopoDS_Vertex aVertex; + BRep_Builder aBuilder; + aBuilder.MakeVertex(aVertex, gp_Pnt(theX, theY, theZ), Precision::Confusion()); + setImpl(new TopoDS_Shape(aVertex)); +} + std::shared_ptr GeomAPI_Vertex::point() { const TopoDS_Shape& aShape = const_cast(this)->impl(); @@ -35,8 +58,10 @@ std::shared_ptr GeomAPI_Vertex::point() return std::shared_ptr(new GeomAPI_Pnt(aPoint.X(), aPoint.Y(), aPoint.Z())); } -bool GeomAPI_Vertex::isEqual(std::shared_ptr theVert) +bool GeomAPI_Vertex::isEqual(const std::shared_ptr theVert) const { + if (!theVert.get() || ! theVert->isVertex()) + return false; const TopoDS_Shape& aMyShape = const_cast(this)->impl(); const TopoDS_Shape& aInShape = theVert->impl();