From 470a9d69119a78538e835018d8d765c6e6d4c959 Mon Sep 17 00:00:00 2001 From: wandererfan Date: Mon, 17 Apr 2023 19:00:56 -0400 Subject: [PATCH] [TD]make scrubbing count a property of view --- src/Mod/TechDraw/App/DrawViewPart.cpp | 3 +++ src/Mod/TechDraw/App/DrawViewPart.h | 2 ++ src/Mod/TechDraw/App/GeometryObject.cpp | 8 +++----- src/Mod/TechDraw/App/GeometryObject.h | 4 ++++ src/Mod/TechDraw/Gui/DlgPrefsTechDrawAdvanced.ui | 7 ++++++- 5 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/Mod/TechDraw/App/DrawViewPart.cpp b/src/Mod/TechDraw/App/DrawViewPart.cpp index c3c52b3269..ac01c1a1c2 100644 --- a/src/Mod/TechDraw/App/DrawViewPart.cpp +++ b/src/Mod/TechDraw/App/DrawViewPart.cpp @@ -137,6 +137,8 @@ DrawViewPart::DrawViewPart(void) "Show Hidden Iso u, v lines"); ADD_PROPERTY_TYPE(IsoCount, (prefIsoCount()), sgroup, App::Prop_None, "Number of iso parameters lines"); + ADD_PROPERTY_TYPE(ScrubCount, (Preferences::scrubCount()), sgroup, App::Prop_None, + "The number of times FreeCAD should try to clean the HLR result."); //initialize bbox to non-garbage bbox = Base::BoundBox3d(Base::Vector3d(0.0, 0.0, 0.0), 0.0); @@ -361,6 +363,7 @@ TechDraw::GeometryObjectPtr DrawViewPart::buildGeometryObject(TopoDS_Shape& shap go->isPerspective(Perspective.getValue()); go->setFocus(Focus.getValue()); go->usePolygonHLR(CoarseView.getValue()); + go->setScrubCount(ScrubCount.getValue()); if (CoarseView.getValue()) { //the polygon approximation HLR process runs quickly, so doesn't need to be in a diff --git a/src/Mod/TechDraw/App/DrawViewPart.h b/src/Mod/TechDraw/App/DrawViewPart.h index 780fb671d1..06c95b4b70 100644 --- a/src/Mod/TechDraw/App/DrawViewPart.h +++ b/src/Mod/TechDraw/App/DrawViewPart.h @@ -109,6 +109,8 @@ public: App::PropertyBool IsoHidden; App::PropertyInteger IsoCount; + App::PropertyInteger ScrubCount; + short mustExecute() const override; App::DocumentObjectExecReturn* execute() override; const char* getViewProviderName() const override { return "TechDrawGui::ViewProviderViewPart"; } diff --git a/src/Mod/TechDraw/App/GeometryObject.cpp b/src/Mod/TechDraw/App/GeometryObject.cpp index 23f6ebecf6..5e54b2585d 100644 --- a/src/Mod/TechDraw/App/GeometryObject.cpp +++ b/src/Mod/TechDraw/App/GeometryObject.cpp @@ -71,7 +71,6 @@ #include "DrawViewPart.h" #include "GeometryObject.h" #include "DrawProjectSplit.h" -#include "Preferences.h" using namespace TechDraw; using namespace std; @@ -85,7 +84,7 @@ struct EdgePoints { GeometryObject::GeometryObject(const string& parent, TechDraw::DrawView* parentObj) : m_parentName(parent), m_parent(parentObj), m_isoCount(0), m_isPersp(false), m_focus(100.0), - m_usePolygonHLR(false) + m_usePolygonHLR(false), m_scrubCount(0) {} @@ -539,10 +538,9 @@ void GeometryObject::addGeomFromCompound(TopoDS_Shape edgeCompound, edgeClass ca // remove overlapping edges TopoDS_Shape cleanShape; - int passes = Preferences::scrubCount(); - if (passes > 0) { + if (m_scrubCount > 0) { std::vector edgeVector = DU::shapeToVector(edgeCompound); - for (int iPass = 0; iPass < passes; iPass++) { + for (int iPass = 0; iPass < m_scrubCount; iPass++) { edgeVector = DrawProjectSplit::removeOverlapEdges(edgeVector); } bool invertResult = false; diff --git a/src/Mod/TechDraw/App/GeometryObject.h b/src/Mod/TechDraw/App/GeometryObject.h index 60920f3af4..1188f1a1fc 100644 --- a/src/Mod/TechDraw/App/GeometryObject.h +++ b/src/Mod/TechDraw/App/GeometryObject.h @@ -132,6 +132,9 @@ public: bool usePolygonHLR() const { return m_usePolygonHLR; } void setFocus(double f) { m_focus = f; } double getFocus() { return m_focus; } + void setScrubCount(int count) { m_scrubCount = count; } + + void pruneVertexGeom(Base::Vector3d center, double radius); //dupl mirrorShape??? @@ -199,6 +202,7 @@ protected: bool m_isPersp; double m_focus; bool m_usePolygonHLR; + int m_scrubCount; }; using GeometryObjectPtr = std::shared_ptr; diff --git a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAdvanced.ui b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAdvanced.ui index 6a05e963c1..c9ba7c3611 100644 --- a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAdvanced.ui +++ b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAdvanced.ui @@ -7,7 +7,7 @@ 0 0 444 - 384 + 416 @@ -558,6 +558,11 @@ can be a performance penalty in complex models. + + + true + + Overlap Edges Scrub Passes