diff --git a/src/Mod/TechDraw/Gui/CommandAnnotate.cpp b/src/Mod/TechDraw/Gui/CommandAnnotate.cpp index dadb04eafe..96718c8b73 100644 --- a/src/Mod/TechDraw/Gui/CommandAnnotate.cpp +++ b/src/Mod/TechDraw/Gui/CommandAnnotate.cpp @@ -61,6 +61,7 @@ #include "TaskCenterLine.h" #include "TaskLineDecor.h" #include "ViewProviderPage.h" +#include "ViewProviderViewPart.h" #include "QGVPage.h" using namespace TechDrawGui; @@ -1204,6 +1205,63 @@ bool CmdTechDrawDecorateLine::isActive(void) return (havePage && haveView); } +//=========================================================================== +// TechDraw_ShowAll +//=========================================================================== + +DEF_STD_CMD_A(CmdTechDrawShowAll); + +CmdTechDrawShowAll::CmdTechDrawShowAll() + : Command("TechDraw_ShowAll") +{ + sAppModule = "TechDraw"; + sGroup = QT_TR_NOOP("TechDraw"); + sMenuText = QT_TR_NOOP("Show/Hide invisible edges in a View"); + sToolTipText = sMenuText; + sWhatsThis = "TechDraw_ShowAll"; + sStatusTip = sToolTipText; + sPixmap = "actions/techdraw-showall"; +} + +void CmdTechDrawShowAll::activated(int iMsg) +{ + Q_UNUSED(iMsg); + Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog(); + if (dlg != nullptr) { + QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Task In Progress"), + QObject::tr("Close active task dialog and try again.")); + return; + } + + TechDraw::DrawPage* page = DrawGuiUtil::findPage(this); + if (!page) { + return; + } + + std::vector selection = getSelection().getSelectionEx(); + TechDraw::DrawView* baseFeat = nullptr; + if (!selection.empty()) { + baseFeat = dynamic_cast(selection[0].getObject()); + } + + Gui::ViewProvider* vp = QGIView::getViewProvider(baseFeat); + auto partVP = dynamic_cast(vp); + if ( vp != nullptr ) { + bool state = partVP->ShowAllEdges.getValue(); + state = !state; + partVP->ShowAllEdges.setValue(state); + baseFeat->requestPaint(); + } + +} + +bool CmdTechDrawShowAll::isActive(void) +{ + bool havePage = DrawGuiUtil::needPage(this); + bool haveView = DrawGuiUtil::needView(this, false); + return (havePage && haveView); +} + void CreateTechDrawCommandsAnnotate(void) { Gui::CommandManager &rcCmdMgr = Gui::Application::Instance->commandManager(); @@ -1221,6 +1279,7 @@ void CreateTechDrawCommandsAnnotate(void) rcCmdMgr.addCommand(new CmdTechDrawAnnotation()); rcCmdMgr.addCommand(new CmdTechDrawCosmeticEraser()); rcCmdMgr.addCommand(new CmdTechDrawDecorateLine()); + rcCmdMgr.addCommand(new CmdTechDrawShowAll()); } //=========================================================================== diff --git a/src/Mod/TechDraw/Gui/QGIViewPart.cpp b/src/Mod/TechDraw/Gui/QGIViewPart.cpp index f925cf0f71..f57fb288f9 100644 --- a/src/Mod/TechDraw/Gui/QGIViewPart.cpp +++ b/src/Mod/TechDraw/Gui/QGIViewPart.cpp @@ -355,6 +355,7 @@ void QGIViewPart::drawViewPart() float lineWidthHid = vp->HiddenWidth.getValue() * lineScaleFactor; float lineWidthIso = vp->IsoWidth.getValue() * lineScaleFactor; // float lineWidthExtra = viewPart->ExtraWidth.getValue() * lineScaleFactor; + bool showAll = vp->ShowAllEdges.getValue(); prepareGeometryChange(); removePrimitives(); //clean the slate @@ -418,6 +419,12 @@ void QGIViewPart::drawViewPart() #endif //#if MOD_TECHDRAW_HANDLE_FACES // Draw Edges + Base::Reference hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")-> + GetGroup("Preferences")->GetGroup("Mod/TechDraw/Colors"); + App::Color fcEdgeColor; + fcEdgeColor.setPackedValue(hGrp->GetUnsigned("NormalColor", 0x00000000)); + QColor edgeColor = fcEdgeColor.asValue(); + const std::vector &geoms = viewPart->getEdgeGeometry(); std::vector::const_iterator itGeom = geoms.begin(); QGIEdge* item; @@ -441,9 +448,11 @@ void QGIViewPart::drawViewPart() } } bool showItem = true; - if (showEdge) { + if (showEdge) { //based on hard/seam/hidden/etc item = new QGIEdge(i); item->setWidth(lineWidth); + item->setNormalColor(edgeColor); + item->setStyle(Qt::SolidLine); if ((*itGeom)->cosmetic == true) { int source = (*itGeom)->source(); int sourceIndex = (*itGeom)->sourceIndex(); @@ -455,7 +464,6 @@ void QGIViewPart::drawViewPart() Base::Console().Message("QGIVP::drawVP - edge: %d is confused - source: %d\n",i,source); } } else { - //TODO: implement formats for geom lines. TechDraw::GeomFormat* gf = viewPart->getGeomFormatByGeom(i); if (gf != nullptr) { item->setNormalColor(gf->m_format.m_color.asValue()); @@ -478,8 +486,10 @@ void QGIViewPart::drawViewPart() item->setWidth(lineWidthIso); } item->setPrettyNormal(); - if (!showItem) { - item->hide(); + if (!showAll) { //view level "show" status + if (!showItem) { //individual edge "show" status + item->hide(); + } } //debug a path // QPainterPath edgePath=drawPainterPath(*itGeom); @@ -491,7 +501,7 @@ void QGIViewPart::drawViewPart() // Draw Vertexs: - Base::Reference hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")-> + hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")-> GetGroup("Preferences")->GetGroup("Mod/TechDraw/General"); double vertexScaleFactor = hGrp->GetFloat("VertexScale", 3.0); hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")-> diff --git a/src/Mod/TechDraw/Gui/Resources/TechDraw.qrc b/src/Mod/TechDraw/Gui/Resources/TechDraw.qrc index 8faf638236..207cd03eef 100644 --- a/src/Mod/TechDraw/Gui/Resources/TechDraw.qrc +++ b/src/Mod/TechDraw/Gui/Resources/TechDraw.qrc @@ -72,6 +72,7 @@ icons/actions/techdraw-eraser.svg icons/actions/techdraw-linedecor.svg icons/actions/techdraw-facedecor.svg + icons/actions/techdraw-showall.svg icons/actions/section-up.svg icons/actions/section-down.svg icons/actions/section-left.svg diff --git a/src/Mod/TechDraw/Gui/Resources/icons/actions/techdraw-showall.svg b/src/Mod/TechDraw/Gui/Resources/icons/actions/techdraw-showall.svg new file mode 100644 index 0000000000..99a2d1140d --- /dev/null +++ b/src/Mod/TechDraw/Gui/Resources/icons/actions/techdraw-showall.svg @@ -0,0 +1,174 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/src/Mod/TechDraw/Gui/ViewProviderViewPart.cpp b/src/Mod/TechDraw/Gui/ViewProviderViewPart.cpp index 63447d9f7c..1c445eb6d5 100644 --- a/src/Mod/TechDraw/Gui/ViewProviderViewPart.cpp +++ b/src/Mod/TechDraw/Gui/ViewProviderViewPart.cpp @@ -98,6 +98,8 @@ ViewProviderViewPart::ViewProviderViewPart() //properties that affect Detail Highlights ADD_PROPERTY_TYPE(HighlightAdjust,(0.0),hgroup,App::Prop_None,"Adjusts the rotation of the Detail highlight"); + + ADD_PROPERTY_TYPE(ShowAllEdges ,(false) ,dgroup,App::Prop_None,"Temporarily show invisible lines"); } ViewProviderViewPart::~ViewProviderViewPart() diff --git a/src/Mod/TechDraw/Gui/ViewProviderViewPart.h b/src/Mod/TechDraw/Gui/ViewProviderViewPart.h index 48f9f16b82..f55d58e016 100644 --- a/src/Mod/TechDraw/Gui/ViewProviderViewPart.h +++ b/src/Mod/TechDraw/Gui/ViewProviderViewPart.h @@ -53,6 +53,7 @@ public: App::PropertyBool VertCenterLine; App::PropertyBool ShowSectionLine; App::PropertyFloat HighlightAdjust; + App::PropertyBool ShowAllEdges; virtual void attach(App::DocumentObject *); virtual void setDisplayMode(const char* ModeName); diff --git a/src/Mod/TechDraw/Gui/Workbench.cpp b/src/Mod/TechDraw/Gui/Workbench.cpp index 2427cb8a5d..cd58e4d122 100644 --- a/src/Mod/TechDraw/Gui/Workbench.cpp +++ b/src/Mod/TechDraw/Gui/Workbench.cpp @@ -98,6 +98,7 @@ Gui::MenuItem* Workbench::setupMenuBar() const *draw << "TechDraw_2PointCenterLine"; *draw << "TechDraw_CosmeticEraser"; *draw << "TechDraw_DecorateLine"; + *draw << "TechDraw_ShowAll"; return root; } @@ -166,6 +167,7 @@ Gui::ToolBarItem* Workbench::setupToolBars() const // *anno << "TechDraw_2PointCenterLine"; *anno << "TechDraw_CosmeticEraser"; *anno << "TechDraw_DecorateLine"; + *anno << "TechDraw_ShowAll"; return root; } @@ -231,6 +233,7 @@ Gui::ToolBarItem* Workbench::setupCommandBars() const // *anno << "TechDraw_2PointCenterLine"; *anno << "TechDraw_CosmeticEraser"; *anno << "TechDraw_DecorateLine"; + *anno << "TechDraw_ShowAll"; return root; }