diff --git a/src/Mod/TechDraw/App/DrawViewDetail.cpp b/src/Mod/TechDraw/App/DrawViewDetail.cpp index 4e2fec4199..56da5c4435 100644 --- a/src/Mod/TechDraw/App/DrawViewDetail.cpp +++ b/src/Mod/TechDraw/App/DrawViewDetail.cpp @@ -144,46 +144,17 @@ void DrawViewDetail::onChanged(const App::Property* prop) std::string(Reference.getValue()); Label.setValue(lblText); } - if ((prop == &Reference) || - (prop == &Radius) || - (prop == &BaseView)) { + if (prop == &Reference || + prop == &Radius || + prop == &BaseView) { requestPaint(); } if (prop == &AnchorPoint) { // to see AnchorPoint changes repainting is not enough, we must recompute recomputeFeature(true); } - if (prop == &ScaleType) { - auto page = findParentPage(); - // if ScaleType is "Page", the user cannot change it - if (ScaleType.isValue("Page")) { - Scale.setStatus(App::Property::ReadOnly, true); - // apply the page-wide Scale - if (page) { - if (std::abs(page->Scale.getValue() - getScale()) > FLT_EPSILON) { - Scale.setValue(page->Scale.getValue()); - Scale.purgeTouched(); - } - } - } - else if (ScaleType.isValue("Custom")) { - // allow Scale changes - Scale.setStatus(App::Property::ReadOnly, false); - } - else if (ScaleType.isValue("Automatic")) { - Scale.setStatus(App::Property::ReadOnly, true); - // apply an automatic Scale - if (!checkFit(page)) { - double newScale = autoScale(page->getPageWidth(), page->getPageHeight()); - if (std::abs(newScale - getScale()) > FLT_EPSILON) { //stops onChanged/execute loop - Scale.setValue(newScale); - Scale.purgeTouched(); - } - } - } - } - DrawView::onChanged(prop); + DrawViewPart::onChanged(prop); } App::DocumentObjectExecReturn *DrawViewDetail::execute() @@ -242,7 +213,6 @@ void DrawViewDetail::detailExec(TopoDS_Shape& shape, { if (waitingForHlr() || waitingForDetail()) { -// Base::Console().Message("DVD::detailExec - waiting for result\n"); return; } @@ -354,7 +324,7 @@ void DrawViewDetail::makeDetailShape(TopoDS_Shape& shape, //Did we get at least 1 solid? TopExp_Explorer xp; xp.Init(mkCommon.Shape(),TopAbs_SOLID); - if ((xp.More() != Standard_True)) { + if (xp.More() != Standard_True) { continue; } builder.Add(pieces, mkCommon.Shape()); @@ -377,7 +347,7 @@ void DrawViewDetail::makeDetailShape(TopoDS_Shape& shape, //Did we get at least 1 shell? TopExp_Explorer xp; xp.Init(mkCommon.Shape(),TopAbs_SHELL); - if ((xp.More() != Standard_True)) { + if (xp.More() != Standard_True) { continue; } builder.Add(pieces, mkCommon.Shape()); diff --git a/src/Mod/TechDraw/App/DrawViewPart.cpp b/src/Mod/TechDraw/App/DrawViewPart.cpp index d17ce0fd8a..abeba09e7d 100644 --- a/src/Mod/TechDraw/App/DrawViewPart.cpp +++ b/src/Mod/TechDraw/App/DrawViewPart.cpp @@ -181,20 +181,20 @@ TopoDS_Shape DrawViewPart::getSourceShape() const { // Base::Console().Message("DVP::getSourceShape()\n"); const std::vector& links = getAllSources(); - if (!links.empty()) { - return ShapeExtractor::getShapes(links); + if (links.empty()) { + return TopoDS_Shape(); } - return TopoDS_Shape(); + return ShapeExtractor::getShapes(links); } TopoDS_Shape DrawViewPart::getSourceShapeFused() const { // Base::Console().Message("DVP::getSourceShapeFused()\n"); const std::vector& links = getAllSources(); - if (!links.empty()) { - return ShapeExtractor::getShapesFused(links); + if (links.empty()) { + return TopoDS_Shape(); } - return TopoDS_Shape(); + return ShapeExtractor::getShapesFused(links); } std::vector DrawViewPart::getAllSources() const @@ -447,13 +447,12 @@ void DrawViewPart::postHlrTasks(void) } //second pass if required - if (ScaleType.isValue("Automatic")) { - if (!checkFit()) { - double newScale = autoScale(); - Scale.setValue(newScale); - Scale.purgeTouched(); - partExec(m_saveShape); - } + if (ScaleType.isValue("Automatic") && + !checkFit()) { + double newScale = autoScale(); + Scale.setValue(newScale); + Scale.purgeTouched(); + partExec(m_saveShape); } overrideKeepUpdated(false); @@ -609,8 +608,8 @@ std::vector DrawViewPart::getHatches() const std::vector result; std::vector children = getInList(); for (auto& child: children) { - if ( (child->getTypeId().isDerivedFrom(DrawHatch::getClassTypeId())) && - (!child->isRemoving()) ) { + if ( child->getTypeId().isDerivedFrom(DrawHatch::getClassTypeId()) && + !child->isRemoving() ) { TechDraw::DrawHatch* hatch = dynamic_cast(child); result.push_back(hatch); } @@ -624,8 +623,8 @@ std::vector DrawViewPart::getGeomHatches() const std::vector result; std::vector children = getInList(); for (auto& child: children) { - if ( (child->getTypeId().isDerivedFrom(DrawGeomHatch::getClassTypeId())) && - (!child->isRemoving()) ) { + if ( child->getTypeId().isDerivedFrom(DrawGeomHatch::getClassTypeId()) && + !child->isRemoving() ) { TechDraw::DrawGeomHatch* geom = dynamic_cast(child); result.push_back(geom); }