[TD]respect AutoDistribute on load

This commit is contained in:
Wanderer Fan
2022-07-23 13:44:36 -04:00
committed by WandererFan
parent 2c19c29d3c
commit 80d5e9a0b8
7 changed files with 95 additions and 78 deletions

View File

@@ -376,9 +376,9 @@ void DrawViewPart::onChanged(const App::Property* prop)
void DrawViewPart::partExec(TopoDS_Shape& shape)
{
// Base::Console().Message("DVP::partExec()\n");
if (waitingForResult()) {
if (waitingForHlr()) {
//finish what we are already doing before starting over
// Base::Console().Message("DVP::partExec - %s - waiting for result\n", getNameInDocument());
// Base::Console().Message("DVP::partExec - %s - waiting for HLR\n", getNameInDocument());
return;
}
@@ -386,7 +386,6 @@ void DrawViewPart::partExec(TopoDS_Shape& shape)
delete geometryObject;
geometryObject = nullptr;
}
showProgressMessage(getNameInDocument(), "is finding hidden lines");
geometryObject = makeGeometryForShape(shape);
}
@@ -424,7 +423,8 @@ GeometryObject* DrawViewPart::makeGeometryForShape(TopoDS_Shape& shape)
//note: slightly different than routine with same name in DrawProjectSplit
TechDraw::GeometryObject* DrawViewPart::buildGeometryObject(TopoDS_Shape& shape, gp_Ax2& viewAxis)
{
// Base::Console().Message("DVP::buildGeometryObject()\n");
// Base::Console().Message("DVP::buildGeometryObject() - %s\n", getNameInDocument());
showProgressMessage(getNameInDocument(), "is finding hidden lines");
TechDraw::GeometryObject* go = new TechDraw::GeometryObject(getNameInDocument(), this);
go->setIsoCount(IsoCount.getValue());
go->isPerspective(Perspective.getValue());
@@ -437,7 +437,6 @@ TechDraw::GeometryObject* DrawViewPart::buildGeometryObject(TopoDS_Shape& shape,
onHlrFinished(); //poly algo does not run in separate thread, so we need to invoke
//the post hlr processing manually
} else {
// Base::Console().Message("DVP::buildGeometryObject - starting projectShape\n");
//project shape runs in a separate thread since if can take a long time
QObject::connect(&m_hlrWatcher, SIGNAL(finished()), this, SLOT(onHlrFinished()));
m_hlrFuture = QtConcurrent::run(go, &GeometryObject::projectShape, shape, viewAxis);
@@ -450,8 +449,7 @@ TechDraw::GeometryObject* DrawViewPart::buildGeometryObject(TopoDS_Shape& shape,
//continue processing after hlr thread completes
void DrawViewPart::onHlrFinished(void)
{
// Base::Console().Message("DVP::onHlrFinished()\n");
// Base::Console().Message("DVP::onHlrFinished() - %s\n", getNameInDocument());
//the last hlr task is to make a bbox of the results
bbox = geometryObject->calcBoundingBox();
@@ -462,9 +460,8 @@ void DrawViewPart::onHlrFinished(void)
postHlrTasks();
//start face finding in a separate thread
if (handleFaces() && !CoarseView.getValue()) {
if (handleFaces() && !CoarseView.getValue() && !waitingForFaces()) {
try {
// Base::Console().Message("DVP::onHlrFinished - starting extractFaces\n");
QObject::connect(&m_faceWatcher, SIGNAL(finished()), this, SLOT(onFacesFinished()));
m_faceFuture = QtConcurrent::run(this, &DrawViewPart::extractFaces);
m_faceWatcher.setFuture(m_faceFuture);
@@ -480,6 +477,7 @@ void DrawViewPart::onHlrFinished(void)
//run any tasks that need to been done after geometry is available
void DrawViewPart::postHlrTasks(void)
{
// Base::Console().Message("DVP::postHlrTasks() - %s\n", getNameInDocument());
//add geometry that doesn't come from HLR
addCosmeticVertexesToGeom();
addCosmeticEdgesToGeom();
@@ -505,16 +503,11 @@ void DrawViewPart::extractFaces()
{
// Base::Console().Message("DVP::extractFaces()\n");
if (geometryObject == nullptr) {
if (!geometryObject) {
//no geometry yet so don't bother
// Base::Console().Message("DVP::extractFaces - GO is null\n");
return;
}
// if (waitingForFaces()) {
// Base::Console().Message("DVP::extractFaces - already extracting faces\n");
// }
waitingForFaces(true);
showProgressMessage(getNameInDocument(), "is extracting faces");