X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomAPI%2FGeomAPI_Wire.cpp;h=65729cbf7bed5f9d49b16703852d3c74f73a366e;hb=f60dc9dd94d5d4b0ea07e3e3cbfd5b3028f0942d;hp=32df6d6bbc55e39207ade979d5e3e2810ec063e2;hpb=5ff96b13035a4e95572580dbc6aa6f2c526d0a45;p=modules%2Fshaper.git diff --git a/src/GeomAPI/GeomAPI_Wire.cpp b/src/GeomAPI/GeomAPI_Wire.cpp index 32df6d6bb..65729cbf7 100644 --- a/src/GeomAPI/GeomAPI_Wire.cpp +++ b/src/GeomAPI/GeomAPI_Wire.cpp @@ -81,6 +81,8 @@ bool GeomAPI_Wire::isPolygon(std::list& thePoints) const //================================================================================================== bool GeomAPI_Wire::isRectangle(std::list& thePoints) const { + thePoints.clear(); + const TopoDS_Wire& aWire = TopoDS::Wire(impl()); const Handle(Standard_Type)& aLineType = STANDARD_TYPE(Geom_Line); @@ -113,3 +115,20 @@ bool GeomAPI_Wire::isRectangle(std::list& thePoints) const } return true; } + +//================================================================================================== +GeomPointPtr GeomAPI_Wire::middlePoint() const +{ + // find middle edge in the wire + std::list 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(); +}