diff --git a/src/Mod/TechDraw/App/Preferences.cpp b/src/Mod/TechDraw/App/Preferences.cpp index 2047014914..9546ac73ed 100644 --- a/src/Mod/TechDraw/App/Preferences.cpp +++ b/src/Mod/TechDraw/App/Preferences.cpp @@ -522,3 +522,8 @@ int Preferences::LineCapIndex() return getPreferenceGroup("General")->GetInt("EdgeCapStyle", 0x20); } +//! returns 0 (use ANSI style section cut line) or 1 (use ISO style section cut line) +int Preferences::sectionLineConvention() +{ + return getPreferenceGroup("Standards")->GetInt("SectionLineStandard", 1); +} diff --git a/src/Mod/TechDraw/App/Preferences.h b/src/Mod/TechDraw/App/Preferences.h index 3613712e38..6387bc9ed7 100644 --- a/src/Mod/TechDraw/App/Preferences.h +++ b/src/Mod/TechDraw/App/Preferences.h @@ -124,6 +124,8 @@ public: static std::string currentLineDefFile(); static std::string currentElementDefFile(); + + static int sectionLineConvention(); }; diff --git a/src/Mod/TechDraw/Gui/PreferencesGui.cpp b/src/Mod/TechDraw/Gui/PreferencesGui.cpp index a5fa7ba9da..b149c00f0b 100644 --- a/src/Mod/TechDraw/Gui/PreferencesGui.cpp +++ b/src/Mod/TechDraw/Gui/PreferencesGui.cpp @@ -156,19 +156,6 @@ double PreferencesGui::edgeFuzz() return Preferences::getPreferenceGroup("General")->GetFloat("EdgeFuzz", 10.0); } - -// this is for the iso vs ansi positioning of arrows and text. rename to sectionLineConvention? -Qt::PenStyle PreferencesGui::sectionLineStyle() -{ - Qt::PenStyle sectStyle = static_cast (Preferences::getPreferenceGroup("Decorations")->GetInt("SectionLine", 2)); - return sectStyle; -} - -bool PreferencesGui::sectionLineMarks() -{ - return Preferences::getPreferenceGroup("Decorations")->GetBool("SectionLineMarks", true); -} - QString PreferencesGui::weldingDirectory() { std::string defaultDir = App::Application::getResourceDir() + "Mod/TechDraw/Symbols/Welding/AWS/"; diff --git a/src/Mod/TechDraw/Gui/PreferencesGui.h b/src/Mod/TechDraw/Gui/PreferencesGui.h index 5f45b7dc69..eee71019f7 100644 --- a/src/Mod/TechDraw/Gui/PreferencesGui.h +++ b/src/Mod/TechDraw/Gui/PreferencesGui.h @@ -63,9 +63,6 @@ static double dimArrowSize(); static double edgeFuzz(); -static Qt::PenStyle sectionLineStyle(); -static bool sectionLineMarks(); - static QString weldingDirectory(); static bool showGrid(); diff --git a/src/Mod/TechDraw/Gui/QGIHighlight.cpp b/src/Mod/TechDraw/Gui/QGIHighlight.cpp index b31911e212..f85ff7ed3a 100644 --- a/src/Mod/TechDraw/Gui/QGIHighlight.cpp +++ b/src/Mod/TechDraw/Gui/QGIHighlight.cpp @@ -173,12 +173,6 @@ QColor QGIHighlight::getHighlightColor() return PreferencesGui::sectionLineQColor(); } -//obs?? -Qt::PenStyle QGIHighlight::getHighlightStyle() -{ - return PreferencesGui::sectionLineStyle(); -} - int QGIHighlight::getHoleStyle() { return TechDraw::Preferences::mattingStyle(); diff --git a/src/Mod/TechDraw/Gui/QGIHighlight.h b/src/Mod/TechDraw/Gui/QGIHighlight.h index f623947c12..723e769955 100644 --- a/src/Mod/TechDraw/Gui/QGIHighlight.h +++ b/src/Mod/TechDraw/Gui/QGIHighlight.h @@ -67,7 +67,6 @@ public: protected: QColor getHighlightColor(); - Qt::PenStyle getHighlightStyle(); void makeHighlight(); void makeReference(); void setTools(); diff --git a/src/Mod/TechDraw/Gui/QGISectionLine.cpp b/src/Mod/TechDraw/Gui/QGISectionLine.cpp index 3780c770eb..00a1ff8c26 100644 --- a/src/Mod/TechDraw/Gui/QGISectionLine.cpp +++ b/src/Mod/TechDraw/Gui/QGISectionLine.cpp @@ -33,6 +33,8 @@ #include #include +#include + #include "QGISectionLine.h" #include "PreferencesGui.h" #include "QGIArrow.h" @@ -73,7 +75,6 @@ QGISectionLine::QGISectionLine() : addToGroup(m_symbol2); setWidth(Rez::guiX(0.75)); //a default? - setStyle(getSectionStyle()); setColor(getSectionColor()); } @@ -81,7 +82,7 @@ QGISectionLine::QGISectionLine() : void QGISectionLine::draw() { prepareGeometryChange(); - int format = getPrefSectionStandard(); + int format = Preferences::sectionLineConvention(); if (format == ANSISTANDARD) { //"ASME"/"ANSI" extensionEndsTrad(); } else { @@ -128,7 +129,7 @@ void QGISectionLine::makeSectionLine() void QGISectionLine::makeArrows() { - int format = getPrefSectionStandard(); + int format = Preferences::sectionLineConvention(); if (format == ANSISTANDARD) { makeArrowsTrad(); } else { @@ -193,7 +194,7 @@ void QGISectionLine::makeArrowsTrad() void QGISectionLine::makeSymbols() { - int format = getPrefSectionStandard(); + int format = Preferences::sectionLineConvention(); if (format == ANSISTANDARD) { makeSymbolsTrad(); } else { @@ -471,25 +472,6 @@ QColor QGISectionLine::getSectionColor() return PreferencesGui::sectionLineQColor(); } -//SectionLineStyle -void QGISectionLine::setSectionStyle(int style) -{ - Qt::PenStyle sectStyle = static_cast (style); - setStyle(sectStyle); -} - -Qt::PenStyle QGISectionLine::getSectionStyle() -{ - return PreferencesGui::sectionLineStyle(); -} - -//ASME("traditional") vs ISO("reference arrow method") arrows -int QGISectionLine::getPrefSectionStandard() -{ - return Preferences::getPreferenceGroup("Standards")->GetInt("SectionLineStandard", ISOSTANDARD); -} - - void QGISectionLine::paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget) { QStyleOptionGraphicsItem myOption(*option); myOption.state &= ~QStyle::State_Selected; diff --git a/src/Mod/TechDraw/Gui/QGISectionLine.h b/src/Mod/TechDraw/Gui/QGISectionLine.h index 23df1fe4b7..02c1c6f824 100644 --- a/src/Mod/TechDraw/Gui/QGISectionLine.h +++ b/src/Mod/TechDraw/Gui/QGISectionLine.h @@ -62,7 +62,6 @@ public: void setDirection(Base::Vector3d dir); void setArrowDirections(Base::Vector3d dir1, Base::Vector3d dir2); void setFont(QFont f, double fsize); - void setSectionStyle(int style); void setSectionColor(QColor c); void setPathMode(bool mode) { m_pathMode = mode; } bool pathMode() { return m_pathMode; } @@ -86,7 +85,6 @@ protected: void makeSymbolsISO(); void makeChangePointMarks(); void setTools(); - int getPrefSectionStandard(); void extensionEndsISO(); void extensionEndsTrad(); double getArrowRotation(Base::Vector3d arrowDir); diff --git a/src/Mod/TechDraw/Gui/QGIViewPart.cpp b/src/Mod/TechDraw/Gui/QGIViewPart.cpp index 50e1b88110..7312a402a9 100644 --- a/src/Mod/TechDraw/Gui/QGIViewPart.cpp +++ b/src/Mod/TechDraw/Gui/QGIViewPart.cpp @@ -637,6 +637,7 @@ void QGIViewPart::drawAllSectionLines() void QGIViewPart::drawSectionLine(TechDraw::DrawViewSection* viewSection, bool b) { +// Base::Console().Message("QGIVP::drawSectionLine()\n"); TechDraw::DrawViewPart* viewPart = static_cast(getViewObject()); if (!viewPart) return; @@ -665,7 +666,6 @@ void QGIViewPart::drawSectionLine(TechDraw::DrawViewSection* viewSection, bool b QGISectionLine* sectionLine = new QGISectionLine(); addToGroup(sectionLine); sectionLine->setSymbol(const_cast(viewSection->SectionSymbol.getValue())); - sectionLine->setSectionStyle(vp->SectionLineStyle.getValue()); App::Color color = Preferences::getAccessibleColor(vp->SectionLineColor.getValue()); sectionLine->setSectionColor(color.asValue()); sectionLine->setPathMode(false); @@ -754,7 +754,6 @@ void QGIViewPart::drawComplexSectionLine(TechDraw::DrawViewSection* viewSection, QGISectionLine* sectionLine = new QGISectionLine(); addToGroup(sectionLine); sectionLine->setSymbol(const_cast(viewSection->SectionSymbol.getValue())); - sectionLine->setSectionStyle(vp->SectionLineStyle.getValue()); App::Color color = Preferences::getAccessibleColor(vp->SectionLineColor.getValue()); sectionLine->setSectionColor(color.asValue()); sectionLine->setPathMode(true); diff --git a/src/Mod/TechDraw/Gui/ViewProviderViewPart.cpp b/src/Mod/TechDraw/Gui/ViewProviderViewPart.cpp index dbd4587efc..94e53586a7 100644 --- a/src/Mod/TechDraw/Gui/ViewProviderViewPart.cpp +++ b/src/Mod/TechDraw/Gui/ViewProviderViewPart.cpp @@ -107,25 +107,15 @@ ViewProviderViewPart::ViewProviderViewPart() ADD_PROPERTY_TYPE(ArcCenterMarks ,(defShowCenters), dgroup, App::Prop_None, "Center marks on/off"); ADD_PROPERTY_TYPE(CenterScale, (defScale), dgroup, App::Prop_None, "Center mark size adjustment, if enabled"); - std::string bodyName = LineGenerator::getLineStandardsBody(); - if (bodyName == "ISO") { - SectionLineStyle.setEnums(ISOLineName::ISOLineNameEnums); - HighlightLineStyle.setEnums(ISOLineName::ISOLineNameEnums); - } else if (bodyName == "ANSI") { - SectionLineStyle.setEnums(ANSILineName::ANSILineNameEnums); - HighlightLineStyle.setEnums(ANSILineName::ANSILineNameEnums); - } else if (bodyName == "ASME") { - SectionLineStyle.setEnums(ASMELineName::ASMELineNameEnums); - HighlightLineStyle.setEnums(ASMELineName::ASMELineNameEnums); - } - //properties that affect Section Line ADD_PROPERTY_TYPE(ShowSectionLine ,(true) ,sgroup, App::Prop_None, "Show/hide section line if applicable"); - ADD_PROPERTY_TYPE(SectionLineStyle, (PreferencesGui::sectionLineStyle()), sgroup, App::Prop_None, + 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"); - ADD_PROPERTY_TYPE(SectionLineMarks, (PreferencesGui::sectionLineMarks()), sgroup, App::Prop_None, + + bool marksDefault = Preferences::sectionLineConvention() == 1 ? true : false; + ADD_PROPERTY_TYPE(SectionLineMarks, (marksDefault), sgroup, App::Prop_None, "Show marks at direction changes for ComplexSection"); //properties that affect Detail Highlights @@ -135,7 +125,7 @@ ViewProviderViewPart::ViewProviderViewPart() "Set highlight line color if applicable"); 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"); + ADD_PROPERTY_TYPE(ShowAllEdges ,(false),dgroup, App::Prop_None, "Temporarily show invisible lines"); // Faces related properties ADD_PROPERTY_TYPE(FaceColor, (Preferences::getPreferenceGroup("Colors")->GetUnsigned("FaceColor", 0xFFFFFF)), @@ -143,6 +133,18 @@ ViewProviderViewPart::ViewProviderViewPart() ADD_PROPERTY_TYPE(FaceTransparency, (Preferences::getPreferenceGroup("Colors")->GetBool("ClearFace", false) ? 100 : 0), fgroup, App::Prop_None, "Set transparency of faces"); FaceTransparency.setConstraints(&intPercent); + + std::string bodyName = LineGenerator::getLineStandardsBody(); + if (bodyName == "ISO") { + SectionLineStyle.setEnums(ISOLineName::ISOLineNameEnums); + HighlightLineStyle.setEnums(ISOLineName::ISOLineNameEnums); + } else if (bodyName == "ANSI") { + SectionLineStyle.setEnums(ANSILineName::ANSILineNameEnums); + HighlightLineStyle.setEnums(ANSILineName::ANSILineNameEnums); + } else if (bodyName == "ASME") { + SectionLineStyle.setEnums(ASMELineName::ASMELineNameEnums); + HighlightLineStyle.setEnums(ASMELineName::ASMELineNameEnums); + } } ViewProviderViewPart::~ViewProviderViewPart()