[QGIS Commit] r11065 - in branches/symbology-ng-branch:
images/themes/default src/core/symbology-ng
src/gui/symbology-ng src/ui/symbollayer
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Tue Jul 14 07:19:36 EDT 2009
Author: wonder
Date: 2009-07-14 07:19:36 -0400 (Tue, 14 Jul 2009)
New Revision: 11065
Added:
branches/symbology-ng-branch/images/themes/default/cap_flat.png
branches/symbology-ng-branch/images/themes/default/cap_round.png
branches/symbology-ng-branch/images/themes/default/cap_square.png
branches/symbology-ng-branch/images/themes/default/cap_style.svg
branches/symbology-ng-branch/images/themes/default/join_bevel.png
branches/symbology-ng-branch/images/themes/default/join_miter.png
branches/symbology-ng-branch/images/themes/default/join_round.png
branches/symbology-ng-branch/images/themes/default/join_style.svg
Modified:
branches/symbology-ng-branch/src/core/symbology-ng/qgslinesymbollayerv2.cpp
branches/symbology-ng-branch/src/core/symbology-ng/qgslinesymbollayerv2.h
branches/symbology-ng-branch/src/core/symbology-ng/qgssymbollayerv2utils.cpp
branches/symbology-ng-branch/src/core/symbology-ng/qgssymbollayerv2utils.h
branches/symbology-ng-branch/src/gui/symbology-ng/qgspenstylecombobox.cpp
branches/symbology-ng-branch/src/gui/symbology-ng/qgspenstylecombobox.h
branches/symbology-ng-branch/src/gui/symbology-ng/qgssymbollayerv2widget.cpp
branches/symbology-ng-branch/src/ui/symbollayer/widget_simpleline.ui
Log:
Added pen cap style and pen join style combo boxes.
Added possibility to set cap and join style for simple line symbol layers.
Added: branches/symbology-ng-branch/images/themes/default/cap_flat.png
===================================================================
(Binary files differ)
Property changes on: branches/symbology-ng-branch/images/themes/default/cap_flat.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: branches/symbology-ng-branch/images/themes/default/cap_round.png
===================================================================
(Binary files differ)
Property changes on: branches/symbology-ng-branch/images/themes/default/cap_round.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: branches/symbology-ng-branch/images/themes/default/cap_square.png
===================================================================
(Binary files differ)
Property changes on: branches/symbology-ng-branch/images/themes/default/cap_square.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: branches/symbology-ng-branch/images/themes/default/cap_style.svg
===================================================================
--- branches/symbology-ng-branch/images/themes/default/cap_style.svg (rev 0)
+++ branches/symbology-ng-branch/images/themes/default/cap_style.svg 2009-07-14 11:19:36 UTC (rev 11065)
@@ -0,0 +1,112 @@
+<?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"
+ width="16"
+ height="16"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.46"
+ version="1.0"
+ inkscape:export-filename="/home/wonder/cap_square.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90"
+ sodipodi:docname="cap_style.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs4">
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 526.18109 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="744.09448 : 526.18109 : 1"
+ inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+ id="perspective10" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="35.375"
+ inkscape:cx="5.3152953"
+ inkscape:cy="6.869258"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer4"
+ showgrid="false"
+ inkscape:window-width="1270"
+ inkscape:window-height="769"
+ inkscape:window-x="0"
+ inkscape:window-y="0" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="square cap"
+ inkscape:groupmode="layer"
+ id="layer1"
+ style="display:inline">
+ <rect
+ style="opacity:1;fill:#6389b8;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect3165"
+ width="16.282686"
+ height="8.4522972"
+ x="-2.0353358"
+ y="3.7738514" />
+ </g>
+ <g
+ inkscape:groupmode="layer"
+ id="layer2"
+ inkscape:label="flat cap"
+ style="display:none">
+ <rect
+ style="opacity:1;fill:#6389b8;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect3167"
+ width="16.282686"
+ height="8.4522972"
+ x="-5.2854118"
+ y="3.7738514" />
+ </g>
+ <g
+ inkscape:groupmode="layer"
+ id="layer4"
+ inkscape:label="round cap"
+ style="display:none">
+ <path
+ style="opacity:1;fill:#6389b8;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ d="M -6.4375,3.78125 L -6.4375,12.21875 L 9.84375,12.21875 L 9.7306758,12.244037 C 10.134161,12.218685 10.418569,12.21875 10.483547,12.21875 C 12.808579,12.21875 14.25,10.325032 14.25,8 C 14.25,5.6749682 12.356282,3.78125 10.03125,3.78125 C 9.966272,3.78125 8.5793902,3.8661211 9.84375,3.8125 L 9.7872129,3.8095186 L -6.4375,3.78125 z"
+ id="path3176"
+ sodipodi:nodetypes="ccccsssccc" />
+ </g>
+ <g
+ inkscape:groupmode="layer"
+ id="layer3"
+ inkscape:label="line">
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#d3c02d;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:2, 1;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 0.14215003,8 L 10.488441,8"
+ id="path2393"
+ inkscape:export-filename="/home/wonder/cap_square.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90" />
+ </g>
+</svg>
Added: branches/symbology-ng-branch/images/themes/default/join_bevel.png
===================================================================
(Binary files differ)
Property changes on: branches/symbology-ng-branch/images/themes/default/join_bevel.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: branches/symbology-ng-branch/images/themes/default/join_miter.png
===================================================================
(Binary files differ)
Property changes on: branches/symbology-ng-branch/images/themes/default/join_miter.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: branches/symbology-ng-branch/images/themes/default/join_round.png
===================================================================
(Binary files differ)
Property changes on: branches/symbology-ng-branch/images/themes/default/join_round.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: branches/symbology-ng-branch/images/themes/default/join_style.svg
===================================================================
--- branches/symbology-ng-branch/images/themes/default/join_style.svg (rev 0)
+++ branches/symbology-ng-branch/images/themes/default/join_style.svg 2009-07-14 11:19:36 UTC (rev 11065)
@@ -0,0 +1,100 @@
+<?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"
+ width="16"
+ height="16"
+ id="svg3203"
+ sodipodi:version="0.32"
+ inkscape:version="0.46"
+ version="1.0"
+ sodipodi:docname="join_style.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs3205">
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 526.18109 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="744.09448 : 526.18109 : 1"
+ inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+ id="perspective3211" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="35.375"
+ inkscape:cx="8"
+ inkscape:cy="8"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer7"
+ showgrid="false"
+ inkscape:window-width="1270"
+ inkscape:window-height="769"
+ inkscape:window-x="0"
+ inkscape:window-y="0" />
+ <metadata
+ id="metadata3208">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:groupmode="layer"
+ id="layer5"
+ inkscape:label="miter join"
+ style="display:none">
+ <path
+ style="fill:#6389b8;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 8.21875,2.3125 L 6.4375,4.09375 L -2.75,13.28125 L 0.78125,16.8125 L 8.21875,9.40625 L 15.71875,16.90625 L 19.25,13.34375 L 10,4.09375 L 8.21875,2.3125 z"
+ id="path3724" />
+ </g>
+ <g
+ inkscape:groupmode="layer"
+ id="layer6"
+ inkscape:label="bevel join"
+ style="display:none">
+ <path
+ style="fill:#6389b8;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 6.46875,4.125 L -2.71875,13.3125 L 0.8125,16.875 L 8.25,9.4375 L 15.75,16.9375 L 19.28125,13.40625 L 10,4.125 L 6.46875,4.125 z"
+ id="path3735" />
+ </g>
+ <g
+ inkscape:groupmode="layer"
+ id="layer7"
+ inkscape:label="round join"
+ style="display:inline">
+ <path
+ style="fill:#6389b8;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;display:inline"
+ d="M 7.96875,3.40625 C 7.401375,3.4676239 6.8720695,3.7212494 6.46875,4.125 L -2.71875,13.3125 L 0.8125,16.875 L 8.25,9.4375 L 15.75,16.9375 L 19.28125,13.40625 L 10,4.125 C 9.4661818,3.5909923 8.7196282,3.3268272 7.96875,3.40625 L 7.96875,3.40625 z"
+ id="path3743" />
+ </g>
+ <g
+ inkscape:label="line"
+ inkscape:groupmode="layer"
+ id="layer1"
+ style="display:inline">
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#d3c02d;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:2, 1;stroke-dashoffset:0;stroke-opacity:1"
+ d="M -0.96113074,15.095406 L 8.2402827,5.8939929 L 17.512367,15.166078"
+ id="path3213" />
+ </g>
+</svg>
Modified: branches/symbology-ng-branch/src/core/symbology-ng/qgslinesymbollayerv2.cpp
===================================================================
--- branches/symbology-ng-branch/src/core/symbology-ng/qgslinesymbollayerv2.cpp 2009-07-14 09:49:44 UTC (rev 11064)
+++ branches/symbology-ng-branch/src/core/symbology-ng/qgslinesymbollayerv2.cpp 2009-07-14 11:19:36 UTC (rev 11065)
@@ -9,7 +9,7 @@
#include <cmath>
QgsSimpleLineSymbolLayerV2::QgsSimpleLineSymbolLayerV2(QColor color, double width, Qt::PenStyle penStyle)
- : mPenStyle(penStyle), mOffset(0)
+ : mPenStyle(penStyle), mPenJoinStyle(DEFAULT_SIMPLELINE_JOINSTYLE), mPenCapStyle(DEFAULT_SIMPLELINE_CAPSTYLE), mOffset(0)
{
mColor = color;
mWidth = width;
@@ -21,17 +21,24 @@
QColor color = DEFAULT_SIMPLELINE_COLOR;
double width = DEFAULT_SIMPLELINE_WIDTH;
Qt::PenStyle penStyle = DEFAULT_SIMPLELINE_PENSTYLE;
-
+ Qt::PenJoinStyle joinStyle = DEFAULT_SIMPLELINE_JOINSTYLE;
+ Qt::PenCapStyle capStyle = DEFAULT_SIMPLELINE_CAPSTYLE;
+
if (props.contains("color"))
color = QgsSymbolLayerV2Utils::decodeColor(props["color"]);
if (props.contains("width"))
width = props["width"].toDouble();
if (props.contains("penstyle"))
penStyle = QgsSymbolLayerV2Utils::decodePenStyle(props["penstyle"]);
+
QgsSimpleLineSymbolLayerV2* l = new QgsSimpleLineSymbolLayerV2(color, width, penStyle);
if (props.contains("offset"))
l->setOffset( props["offset"].toDouble() );
+ if (props.contains("joinstyle"))
+ l->setPenJoinStyle( QgsSymbolLayerV2Utils::decodePenJoinStyle(props["joinstyle"]) );
+ if (props.contains("capstyle"))
+ l->setPenCapStyle( QgsSymbolLayerV2Utils::decodePenCapStyle(props["capstyle"]) );
return l;
}
@@ -47,6 +54,8 @@
mPen.setColor(mColor);
mPen.setWidth(mWidth);
mPen.setStyle(mPenStyle);
+ mPen.setJoinStyle(mPenJoinStyle);
+ mPen.setCapStyle(mPenCapStyle);
}
void QgsSimpleLineSymbolLayerV2::stopRender(QgsRenderContext& context)
@@ -72,6 +81,8 @@
map["color"] = QgsSymbolLayerV2Utils::encodeColor(mColor);
map["width"] = QString::number(mWidth);
map["penstyle"] = QgsSymbolLayerV2Utils::encodePenStyle(mPenStyle);
+ map["joinstyle"] = QgsSymbolLayerV2Utils::encodePenJoinStyle(mPenJoinStyle);
+ map["capstyle"] = QgsSymbolLayerV2Utils::encodePenCapStyle(mPenCapStyle);
map["offset"] = QString::number(mOffset);
return map;
}
@@ -80,6 +91,8 @@
{
QgsSimpleLineSymbolLayerV2* l = new QgsSimpleLineSymbolLayerV2(mColor, mWidth, mPenStyle);
l->setOffset(mOffset);
+ l->setPenJoinStyle(mPenJoinStyle);
+ l->setPenCapStyle(mPenCapStyle);
return l;
}
Modified: branches/symbology-ng-branch/src/core/symbology-ng/qgslinesymbollayerv2.h
===================================================================
--- branches/symbology-ng-branch/src/core/symbology-ng/qgslinesymbollayerv2.h 2009-07-14 09:49:44 UTC (rev 11064)
+++ branches/symbology-ng-branch/src/core/symbology-ng/qgslinesymbollayerv2.h 2009-07-14 11:19:36 UTC (rev 11065)
@@ -9,6 +9,8 @@
#define DEFAULT_SIMPLELINE_COLOR QColor(0,0,0)
#define DEFAULT_SIMPLELINE_WIDTH 1
#define DEFAULT_SIMPLELINE_PENSTYLE Qt::SolidLine
+#define DEFAULT_SIMPLELINE_JOINSTYLE Qt::BevelJoin
+#define DEFAULT_SIMPLELINE_CAPSTYLE Qt::SquareCap
class QgsSimpleLineSymbolLayerV2 : public QgsLineSymbolLayerV2
@@ -17,7 +19,7 @@
QgsSimpleLineSymbolLayerV2(QColor color = DEFAULT_SIMPLELINE_COLOR,
double width = DEFAULT_SIMPLELINE_WIDTH,
Qt::PenStyle penStyle = DEFAULT_SIMPLELINE_PENSTYLE);
-
+
// static stuff
static QgsSymbolLayerV2* create(const QgsStringMap& properties = QgsStringMap());
@@ -41,11 +43,19 @@
Qt::PenStyle penStyle() const { return mPenStyle; }
void setPenStyle(Qt::PenStyle style) { mPenStyle = style; }
+ Qt::PenJoinStyle penJoinStyle() const { return mPenJoinStyle; }
+ void setPenJoinStyle(Qt::PenJoinStyle style) { mPenJoinStyle = style; }
+
+ Qt::PenCapStyle penCapStyle() const { return mPenCapStyle; }
+ void setPenCapStyle(Qt::PenCapStyle style) { mPenCapStyle = style; }
+
double offset() const { return mOffset; }
void setOffset(double offset) { mOffset = offset; }
protected:
Qt::PenStyle mPenStyle;
+ Qt::PenJoinStyle mPenJoinStyle;
+ Qt::PenCapStyle mPenCapStyle;
QPen mPen;
double mOffset;
};
Modified: branches/symbology-ng-branch/src/core/symbology-ng/qgssymbollayerv2utils.cpp
===================================================================
--- branches/symbology-ng-branch/src/core/symbology-ng/qgssymbollayerv2utils.cpp 2009-07-14 09:49:44 UTC (rev 11064)
+++ branches/symbology-ng-branch/src/core/symbology-ng/qgssymbollayerv2utils.cpp 2009-07-14 11:19:36 UTC (rev 11065)
@@ -45,6 +45,45 @@
return Qt::SolidLine;
}
+QString QgsSymbolLayerV2Utils::encodePenJoinStyle(Qt::PenJoinStyle style)
+{
+ switch (style)
+ {
+ case Qt::BevelJoin: return "bevel";
+ case Qt::MiterJoin: return "miter";
+ case Qt::RoundJoin: return "round";
+ default: return "???";
+ }
+}
+
+Qt::PenJoinStyle QgsSymbolLayerV2Utils::decodePenJoinStyle(QString str)
+{
+ if (str == "bevel") return Qt::BevelJoin;
+ if (str == "miter") return Qt::MiterJoin;
+ if (str == "round") return Qt::RoundJoin;
+ return Qt::BevelJoin;
+}
+
+QString QgsSymbolLayerV2Utils::encodePenCapStyle(Qt::PenCapStyle style)
+{
+ switch (style)
+ {
+ case Qt::SquareCap: return "square";
+ case Qt::FlatCap: return "flat";
+ case Qt::RoundCap: return "round";
+ default: return "???";
+ }
+}
+
+Qt::PenCapStyle QgsSymbolLayerV2Utils::decodePenCapStyle(QString str)
+{
+ if (str == "square") return Qt::SquareCap;
+ if (str == "flat") return Qt::FlatCap;
+ if (str == "round") return Qt::RoundCap;
+ return Qt::SquareCap;
+}
+
+
QString QgsSymbolLayerV2Utils::encodeBrushStyle(Qt::BrushStyle style)
{
switch (style)
Modified: branches/symbology-ng-branch/src/core/symbology-ng/qgssymbollayerv2utils.h
===================================================================
--- branches/symbology-ng-branch/src/core/symbology-ng/qgssymbollayerv2utils.h 2009-07-14 09:49:44 UTC (rev 11064)
+++ branches/symbology-ng-branch/src/core/symbology-ng/qgssymbollayerv2utils.h 2009-07-14 11:19:36 UTC (rev 11065)
@@ -28,6 +28,12 @@
static QString encodePenStyle(Qt::PenStyle style);
static Qt::PenStyle decodePenStyle(QString str);
+ static QString encodePenJoinStyle(Qt::PenJoinStyle style);
+ static Qt::PenJoinStyle decodePenJoinStyle(QString str);
+
+ static QString encodePenCapStyle(Qt::PenCapStyle style);
+ static Qt::PenCapStyle decodePenCapStyle(QString str);
+
static QString encodeBrushStyle(Qt::BrushStyle style);
static Qt::BrushStyle decodeBrushStyle(QString str);
Modified: branches/symbology-ng-branch/src/gui/symbology-ng/qgspenstylecombobox.cpp
===================================================================
--- branches/symbology-ng-branch/src/gui/symbology-ng/qgspenstylecombobox.cpp 2009-07-14 09:49:44 UTC (rev 11064)
+++ branches/symbology-ng-branch/src/gui/symbology-ng/qgspenstylecombobox.cpp 2009-07-14 11:19:36 UTC (rev 11065)
@@ -1,6 +1,8 @@
#include "qgspenstylecombobox.h"
+#include "qgsapplication.h"
+
#include <QList>
#include <QPair>
@@ -54,3 +56,51 @@
return QIcon(pix);
}
+
+
+/////////
+// join
+
+QgsPenJoinStyleComboBox::QgsPenJoinStyleComboBox(QWidget* parent)
+ : QComboBox(parent)
+{
+ QString path = QgsApplication::defaultThemePath();
+ addItem(QIcon(path + "/join_bevel.png"), tr("Bevel"), QVariant(Qt::BevelJoin));
+ addItem(QIcon(path + "/join_miter.png"), tr("Miter"), QVariant(Qt::MiterJoin));
+ addItem(QIcon(path + "/join_round.png"), tr("Round"), QVariant(Qt::RoundJoin));
+}
+
+Qt::PenJoinStyle QgsPenJoinStyleComboBox::penJoinStyle() const
+{
+ return (Qt::PenJoinStyle) itemData(currentIndex()).toInt();
+}
+
+void QgsPenJoinStyleComboBox::setPenJoinStyle(Qt::PenJoinStyle style)
+{
+ int idx = findData(QVariant(style));
+ setCurrentIndex( idx == -1 ? 0 : idx );
+}
+
+
+/////////
+// cap
+
+QgsPenCapStyleComboBox::QgsPenCapStyleComboBox(QWidget* parent)
+ : QComboBox(parent)
+{
+ QString path = QgsApplication::defaultThemePath();
+ addItem(QIcon(path + "/cap_square.png"), tr("Square"), QVariant(Qt::SquareCap));
+ addItem(QIcon(path + "/cap_flat.png"), tr("Flat"), QVariant(Qt::FlatCap));
+ addItem(QIcon(path + "/cap_round.png"), tr("Round"), QVariant(Qt::RoundCap));
+}
+
+Qt::PenCapStyle QgsPenCapStyleComboBox::penCapStyle() const
+{
+ return (Qt::PenCapStyle) itemData(currentIndex()).toInt();
+}
+
+void QgsPenCapStyleComboBox::setPenCapStyle(Qt::PenCapStyle style)
+{
+ int idx = findData(QVariant(style));
+ setCurrentIndex( idx == -1 ? 0 : idx );
+}
Modified: branches/symbology-ng-branch/src/gui/symbology-ng/qgspenstylecombobox.h
===================================================================
--- branches/symbology-ng-branch/src/gui/symbology-ng/qgspenstylecombobox.h 2009-07-14 09:49:44 UTC (rev 11064)
+++ branches/symbology-ng-branch/src/gui/symbology-ng/qgspenstylecombobox.h 2009-07-14 11:19:36 UTC (rev 11065)
@@ -18,4 +18,24 @@
};
+class QgsPenJoinStyleComboBox : public QComboBox
+{
+public:
+ QgsPenJoinStyleComboBox(QWidget* parent = NULL);
+
+ Qt::PenJoinStyle penJoinStyle() const;
+
+ void setPenJoinStyle(Qt::PenJoinStyle style);
+};
+
+class QgsPenCapStyleComboBox : public QComboBox
+{
+public:
+ QgsPenCapStyleComboBox(QWidget* parent = NULL);
+
+ Qt::PenCapStyle penCapStyle() const;
+
+ void setPenCapStyle(Qt::PenCapStyle style);
+};
+
#endif
Modified: branches/symbology-ng-branch/src/gui/symbology-ng/qgssymbollayerv2widget.cpp
===================================================================
--- branches/symbology-ng-branch/src/gui/symbology-ng/qgssymbollayerv2widget.cpp 2009-07-14 09:49:44 UTC (rev 11064)
+++ branches/symbology-ng-branch/src/gui/symbology-ng/qgssymbollayerv2widget.cpp 2009-07-14 11:19:36 UTC (rev 11065)
@@ -36,6 +36,9 @@
connect(btnChangeColor, SIGNAL(clicked()), this, SLOT(colorChanged()));
connect(cboPenStyle, SIGNAL(currentIndexChanged(int)), this, SLOT(penStyleChanged()));
connect(spinOffset, SIGNAL(valueChanged(double)), this, SLOT(offsetChanged()));
+ connect(cboCapStyle, SIGNAL(currentIndexChanged(int)), this, SLOT(penStyleChanged()));
+ connect(cboJoinStyle, SIGNAL(currentIndexChanged(int)), this, SLOT(penStyleChanged()));
+
}
void QgsSimpleLineSymbolLayerV2Widget::setSymbolLayer(QgsSymbolLayerV2* layer)
@@ -51,6 +54,8 @@
updateColorButton(btnChangeColor, mLayer->color());
cboPenStyle->setPenStyle(mLayer->penStyle());
spinOffset->setValue(mLayer->offset());
+ cboJoinStyle->setPenJoinStyle(mLayer->penJoinStyle());
+ cboCapStyle->setPenCapStyle(mLayer->penCapStyle());
}
QgsSymbolLayerV2* QgsSimpleLineSymbolLayerV2Widget::symbolLayer()
@@ -77,6 +82,8 @@
void QgsSimpleLineSymbolLayerV2Widget::penStyleChanged()
{
mLayer->setPenStyle(cboPenStyle->penStyle());
+ mLayer->setPenJoinStyle(cboJoinStyle->penJoinStyle());
+ mLayer->setPenCapStyle(cboCapStyle->penCapStyle());
emit changed();
}
Modified: branches/symbology-ng-branch/src/ui/symbollayer/widget_simpleline.ui
===================================================================
--- branches/symbology-ng-branch/src/ui/symbollayer/widget_simpleline.ui 2009-07-14 09:49:44 UTC (rev 11064)
+++ branches/symbology-ng-branch/src/ui/symbollayer/widget_simpleline.ui 2009-07-14 11:19:36 UTC (rev 11065)
@@ -13,7 +13,7 @@
<property name="windowTitle">
<string>Form</string>
</property>
- <layout class="QVBoxLayout">
+ <layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout">
<item row="0" column="0">
@@ -123,6 +123,46 @@
</property>
</spacer>
</item>
+ <item>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_5">
+ <property name="text">
+ <string>Join style:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QgsPenJoinStyleComboBox" name="cboJoinStyle"/>
+ </item>
+ <item row="0" column="2" rowspan="2">
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Preferred</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>38</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_6">
+ <property name="text">
+ <string>Cap style:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QgsPenCapStyleComboBox" name="cboCapStyle"/>
+ </item>
+ </layout>
+ </item>
</layout>
</widget>
<customwidgets>
@@ -131,6 +171,16 @@
<extends>QComboBox</extends>
<header>qgspenstylecombobox.h</header>
</customwidget>
+ <customwidget>
+ <class>QgsPenJoinStyleComboBox</class>
+ <extends>QComboBox</extends>
+ <header>qgspenstylecombobox.h</header>
+ </customwidget>
+ <customwidget>
+ <class>QgsPenCapStyleComboBox</class>
+ <extends>QComboBox</extends>
+ <header>qgspenstylecombobox.h</header>
+ </customwidget>
</customwidgets>
<resources/>
<connections/>
More information about the QGIS-commit
mailing list