Salome HOME
Merge branch 'Dev_1.1.0' of newgeom:newgeom into Dev_1.1.0
[modules/shaper.git] / src / GeomAPI / GeomAPI_Vertex.cpp
index 6c3d05e3556f1caff93dccd40fb1d07eb92f080e..b917837a09cfcaa4e9589598625f7a4d4f63765e 100644 (file)
@@ -35,16 +35,21 @@ std::shared_ptr<GeomAPI_Pnt> GeomAPI_Vertex::point()
   return std::shared_ptr<GeomAPI_Pnt>(new GeomAPI_Pnt(aPoint.X(), aPoint.Y(), aPoint.Z()));
 }
 
-bool GeomAPI_Vertex::isEqual(std::shared_ptr<GeomAPI_Shape> theVert)
+bool GeomAPI_Vertex::isEqual(const std::shared_ptr<GeomAPI_Shape> theVert) const
 {
+  if (!theVert.get() || ! theVert->isVertex())
+    return false;
   const TopoDS_Shape& aMyShape = const_cast<GeomAPI_Vertex*>(this)->impl<TopoDS_Shape>();
   const TopoDS_Shape& aInShape = theVert->impl<TopoDS_Shape>();
 
+  if (aMyShape.ShapeType() != aInShape.ShapeType())
+    return false;
+
   TopoDS_Vertex aVertex1 = TopoDS::Vertex(aMyShape);
   gp_Pnt aPoint1 = BRep_Tool::Pnt(aVertex1);
 
   TopoDS_Vertex aVertex2 = TopoDS::Vertex(aInShape);
   gp_Pnt aPoint2 = BRep_Tool::Pnt(aVertex2);
 
-  return aPoint1.IsEqual(aPoint2, Precision::Confusion());
+  return aPoint1.IsEqual(aPoint2, Precision::Confusion()) == Standard_True;
 }