Salome HOME
Implement filter "F5: On geometry"
[modules/shaper.git] / src / GeomAPI / GeomAPI_Edge.cpp
index ede977f30df08670d940ebbf007986f89286d43f..f69cbca46a5c1c7e51fb36f7869dfadd6727452a 100644 (file)
@@ -67,6 +67,19 @@ GeomAPI_Edge::GeomAPI_Edge(const std::shared_ptr<GeomAPI_Shape>& theShape)
   }
 }
 
+bool GeomAPI_Edge::isSameGeometry(const std::shared_ptr<GeomAPI_Shape> theShape) const
+{
+  if (!theShape->isEdge())
+    return false;
+  TopoDS_Edge anOwnEdge = TopoDS::Edge(impl<TopoDS_Shape>());
+  TopoDS_Edge anOtherEdge = TopoDS::Edge(theShape->impl<TopoDS_Shape>());
+
+  double aFirst, aLast;
+  Handle(Geom_Curve) anOwnCurve = BRep_Tool::Curve(anOwnEdge, aFirst, aLast);
+  Handle(Geom_Curve) anOtherCurve = BRep_Tool::Curve(anOtherEdge, aFirst, aLast);
+  return anOwnCurve == anOtherCurve;
+}
+
 bool GeomAPI_Edge::isLine() const
 {
   const TopoDS_Shape& aShape = const_cast<GeomAPI_Edge*>(this)->impl<TopoDS_Shape>();