X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FGeomAPI%2FGeomAPI_PlanarEdges.cpp;h=e49d39e6d58b8add07b4318d6024e33d367b61ec;hb=7c26163aa1b2f3384ed0b3bd3fb12188478f6189;hp=619716256d1b81865122b9a0122b880216a5c1b8;hpb=57cf6e2ea021fe95dcc0caa5d19bffd2cde4223f;p=modules%2Fshaper.git diff --git a/src/GeomAPI/GeomAPI_PlanarEdges.cpp b/src/GeomAPI/GeomAPI_PlanarEdges.cpp index 619716256..e49d39e6d 100644 --- a/src/GeomAPI/GeomAPI_PlanarEdges.cpp +++ b/src/GeomAPI/GeomAPI_PlanarEdges.cpp @@ -40,7 +40,6 @@ void GeomAPI_PlanarEdges::addEdge(std::shared_ptr theEdge) std::list > GeomAPI_PlanarEdges::getEdges() { TopoDS_Shape& aShape = const_cast(impl()); - //BRepTools_WireExplorer aWireExp(TopoDS::Wire(aShape)); TopExp_Explorer aWireExp(aShape, TopAbs_EDGE); std::list > aResult; for (; aWireExp.More(); aWireExp.Next()) { @@ -87,13 +86,38 @@ std::shared_ptr GeomAPI_PlanarEdges::dirY() const std::shared_ptr GeomAPI_PlanarEdges::norm() const { if (hasPlane()) - return myPlane->norm(); + return myPlane->normal(); return std::shared_ptr(); } +bool GeomAPI_PlanarEdges::isPlanar() const +{ + return true; +} + void GeomAPI_PlanarEdges::setPlane(const std::shared_ptr& theOrigin, const std::shared_ptr& theDirX, const std::shared_ptr& theNorm) { myPlane = std::shared_ptr(new GeomAPI_Ax3(theOrigin, theDirX, theNorm)); -} \ No newline at end of file +} + +bool GeomAPI_PlanarEdges::isEqual(const std::shared_ptr theShape) const +{ + if (!theShape.get()) + return false; + TopoDS_Shape& aMyShape = const_cast(impl()); + TopoDS_Shape aTheShape = theShape->impl(); + TopExp_Explorer aMyExp(aMyShape, TopAbs_EDGE); + TopExp_Explorer aTheExp(aTheShape, TopAbs_EDGE); + for (; aMyExp.More() && aTheExp.More(); aMyExp.Next(), aTheExp.Next()) { + // check that edge by edge all geometrically matches + std::shared_ptr aMyEdge(new GeomAPI_Edge); + aMyEdge->setImpl(new TopoDS_Shape(aMyExp.Current())); + std::shared_ptr aTheEdge(new GeomAPI_Edge); + aTheEdge->setImpl(new TopoDS_Shape(aTheExp.Current())); + if (!aMyEdge->isEqual(aTheEdge)) + return false; + } + return !(aMyExp.More() || aTheExp.More()); +}