/*************************************************************************** * Copyright (c) WandererFan (wandererfan@gmail.com) 2016 * * * * This file is part of the FreeCAD CAx development system. * * * * This library is free software; you can redistribute it and/or * * modify it under the terms of the GNU Library General Public * * License as published by the Free Software Foundation; either * * version 2 of the License, or (at your option) any later version. * * * * This library is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU Library General Public License for more details. * * * * You should have received a copy of the GNU Library General Public * * License along with this library; see the file COPYING.LIB. If not, * * write to the Free Software Foundation, Inc., 59 Temple Place, * * Suite 330, Boston, MA 02111-1307, USA * * * ***************************************************************************/ #ifndef _DrawProjectSplit_h_ #define _DrawProjectSplit_h_ #include #include #include #include #include #include #include #include #include class gp_Pnt; namespace TechDrawGeometry { class GeometryObject; class Vertex; class BaseGeom; } namespace TechDraw { struct splitPoint { int i; Base::Vector3d v; double param; }; class edgeSortItem { public: edgeSortItem() { startAngle = endAngle = 0.0; idx = 0; } ~edgeSortItem() {} Base::Vector3d start; Base::Vector3d end; double startAngle; double endAngle; unsigned int idx; static bool edgeCompare(const edgeSortItem& e1, const edgeSortItem& e2); static bool edgeEqual(const edgeSortItem& e1, const edgeSortItem& e2); std::string dump(void); }; class TechDrawExport DrawProjectSplit { public: DrawProjectSplit(); ~DrawProjectSplit(); public: static std::vector getEdgesForWalker(TopoDS_Shape shape, double scale, Base::Vector3d direction); static TechDrawGeometry::GeometryObject* buildGeometryObject(TopoDS_Shape shape, gp_Pnt& center, Base::Vector3d direction); static bool isOnEdge(TopoDS_Edge e, TopoDS_Vertex v, double& param, bool allowEnds = false); static std::vector splitEdges(std::vector orig, std::vector splits); static std::vector split1Edge(TopoDS_Edge e, std::vector splitPoints); static std::vector sortSplits(std::vector& s, bool ascend); static bool splitCompare(const splitPoint& p1, const splitPoint& p2); static bool splitEqual(const splitPoint& p1, const splitPoint& p2); static std::vector removeDuplicateEdges(std::vector& inEdges); static std::vector sortEdges(std::vector& e, bool ascend); protected: static std::vector getEdges(TechDrawGeometry::GeometryObject* geometryObject); private: }; typedef App::FeaturePythonT DrawProjectSplitPython; } //namespace TechDraw #endif // #ifndef _DrawProjectSplit_h_