Add Fork arrowhead option

This commit is contained in:
wandererfan
2019-05-25 10:29:43 -04:00
committed by wmayer
parent e480d8f5aa
commit da047abdd9
6 changed files with 175 additions and 1 deletions

View File

@@ -216,6 +216,15 @@
</iconset>
</property>
</item>
<item>
<property name="text">
<string>5 - Fork</string>
</property>
<property name="icon">
<iconset resource="Resources/TechDraw.qrc">
<normaloff>:/icons/arrowfork.svg</normaloff>:/icons/arrowfork.svg</iconset>
</property>
</item>
</widget>
</item>
<item row="7" column="0">

View File

@@ -86,6 +86,12 @@ void QGIArrow::draw() {
path = makeDot(m_size/2.0,m_size/2.0,isFlipped);
} else if (m_style == 4) {
path = makeOpenDot(m_size/2.0,m_size/2.0,isFlipped);
} else if (m_style == 5) {
if (m_dirMode) {
path = makeForkArrow(getDirection(), m_size/2.0,m_size/2.0); //big enough?
} else {
path = makeForkArrow(m_size/2.0,m_size/2.0,isFlipped); //big enough?
}
} else {
path = makeFilledTriangle(m_size,m_size/6.0,isFlipped); //sb a question mark or ???
}
@@ -217,6 +223,41 @@ QPainterPath QGIArrow::makeOpenDot(double length, double width, bool flipped)
return path;
}
QPainterPath QGIArrow::makeForkArrow(double length, double width, bool flipped)
{
//(0,0) is tip of arrow
if (flipped) {
length *= -1;
}
QPainterPath path;
path.moveTo(QPointF(Rez::guiX(length),Rez::guiX(-width)));
path.lineTo(QPointF(0.,0.));
path.lineTo(QPointF(Rez::guiX(length),Rez::guiX(width)));
m_fill = Qt::NoBrush;
return path;
}
QPainterPath QGIArrow::makeForkArrow(Base::Vector3d dir, double length, double width)
{
//(0,0) is tip of arrow
Base::Vector3d negDir = -dir;
Base::Vector3d normDir = dir;
negDir.Normalize();
normDir.Normalize();
Base::Vector3d perp(-normDir.y,normDir.x, 0.0);
Base::Vector3d barb1 = normDir * length + perp * width;
Base::Vector3d barb2 = normDir * length - perp * width;
QPainterPath path;
path.moveTo(QPointF(Rez::guiX(barb1.x),Rez::guiX(barb1.y)));
path.lineTo(QPointF(0.,0.));
path.lineTo(QPointF(Rez::guiX(barb2.x),Rez::guiX(barb2.y)));
m_fill = Qt::NoBrush;
return path;
}
int QGIArrow::getPrefArrowStyle()
{

View File

@@ -69,7 +69,9 @@ protected:
QPainterPath makeHashMark(Base::Vector3d dir, double length, double width);
QPainterPath makeDot(double length, double width, bool flipped);
QPainterPath makeOpenDot(double length, double width, bool flipped);
QPainterPath makeForkArrow(double length, double width, bool flipped);
QPainterPath makeForkArrow(Base::Vector3d dir, double length, double width);
private:
QBrush m_brush;
Qt::BrushStyle m_fill;

View File

@@ -39,6 +39,7 @@
<file>icons/arrowfilled.svg</file>
<file>icons/arrowopen.svg</file>
<file>icons/arrowtick.svg</file>
<file>icons/arrowfork.svg</file>
<file>icons/actions/techdraw-new-default.svg</file>
<file>icons/actions/techdraw-new-pick.svg</file>
<file>icons/actions/techdraw-view.svg</file>

View File

@@ -0,0 +1,103 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
width="48"
height="48"
id="svg2985"
sodipodi:docname="arrowfork.svg"
inkscape:version="0.92.4 (unknown)">
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1358"
inkscape:window-height="703"
id="namedview922"
showgrid="false"
inkscape:zoom="10.708333"
inkscape:cx="24"
inkscape:cy="24.612345"
inkscape:window-x="0"
inkscape:window-y="26"
inkscape:window-maximized="1"
inkscape:current-layer="svg2985" />
<defs
id="defs2987" />
<metadata
id="metadata2990">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="g945"
transform="translate(-1.864559)">
<g
transform="translate(3.4375,-0.13060184)"
id="g3796">
<rect
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.28200001;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate"
id="rect3763"
y="19.642857"
x="2.8571429"
ry="1.7378116"
rx="1.4997782"
height="8.7142859"
width="24.142857" />
<rect
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.28200001;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate"
id="rect3799"
y="19.642857"
x="2.8571429"
ry="1.7378116"
rx="1.4997782"
height="8.7142859"
width="24.142857" />
</g>
<rect
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.28200001;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate"
id="rect3773"
transform="matrix(-0.70710678,0.70710678,0.70710678,0.70710678,0,0)"
y="31.853426"
x="-24.627098"
ry="1.7378116"
rx="1.4997782"
height="8.7142859"
width="24.142857" />
<rect
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.28200001;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate"
id="rect3775"
transform="rotate(-135)"
y="-2.0876999"
x="-58.568226"
ry="1.7378116"
rx="1.4997782"
height="8.7142859"
width="24.142857" />
<path
inkscape:connector-curvature="0"
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:#000000;stroke:#000000;stroke-width:0.28200001;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate"
id="path3792"
d="m 30.550202,20.79387 2.874999,3.071429 -3.035714,3.303571" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

@@ -205,6 +205,15 @@
<normaloff>:/icons/arrowopendot.svg</normaloff>:/icons/arrowopendot.svg</iconset>
</property>
</item>
<item>
<property name="text">
<string>Fork</string>
</property>
<property name="icon">
<iconset resource="Resources/TechDraw.qrc">
<normaloff>:/icons/arrowfork.svg</normaloff>:/icons/arrowfork.svg</iconset>
</property>
</item>
</widget>
</item>
<item row="2" column="0">
@@ -266,6 +275,15 @@
<normaloff>:/icons/arrowopendot.svg</normaloff>:/icons/arrowopendot.svg</iconset>
</property>
</item>
<item>
<property name="text">
<string>Fork</string>
</property>
<property name="icon">
<iconset resource="Resources/TechDraw.qrc">
<normaloff>:/icons/arrowfork.svg</normaloff>:/icons/arrowfork.svg</iconset>
</property>
</item>
</widget>
</item>
<item row="3" column="0">