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)
This commit is contained in:
Sebastian Bachmann
2018-02-21 11:10:39 +01:00
parent 3fc7333309
commit 1505ee3115
13 changed files with 343 additions and 201 deletions

View File

@@ -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<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Labels");
double fontSize = hGrp->GetFloat("LabelSize", 5.0);
return Rez::guiX(fontSize);
}