Skip to content

Commit 8f6ee1c

Browse files
committedOct 15, 2018
Dox
1 parent 8dd0f00 commit 8f6ee1c

File tree

3 files changed

+415
-71
lines changed

3 files changed

+415
-71
lines changed
 

‎python/core/auto_generated/symbology/qgsfillsymbollayer.sip.in

Lines changed: 213 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -680,44 +680,62 @@ Base class for polygon renderers generating texture images*
680680

681681
void setStrokeWidthUnit( QgsUnitTypes::RenderUnit unit );
682682
%Docstring
683-
Sets the units for the symbol's stroke width.
684-
685-
:param unit: symbol units
683+
Sets the ``units`` fo the symbol's stroke width.
686684

687685
.. seealso:: :py:func:`strokeWidthUnit`
686+
687+
.. seealso:: :py:func:`setStrokeWidthMapUnitScale`
688688
%End
689689

690690
QgsUnitTypes::RenderUnit strokeWidthUnit() const;
691691
%Docstring
692692
Returns the units for the symbol's stroke width.
693693

694694
.. seealso:: :py:func:`setStrokeWidthUnit`
695+
696+
.. seealso:: :py:func:`strokeWidthMapUnitScale`
695697
%End
696698

697699
void setStrokeWidthMapUnitScale( const QgsMapUnitScale &scale );
700+
%Docstring
701+
Sets the stroke width map unit ``scale``.
702+
703+
.. seealso:: :py:func:`strokeWidthMapUnitScale`
704+
705+
.. seealso:: :py:func:`setStrokeWidth`
706+
707+
.. seealso:: :py:func:`setStrokeWidthUnit`
708+
%End
709+
698710
const QgsMapUnitScale &strokeWidthMapUnitScale() const;
711+
%Docstring
712+
Returns the stroke width map unit scale.
713+
714+
.. seealso:: :py:func:`setStrokeWidthMapUnitScale`
715+
716+
.. seealso:: :py:func:`strokeWidth`
717+
718+
.. seealso:: :py:func:`strokeWidthUnit`
719+
720+
.. versionadded:: 2.16
721+
%End
699722

700723
virtual void setOutputUnit( QgsUnitTypes::RenderUnit unit );
701724

702725
virtual QgsUnitTypes::RenderUnit outputUnit() const;
703726

704-
705727
virtual void setMapUnitScale( const QgsMapUnitScale &scale );
706728

707729
virtual QgsMapUnitScale mapUnitScale() const;
708730

709-
710731
virtual double estimateMaxBleed( const QgsRenderContext &context ) const;
711732

712-
713733
virtual double dxfWidth( const QgsDxfExport &e, QgsSymbolRenderContext &context ) const;
714734

715735
virtual QColor dxfColor( QgsSymbolRenderContext &context ) const;
716736

717-
718737
virtual Qt::PenStyle dxfPenStyle() const;
719738

720-
721739
virtual QSet<QString> usedAttributes( const QgsRenderContext &context ) const;
722740

723741

@@ -750,12 +768,20 @@ A class for filling symbols with a repeated raster image.
750768
enum FillCoordinateMode
751769
{
752770
Feature,
753-
Viewport
771+
Viewport,
754772
};
755773

756774
QgsRasterFillSymbolLayer( const QString &imageFilePath = QString() );
775+
%Docstring
776+
Constructor for QgsRasterFillSymbolLayer, using a raster fill from the
777+
specified ``imageFilePath``.
778+
%End
757779

758780
static QgsSymbolLayer *create( const QgsStringMap &properties = QgsStringMap() ) /Factory/;
781+
%Docstring
782+
Creates a new QgsRasterFillSymbolLayer from a ``properties`` map. The caller takes
783+
ownership of the returned object.
784+
%End
759785

760786
static void resolvePaths( QgsStringMap &properties, const QgsPathResolver &pathResolver, bool saving );
761787
%Docstring
@@ -1000,36 +1026,43 @@ Returns the map unit scale for the image's width.
10001026

10011027
protected:
10021028

1003-
1004-
1005-
10061029
virtual void applyDataDefinedSettings( QgsSymbolRenderContext &context );
10071030

1008-
%Docstring
1009-
Path to the image file
1010-
%End
10111031

10121032
};
10131033

