[TD]make scrubbing count a property of view

This commit is contained in:
wandererfan
2023-04-17 19:00:56 -04:00
committed by WandererFan
parent 73c706fb1b
commit 3d0d65b41c
5 changed files with 18 additions and 6 deletions

View File

@@ -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

View File

@@ -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"; }

View File

@@ -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<TopoDS_Edge> 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;

View File

@@ -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<GeometryObject>;

View File

@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>444</width>
<height>384</height>
<height>416</height>
</rect>
</property>
<property name="windowTitle">
@@ -558,6 +558,11 @@ can be a performance penalty in complex models.</string>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_3">
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="text">
<string>Overlap Edges Scrub Passes</string>
</property>