Salome HOME
Dump with geometrical selection
[modules/shaper.git] / src / GeomAPI / GeomAPI_Wire.cpp
index 32df6d6bbc55e39207ade979d5e3e2810ec063e2..bcbaf3e946be37bff95143533d3635145f0dd2c8 100644 (file)
@@ -113,3 +113,20 @@ bool GeomAPI_Wire::isRectangle(std::list<GeomPointPtr>& thePoints) const
   }
   return true;
 }
+
+//==================================================================================================
+GeomPointPtr GeomAPI_Wire::middlePoint() const
+{
+  // find middle edge in the wire
+  std::list<GeomShapePtr> aSubs = subShapes(EDGE);
+  size_t aNbSubs = aSubs.size();
+  if (aNbSubs == 0)
+    return GeomPointPtr();
+
+  aNbSubs /= 2;
+  for (; aNbSubs > 0; --aNbSubs)
+    aSubs.pop_front();
+
+  // compute middle point on the middle edge
+  return aSubs.front()->middlePoint();
+}