From 55968bbf6c09082348bc95647d3b40c9a730f2ca Mon Sep 17 00:00:00 2001 From: wandererfan Date: Fri, 17 May 2024 18:31:36 -0400 Subject: [PATCH] [TD]assorted Preference updates - section line convention label - remove superfluous save/restore on changeEvent - change default scrub count - add preference for default symbol dir - add preference for display of section cut line --- src/Mod/TechDraw/App/Preferences.cpp | 33 +- src/Mod/TechDraw/App/Preferences.h | 4 + src/Mod/TechDraw/Gui/Command.cpp | 10 +- src/Mod/TechDraw/Gui/CommandDecorate.cpp | 4 +- .../TechDraw/Gui/DlgPrefsTechDrawAdvanced.ui | 3 + .../Gui/DlgPrefsTechDrawAdvancedImp.cpp | 2 - .../Gui/DlgPrefsTechDrawAnnotation.ui | 542 ++++++++++-------- .../Gui/DlgPrefsTechDrawAnnotationImp.cpp | 6 +- .../Gui/DlgPrefsTechDrawColorsImp.cpp | 2 - .../Gui/DlgPrefsTechDrawDimensionsImp.cpp | 2 - .../TechDraw/Gui/DlgPrefsTechDrawGeneral.ui | 336 ++++++----- .../Gui/DlgPrefsTechDrawGeneralImp.cpp | 6 +- .../TechDraw/Gui/DlgPrefsTechDrawHLRImp.cpp | 2 - .../TechDraw/Gui/DlgPrefsTechDrawScaleImp.cpp | 2 - src/Mod/TechDraw/Gui/QGISectionLine.cpp | 6 +- src/Mod/TechDraw/Gui/QGISectionLine.h | 3 + src/Mod/TechDraw/Gui/QGIViewPart.cpp | 38 +- src/Mod/TechDraw/Gui/TaskHatch.cpp | 7 - src/Mod/TechDraw/Gui/ViewProviderViewPart.cpp | 7 +- src/Mod/TechDraw/Gui/ViewProviderViewPart.h | 1 + 20 files changed, 574 insertions(+), 442 deletions(-) diff --git a/src/Mod/TechDraw/App/Preferences.cpp b/src/Mod/TechDraw/App/Preferences.cpp index 3028531c51..0dea12bf39 100644 --- a/src/Mod/TechDraw/App/Preferences.cpp +++ b/src/Mod/TechDraw/App/Preferences.cpp @@ -250,6 +250,24 @@ bool Preferences::showDetailHighlight() return getPreferenceGroup("General")->GetBool("ShowDetailHighlight", true); } +//! returns the default or preferred directory to search for svg symbols +QString Preferences::defaultSymbolDir() +{ + std::string defaultDir = App::Application::getResourceDir() + "Mod/TechDraw/Templates"; + std::string prefSymbolDir = getPreferenceGroup("Files")->GetASCII("DirSymbol", defaultDir.c_str()); + if (prefSymbolDir.empty()) { + prefSymbolDir = defaultDir; + } + QString symbolDir = QString::fromStdString(prefSymbolDir); + Base::FileInfo fi(prefSymbolDir); + if (!fi.isReadable()) { + Base::Console().Warning("Symbol Directory: %s is not readable\n", + prefSymbolDir.c_str()); + symbolDir = QString::fromStdString(defaultDir); + } + return symbolDir; +} + std::string Preferences::svgFile() { std::string defaultDir = App::Application::getResourceDir() + "Mod/TechDraw/Patterns/"; @@ -402,7 +420,7 @@ bool Preferences::autoCorrectDimRefs() //! number of times to clean the output edges from HLR int Preferences::scrubCount() { - return getPreferenceGroup("General")->GetInt("ScrubCount", 0); + return getPreferenceGroup("General")->GetInt("ScrubCount", 1); } //! Returns the factor for the overlap of svg tiles when hatching faces @@ -540,6 +558,19 @@ int Preferences::sectionLineConvention() return getPreferenceGroup("Standards")->GetInt("SectionLineStandard", 1); } +//! true if a section line annotation should be drawn on the source view. If false, +//! no cut line, change marks, arrows or symbol will be drawn. +bool Preferences::showSectionLine() +{ + return getPreferenceGroup("Decorations")->GetBool("ShowSectionLine", true); +} + +//! true if the section cut line should be drawn on the source view. Some conventions do not draw the +//! actual cut line, but only the change points, arrows and symbols. +bool Preferences::includeCutLine() +{ + return getPreferenceGroup("Decorations")->GetBool("IncludeCutLine", true); +} //! true if the GeometryMatcher should be used in correcting Dimension references bool Preferences::useExactMatchOnDims() diff --git a/src/Mod/TechDraw/App/Preferences.h b/src/Mod/TechDraw/App/Preferences.h index d36636832b..1903d6cded 100644 --- a/src/Mod/TechDraw/App/Preferences.h +++ b/src/Mod/TechDraw/App/Preferences.h @@ -85,6 +85,8 @@ public: static std::string svgFile(); static std::string patFile(); + static QString defaultSymbolDir(); + static std::string bitmapFill(); static double GapISO(); @@ -126,6 +128,8 @@ public: static std::string currentElementDefFile(); static int sectionLineConvention(); + static bool showSectionLine(); + static bool includeCutLine(); static bool useExactMatchOnDims(); }; diff --git a/src/Mod/TechDraw/Gui/Command.cpp b/src/Mod/TechDraw/Gui/Command.cpp index 3c953b72b6..08456771f0 100644 --- a/src/Mod/TechDraw/Gui/Command.cpp +++ b/src/Mod/TechDraw/Gui/Command.cpp @@ -435,13 +435,14 @@ void CmdTechDrawView::activated(int iMsg) } } - QString filename = Gui::FileDialog::getOpenFileName(Gui::getMainWindow(), - QObject::tr("Select a SVG or Image file to open"), QString(), + QString filename = Gui::FileDialog::getOpenFileName(Gui::getMainWindow(), + QObject::tr("Select a SVG or Image file to open"), + Preferences::defaultSymbolDir(), QString::fromLatin1("%1 (*.svg *.svgz *.jpg *.jpeg *.png *.bmp);;%2 (*.*)") .arg(QObject::tr("SVG or Image files"), QObject::tr("All Files"))); if (!filename.isEmpty()) { - if (filename.endsWith(QString::fromLatin1(".svg"), Qt::CaseInsensitive) + if (filename.endsWith(QString::fromLatin1(".svg"), Qt::CaseInsensitive) || filename.endsWith(QString::fromLatin1(".svgz"), Qt::CaseInsensitive)) { std::string FeatName = getUniqueObjectName("Symbol"); filename = Base::Tools::escapeEncodeFilename(filename); @@ -1501,7 +1502,8 @@ void CmdTechDrawSymbol::activated(int iMsg) // Reading an image QString filename = Gui::FileDialog::getOpenFileName( - Gui::getMainWindow(), QObject::tr("Choose an SVG file to open"), QString(), + Gui::getMainWindow(), QObject::tr("Choose an SVG file to open"), + Preferences::defaultSymbolDir(), QString::fromLatin1("%1 (*.svg *.svgz);;%2 (*.*)") .arg(QObject::tr("Scalable Vector Graphic"), QObject::tr("All Files"))); diff --git a/src/Mod/TechDraw/Gui/CommandDecorate.cpp b/src/Mod/TechDraw/Gui/CommandDecorate.cpp index 2deeb5b3a2..a78615f150 100644 --- a/src/Mod/TechDraw/Gui/CommandDecorate.cpp +++ b/src/Mod/TechDraw/Gui/CommandDecorate.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #include "DrawGuiUtil.h" #include "MDIViewPage.h" @@ -55,6 +56,7 @@ using namespace TechDrawGui; +using namespace TechDraw; //internal functions bool _checkSelectionHatch(Gui::Command* cmd); @@ -256,7 +258,7 @@ void CmdTechDrawImage::activated(int iMsg) // Reading an image QString fileName = Gui::FileDialog::getOpenFileName(Gui::getMainWindow(), QString::fromUtf8(QT_TR_NOOP("Select an Image File")), - QString(), + Preferences::defaultSymbolDir(), QString::fromUtf8(QT_TR_NOOP("Image files (*.jpg *.jpeg *.png *.bmp);;All files (*)"))); if (fileName.isEmpty()) { return; diff --git a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAdvanced.ui b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAdvanced.ui index 91db4dd5bc..674600c29b 100644 --- a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAdvanced.ui +++ b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAdvanced.ui @@ -499,6 +499,9 @@ can be a performance penalty in complex models. + + 1 + ScrubCount diff --git a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAdvancedImp.cpp b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAdvancedImp.cpp index fa570ce342..c3d3ea062e 100644 --- a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAdvancedImp.cpp +++ b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAdvancedImp.cpp @@ -84,9 +84,7 @@ void DlgPrefsTechDrawAdvancedImp::loadSettings() void DlgPrefsTechDrawAdvancedImp::changeEvent(QEvent *e) { if (e->type() == QEvent::LanguageChange) { - saveSettings(); ui->retranslateUi(this); - loadSettings(); } else { QWidget::changeEvent(e); diff --git a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAnnotation.ui b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAnnotation.ui index 24dd6abd88..d012ba3aad 100644 --- a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAnnotation.ui +++ b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAnnotation.ui @@ -7,7 +7,7 @@ 0 0 580 - 687 + 795 @@ -34,131 +34,8 @@ - - - - - 0 - 0 - - - - - 0 - 0 - - - - - true - - - - Forces last leader line segment to be horizontal - - - Leader Line Auto Horizontal - - - true - - - AutoHorizontal - - - Mod/TechDraw/LeaderLine - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - true - - - - Show arc center marks in views - - - Show Center Marks - - - true - - - ShowCenterMarks - - - Mod/TechDraw/Decorations - - - - - - - - true - - - - Show or hide marks at direction changes on ComplexSection lines. - - - Complex Section Line Marks - - - true - - - SectionLineMarks - - - Mod/TechDraw/Decorations - - - - - - - - true - - - - Section Cut Surface - - - - - - - - true - - - - Length of horizontal portion of Balloon leader - - - Ballon Leader Kink Length - - - - - + + 0 @@ -172,35 +49,108 @@ - Outline shape for detail views + Length of balloon leader line kink + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 5.000000000000000 - MattingStyle + BalloonKink + + + Mod/TechDraw/Dimensions + + + + + + + + 0 + 22 + + + + Default appearance of cut surface in section view + + + 2 + + + CutSurfaceDisplay /Mod/TechDraw/Decorations - Circle - - - - :/icons/circular.svg:/icons/circular.svg + Hide - Square + Solid Color - - - :/icons/square.svg:/icons/square.svg + + + + SVG Hatch + + + + + PAT Hatch - + + + + + true + + + + Balloon Leader End + + + + + + + + false + + + + Detail View Outline Shape + + + + + + + This checkbox controls whether or not to display the outline around a detail view. + + + Detail View Show Matting + + + true + + + ShowDetailMatting + + + /Mod/TechDraw/General + + + + @@ -297,8 +247,20 @@ - - + + + + + true + + + + Balloon Shape + + + + + 0 @@ -312,23 +274,59 @@ - Length of balloon leader line kink - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - 5.000000000000000 + Outline shape for detail views - BalloonKink + MattingStyle - Mod/TechDraw/Dimensions + /Mod/TechDraw/Decorations + + + + Circle + + + + :/icons/circular.svg:/icons/circular.svg + + + + + Square + + + + :/icons/square.svg:/icons/square.svg + + + + + + + + + true + + + + Show or hide marks at direction changes on ComplexSection lines. + + + Complex Section Line Marks + + + true + + + SectionLineMarks + + + Mod/TechDraw/Decorations - + @@ -359,7 +357,104 @@ - + + + + + 0 + 0 + + + + + 0 + 0 + + + + Style for balloon leader line ends + + + BalloonArrow + + + Mod/TechDraw/Decorations + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + true + + + + Forces last leader line segment to be horizontal + + + Leader Line Auto Horizontal + + + true + + + AutoHorizontal + + + Mod/TechDraw/LeaderLine + + + + + + + + true + + + + Section Cut Surface + + + + + + + + true + + + + If checked, the section annotation will be drawn on the Source view. If unchecked, no section line, arrows or symbol will be shown in the Source view. + + + Show Section Line in Source View + + + true + + + ShowSectionLine + + + Mod/TechDraw/Decorations + + + + Qt::Horizontal @@ -373,61 +468,76 @@ - - - - true - - - - Balloon Leader End - - - - - + - This checkbox controls whether or not to display the outline around a detail view. + This checkbox controls whether or not to display a highlight around the detail area in the detail's source view. - Detail View Show Matting + Detail Source Show Highlight true - ShowDetailMatting + ShowDetailHighlight /Mod/TechDraw/General - - + + true + + Length of horizontal portion of Balloon leader + - Balloon Shape + Ballon Leader Kink Length - - + + + + + 0 + 0 + + + + + 0 + 0 + + - false + true + + Show arc center marks in views + - Detail View Outline Shape + Show Center Marks + + + true + + + ShowCenterMarks + + + Mod/TechDraw/Decorations - + @@ -455,89 +565,27 @@ - - - - - 0 - 22 - + + + + + true + - Default appearance of cut surface in section view - - - 2 - - - CutSurfaceDisplay - - - /Mod/TechDraw/Decorations - - - - Hide - - - - - Solid Color - - - - - SVG Hatch - - - - - PAT Hatch - - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - Style for balloon leader line ends - - - BalloonArrow - - - Mod/TechDraw/Decorations - - - - - - - This checkbox controls whether or not to display a highlight around the detail area in the detail's source view. + If checked, the cut line will be drawn on the Source view. If unchecked, only the change marks, arrows and symbols will be displayed. - Detail Source Show Highlight + Include Cut Line in Section Annotation true - ShowDetailHighlight + IncludeCutLine - /Mod/TechDraw/General + Mod/TechDraw/Decorations diff --git a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAnnotationImp.cpp b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAnnotationImp.cpp index 6264b05090..36163b1501 100644 --- a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAnnotationImp.cpp +++ b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAnnotationImp.cpp @@ -90,6 +90,9 @@ void DlgPrefsTechDrawAnnotationImp::saveSettings() ui->pcbMatting->onSave(); ui->pdsbBalloonKink->onSave(); ui->cbCutSurface->onSave(); + ui->cb_ShowSectionLine->onSave(); + ui->cb_IncludeCutLine->onSave(); + // don't save invalid parameter values // the comboboxes are properly loaded. @@ -152,7 +155,8 @@ void DlgPrefsTechDrawAnnotationImp::loadSettings() ui->cbCutSurface->onRestore(); ui->pcbDetailMatting->onRestore(); ui->pcbDetailHighlight->onRestore(); - + ui->cb_ShowSectionLine->onRestore(); + ui->cb_IncludeCutLine->onRestore(); ui->pcbBalloonArrow->onRestore(); DrawGuiUtil::loadArrowBox(ui->pcbBalloonArrow); diff --git a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawColorsImp.cpp b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawColorsImp.cpp index bf51d29f59..c6ae30d1e7 100644 --- a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawColorsImp.cpp +++ b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawColorsImp.cpp @@ -100,9 +100,7 @@ void DlgPrefsTechDrawColorsImp::loadSettings() void DlgPrefsTechDrawColorsImp::changeEvent(QEvent *e) { if (e->type() == QEvent::LanguageChange) { - saveSettings(); ui->retranslateUi(this); - loadSettings(); } else { QWidget::changeEvent(e); diff --git a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawDimensionsImp.cpp b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawDimensionsImp.cpp index c7ef7746ce..3369da18f1 100644 --- a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawDimensionsImp.cpp +++ b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawDimensionsImp.cpp @@ -201,9 +201,7 @@ void DlgPrefsTechDrawDimensionsImp::dimensioningModeChanged(int index) void DlgPrefsTechDrawDimensionsImp::changeEvent(QEvent *e) { if (e->type() == QEvent::LanguageChange) { - saveSettings(); ui->retranslateUi(this); - loadSettings(); } else { QWidget::changeEvent(e); diff --git a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawGeneral.ui b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawGeneral.ui index 3b173bc8f3..dfc9a0af04 100644 --- a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawGeneral.ui +++ b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawGeneral.ui @@ -7,7 +7,7 @@ 0 0 499 - 768 + 897 @@ -462,7 +462,7 @@ for ProjectionGroups - true + false @@ -494,17 +494,73 @@ for ProjectionGroups - - - + + + + + Qt::Horizontal + + + + 40 + 22 + + + + + + 0 0 + + + true + + - Default Template + PAT File + + + + + + + + 191 + 0 + + + + Preferred SVG or bitmap file for hatching. This value will also control the initial directory for choosing hatch patterns. You can use this to get hatch files from a local directory. + + + FileHatch + + + /Mod/TechDraw/Files + + + + + + + + 191 + 0 + + + + Alternate file for personal LineGroup definition + + + LineGroupFile + + + /Mod/TechDraw/Files @@ -533,128 +589,6 @@ for ProjectionGroups - - - - - 0 - 0 - - - - Template Directory - - - - - - - Qt::Horizontal - - - - 40 - 22 - - - - - - - - - 191 - 0 - - - - Starting directory for menu 'Insert Page using Template' - - - Gui::FileChooser::Directory - - - TemplateDir - - - /Mod/TechDraw/Files - - - - - - - - 0 - 0 - - - - - true - - - - Hatch Pattern File - - - - - - - - 191 - 0 - - - - Default SVG or bitmap file for hatching - - - FileHatch - - - /Mod/TechDraw/Files - - - - - - - - 0 - 0 - - - - - true - - - - Line Group File - - - - - - - - 191 - 0 - - - - Alternate file for personal LineGroup definition - - - LineGroupFile - - - /Mod/TechDraw/Files - - - @@ -673,6 +607,25 @@ for ProjectionGroups + + + + + 191 + 0 + + + + Default PAT pattern definition file for geometric hatching + + + FilePattern + + + /Mod/TechDraw/PAT + + + @@ -695,26 +648,8 @@ for ProjectionGroups - - - - - 0 - 0 - - - - - true - - - - PAT File - - - - - + + 191 @@ -722,18 +657,50 @@ for ProjectionGroups - Default PAT pattern definition file for geometric hatching + Starting directory for menu 'Insert Page using Template' + + + Gui::FileChooser::Directory - FilePattern + TemplateDir - /Mod/TechDraw/PAT + /Mod/TechDraw/Files - - + + + + + 0 + 0 + + + + Template Directory + + + + + + + Alternate directory to search for Svg symbol files. + + + Gui::FileChooser::Directory + + + DirSymbol + + + /Mod/TechDraw/Files + + + + + 0 @@ -746,7 +713,32 @@ for ProjectionGroups - Pattern Name + Hatch Pattern File + + + + + + + + 0 + 0 + + + + Default Template + + + + + + + + true + + + + Symbol Directory @@ -781,6 +773,42 @@ for ProjectionGroups + + + + + 0 + 0 + + + + + true + + + + Line Group File + + + + + + + + 0 + 0 + + + + + true + + + + Pattern Name + + + diff --git a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawGeneralImp.cpp b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawGeneralImp.cpp index a258476c7e..035335db46 100644 --- a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawGeneralImp.cpp +++ b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawGeneralImp.cpp @@ -70,6 +70,8 @@ void DlgPrefsTechDrawGeneralImp::saveSettings() ui->pfc_Welding->onSave(); ui->pfc_FilePattern->onSave(); ui->le_NamePattern->onSave(); + ui->fcSymbolDir->onSave(); + ui->cb_ShowGrid->onSave(); ui->psb_GridSpacing->onSave(); @@ -102,6 +104,8 @@ void DlgPrefsTechDrawGeneralImp::loadSettings() ui->pfc_Welding->onRestore(); ui->pfc_FilePattern->onRestore(); ui->le_NamePattern->onRestore(); + ui->fcSymbolDir->onRestore(); + bool gridDefault = PreferencesGui::showGrid(); ui->cb_ShowGrid->setChecked(gridDefault); @@ -122,9 +126,7 @@ void DlgPrefsTechDrawGeneralImp::loadSettings() void DlgPrefsTechDrawGeneralImp::changeEvent(QEvent *e) { if (e->type() == QEvent::LanguageChange) { - saveSettings(); ui->retranslateUi(this); - loadSettings(); } else { QWidget::changeEvent(e); diff --git a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawHLRImp.cpp b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawHLRImp.cpp index 9b1419e723..8d5e834c44 100644 --- a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawHLRImp.cpp +++ b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawHLRImp.cpp @@ -78,9 +78,7 @@ void DlgPrefsTechDrawHLRImp::loadSettings() void DlgPrefsTechDrawHLRImp::changeEvent(QEvent *e) { if (e->type() == QEvent::LanguageChange) { - saveSettings(); ui->retranslateUi(this); - loadSettings(); } else { QWidget::changeEvent(e); diff --git a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawScaleImp.cpp b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawScaleImp.cpp index 2b7cc2c74f..11c9ad0052 100644 --- a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawScaleImp.cpp +++ b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawScaleImp.cpp @@ -88,9 +88,7 @@ void DlgPrefsTechDrawScaleImp::loadSettings() void DlgPrefsTechDrawScaleImp::changeEvent(QEvent *e) { if (e->type() == QEvent::LanguageChange) { - saveSettings(); ui->retranslateUi(this); - loadSettings(); } else { QWidget::changeEvent(e); diff --git a/src/Mod/TechDraw/Gui/QGISectionLine.cpp b/src/Mod/TechDraw/Gui/QGISectionLine.cpp index 00a1ff8c26..3a1b087cf3 100644 --- a/src/Mod/TechDraw/Gui/QGISectionLine.cpp +++ b/src/Mod/TechDraw/Gui/QGISectionLine.cpp @@ -122,8 +122,10 @@ void QGISectionLine::makeExtensionLine() void QGISectionLine::makeSectionLine() { QPainterPath pp; - pp.moveTo(m_start); - pp.lineTo(m_end); + if (m_showLine) { + pp.moveTo(m_start); + pp.lineTo(m_end); + } m_line->setPath(pp); } diff --git a/src/Mod/TechDraw/Gui/QGISectionLine.h b/src/Mod/TechDraw/Gui/QGISectionLine.h index 02c1c6f824..84aaabbbd2 100644 --- a/src/Mod/TechDraw/Gui/QGISectionLine.h +++ b/src/Mod/TechDraw/Gui/QGISectionLine.h @@ -64,6 +64,7 @@ public: void setFont(QFont f, double fsize); void setSectionColor(QColor c); void setPathMode(bool mode) { m_pathMode = mode; } + void setShowLine(bool state) { m_showLine = state; } bool pathMode() { return m_pathMode; } void setChangePoints(TechDraw::ChangePointVector changePoints); void clearChangePoints(); @@ -123,6 +124,8 @@ private: QPointF m_arrowPos2; std::vector m_changePointMarks; TechDraw::ChangePointVector m_changePointData; + + bool m_showLine{true}; }; } diff --git a/src/Mod/TechDraw/Gui/QGIViewPart.cpp b/src/Mod/TechDraw/Gui/QGIViewPart.cpp index 7da64a12df..2ccdf2e9e1 100644 --- a/src/Mod/TechDraw/Gui/QGIViewPart.cpp +++ b/src/Mod/TechDraw/Gui/QGIViewPart.cpp @@ -697,8 +697,10 @@ void QGIViewPart::drawAllSectionLines() return; auto vp = static_cast(getViewProvider(getViewObject())); - if (!vp) + if (!vp) { return; + } + if (vp->ShowSectionLine.getValue()) { auto refs = viewPart->getSectionRefs(); for (auto& r : refs) { @@ -776,11 +778,18 @@ void QGIViewPart::drawSectionLine(TechDraw::DrawViewSection* viewSection, bool b //set the general parameters sectionLine->setPos(0.0, 0.0); - // sectionLines are typically ISO 8 (long dash, short dash) or ISO 4 (long dash, dot) - sectionLine->setLinePen( - m_dashedLineGenerator->getLinePen((size_t)vp->SectionLineStyle.getValue(), - vp->HiddenWidth.getValue())); - sectionLine->setWidth(Rez::guiX(vp->HiddenWidth.getValue())); + + if (vp->IncludeCutLine.getValue()) { + sectionLine->setShowLine(true); + // sectionLines are typically ISO 8 (long dash, short dash) or ISO 4 (long dash, dot) + sectionLine->setLinePen( + m_dashedLineGenerator->getLinePen((size_t)vp->SectionLineStyle.getValue(), + vp->HiddenWidth.getValue())); + sectionLine->setWidth(Rez::guiX(vp->HiddenWidth.getValue())); + } else { + sectionLine->setShowLine(false); + } + double fontSize = Preferences::dimFontSizeMM(); sectionLine->setFont(getFont(), fontSize); sectionLine->setZValue(ZVALUE::SECTIONLINE); @@ -857,11 +866,18 @@ void QGIViewPart::drawComplexSectionLine(TechDraw::DrawViewSection* viewSection, //set the general parameters sectionLine->setPos(0.0, 0.0); - // sectionLines are typically ISO 8 (long dash, short dash) or ISO 4 (long dash, dot) - sectionLine->setLinePen( - m_dashedLineGenerator->getLinePen((size_t)vp->SectionLineStyle.getValue(), - vp->HiddenWidth.getValue())); - sectionLine->setWidth(Rez::guiX(vp->HiddenWidth.getValue())); + + if (vp->IncludeCutLine.getValue()) { + sectionLine->setShowLine(true); + // sectionLines are typically ISO 8 (long dash, short dash) or ISO 4 (long dash, dot) + sectionLine->setLinePen( + m_dashedLineGenerator->getLinePen((size_t)vp->SectionLineStyle.getValue(), + vp->HiddenWidth.getValue())); + sectionLine->setWidth(Rez::guiX(vp->HiddenWidth.getValue())); + } else { + sectionLine->setShowLine(false); + } + double fontSize = Preferences::dimFontSizeMM(); sectionLine->setFont(getFont(), fontSize); sectionLine->setZValue(ZVALUE::SECTIONLINE); diff --git a/src/Mod/TechDraw/Gui/TaskHatch.cpp b/src/Mod/TechDraw/Gui/TaskHatch.cpp index 05b0129d1f..71280a0555 100644 --- a/src/Mod/TechDraw/Gui/TaskHatch.cpp +++ b/src/Mod/TechDraw/Gui/TaskHatch.cpp @@ -185,7 +185,6 @@ void TaskHatch::apply(bool forceUpdate) if (m_dvp) { //only need requestPaint to hatch the face -// m_dvp->requestPaint(); //need a recompute in order to claimChildren in tree m_dvp->recomputeFeature(); } @@ -199,16 +198,10 @@ void TaskHatch::createHatch() // TODO: the structured label for Hatch (and GeomHatch) should be retired. const std::string objectName("Hatch"); std::string FeatName = doc->getUniqueObjectName(objectName.c_str()); -// std::string generatedSuffix {FeatName.substr(objectName.length())}; -// std::string translatedObjectName{tr(objectName.c_str()).toStdString()}; -// std::stringstream featLabel; -// featLabel << translatedObjectName << generatedSuffix << "F" << -// TechDraw::DrawUtil::getIndexFromName(m_subs.at(0)); //use 1st face# for label Command::openCommand(QT_TRANSLATE_NOOP("Command", "Create Hatch")); Command::doCommand(Command::Doc, "App.activeDocument().addObject('TechDraw::DrawHatch', '%s')", FeatName.c_str()); -// Command::doCommand(Command::Doc, "App.activeDocument().%s.Label = '%s'", FeatName.c_str(), featLabel.str().c_str()); Command::doCommand(Command::Doc, "App.activeDocument().%s.translateLabel('DrawHatch', 'Hatch', '%s')", FeatName.c_str(), FeatName.c_str()); diff --git a/src/Mod/TechDraw/Gui/ViewProviderViewPart.cpp b/src/Mod/TechDraw/Gui/ViewProviderViewPart.cpp index 488ff1bff3..f6e3858871 100644 --- a/src/Mod/TechDraw/Gui/ViewProviderViewPart.cpp +++ b/src/Mod/TechDraw/Gui/ViewProviderViewPart.cpp @@ -109,13 +109,15 @@ ViewProviderViewPart::ViewProviderViewPart() ADD_PROPERTY_TYPE(CenterScale, (defScale), dgroup, App::Prop_None, "Center mark size adjustment, if enabled"); //properties that affect Section Line - ADD_PROPERTY_TYPE(ShowSectionLine ,(true) ,sgroup, App::Prop_None, "Show/hide section line if applicable"); + ADD_PROPERTY_TYPE(ShowSectionLine ,(Preferences::showSectionLine()), sgroup, App::Prop_None, "Show/hide section line if applicable"); + ADD_PROPERTY_TYPE(IncludeCutLine ,(Preferences::includeCutLine()), sgroup, App::Prop_None, "Show/hide section cut line if applicable"); ADD_PROPERTY_TYPE(SectionLineStyle, (Preferences::SectionLineStyle()), sgroup, App::Prop_None, "Set section line style if applicable"); ADD_PROPERTY_TYPE(SectionLineColor, (prefSectionColor()), sgroup, App::Prop_None, "Set section line color if applicable"); - bool marksDefault = Preferences::sectionLineConvention() == 1 ? true : false; + // Assumption: ASME does not use change marks and ISO does use change marks + bool marksDefault = Preferences::sectionLineConvention() == 1 ? true : false; ADD_PROPERTY_TYPE(SectionLineMarks, (marksDefault), sgroup, App::Prop_None, "Show marks at direction changes for ComplexSection"); @@ -176,6 +178,7 @@ void ViewProviderViewPart::onChanged(const App::Property* prop) prop == &(SectionLineStyle) || prop == &(SectionLineColor) || prop == &(SectionLineMarks) || + prop == &(IncludeCutLine) || prop == &(HighlightLineStyle) || prop == &(HighlightLineColor) || prop == &(HorizCenterLine) || diff --git a/src/Mod/TechDraw/Gui/ViewProviderViewPart.h b/src/Mod/TechDraw/Gui/ViewProviderViewPart.h index b4a35d718f..fb15bbdcc0 100644 --- a/src/Mod/TechDraw/Gui/ViewProviderViewPart.h +++ b/src/Mod/TechDraw/Gui/ViewProviderViewPart.h @@ -53,6 +53,7 @@ public: App::PropertyBool HorizCenterLine; App::PropertyBool VertCenterLine; App::PropertyBool ShowSectionLine; + App::PropertyBool IncludeCutLine; App::PropertyEnumeration SectionLineStyle; App::PropertyColor SectionLineColor; App::PropertyBool SectionLineMarks;