From c41363c117eb499479038b8c7399c4e0927d923a Mon Sep 17 00:00:00 2001 From: Sebastian Bachmann Date: Wed, 21 Feb 2018 11:10:39 +0100 Subject: [PATCH] TechDraw: new center/section draw style using custom QT pen styles, the center and section lines look much better. With some math we are also able to control the middle position, thus the centerlines will always look good, regardless of the size of an object. Also getting the section label size from the settings, so the font size is controllable and not hardcoded. Bonus: adding blank templates for the common paper sizes (as the Drawing WB has them) --- src/Mod/TechDraw/App/CMakeLists.txt | 6 + src/Mod/TechDraw/Gui/QGICenterLine.cpp | 46 ++- src/Mod/TechDraw/Gui/QGICenterLine.h | 3 + src/Mod/TechDraw/Gui/QGISectionLine.cpp | 31 +- src/Mod/TechDraw/Gui/QGIViewPart.cpp | 21 +- src/Mod/TechDraw/Gui/QGIViewPart.h | 1 + src/Mod/TechDraw/Gui/ViewProviderViewPart.cpp | 382 +++++++++--------- .../TechDraw/Templates/A0_Landscape_blank.svg | 9 + .../TechDraw/Templates/A1_Landscape_blank.svg | 9 + .../TechDraw/Templates/A2_Landscape_blank.svg | 9 + .../TechDraw/Templates/A3_Landscape_blank.svg | 9 + .../TechDraw/Templates/A4_Landscape_blank.svg | 9 + .../TechDraw/Templates/A4_Portrait_blank.svg | 9 + 13 files changed, 343 insertions(+), 201 deletions(-) create mode 100644 src/Mod/TechDraw/Templates/A0_Landscape_blank.svg create mode 100644 src/Mod/TechDraw/Templates/A1_Landscape_blank.svg create mode 100644 src/Mod/TechDraw/Templates/A2_Landscape_blank.svg create mode 100644 src/Mod/TechDraw/Templates/A3_Landscape_blank.svg create mode 100644 src/Mod/TechDraw/Templates/A4_Landscape_blank.svg create mode 100644 src/Mod/TechDraw/Templates/A4_Portrait_blank.svg diff --git a/src/Mod/TechDraw/App/CMakeLists.txt b/src/Mod/TechDraw/App/CMakeLists.txt index fcd76aa48f66..14158a1718e1 100644 --- a/src/Mod/TechDraw/App/CMakeLists.txt +++ b/src/Mod/TechDraw/App/CMakeLists.txt @@ -158,6 +158,12 @@ SET(TechDraw_Templates Templates/A4_LandscapeTD.svg Templates/A4_Landscape_ISO7200TD.svg Templates/A4_Portrait_ISO7200TD.svg + Templates/A0_Landscape_blank.svg + Templates/A1_Landscape_blank.svg + Templates/A2_Landscape_blank.svg + Templates/A3_Landscape_blank.svg + Templates/A4_Landscape_blank.svg + Templates/A4_Portrait_blank.svg ) SET(TechDraw_PATFile diff --git a/src/Mod/TechDraw/Gui/QGICenterLine.cpp b/src/Mod/TechDraw/Gui/QGICenterLine.cpp index 31a6b0a48ad2..b46f7ebfc9df 100644 --- a/src/Mod/TechDraw/Gui/QGICenterLine.cpp +++ b/src/Mod/TechDraw/Gui/QGICenterLine.cpp @@ -26,6 +26,8 @@ #include #endif +#include + #include #include #include @@ -70,7 +72,7 @@ QColor QGICenterLine::getCenterColor() { Base::Reference hGrp = App::GetApplication().GetUserParameter() .GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Decorations"); - App::Color fcColor = App::Color((uint32_t) hGrp->GetUnsigned("CenterColor", 0x08080800)); + App::Color fcColor = App::Color((uint32_t) hGrp->GetUnsigned("CenterColor", 0x00000000)); return fcColor.asValue(); } @@ -78,7 +80,7 @@ Qt::PenStyle QGICenterLine::getCenterStyle() { Base::Reference hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")-> GetGroup("Preferences")->GetGroup("Mod/TechDraw/Decorations"); - Qt::PenStyle centerStyle = static_cast (hGrp->GetInt("CenterLine",3)); + Qt::PenStyle centerStyle = static_cast (hGrp->GetInt("CenterLine", 4)); return centerStyle; } @@ -90,10 +92,48 @@ void QGICenterLine::paint ( QPainter * painter, const QStyleOptionGraphicsItem * QGIDecoration::paint (painter, &myOption, widget); } +void QGICenterLine::setIntersection(bool isIntersecting) { + /** + * Set the intersection style for the centerline. + * If isIntersecting is set to true, the middle of the centerline + * will be the middle of a dash - therefore if two lines intersect, they + * will form a cross. + * If isIntersecting is set to false, the middle of the centerline will be a + * dot. + */ + m_isintersection = isIntersecting; +} + void QGICenterLine::setTools() { + if (m_styleCurrent == Qt::DashDotLine) { + QVector dashes; + qreal space = 4; // in unit width + qreal dash = 16; + // dot must be really small when using CapStyle RoundCap but > 0 + // for CapStyle FlatCap you would need to set it to 1 + qreal dot = 0.000001; + + dashes << dot << space << dash << space; + qreal dashlen = dot + 2 * space + dash; + qreal l_len = sqrt(pow(m_start.x() - m_end.x(), 2) + pow(m_start.y() - m_end.y(), 2)) / 2.0; + // convert from pixelunits to width units + l_len = l_len / m_width; + // note that the additional length using RoundCap or SquareCap does not + // count here! + if (m_isintersection) { + m_pen.setDashOffset(dashlen - fmod(l_len, dashlen) + space + dash / 2); + } else { + m_pen.setDashOffset(dashlen - fmod(l_len, dashlen)); + } + + m_pen.setDashPattern(dashes); + } + else { + m_pen.setStyle(m_styleCurrent); + } + m_pen.setCapStyle(Qt::RoundCap); m_pen.setWidthF(m_width); m_pen.setColor(m_colCurrent); - m_pen.setStyle(m_styleCurrent); m_line->setPen(m_pen); } diff --git a/src/Mod/TechDraw/Gui/QGICenterLine.h b/src/Mod/TechDraw/Gui/QGICenterLine.h index 09108f795d1e..c018ccca1ee2 100644 --- a/src/Mod/TechDraw/Gui/QGICenterLine.h +++ b/src/Mod/TechDraw/Gui/QGICenterLine.h @@ -48,6 +48,8 @@ class TechDrawGuiExport QGICenterLine : public QGIDecoration void setBounds(double x1,double y1,double x2,double y2); virtual void draw(); + void setIntersection(bool isIntersecting); + protected: QColor getCenterColor(); Qt::PenStyle getCenterStyle(); @@ -58,6 +60,7 @@ class TechDrawGuiExport QGICenterLine : public QGIDecoration QGraphicsPathItem* m_line; //primpath? QPointF m_start; QPointF m_end; + bool m_isintersection; }; } diff --git a/src/Mod/TechDraw/Gui/QGISectionLine.cpp b/src/Mod/TechDraw/Gui/QGISectionLine.cpp index 9e861d2f2f20..cd387ec9baea 100644 --- a/src/Mod/TechDraw/Gui/QGISectionLine.cpp +++ b/src/Mod/TechDraw/Gui/QGISectionLine.cpp @@ -119,7 +119,7 @@ void QGISectionLine::makeSymbols() { QPointF extLineStart,extLineEnd; QPointF offset(m_arrowDir.x,-m_arrowDir.y); - offset = 2.0 * m_extLen * offset; + offset = 1.5 * m_extLen * offset; extLineStart = m_start + offset; extLineEnd = m_end + offset; @@ -173,7 +173,7 @@ QColor QGISectionLine::getSectionColor() { Base::Reference hGrp = App::GetApplication().GetUserParameter() .GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Colors"); - App::Color fcColor = App::Color((uint32_t) hGrp->GetUnsigned("SectionColor", 0x08080800)); + App::Color fcColor = App::Color((uint32_t) hGrp->GetUnsigned("SectionColor", 0x00000000)); return fcColor.asValue(); } @@ -181,7 +181,7 @@ Qt::PenStyle QGISectionLine::getSectionStyle() { Base::Reference hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")-> GetGroup("Preferences")->GetGroup("Mod/TechDraw"); - Qt::PenStyle sectStyle = static_cast (hGrp->GetInt("SectionLine",2)); + Qt::PenStyle sectStyle = static_cast (hGrp->GetInt("SectionLine", 4)); return sectStyle; } @@ -195,9 +195,32 @@ void QGISectionLine::paint ( QPainter * painter, const QStyleOptionGraphicsItem void QGISectionLine::setTools() { + // Use our own style + if (m_styleCurrent == Qt::DashDotLine) { + QVector dashes; + // the stroke width is double the one of center lines, but we like to + // have the same spacing. thus these values must be half as large + qreal space = 2; // in unit r_width + qreal dash = 8; + // dot must be really small when using CapStyle RoundCap but > 0 + // for CapStyle FlatCap you would need to set it to 1 + qreal dot = 0.000001; + + dashes << dot << space << dash << space; + + // TODO for fancyness: calculate the offset so both arrows start with a + // dash! + + m_pen.setDashPattern(dashes); + + m_pen.setDashOffset(2); + } + else { + m_pen.setStyle(m_styleCurrent); + } m_pen.setWidthF(m_width); m_pen.setColor(m_colCurrent); - m_pen.setStyle(m_styleCurrent); + m_pen.setCapStyle(Qt::RoundCap); m_brush.setStyle(m_brushCurrent); m_brush.setColor(m_colCurrent); diff --git a/src/Mod/TechDraw/Gui/QGIViewPart.cpp b/src/Mod/TechDraw/Gui/QGIViewPart.cpp index 68c0904bb76e..5f67c798b39e 100644 --- a/src/Mod/TechDraw/Gui/QGIViewPart.cpp +++ b/src/Mod/TechDraw/Gui/QGIViewPart.cpp @@ -654,6 +654,7 @@ void QGIViewPart::drawSectionLine(TechDraw::DrawViewSection* viewSection, bool b double sectionSpan; double sectionFudge = Rez::guiX(10.0); double xVal, yVal; + double fontSize = getPrefFontSize(); if (horiz) { sectionSpan = m_border->rect().width() + sectionFudge; xVal = sectionSpan / 2.0; @@ -664,8 +665,8 @@ void QGIViewPart::drawSectionLine(TechDraw::DrawViewSection* viewSection, bool b yVal = sectionSpan / 2.0; } sectionLine->setBounds(-xVal,-yVal,xVal,yVal); - sectionLine->setWidth(Rez::guiX(vp->IsoWidth.getValue())); - sectionLine->setFont(m_font,Rez::guiX(6.0)); + sectionLine->setWidth(Rez::guiX(vp->LineWidth.getValue())); + sectionLine->setFont(m_font, fontSize); sectionLine->setZValue(ZVALUE::SECTIONLINE); sectionLine->setRotation(viewPart->Rotation.getValue()); sectionLine->draw(); @@ -690,7 +691,7 @@ void QGIViewPart::drawCenterLines(bool b) QGICenterLine* centerLine; double sectionSpan; - double sectionFudge = 10.0; + double sectionFudge = Rez::guiX(10.0); double xVal, yVal; if (horiz) { centerLine = new QGICenterLine(); @@ -699,8 +700,9 @@ void QGIViewPart::drawCenterLines(bool b) sectionSpan = m_border->rect().width() + sectionFudge; xVal = sectionSpan / 2.0; yVal = 0.0; + centerLine->setIntersection(horiz && vert); centerLine->setBounds(-xVal,-yVal,xVal,yVal); - centerLine->setWidth(Rez::guiX(vp->IsoWidth.getValue())); + centerLine->setWidth(Rez::guiX(vp->HiddenWidth.getValue())); centerLine->setZValue(ZVALUE::SECTIONLINE); centerLine->setRotation(viewPart->Rotation.getValue()); centerLine->draw(); @@ -712,8 +714,9 @@ void QGIViewPart::drawCenterLines(bool b) sectionSpan = (m_border->rect().height() - m_label->boundingRect().height()) + sectionFudge; xVal = 0.0; yVal = sectionSpan / 2.0; + centerLine->setIntersection(horiz && vert); centerLine->setBounds(-xVal,-yVal,xVal,yVal); - centerLine->setWidth(Rez::guiX(vp->IsoWidth.getValue())); + centerLine->setWidth(Rez::guiX(vp->HiddenWidth.getValue())); centerLine->setZValue(ZVALUE::SECTIONLINE); centerLine->setRotation(viewPart->Rotation.getValue()); centerLine->draw(); @@ -1001,3 +1004,11 @@ bool QGIViewPart::getFaceEdgesPref(void) result = hGrp->GetBool("DrawFaceEdges", 0l); return result; } + +double QGIViewPart::getPrefFontSize() +{ + Base::Reference hGrp = App::GetApplication().GetUserParameter(). + GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Labels"); + double fontSize = hGrp->GetFloat("LabelSize", 5.0); + return Rez::guiX(fontSize); +} diff --git a/src/Mod/TechDraw/Gui/QGIViewPart.h b/src/Mod/TechDraw/Gui/QGIViewPart.h index dfba1ee6b41e..8e0a4667a8c4 100644 --- a/src/Mod/TechDraw/Gui/QGIViewPart.h +++ b/src/Mod/TechDraw/Gui/QGIViewPart.h @@ -100,6 +100,7 @@ class TechDrawGuiExport QGIViewPart : public QGIView void removePrimitives(void); void removeDecorations(void); bool getFaceEdgesPref(void); + double getPrefFontSize(void); private: QList deleteItems; diff --git a/src/Mod/TechDraw/Gui/ViewProviderViewPart.cpp b/src/Mod/TechDraw/Gui/ViewProviderViewPart.cpp index 3b5898cc0dec..f282ab3f917d 100644 --- a/src/Mod/TechDraw/Gui/ViewProviderViewPart.cpp +++ b/src/Mod/TechDraw/Gui/ViewProviderViewPart.cpp @@ -1,189 +1,193 @@ -/*************************************************************************** - * Copyright (c) 2014 Luke Parry * - * * - * This file is part of the FreeCAD CAx development system. * - * * - * This library is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Library General Public * - * License as published by the Free Software Foundation; either * - * version 2 of the License, or (at your option) any later version. * - * * - * This library is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU Library General Public License for more details. * - * * - * You should have received a copy of the GNU Library General Public * - * License along with this library; see the file COPYING.LIB. If not, * - * write to the Free Software Foundation, Inc., 59 Temple Place, * - * Suite 330, Boston, MA 02111-1307, USA * - * * - ***************************************************************************/ - -#include "PreCompiled.h" - -#ifndef _PreComp_ -# ifdef FC_OS_WIN32 -# include -# endif -#endif - -/// Here the FreeCAD includes sorted by Base,App,Gui...... -#include -#include -//#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include "ViewProviderViewPart.h" - -using namespace TechDrawGui; - -PROPERTY_SOURCE(TechDrawGui::ViewProviderViewPart, TechDrawGui::ViewProviderDrawingView) - -//************************************************************************** -// Construction/Destruction - -ViewProviderViewPart::ViewProviderViewPart() -{ - sPixmap = "TechDraw_Tree_View"; - - static const char *group = "Lines"; - static const char *dgroup = "Decoration"; - - //default line weights - Base::Reference hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")-> - GetGroup("Preferences")->GetGroup("Mod/TechDraw/Decorations"); - std::string lgName = hGrp->GetASCII("LineGroup","FC 0.70mm"); - auto lg = TechDraw::LineGroup::lineGroupFactory(lgName); - double weight = lg->getWeight("Thick"); - ADD_PROPERTY_TYPE(LineWidth,(weight),group,App::Prop_None,"The thickness of visible lines"); - weight = lg->getWeight("Thin"); - ADD_PROPERTY_TYPE(HiddenWidth,(weight),group,App::Prop_None,"The thickness of hidden lines, if enabled"); - weight = lg->getWeight("Graphic"); - ADD_PROPERTY_TYPE(IsoWidth,(weight),group,App::Prop_None,"The thickness of isoparameter/center/section lines, if enabled"); - weight = lg->getWeight("Extra"); - ADD_PROPERTY_TYPE(ExtraWidth,(weight),group,App::Prop_None,"The thickness of LineGroup Extra lines, if enabled"); - - //decorations - ADD_PROPERTY_TYPE(HorizCenterLine ,(false),dgroup,App::Prop_None,"Show a horizontal centerline through view"); - ADD_PROPERTY_TYPE(VertCenterLine ,(false),dgroup,App::Prop_None,"Show a vertical centerline through view"); - ADD_PROPERTY_TYPE(ArcCenterMarks ,(true),dgroup,App::Prop_None,"Center marks on/off"); - ADD_PROPERTY_TYPE(CenterScale,(2.0),dgroup,App::Prop_None,"Center mark size adjustment, if enabled"); - - //properties that affect Section Line - ADD_PROPERTY_TYPE(ShowSectionLine ,(true) ,dgroup,App::Prop_None,"Show/hide section line if applicable"); -} - -ViewProviderViewPart::~ViewProviderViewPart() -{ - -} - -void ViewProviderViewPart::updateData(const App::Property* prop) -{ - - ViewProviderDrawingView::updateData(prop); -} - -void ViewProviderViewPart::onChanged(const App::Property* prop) -{ - if (prop == &(LineWidth) || - prop == &(HiddenWidth) || - prop == &(IsoWidth) || - prop == &(ExtraWidth) || - prop == &(ArcCenterMarks) || - prop == &(CenterScale) || - prop == &(ShowSectionLine) || - prop == &(HorizCenterLine) || - prop == &(VertCenterLine) ) { - // redraw QGIVP - QGIView* qgiv = getQView(); - if (qgiv) { - qgiv->updateView(true); - } - } - - ViewProviderDrawingView::onChanged(prop); -} - - -void ViewProviderViewPart::attach(App::DocumentObject *pcFeat) -{ - TechDraw::DrawViewMulti* dvm = dynamic_cast(pcFeat); - if (dvm != nullptr) { - sPixmap = "TechDraw_Tree_Multi"; - } - - ViewProviderDrawingView::attach(pcFeat); -} - -void ViewProviderViewPart::setDisplayMode(const char* ModeName) -{ - ViewProviderDocumentObject::setDisplayMode(ModeName); -} - -std::vector ViewProviderViewPart::getDisplayModes(void) const -{ - // get the modes of the father - std::vector StrList = ViewProviderDocumentObject::getDisplayModes(); - - return StrList; -} - - -std::vector ViewProviderViewPart::claimChildren(void) const -{ - // Collect any child Document Objects and put them in the right place in the Feature tree - // valid children of a ViewPart are: - // - Dimensions - // - Hatches - // - GeomHatches - std::vector temp; - const std::vector &views = getViewPart()->getInList(); - try { - for(std::vector::const_iterator it = views.begin(); it != views.end(); ++it) { - if((*it)->getTypeId().isDerivedFrom(TechDraw::DrawViewDimension::getClassTypeId())) { - //TODO: make a list, then prune it. should be faster? - bool skip = false; - std::string dimName = (*it)->getNameInDocument(); - for (auto& t: temp) { //only add dim once even if it references 2 geometries - std::string tName = t->getNameInDocument(); - if (dimName == tName) { - skip = true; - break; - } - } - if (!skip) { - temp.push_back(*it); - } - } else if ((*it)->getTypeId().isDerivedFrom(TechDraw::DrawHatch::getClassTypeId())) { - temp.push_back((*it)); - } else if ((*it)->getTypeId().isDerivedFrom(TechDraw::DrawGeomHatch::getClassTypeId())) { - temp.push_back((*it)); - } - } - return temp; - } catch (...) { - std::vector tmp; - return tmp; - } -} - -TechDraw::DrawViewPart* ViewProviderViewPart::getViewObject() const -{ - return dynamic_cast(pcObject); -} - -TechDraw::DrawViewPart* ViewProviderViewPart::getViewPart() const -{ - return getViewObject(); -} +/*************************************************************************** + * Copyright (c) 2014 Luke Parry * + * * + * This file is part of the FreeCAD CAx development system. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Library General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Library General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public * + * License along with this library; see the file COPYING.LIB. If not, * + * write to the Free Software Foundation, Inc., 59 Temple Place, * + * Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************/ + +#include "PreCompiled.h" + +#ifndef _PreComp_ +# ifdef FC_OS_WIN32 +# include +# endif +#endif + +/// Here the FreeCAD includes sorted by Base,App,Gui...... +#include +#include +//#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include "ViewProviderViewPart.h" + +using namespace TechDrawGui; + +PROPERTY_SOURCE(TechDrawGui::ViewProviderViewPart, TechDrawGui::ViewProviderDrawingView) + +//************************************************************************** +// Construction/Destruction + +ViewProviderViewPart::ViewProviderViewPart() +{ + sPixmap = "TechDraw_Tree_View"; + + static const char *group = "Lines"; + static const char *dgroup = "Decoration"; + + //default line weights + Base::Reference hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")-> + GetGroup("Preferences")->GetGroup("Mod/TechDraw/Decorations"); + std::string lgName = hGrp->GetASCII("LineGroup","FC 0.70mm"); + auto lg = TechDraw::LineGroup::lineGroupFactory(lgName); + + double weight = lg->getWeight("Thick"); + ADD_PROPERTY_TYPE(LineWidth,(weight),group,App::Prop_None,"The thickness of visible lines (line groups xx.2"); + + weight = lg->getWeight("Thin"); + ADD_PROPERTY_TYPE(HiddenWidth,(weight),group,App::Prop_None,"The thickness of hidden lines, if enabled (line groups xx.1)"); + + weight = lg->getWeight("Graphic"); + ADD_PROPERTY_TYPE(IsoWidth,(weight),group,App::Prop_None,"The thickness of isoparameter lines, if enabled"); + + weight = lg->getWeight("Extra"); + ADD_PROPERTY_TYPE(ExtraWidth,(weight),group,App::Prop_None,"The thickness of LineGroup Extra lines, if enabled"); + + //decorations + ADD_PROPERTY_TYPE(HorizCenterLine ,(false),dgroup,App::Prop_None,"Show a horizontal centerline through view"); + ADD_PROPERTY_TYPE(VertCenterLine ,(false),dgroup,App::Prop_None,"Show a vertical centerline through view"); + ADD_PROPERTY_TYPE(ArcCenterMarks ,(true),dgroup,App::Prop_None,"Center marks on/off"); + ADD_PROPERTY_TYPE(CenterScale,(2.0),dgroup,App::Prop_None,"Center mark size adjustment, if enabled"); + + //properties that affect Section Line + ADD_PROPERTY_TYPE(ShowSectionLine ,(true) ,dgroup,App::Prop_None,"Show/hide section line if applicable"); +} + +ViewProviderViewPart::~ViewProviderViewPart() +{ + +} + +void ViewProviderViewPart::updateData(const App::Property* prop) +{ + + ViewProviderDrawingView::updateData(prop); +} + +void ViewProviderViewPart::onChanged(const App::Property* prop) +{ + if (prop == &(LineWidth) || + prop == &(HiddenWidth) || + prop == &(IsoWidth) || + prop == &(ExtraWidth) || + prop == &(ArcCenterMarks) || + prop == &(CenterScale) || + prop == &(ShowSectionLine) || + prop == &(HorizCenterLine) || + prop == &(VertCenterLine) ) { + // redraw QGIVP + QGIView* qgiv = getQView(); + if (qgiv) { + qgiv->updateView(true); + } + } + + ViewProviderDrawingView::onChanged(prop); +} + + +void ViewProviderViewPart::attach(App::DocumentObject *pcFeat) +{ + TechDraw::DrawViewMulti* dvm = dynamic_cast(pcFeat); + if (dvm != nullptr) { + sPixmap = "TechDraw_Tree_Multi"; + } + + ViewProviderDrawingView::attach(pcFeat); +} + +void ViewProviderViewPart::setDisplayMode(const char* ModeName) +{ + ViewProviderDocumentObject::setDisplayMode(ModeName); +} + +std::vector ViewProviderViewPart::getDisplayModes(void) const +{ + // get the modes of the father + std::vector StrList = ViewProviderDocumentObject::getDisplayModes(); + + return StrList; +} + + +std::vector ViewProviderViewPart::claimChildren(void) const +{ + // Collect any child Document Objects and put them in the right place in the Feature tree + // valid children of a ViewPart are: + // - Dimensions + // - Hatches + // - GeomHatches + std::vector temp; + const std::vector &views = getViewPart()->getInList(); + try { + for(std::vector::const_iterator it = views.begin(); it != views.end(); ++it) { + if((*it)->getTypeId().isDerivedFrom(TechDraw::DrawViewDimension::getClassTypeId())) { + //TODO: make a list, then prune it. should be faster? + bool skip = false; + std::string dimName = (*it)->getNameInDocument(); + for (auto& t: temp) { //only add dim once even if it references 2 geometries + std::string tName = t->getNameInDocument(); + if (dimName == tName) { + skip = true; + break; + } + } + if (!skip) { + temp.push_back(*it); + } + } else if ((*it)->getTypeId().isDerivedFrom(TechDraw::DrawHatch::getClassTypeId())) { + temp.push_back((*it)); + } else if ((*it)->getTypeId().isDerivedFrom(TechDraw::DrawGeomHatch::getClassTypeId())) { + temp.push_back((*it)); + } + } + return temp; + } catch (...) { + std::vector tmp; + return tmp; + } +} + +TechDraw::DrawViewPart* ViewProviderViewPart::getViewObject() const +{ + return dynamic_cast(pcObject); +} + +TechDraw::DrawViewPart* ViewProviderViewPart::getViewPart() const +{ + return getViewObject(); +} diff --git a/src/Mod/TechDraw/Templates/A0_Landscape_blank.svg b/src/Mod/TechDraw/Templates/A0_Landscape_blank.svg new file mode 100644 index 000000000000..8f7709c24076 --- /dev/null +++ b/src/Mod/TechDraw/Templates/A0_Landscape_blank.svg @@ -0,0 +1,9 @@ + + + + diff --git a/src/Mod/TechDraw/Templates/A1_Landscape_blank.svg b/src/Mod/TechDraw/Templates/A1_Landscape_blank.svg new file mode 100644 index 000000000000..6b59d813f37a --- /dev/null +++ b/src/Mod/TechDraw/Templates/A1_Landscape_blank.svg @@ -0,0 +1,9 @@ + + + + diff --git a/src/Mod/TechDraw/Templates/A2_Landscape_blank.svg b/src/Mod/TechDraw/Templates/A2_Landscape_blank.svg new file mode 100644 index 000000000000..0a66e88b1d77 --- /dev/null +++ b/src/Mod/TechDraw/Templates/A2_Landscape_blank.svg @@ -0,0 +1,9 @@ + + + + diff --git a/src/Mod/TechDraw/Templates/A3_Landscape_blank.svg b/src/Mod/TechDraw/Templates/A3_Landscape_blank.svg new file mode 100644 index 000000000000..91387fd185fa --- /dev/null +++ b/src/Mod/TechDraw/Templates/A3_Landscape_blank.svg @@ -0,0 +1,9 @@ + + + + diff --git a/src/Mod/TechDraw/Templates/A4_Landscape_blank.svg b/src/Mod/TechDraw/Templates/A4_Landscape_blank.svg new file mode 100644 index 000000000000..1accfd8e73d4 --- /dev/null +++ b/src/Mod/TechDraw/Templates/A4_Landscape_blank.svg @@ -0,0 +1,9 @@ + + + + diff --git a/src/Mod/TechDraw/Templates/A4_Portrait_blank.svg b/src/Mod/TechDraw/Templates/A4_Portrait_blank.svg new file mode 100644 index 000000000000..f7814f1cefae --- /dev/null +++ b/src/Mod/TechDraw/Templates/A4_Portrait_blank.svg @@ -0,0 +1,9 @@ + + + +