]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/GeomAPI/GeomAPI_Edge.cpp
Salome HOME
Fix for the issue #2172 and the issue #2198 : additional naming for revolution edges...
[modules/shaper.git] / src / GeomAPI / GeomAPI_Edge.cpp
index c336050f9c08bdd5f35cf56cd3e08e8a090303da..1fd744fd4a07584b582062d56b811d1caff25d76 100644 (file)
@@ -247,3 +247,17 @@ double GeomAPI_Edge::length() const
   Adaptor3d_Curve* anAdaptor3d = &aBRepAdaptor;
   return GCPnts_AbscissaPoint::Length(*anAdaptor3d);
 }
+
+bool GeomAPI_Edge::isClosed() const
+{
+  const TopoDS_Shape& aShape = const_cast<GeomAPI_Edge*>(this)->impl<TopoDS_Shape>();
+  if (aShape.IsNull())
+    return false;
+  double aFirst, aLast;
+  Handle(Geom_Curve) aCurve = BRep_Tool::Curve((const TopoDS_Edge&)aShape, aFirst, aLast);
+  if (aCurve.IsNull() || !aCurve->IsPeriodic())
+    return false;
+  aLast += aLast > aFirst ? -aCurve->Period() : aCurve->Period();;
+
+  return fabs(aFirst - aLast) < 1.e-9;
+}