| | |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | |
| | |
| |
|
| | #ifndef DRAWBROKENVIEW_H_ |
| | #define DRAWBROKENVIEW_H_ |
| |
|
| | #include <Mod/TechDraw/TechDrawGlobal.h> |
| |
|
| | #include <TopoDS_Shape.hxx> |
| |
|
| | #include <Base/Vector3D.h> |
| |
|
| | #include "DrawViewPart.h" |
| |
|
| | namespace TechDraw |
| | { |
| |
|
| | struct BreakListEntry { |
| | App::DocumentObject* breakObj; |
| | double lowLimit; |
| | double highLimit; |
| | double netRemoved; |
| | |
| | |
| | }; |
| | using BreakList = std::vector<BreakListEntry>; |
| |
|
| | struct PieceLimitEntry { |
| | double lowLimit; |
| | double highLimit; |
| | }; |
| | using PieceLimitList = std::vector<PieceLimitEntry>; |
| |
|
| | |
| | class TechDrawExport DrawBrokenView: public TechDraw::DrawViewPart |
| | { |
| | PROPERTY_HEADER_WITH_OVERRIDE(TechDraw::DrawBrokenView); |
| |
|
| | |
| |
|
| | public: |
| | enum class BreakType : int { |
| | NONE, |
| | ZIGZAG, |
| | SIMPLE |
| | }; |
| | static const char* BreakTypeEnums[]; |
| |
|
| | DrawBrokenView(); |
| | ~DrawBrokenView() override = default; |
| |
|
| | App::PropertyLinkList Breaks; |
| | App::PropertyLength Gap; |
| |
|
| | App::DocumentObjectExecReturn* execute() override; |
| | short mustExecute() const override; |
| | PyObject *getPyObject() override; |
| | const char* getViewProviderName() const override |
| | { |
| | return "TechDrawGui::ViewProviderViewPart"; |
| | } |
| |
|
| | std::pair<Base::Vector3d, Base::Vector3d> |
| | breakPointsFromObj(const App::DocumentObject& breakObj) const; |
| | std::pair<Base::Vector3d, Base::Vector3d> |
| | breakBoundsFromObj(const App::DocumentObject& breakObj) const; |
| | Base::Vector3d directionFromObj(const App::DocumentObject& breakObj) const; |
| | Base::Vector3d guiDirectionFromObj(const App::DocumentObject& breakObj) const; |
| |
|
| | static bool isBreakObject(const App::DocumentObject& breakObj); |
| | static bool isBreakObjectSketch(const App::DocumentObject& breakObj); |
| | static std::vector<App::DocumentObject*> removeBreakObjects(std::vector<App::DocumentObject*> breaks, |
| | std::vector<App::DocumentObject*> shapes); |
| | static std::vector<TopoDS_Edge> edgesFromCompound(const TopoDS_Shape& compound); |
| |
|
| | Base::Vector3d mapPoint3dToView(Base::Vector3d point3d) const; |
| | Base::Vector3d mapPoint2dFromView(Base::Vector3d point2d) const; |
| |
|
| | Base::Vector3d getCompressedCentroid() const; |
| | double breaklineLength(const App::DocumentObject& breakObj) const; |
| |
|
| |
|
| |
|
| | private: |
| | TopoDS_Shape breakShape(const TopoDS_Shape& shapeToBreak) const; |
| | TopoDS_Shape compressShape(const TopoDS_Shape& shapeToCompress) const; |
| | TopoDS_Shape apply1Break(const App::DocumentObject& breakObj, const TopoDS_Shape& inShape) const; |
| | TopoDS_Shape makeHalfSpace(const Base::Vector3d& point, |
| | const Base::Vector3d& direction, |
| | const Base::Vector3d& pointInSpace) const; |
| | std::pair<Base::Vector3d, Base::Vector3d> |
| | breakPointsFromSketch(const App::DocumentObject& breakObj) const; |
| | std::pair<Base::Vector3d, Base::Vector3d> |
| | breakPointsFromEdge(const App::DocumentObject& breakObj) const; |
| | std::pair<Base::Vector3d, Base::Vector3d> |
| | breakBoundsFromSketch(const App::DocumentObject& breakObj) const; |
| | std::pair<Base::Vector3d, Base::Vector3d> |
| | breakBoundsFromEdge(const App::DocumentObject& breakObj) const; |
| | double removedLengthFromObj(const App::DocumentObject& breakObj) const; |
| | double breaklineLengthFromSketch(const App::DocumentObject& breakObj) const; |
| | double breaklineLengthFromEdge(const App::DocumentObject& breakObj) const; |
| |
|
| |
|
| | bool isVertical(const TopoDS_Edge& edge, const bool projected = false) const; |
| | bool isVertical(std::pair<Base::Vector3d, Base::Vector3d>, bool projected = false) const; |
| | bool isHorizontal(const TopoDS_Edge& edge, const bool projected = false) const; |
| |
|
| | TopoDS_Shape compressHorizontal(const TopoDS_Shape& inShape) const; |
| | TopoDS_Shape compressVertical(const TopoDS_Shape& inShape) const; |
| |
|
| | static PieceLimitList getPieceLimits(const std::vector<TopoDS_Shape>& pieces, Base::Vector3d direction); |
| |
|
| | double getExpandGaps(double pointCoord, |
| | const BreakList& compressedBreakList, |
| | Base::Vector3d moveDirection, |
| | std::vector<size_t>& fullGaps, |
| | int& partialGapIndex) const; |
| |
|
| | BreakList makeSortedBreakList(const std::vector<App::DocumentObject*>& breaks, |
| | const Base::Vector3d& direction, |
| | const bool descend = false) const; |
| |
|
| | BreakList makeSortedBreakListCompressed(const std::vector<App::DocumentObject*>& breaks, |
| | const Base::Vector3d& moveDirection, |
| | const bool descend = false) const; |
| |
|
| | static std::vector<TopoDS_Shape> getPieces(const TopoDS_Shape& brokenShape); |
| | static std::vector<TopoDS_Shape> getPiecesByType(const TopoDS_Shape& shapeToSearch, |
| | TopAbs_ShapeEnum desiredShapeType, |
| | TopAbs_ShapeEnum avoidShapeType = TopAbs_SHAPE); |
| |
|
| | static BreakList sortBreaks(BreakList& inList, bool descend = false); |
| | static bool breakLess(const BreakListEntry& entry0, const BreakListEntry& entry1); |
| |
|
| | double shiftAmountShrink(double pointCoord, Base::Vector3d direction, const BreakList& sortedBreaks) const; |
| |
|
| | void printBreakList(const std::string& text, const BreakList& inBreaks) const; |
| |
|
| | std::pair<Base::Vector3d, Base::Vector3d> |
| | scalePair(std::pair<Base::Vector3d, Base::Vector3d> inPair) const; |
| | Base::Vector3d makePerpendicular(Base::Vector3d inDir) const; |
| |
|
| | bool moveThisPiece(PieceLimitEntry piece, BreakListEntry breakItem, Base::Vector3d moveDirection) const; |
| | bool isDirectionReversed(Base::Vector3d direction) const; |
| |
|
| | Base::Vector3d m_unbrokenCenter; |
| | TopoDS_Shape m_compressedShape; |
| |
|
| | }; |
| |
|
| | using DrawBrokenViewPython = App::FeaturePythonT<DrawBrokenView>; |
| |
|
| | } |
| |
|
| | #endif |
| |
|
| |
|