10141034
class QgsSVGFillSymbolLayer: QgsImageFillSymbolLayer
10151035
{
10161036
%Docstring
1017-
A class for svg fill patterns. The class automatically scales the pattern to
1018-
the appropriate pixel dimensions of the output device*
1037+
A class for filling symbols with a repeated SVG file.
10191038
%End
10201039

10211040
%TypeHeaderCode
10221041
#include "qgsfillsymbollayer.h"
10231042
%End
10241043
public:
1044+
10251045
QgsSVGFillSymbolLayer( const QString &svgFilePath, double width = 20, double rotation = 0.0 );
10261046
%Docstring
1027-
Constructs SVG fill symbol layer with picture from given absolute path to a SVG file
1047+
Constructor for QgsSVGFillSymbolLayer, using the SVG picture at the specified absolute file path.
10281048
%End
1049+
10291050
QgsSVGFillSymbolLayer( const QByteArray &svgData, double width = 20, double rotation = 0.0 );
1051+
%Docstring
1052+
Constructor for QgsSVGFillSymbolLayer, using the specified SVG picture data.
1053+
%End
10301054

10311055
static QgsSymbolLayer *create( const QgsStringMap &properties = QgsStringMap() ) /Factory/;
1056+
%Docstring
1057+
Creates a new QgsSVGFillSymbolLayer from a ``properties`` map. The caller takes
1058+
ownership of the returned object.
1059+
%End
1060+
10321061
static QgsSymbolLayer *createFromSld( QDomElement &element ) /Factory/;
1062+
%Docstring
1063+
Creates a new QgsSVGFillSymbolLayer from a SLD ``element``. The caller takes
1064+
ownership of the returned object.
1065+
%End
10331066

10341067
static void resolvePaths( QgsStringMap &properties, const QgsPathResolver &pathResolver, bool saving );
10351068
%Docstring
@@ -1042,71 +1075,223 @@ Used internally when reading/writing symbols.
10421075

10431076
virtual QString layerType() const;
10441077

1045-
10461078
virtual void startRender( QgsSymbolRenderContext &context );
10471079

10481080
virtual void stopRender( QgsSymbolRenderContext &context );
10491081

1050-
10511082
virtual QgsStringMap properties() const;
10521083

1053-
10541084
virtual QgsSVGFillSymbolLayer *clone() const /Factory/;
10551085

1056-
10571086
virtual void toSld( QDomDocument &doc, QDomElement &element, const QgsStringMap &props ) const;
10581087

10591088

10601089
void setSvgFilePath( const QString &svgPath );
1090+
%Docstring
1091+
Sets the path to the SVG file to render in the fill.
1092+
1093+
This is usually an absolute file path. Other supported options include
1094+
- relative paths to folders from the user's SVG search paths
1095+
- base64 encoded content, prefixed with a 'base64:' string
1096+
- http(s) paths
1097+
1098+
.. seealso:: :py:func:`svgFilePath`
1099+
%End
1100+
10611101
QString svgFilePath() const;
1102+
%Docstring
1103+
Returns the path to the SVG file used to render the fill.
1104+
1105+
.. seealso:: :py:func:`setSvgFilePath`
1106+
%End
1107+
10621108
void setPatternWidth( double width );
1109+
%Docstring
1110+
Sets the ``width`` to render the SVG content as within the fill (i.e. the pattern repeat/tile size).
1111+
1112+
Units are specified by setPatternWidthUnit()
1113+
1114+
.. seealso:: :py:func:`patternWidth`
1115+
1116+
.. seealso:: :py:func:`setPatternWidthUnit`
1117+
1118+
.. seealso:: :py:func:`setPatternWidthMapUnitScale`
1119+
%End
1120+
10631121
double patternWidth() const;
1122+
%Docstring
1123+
Returns the width of the rendered SVG content within the fill (i.e. the pattern repeat/tile size).
1124+
1125+
Units are retrieved by patternWidthUnit()
1126+
1127+
.. seealso:: :py:func:`setPatternWidth`
1128+
1129+
.. seealso:: :py:func:`patternWidthUnit`
1130+
1131+
.. seealso:: :py:func:`patternWidthMapUnitScale`
1132+
%End
10641133

10651134
void setSvgFillColor( const QColor &c );
1135+
%Docstring
1136+
Sets the fill color used for rendering the SVG content.
1137+
1138+
Fill color is only supported for parameterized SVG files. Color opacity is
1139+
ignored if the SVG file does not support parameterized fill opacity.
1140+
1141+
.. seealso:: :py:func:`svgFillColor`
1142+
1143+
.. seealso:: :py:func:`setSvgStrokeColor`
1144+
%End
1145+
10661146
QColor svgFillColor() const;
1147+
%Docstring
1148+
Returns the fill color used for rendering the SVG content.
1149+
1150+
Fill color is only supported for parameterized SVG files.
1151+
1152+
.. seealso:: :py:func:`setSvgFillColor`
1153+
1154+
.. seealso:: :py:func:`svgStrokeColor`
1155+
%End
10671156

10681157
void setSvgStrokeColor( const QColor &c );
1158+
%Docstring
1159+
Sets the stroke color used for rendering the SVG content.
1160+
1161+
Stroke color is only supported for parameterized SVG files. Color opacity is
1162+
ignored if the SVG file does not support parameterized outline opacity.
1163+
1164+
.. seealso:: :py:func:`svgStrokeColor`
1165+
1166+
.. seealso:: :py:func:`setSvgFillColor`
1167+
%End
1168+
10691169
QColor svgStrokeColor() const;
1170+
%Docstring
1171+
Returns the stroke color used for rendering the SVG content.
1172+
1173+
Stroke color is only supported for parameterized SVG files.
1174+
1175+
.. seealso:: :py:func:`setSvgStrokeColor`
1176+
1177+
.. seealso:: :py:func:`svgFillColor`
1178+
%End
1179+
10701180
void setSvgStrokeWidth( double w );
1181+
%Docstring
1182+
Sets the stroke width used for rendering the SVG content.
1183+
1184+
Stroke width is only supported for parameterized SVG files. Units are
1185+
specified via setSvgStrokeWidthUnit()
1186+
1187+
.. seealso:: :py:func:`svgStrokeWidth`
1188+
1189+
.. seealso:: :py:func:`setSvgStrokeWidthUnit`
1190+
1191+
.. seealso:: :py:func:`setSvgStrokeWidthMapUnitScale`
1192+
%End
1193+
10711194
double svgStrokeWidth() const;
1195+
%Docstring
1196+
Returns the stroke width used for rendering the SVG content.
1197+
1198+
Stroke width is only supported for parameterized SVG files. Units are
1199+
retrieved via setSvgStrokeWidthUnit()
1200+
1201+
.. seealso:: :py:func:`setSvgStrokeWidth`
1202+
1203+
.. seealso:: :py:func:`svgStrokeWidthUnit`
1204+
1205+
.. seealso:: :py:func:`svgStrokeWidthMapUnitScale`
1206+
%End
10721207

10731208
void setPatternWidthUnit( QgsUnitTypes::RenderUnit unit );
10741209
%Docstring
1075-
Sets the units for the width of the SVG images in the pattern.
1076-
1077-
:param unit: width units
1210+
Sets the ``unit`` for the width of the SVG images in the pattern.
10781211

10791212
.. seealso:: :py:func:`patternWidthUnit`
1213+
1214+
.. seealso:: :py:func:`setPatternWidth`
1215+
1216+
.. seealso:: :py:func:`setPatternWidthMapUnitScale`
10801217
%End
10811218

10821219
QgsUnitTypes::RenderUnit patternWidthUnit() const;
10831220
%Docstring
10841221
Returns the units for the width of the SVG images in the pattern.
10851222

10861223
.. seealso:: :py:func:`setPatternWidthUnit`
1224+
1225+
.. seealso:: :py:func:`patternWidth`
1226+
1227+
.. seealso:: :py:func:`patternWidthMapUnitScale`
10871228
%End
10881229

10891230
void setPatternWidthMapUnitScale( const QgsMapUnitScale &scale );
1231+
%Docstring
1232+
Sets the map unit ``scale`` for the pattern's width.
1233+
1234+
.. seealso:: :py:func:`patternWidthMapUnitScale`
1235+
1236+
.. seealso:: :py:func:`setPatternWidth`
1237+
1238+
.. seealso:: :py:func:`setPatternWidthUnit`
1239+
%End
1240+
10901241
const QgsMapUnitScale &patternWidthMapUnitScale() const;
1242+
%Docstring
1243+
Returns the map unit scale for the pattern's width.
1244+
1245+
.. seealso:: :py:func:`setPatternWidthMapUnitScale`
1246+
1247+
.. seealso:: :py:func:`patternWidth`
1248+
1249+
.. seealso:: :py:func:`patternWidthUnit`
1250+
%End
10911251

10921252
void setSvgStrokeWidthUnit( QgsUnitTypes::RenderUnit unit );
10931253
%Docstring
1094-
Sets the units for the stroke width.
1095-
1096-
:param unit: width units
1254+
Sets the ``unit`` for the stroke width.
10971255

10981256
.. seealso:: :py:func:`svgStrokeWidthUnit`
1257+
1258+
.. seealso:: :py:func:`setSvgStrokeWidth`
1259+
1260+
.. seealso:: :py:func:`setSvgStrokeWidthMapUnitScale`
10991261
%End
11001262

11011263
QgsUnitTypes::RenderUnit svgStrokeWidthUnit() const;
11021264
%Docstring
11031265
Returns the units for the stroke width.
11041266

11051267
.. seealso:: :py:func:`setSvgStrokeWidthUnit`
1268+
1269+
.. seealso:: :py:func:`svgStrokeWidth`
1270+
1271+
.. seealso:: :py:func:`svgStrokeWidthMapUnitScale`
11061272
%End
11071273

11081274
void setSvgStrokeWidthMapUnitScale( const QgsMapUnitScale &scale );
1275+
%Docstring
1276+
Sets the map unit ``scale`` for the pattern's stroke.
1277+
1278+
.. seealso:: :py:func:`svgStrokeWidthMapUnitScale`
1279+
1280+
.. seealso:: :py:func:`setSvgStrokeWidth`
1281+
1282+
.. seealso:: :py:func:`setSvgStrokeWidthUnit`
1283+
%End
1284+
11091285
const QgsMapUnitScale &svgStrokeWidthMapUnitScale() const;
1286+
%Docstring
1287+
Returns the map unit scale for the pattern's stroke.
1288+
1289+
.. seealso:: :py:func:`setSvgStrokeWidthMapUnitScale`
1290+
1291+
.. seealso:: :py:func:`svgStrokeWidth`
1292+
1293+
.. seealso:: :py:func:`svgStrokeWidthUnit`
1294+
%End
11101295

11111296
virtual void setOutputUnit( QgsUnitTypes::RenderUnit unit );
11121297

@@ -1120,8 +1305,6 @@ Returns the units for the stroke width.
11201305

11211306
protected:
11221307

1123-
1124-
11251308
virtual void applyDataDefinedSettings( QgsSymbolRenderContext &context );
11261309

11271310

‎src/core/symbology/qgsfillsymbollayer.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1712,31 +1712,23 @@ QSet<QString> QgsImageFillSymbolLayer::usedAttributes( const QgsRenderContext &c
17121712
QgsSVGFillSymbolLayer::QgsSVGFillSymbolLayer( const QString &svgFilePath, double width, double angle )
17131713
: QgsImageFillSymbolLayer()
17141714
, mPatternWidth( width )
1715-
, mPatternWidthUnit( QgsUnitTypes::RenderMillimeters )
1716-
, mSvgStrokeWidthUnit( QgsUnitTypes::RenderMillimeters )
17171715
{
17181716
setSvgFilePath( svgFilePath );
17191717
mStrokeWidth = 0.3;
17201718
mAngle = angle;
17211719
mColor = QColor( 255, 255, 255 );
1722-
mSvgStrokeColor = QColor( 35, 35, 35 );
1723-
mSvgStrokeWidth = 0.2;
17241720
setDefaultSvgParams();
17251721
}
17261722

17271723
QgsSVGFillSymbolLayer::QgsSVGFillSymbolLayer( const QByteArray &svgData, double width, double angle )
17281724
: QgsImageFillSymbolLayer()
17291725
, mPatternWidth( width )
1730-
, mPatternWidthUnit( QgsUnitTypes::RenderMillimeters )
17311726
, mSvgData( svgData )
1732-
, mSvgStrokeWidthUnit( QgsUnitTypes::RenderMillimeters )
17331727
{
17341728
storeViewBox();
17351729
mStrokeWidth = 0.3;
17361730
mAngle = angle;
17371731
mColor = QColor( 255, 255, 255 );
1738-
mSvgStrokeColor = QColor( 35, 35, 35 );
1739-
mSvgStrokeWidth = 0.2;
17401732
setSubSymbol( new QgsLineSymbol() );
17411733
setDefaultSvgParams();
17421734
}

‎src/core/symbology/qgsfillsymbollayer.h

Lines changed: 202 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -637,34 +637,47 @@ class CORE_EXPORT QgsImageFillSymbolLayer: public QgsFillSymbolLayer
637637
bool setSubSymbol( QgsSymbol *symbol SIP_TRANSFER ) override;
638638

639639
/**
640-
* Sets the units for the symbol's stroke width.
641-
* \param unit symbol units
640+
* Sets the \a units fo the symbol's stroke width.
642641
* \see strokeWidthUnit()
642+
* \see setStrokeWidthMapUnitScale()
643643
*/
644644
void setStrokeWidthUnit( QgsUnitTypes::RenderUnit unit ) { mStrokeWidthUnit = unit; }
645645

646646
/**
647647
* Returns the units for the symbol's stroke width.
648648
* \see setStrokeWidthUnit()
649+
* \see strokeWidthMapUnitScale()
649650
*/
650651
QgsUnitTypes::RenderUnit strokeWidthUnit() const { return mStrokeWidthUnit; }
651652

653+
/**
654+
* Sets the stroke width map unit \a scale.
655+
*
656+
* \see strokeWidthMapUnitScale()
657+
* \see setStrokeWidth()
658+
* \see setStrokeWidthUnit()
659+
*/
652660
void setStrokeWidthMapUnitScale( const QgsMapUnitScale &scale ) { mStrokeWidthMapUnitScale = scale; }
661+
662+
/**
663+
* Returns the stroke width map unit scale.
664+
*
665+
* \see setStrokeWidthMapUnitScale()
666+
* \see strokeWidth()
667+
* \see strokeWidthUnit()
668+
*
669+
* \since QGIS 2.16
670+
*/
653671
const QgsMapUnitScale &strokeWidthMapUnitScale() const { return mStrokeWidthMapUnitScale; }
654672

655673
void setOutputUnit( QgsUnitTypes::RenderUnit unit ) override;
656674
QgsUnitTypes::RenderUnit outputUnit() const override;
657-
658675
void setMapUnitScale( const QgsMapUnitScale &scale ) override;
659676
QgsMapUnitScale mapUnitScale() const override;
660-
661677
double estimateMaxBleed( const QgsRenderContext &context ) const override;
662-
663678
double dxfWidth( const QgsDxfExport &e, QgsSymbolRenderContext &context ) const override;
664679
QColor dxfColor( QgsSymbolRenderContext &context ) const override;
665-
666680
Qt::PenStyle dxfPenStyle() const override;
667-
668681
QSet<QString> usedAttributes( const QgsRenderContext &context ) const override;
669682

670683
protected:
@@ -697,14 +710,23 @@ class CORE_EXPORT QgsRasterFillSymbolLayer: public QgsImageFillSymbolLayer
697710
{
698711
public:
699712

713+
//! Fill coordinate modes, dictates fill tiling behavior
700714
enum FillCoordinateMode
701715
{
702-
Feature,
703-
Viewport
716+
Feature, //!< Tiling is based on feature bounding box
717+
Viewport, //!< Tiling is based on complete map viewport
704718
};
705719

720+
/**
721+
* Constructor for QgsRasterFillSymbolLayer, using a raster fill from the
722+
* specified \a imageFilePath.
723+
*/
706724
QgsRasterFillSymbolLayer( const QString &imageFilePath = QString() );
707725

726+
/**
727+
* Creates a new QgsRasterFillSymbolLayer from a \a properties map. The caller takes
728+
* ownership of the returned object.
729+
*/
708730
static QgsSymbolLayer *create( const QgsStringMap &properties = QgsStringMap() ) SIP_FACTORY;
709731

710732
/**
@@ -883,6 +905,10 @@ class CORE_EXPORT QgsRasterFillSymbolLayer: public QgsImageFillSymbolLayer
883905

884906
protected:
885907

908+
void applyDataDefinedSettings( QgsSymbolRenderContext &context ) override;
909+
910+
private:
911+
886912
//! Path to the image file
887913
QString mImageFilePath;
888914
FillCoordinateMode mCoordinateMode = QgsRasterFillSymbolLayer::Feature;
@@ -896,27 +922,39 @@ class CORE_EXPORT QgsRasterFillSymbolLayer: public QgsImageFillSymbolLayer
896922
QgsUnitTypes::RenderUnit mWidthUnit = QgsUnitTypes::RenderPixels;
897923
QgsMapUnitScale mWidthMapUnitScale;
898924

899-
void applyDataDefinedSettings( QgsSymbolRenderContext &context ) override;
900-
901-
private:
902-
903925
//! Applies the image pattern to the brush
904926
void applyPattern( QBrush &brush, const QString &imageFilePath, double width, double opacity,
905927
const QgsSymbolRenderContext &context );
906928
};
907929

908930
/**
909931
* \ingroup core
910-
* A class for svg fill patterns. The class automatically scales the pattern to
911-
the appropriate pixel dimensions of the output device*/
932+
* A class for filling symbols with a repeated SVG file.
933+
*/
912934
class CORE_EXPORT QgsSVGFillSymbolLayer: public QgsImageFillSymbolLayer
913935
{
914936
public:
915-
//! Constructs SVG fill symbol layer with picture from given absolute path to a SVG file
937+
938+
/**
939+
* Constructor for QgsSVGFillSymbolLayer, using the SVG picture at the specified absolute file path.
940+
*/
916941
QgsSVGFillSymbolLayer( const QString &svgFilePath, double width = 20, double rotation = 0.0 );
942+
943+
/**
944+
* Constructor for QgsSVGFillSymbolLayer, using the specified SVG picture data.
945+
*/
917946
QgsSVGFillSymbolLayer( const QByteArray &svgData, double width = 20, double rotation = 0.0 );
918947

948+
/**
949+
* Creates a new QgsSVGFillSymbolLayer from a \a properties map. The caller takes
950+
* ownership of the returned object.
951+
*/
919952
static QgsSymbolLayer *create( const QgsStringMap &properties = QgsStringMap() ) SIP_FACTORY;
953+
954+
/**
955+
* Creates a new QgsSVGFillSymbolLayer from a SLD \a element. The caller takes
956+
* ownership of the returned object.
957+
*/
920958
static QgsSymbolLayer *createFromSld( QDomElement &element ) SIP_FACTORY;
921959

922960
/**
@@ -929,60 +967,189 @@ class CORE_EXPORT QgsSVGFillSymbolLayer: public QgsImageFillSymbolLayer
929967
// implemented from base classes
930968

931969
QString layerType() const override;
932-
933970
void startRender( QgsSymbolRenderContext &context ) override;
934971
void stopRender( QgsSymbolRenderContext &context ) override;
935-
936972
QgsStringMap properties() const override;
937-
938973
QgsSVGFillSymbolLayer *clone() const override SIP_FACTORY;
939-
940974
void toSld( QDomDocument &doc, QDomElement &element, const QgsStringMap &props ) const override;
941975

942-
//getters and setters
976+
/**
977+
* Sets the path to the SVG file to render in the fill.
978+
*
979+
* This is usually an absolute file path. Other supported options include
980+
* - relative paths to folders from the user's SVG search paths
981+
* - base64 encoded content, prefixed with a 'base64:' string
982+
* - http(s) paths
983+
*
984+
* \see svgFilePath()
985+
*/
943986
void setSvgFilePath( const QString &svgPath );
987+
988+
/**
989+
* Returns the path to the SVG file used to render the fill.
990+
*
991+
* \see setSvgFilePath()
992+
*/
944993
QString svgFilePath() const { return mSvgFilePath; }
994+
995+
/**
996+
* Sets the \a width to render the SVG content as within the fill (i.e. the pattern repeat/tile size).
997+
*
998+
* Units are specified by setPatternWidthUnit()
999+
*
1000+
* \see patternWidth()
1001+
* \see setPatternWidthUnit()
1002+
* \see setPatternWidthMapUnitScale(*)
1003+
*/
9451004
void setPatternWidth( double width ) { mPatternWidth = width;}
1005+
1006+
/**
1007+
* Returns the width of the rendered SVG content within the fill (i.e. the pattern repeat/tile size).
1008+
*
1009+
* Units are retrieved by patternWidthUnit()
1010+
*
1011+
* \see setPatternWidth()
1012+
* \see patternWidthUnit()
1013+
* \see patternWidthMapUnitScale(*)
1014+
*/
9461015
double patternWidth() const { return mPatternWidth; }
9471016

1017+
/**
1018+
* Sets the fill color used for rendering the SVG content.
1019+
*
1020+
* Fill color is only supported for parameterized SVG files. Color opacity is
1021+
* ignored if the SVG file does not support parameterized fill opacity.
1022+
*
1023+
* \see svgFillColor()
1024+
* \see setSvgStrokeColor()
1025+
*/
9481026
void setSvgFillColor( const QColor &c ) { setColor( c ); }
1027+
1028+
/**
1029+
* Returns the fill color used for rendering the SVG content.
1030+
*
1031+
* Fill color is only supported for parameterized SVG files.
1032+
*
1033+
* \see setSvgFillColor()
1034+
* \see svgStrokeColor()
1035+
*/
9491036
QColor svgFillColor() const { return color(); }
9501037

1038+
/**
1039+
* Sets the stroke color used for rendering the SVG content.
1040+
*
1041+
* Stroke color is only supported for parameterized SVG files. Color opacity is
1042+
* ignored if the SVG file does not support parameterized outline opacity.
1043+
*
1044+
* \see svgStrokeColor()
1045+
* \see setSvgFillColor()
1046+
*/
9511047
void setSvgStrokeColor( const QColor &c ) { mSvgStrokeColor = c; }
1048+
1049+
/**
1050+
* Returns the stroke color used for rendering the SVG content.
1051+
*
1052+
* Stroke color is only supported for parameterized SVG files.
1053+
*
1054+
* \see setSvgStrokeColor()
1055+
* \see svgFillColor()
1056+
*/
9521057
QColor svgStrokeColor() const { return mSvgStrokeColor; }
1058+
1059+
/**
1060+
* Sets the stroke width used for rendering the SVG content.
1061+
*
1062+
* Stroke width is only supported for parameterized SVG files. Units are
1063+
* specified via setSvgStrokeWidthUnit()
1064+
*
1065+
* \see svgStrokeWidth()
1066+
* \see setSvgStrokeWidthUnit()
1067+
* \see setSvgStrokeWidthMapUnitScale()
1068+
*/
9531069
void setSvgStrokeWidth( double w ) { mSvgStrokeWidth = w; }
1070+
1071+
/**
1072+
* Returns the stroke width used for rendering the SVG content.
1073+
*
1074+
* Stroke width is only supported for parameterized SVG files. Units are
1075+
* retrieved via setSvgStrokeWidthUnit()
1076+
*
1077+
* \see setSvgStrokeWidth()
1078+
* \see svgStrokeWidthUnit()
1079+
* \see svgStrokeWidthMapUnitScale()
1080+
*/
9541081
double svgStrokeWidth() const { return mSvgStrokeWidth; }
9551082

9561083
/**
957-
* Sets the units for the width of the SVG images in the pattern.
958-
* \param unit width units
1084+
* Sets the \a unit for the width of the SVG images in the pattern.
1085+
*
9591086
* \see patternWidthUnit()
1087+
* \see setPatternWidth()
1088+
* \see setPatternWidthMapUnitScale()
9601089
*/
9611090
void setPatternWidthUnit( QgsUnitTypes::RenderUnit unit ) { mPatternWidthUnit = unit; }
9621091

9631092
/**
9641093
* Returns the units for the width of the SVG images in the pattern.
1094+
*
9651095
* \see setPatternWidthUnit()
1096+
* \see patternWidth()
1097+
* \see patternWidthMapUnitScale()
9661098
*/
9671099
QgsUnitTypes::RenderUnit patternWidthUnit() const { return mPatternWidthUnit; }
9681100

1101+
/**
1102+
* Sets the map unit \a scale for the pattern's width.
1103+
*
1104+
* \see patternWidthMapUnitScale()
1105+
* \see setPatternWidth()
1106+
* \see setPatternWidthUnit()
1107+
*/
9691108
void setPatternWidthMapUnitScale( const QgsMapUnitScale &scale ) { mPatternWidthMapUnitScale = scale; }
1109+
1110+
/**
1111+
* Returns the map unit scale for the pattern's width.
1112+
*
1113+
* \see setPatternWidthMapUnitScale()
1114+
* \see patternWidth()
1115+
* \see patternWidthUnit()
1116+
*/
9701117
const QgsMapUnitScale &patternWidthMapUnitScale() const { return mPatternWidthMapUnitScale; }
9711118

9721119
/**
973-
* Sets the units for the stroke width.
974-
* \param unit width units
1120+
* Sets the \a unit for the stroke width.
1121+
*
9751122
* \see svgStrokeWidthUnit()
1123+
* \see setSvgStrokeWidth()
1124+
* \see setSvgStrokeWidthMapUnitScale()
9761125
*/
9771126
void setSvgStrokeWidthUnit( QgsUnitTypes::RenderUnit unit ) { mSvgStrokeWidthUnit = unit; }
9781127

9791128
/**
9801129
* Returns the units for the stroke width.
1130+
*
9811131
* \see setSvgStrokeWidthUnit()
1132+
* \see svgStrokeWidth()
1133+
* \see svgStrokeWidthMapUnitScale()
9821134
*/
9831135
QgsUnitTypes::RenderUnit svgStrokeWidthUnit() const { return mSvgStrokeWidthUnit; }
9841136

1137+
/**
1138+
* Sets the map unit \a scale for the pattern's stroke.
1139+
*
1140+
* \see svgStrokeWidthMapUnitScale()
1141+
* \see setSvgStrokeWidth()
1142+
* \see setSvgStrokeWidthUnit()
1143+
*/
9851144
void setSvgStrokeWidthMapUnitScale( const QgsMapUnitScale &scale ) { mSvgStrokeWidthMapUnitScale = scale; }
1145+
1146+
/**
1147+
* Returns the map unit scale for the pattern's stroke.
1148+
*
1149+
* \see setSvgStrokeWidthMapUnitScale()
1150+
* \see svgStrokeWidth()
1151+
* \see svgStrokeWidthUnit()
1152+
*/
9861153
const QgsMapUnitScale &svgStrokeWidthMapUnitScale() const { return mSvgStrokeWidthMapUnitScale; }
9871154

9881155
void setOutputUnit( QgsUnitTypes::RenderUnit unit ) override;
@@ -992,9 +1159,14 @@ class CORE_EXPORT QgsSVGFillSymbolLayer: public QgsImageFillSymbolLayer
9921159
QgsMapUnitScale mapUnitScale() const override;
9931160

9941161
protected:
1162+
1163+
void applyDataDefinedSettings( QgsSymbolRenderContext &context ) override;
1164+
1165+
private:
1166+
9951167
//! Width of the pattern (in output units)
996-
double mPatternWidth;
997-
QgsUnitTypes::RenderUnit mPatternWidthUnit;
1168+
double mPatternWidth = 20;
1169+
QgsUnitTypes::RenderUnit mPatternWidthUnit = QgsUnitTypes::RenderMillimeters;
9981170
QgsMapUnitScale mPatternWidthMapUnitScale;
9991171

10001172
//! SVG data
@@ -1006,14 +1178,11 @@ class CORE_EXPORT QgsSVGFillSymbolLayer: public QgsImageFillSymbolLayer
10061178

10071179
//param(fill), param(stroke), param(stroke-width) are going
10081180
//to be replaced in memory
1009-
QColor mSvgStrokeColor;
1010-
double mSvgStrokeWidth;
1011-
QgsUnitTypes::RenderUnit mSvgStrokeWidthUnit;
1181+
QColor mSvgStrokeColor = QColor( 35, 35, 35 );
1182+
double mSvgStrokeWidth = 0.2;
1183+
QgsUnitTypes::RenderUnit mSvgStrokeWidthUnit = QgsUnitTypes::RenderMillimeters;
10121184
QgsMapUnitScale mSvgStrokeWidthMapUnitScale;
10131185

1014-
void applyDataDefinedSettings( QgsSymbolRenderContext &context ) override;
1015-
1016-
private:
10171186
//! Helper function that gets the view box from the byte array
10181187
void storeViewBox();
10191188
void setDefaultSvgParams(); //fills mSvgFillColor, mSvgStrokeColor, mSvgStrokeWidth with default values for mSvgFilePath

0 commit comments

Comments
 (0)
Please sign in to comment.