30 #include <QSvgRenderer> 31 #include <QDomDocument> 32 #include <QDomElement> 35 Qt::PenJoinStyle penJoinStyle )
36 : mBrushStyle( style )
37 , mBorderColor( borderColor )
38 , mBorderStyle( borderStyle )
39 , mBorderWidth( borderWidth )
41 , mPenJoinStyle( penJoinStyle )
78 void QgsSimpleFillSymbolLayerV2::applyDataDefinedSymbology(
QgsSymbolV2RenderContext& context, QBrush& brush, QPen& pen, QPen& selPen )
84 if ( colorExpression )
89 if ( fillStyleExpression )
94 if ( colorBorderExpression )
99 if ( widthBorderExpression )
101 double width = widthBorderExpression->
evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toDouble();
103 pen.setWidthF( width );
104 selPen.setWidthF( width );
107 if ( borderStyleExpression )
113 if ( joinStyleExpression )
131 if ( props.contains(
"color" ) )
133 if ( props.contains(
"style" ) )
135 if ( props.contains(
"color_border" ) )
140 else if ( props.contains(
"outline_color" ) )
144 else if ( props.contains(
"line_color" ) )
149 if ( props.contains(
"style_border" ) )
154 else if ( props.contains(
"outline_style" ) )
158 else if ( props.contains(
"line_style" ) )
162 if ( props.contains(
"width_border" ) )
165 borderWidth = props[
"width_border"].toDouble();
167 else if ( props.contains(
"outline_width" ) )
169 borderWidth = props[
"outline_width"].toDouble();
171 else if ( props.contains(
"line_width" ) )
173 borderWidth = props[
"line_width"].toDouble();
175 if ( props.contains(
"offset" ) )
177 if ( props.contains(
"joinstyle" ) )
182 if ( props.contains(
"border_width_unit" ) )
186 else if ( props.contains(
"outline_width_unit" ) )
190 else if ( props.contains(
"line_width_unit" ) )
194 if ( props.contains(
"offset_unit" ) )
197 if ( props.contains(
"border_width_map_unit_scale" ) )
199 if ( props.contains(
"offset_map_unit_scale" ) )
202 if ( props.contains(
"color_expression" ) )
206 if ( props.contains(
"color_border_expression" ) )
210 if ( props.contains(
"width_border_expression" ) )
214 if ( props.contains(
"fill_style_expression" ) )
218 if ( props.contains(
"border_style_expression" ) )
222 if ( props.contains(
"join_style_expression" ) )
238 fillColor.setAlphaF( context.
alpha() *
mColor.alphaF() );
243 if ( rasterScaleFactor != 1.0 )
245 mBrush.setMatrix( QMatrix().scale( 1.0 / rasterScaleFactor, 1.0 / rasterScaleFactor ) );
259 mPen = QPen( borderColor );
290 p->translate( offset );
297 p->translate( -offset );
336 QDomElement symbolizerElem = doc.createElement(
"se:PolygonSymbolizer" );
337 if ( !props.value(
"uom",
"" ).isEmpty() )
338 symbolizerElem.setAttribute(
"uom", props.value(
"uom",
"" ) );
339 element.appendChild( symbolizerElem );
347 QDomElement fillElem = doc.createElement(
"se:Fill" );
348 symbolizerElem.appendChild( fillElem );
355 QDomElement strokeElem = doc.createElement(
"se:Stroke" );
356 symbolizerElem.appendChild( strokeElem );
369 symbolStyle.append(
";" );
380 Qt::BrushStyle fillStyle;
384 QDomElement fillElem = element.firstChildElement(
"Fill" );
387 QDomElement strokeElem = element.firstChildElement(
"Stroke" );
402 return penBleed + offsetBleed;
409 if ( widthBorderExpression )
411 width = widthBorderExpression->
evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toDouble();
419 if ( colorExpression )
434 if ( colorExpression )
451 : mGradientColorType( colorType )
452 , mGradientRamp( NULL )
453 , mGradientType( gradientType )
454 , mCoordinateMode( coordinateMode )
455 , mGradientSpread( spread )
456 , mReferencePoint1( QPointF( 0.5, 0 ) )
457 , mReferencePoint1IsCentroid( false )
458 , mReferencePoint2( QPointF( 0.5, 1 ) )
459 , mReferencePoint2IsCentroid( false )
481 bool refPoint1IsCentroid =
false;
483 bool refPoint2IsCentroid =
false;
488 if ( props.contains(
"type" ) )
490 if ( props.contains(
"coordinate_mode" ) )
492 if ( props.contains(
"spread" ) )
494 if ( props.contains(
"color_type" ) )
496 if ( props.contains(
"gradient_color" ) )
501 else if ( props.contains(
"color" ) )
505 if ( props.contains(
"gradient_color2" ) )
510 if ( props.contains(
"reference_point1" ) )
512 if ( props.contains(
"reference_point1_iscentroid" ) )
513 refPoint1IsCentroid = props[
"reference_point1_iscentroid"].toInt();
514 if ( props.contains(
"reference_point2" ) )
516 if ( props.contains(
"reference_point2_iscentroid" ) )
517 refPoint2IsCentroid = props[
"reference_point2_iscentroid"].toInt();
518 if ( props.contains(
"angle" ) )
519 angle = props[
"angle"].toDouble();
521 if ( props.contains(
"offset" ) )
530 if ( props.contains(
"offset_unit" ) )
532 if ( props.contains(
"offset_map_unit_scale" ) )
543 if ( props.contains(
"color_expression" ) )
545 if ( props.contains(
"color2_expression" ) )
547 if ( props.contains(
"angle_expression" ) )
549 if ( props.contains(
"gradient_type_expression" ) )
551 if ( props.contains(
"coordinate_mode_expression" ) )
553 if ( props.contains(
"spread_expression" ) )
555 if ( props.contains(
"reference1_x_expression" ) )
557 if ( props.contains(
"reference1_y_expression" ) )
559 if ( props.contains(
"reference1_iscentroid_expression" ) )
561 if ( props.contains(
"reference2_x_expression" ) )
563 if ( props.contains(
"reference2_y_expression" ) )
565 if ( props.contains(
"reference2_iscentroid_expression" ) )
579 return "GradientFill";
582 void QgsGradientFillSymbolLayerV2::applyDataDefinedSymbology(
QgsSymbolV2RenderContext& context,
const QPolygonF& points )
596 if ( colorExpression )
602 if ( colorExpression2 )
608 if ( angleExpression )
609 angle = angleExpression->evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toDouble();
614 if ( typeExpression )
616 QString currentType = typeExpression->
evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toString();
625 else if ( currentType ==
QObject::tr(
"conical" ) )
639 if ( coordModeExpression )
641 QString currentCoordMode = coordModeExpression->
evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toString();
642 if ( currentCoordMode ==
QObject::tr(
"feature" ) )
646 else if ( currentCoordMode ==
QObject::tr(
"viewport" ) )
660 if ( spreadExpression )
662 QString currentSpread = spreadExpression->
evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toString();
667 else if ( currentSpread ==
QObject::tr(
"repeat" ) )
671 else if ( currentSpread ==
QObject::tr(
"reflect" ) )
685 if ( ref1XExpression )
686 refPoint1X = ref1XExpression->
evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toDouble();
689 if ( ref1YExpression )
690 refPoint1Y = ref1YExpression->
evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toDouble();
693 if ( ref1IsCentroidExpression )
694 refPoint1IsCentroid = ref1IsCentroidExpression->
evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toBool();
699 if ( ref2XExpression )
700 refPoint2X = ref2XExpression->
evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toDouble();
703 if ( ref2YExpression )
704 refPoint2Y = ref2YExpression->
evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toDouble();
707 if ( ref2IsCentroidExpression )
708 refPoint2IsCentroid = ref2IsCentroidExpression->
evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toBool();
710 if ( refPoint1IsCentroid || refPoint2IsCentroid )
715 QRectF bbox = points.boundingRect();
716 double centroidX = ( centroid.x() - bbox.left() ) / bbox.width();
717 double centroidY = ( centroid.y() - bbox.top() ) / bbox.height();
719 if ( refPoint1IsCentroid )
721 refPoint1X = centroidX;
722 refPoint1Y = centroidY;
724 if ( refPoint2IsCentroid )
726 refPoint2X = centroidX;
727 refPoint2Y = centroidY;
733 spread, QPointF( refPoint1X, refPoint1Y ), QPointF( refPoint2X, refPoint2Y ), angle );
736 QPointF QgsGradientFillSymbolLayerV2::rotateReferencePoint(
const QPointF & refPoint,
double angle )
741 QLineF refLine = QLineF( QPointF( 0.5, 0.5 ), refPoint );
743 refLine.setAngle( refLine.angle() +
angle );
745 QPointF rotatedReferencePoint = refLine.p2();
747 if ( rotatedReferencePoint.x() > 1 )
748 rotatedReferencePoint.setX( 1 );
749 if ( rotatedReferencePoint.x() < 0 )
750 rotatedReferencePoint.setX( 0 );
751 if ( rotatedReferencePoint.y() > 1 )
752 rotatedReferencePoint.setY( 1 );
753 if ( rotatedReferencePoint.y() < 0 )
754 rotatedReferencePoint.setY( 0 );
756 return rotatedReferencePoint;
767 fillColor.setAlphaF( context.
alpha() * fillColor.alphaF() );
768 QColor fillColor2 =
color2;
769 fillColor2.setAlphaF( context.
alpha() * fillColor2.alphaF() );
780 gradient = QLinearGradient( rotatedReferencePoint1, rotatedReferencePoint2 );
783 gradient = QRadialGradient( rotatedReferencePoint1, QLineF( rotatedReferencePoint1, rotatedReferencePoint2 ).length() );
786 gradient = QConicalGradient( rotatedReferencePoint1, QLineF( rotatedReferencePoint1, rotatedReferencePoint2 ).
angle() );
792 gradient.setCoordinateMode( QGradient::ObjectBoundingMode );
795 gradient.setCoordinateMode( QGradient::StretchToDeviceMode );
801 gradient.setSpread( QGradient::PadSpread );
804 gradient.setSpread( QGradient::ReflectSpread );
807 gradient.setSpread( QGradient::RepeatSpread );
821 gradient.setColorAt( 0.0, fillColor );
822 gradient.setColorAt( 1.0, fillColor2 );
826 brush = QBrush( gradient );
852 applyDataDefinedSymbology( context, points );
855 p->setPen( Qt::NoPen );
862 p->translate( offset );
869 p->translate( -offset );
886 map[
"angle"] = QString::number(
mAngle );
944 int blurRadius,
bool useWholeShape,
double maxDistance ) :
946 mBlurRadius( blurRadius ),
947 mUseWholeShape( useWholeShape ),
948 mMaxDistance( maxDistance ),
950 mColorType( colorType ),
953 mTwoColorGradientRamp( 0 ),
954 mIgnoreRings( false ),
976 if ( props.contains(
"color_type" ) )
980 if ( props.contains(
"shapeburst_color" ) )
985 else if ( props.contains(
"color" ) )
990 if ( props.contains(
"shapeburst_color2" ) )
995 else if ( props.contains(
"gradient_color2" ) )
999 if ( props.contains(
"blur_radius" ) )
1001 blurRadius = props[
"blur_radius"].toInt();
1003 if ( props.contains(
"use_whole_shape" ) )
1005 useWholeShape = props[
"use_whole_shape"].toInt();
1007 if ( props.contains(
"max_distance" ) )
1009 maxDistance = props[
"max_distance"].toDouble();
1011 if ( props.contains(
"offset" ) )
1022 if ( props.contains(
"offset_unit" ) )
1026 if ( props.contains(
"distance_unit" ) )
1030 if ( props.contains(
"offset_map_unit_scale" ) )
1034 if ( props.contains(
"distance_map_unit_scale" ) )
1038 if ( props.contains(
"ignore_rings" ) )
1047 if ( props.contains(
"color_expression" ) )
1049 if ( props.contains(
"color2_expression" ) )
1051 if ( props.contains(
"blur_radius_expression" ) )
1053 if ( props.contains(
"use_whole_shape_expression" ) )
1055 if ( props.contains(
"max_distance_expression" ) )
1057 if ( props.contains(
"ignore_rings_expression" ) )
1065 return "ShapeburstFill";
1080 if ( colorExpression )
1086 if ( colorExpression2 )
1092 if ( blurRadiusExpression )
1093 blurRadius = blurRadiusExpression->evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toInt();
1098 if ( useWholeShapeExpression )
1104 if ( maxDistanceExpression )
1110 if ( ignoreRingsExpression )
1111 ignoreRings = ignoreRingsExpression->
evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toBool();
1127 Q_UNUSED( context );
1147 p->translate( offset );
1152 p->translate( -offset );
1163 applyDataDefinedSymbology( context, color1, color2, blurRadius, useWholeShape, maxDistance, ignoreRings );
1166 int outputPixelMaxDist = 0;
1167 if ( !useWholeShape && maxDistance != 0 )
1181 p->setPen( QPen( Qt::NoPen ) );
1184 int sideBuffer = 4 + ( blurRadius + 2 ) * 4;
1186 double imWidth = points.boundingRect().width() + ( sideBuffer * 2 );
1187 double imHeight = points.boundingRect().height() + ( sideBuffer * 2 );
1193 fillImage->fill( Qt::black );
1196 QImage * alphaImage =
new QImage( fillImage->width(), fillImage->height(), QImage::Format_ARGB32_Premultiplied );
1198 alphaImage->fill( Qt::transparent );
1201 QPainter imgPainter;
1202 imgPainter.begin( alphaImage );
1203 imgPainter.setRenderHint( QPainter::Antialiasing,
true );
1204 imgPainter.setBrush( QBrush( Qt::white ) );
1205 imgPainter.setPen( QPen( Qt::black ) );
1206 imgPainter.translate( -points.boundingRect().left() + sideBuffer, - points.boundingRect().top() + sideBuffer );
1213 imgPainter.begin( fillImage );
1216 imgPainter.drawImage( 0, 0, *alphaImage );
1223 imgPainter.setBrush( QBrush( Qt::white ) );
1224 imgPainter.setPen( QPen( Qt::black ) );
1225 imgPainter.translate( -points.boundingRect().left() + sideBuffer, - points.boundingRect().top() + sideBuffer );
1232 double * dtArray = distanceTransform( fillImage );
1246 if ( blurRadius > 0 )
1252 imgPainter.begin( fillImage );
1253 imgPainter.setCompositionMode( QPainter::CompositionMode_DestinationIn );
1254 imgPainter.drawImage( 0, 0, *alphaImage );
1267 p->translate( offset );
1271 p->drawImage( points.boundingRect().left() - sideBuffer, points.boundingRect().top() - sideBuffer, *fillImage );
1277 p->translate( -offset );
1286 void QgsShapeburstFillSymbolLayerV2::distanceTransform1d(
double *f,
int n,
int *v,
double *z,
double *d )
1292 for (
int q = 1; q <= n - 1; q++ )
1294 double s = (( f[q] + q * q ) - ( f[v[k]] + ( v[k] * v[k] ) ) ) / ( 2 * q - 2 * v[k] );
1298 s = (( f[q] + q * q ) - ( f[v[k]] + ( v[k] * v[k] ) ) ) / ( 2 * q - 2 * v[k] );
1307 for (
int q = 0; q <= n - 1; q++ )
1309 while ( z[k+1] < q )
1311 d[q] = ( q - v[k] ) * ( q - v[k] ) + f[v[k]];
1316 void QgsShapeburstFillSymbolLayerV2::distanceTransform2d(
double * im,
int width,
int height )
1318 int maxDimension = qMax( width, height );
1319 double *f =
new double[ maxDimension ];
1320 int *v =
new int[ maxDimension ];
1321 double *z =
new double[ maxDimension + 1 ];
1322 double *d =
new double[ maxDimension ];
1325 for (
int x = 0; x < width; x++ )
1327 for (
int y = 0; y < height; y++ )
1329 f[y] = im[ x + y * width ];
1331 distanceTransform1d( f, height, v, z, d );
1332 for (
int y = 0; y < height; y++ )
1334 im[ x + y * width ] = d[y];
1339 for (
int y = 0; y < height; y++ )
1341 for (
int x = 0; x < width; x++ )
1343 f[x] = im[ x + y*width ];
1345 distanceTransform1d( f, width, v, z, d );
1346 for (
int x = 0; x < width; x++ )
1348 im[ x + y*width ] = d[x];
1359 double * QgsShapeburstFillSymbolLayerV2::distanceTransform( QImage *im )
1361 int width = im->width();
1362 int height = im->height();
1364 double * dtArray =
new double[width * height];
1369 for (
int heightIndex = 0; heightIndex < height; ++heightIndex )
1371 QRgb* scanLine = ( QRgb* )im->constScanLine( heightIndex );
1372 for (
int widthIndex = 0; widthIndex < width; ++widthIndex )
1374 tmpRgb = scanLine[widthIndex];
1375 if ( qRed( tmpRgb ) == 0 )
1383 dtArray[ idx ] =
INF;
1390 distanceTransform2d( dtArray, width, height );
1395 void QgsShapeburstFillSymbolLayerV2::dtArrayToQImage(
double * array, QImage *im,
QgsVectorColorRampV2* ramp,
double layerAlpha,
bool useWholeShape,
int maxPixelDistance )
1397 int width = im->width();
1398 int height = im->height();
1401 double maxDistanceValue;
1406 double dtMaxValue = array[0];
1407 for (
int i = 1; i < ( width * height ); ++i )
1409 if ( array[i] > dtMaxValue )
1411 dtMaxValue = array[i];
1416 maxDistanceValue = sqrt( dtMaxValue );
1421 maxDistanceValue = maxPixelDistance;
1426 double squaredVal = 0;
1429 bool layerHasAlpha = layerAlpha < 1.0;
1431 for (
int heightIndex = 0; heightIndex < height; ++heightIndex )
1433 QRgb* scanLine = ( QRgb* )im->scanLine( heightIndex );
1434 for (
int widthIndex = 0; widthIndex < width; ++widthIndex )
1437 squaredVal = array[idx];
1440 if ( maxDistanceValue > 0 )
1442 pixVal = squaredVal > 0 ? qMin(( sqrt( squaredVal ) / maxDistanceValue ), 1.0 ) : 0;
1450 pixColor = ramp->
color( pixVal );
1452 int pixAlpha = pixColor.alpha();
1453 if (( layerHasAlpha ) || ( pixAlpha != 255 ) )
1456 double alpha = pixAlpha * layerAlpha;
1461 scanLine[widthIndex] = pixColor.rgba();
1472 map[
"color_type"] = QString::number(
mColorType );
1473 map[
"blur_radius"] = QString::number(
mBlurRadius );
1551 , mOutlineWidth( 0.0 )
1573 p->setPen( QPen( Qt::NoPen ) );
1580 p->setBrush( QBrush( selColor ) );
1590 QTransform t =
mBrush.transform();
1592 QBrush rotatedBrush =
mBrush;
1593 rotatedBrush.setTransform( t );
1594 p->setBrush( rotatedBrush );
1602 QList<QPolygonF>::const_iterator ringIt = rings->constBegin();
1603 for ( ; ringIt != rings->constEnd(); ++ringIt )
1663 return subLayerBleed;
1672 if ( widthExpression )
1674 width = widthExpression->
evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toDouble();
1681 Q_UNUSED( context );
1684 return QColor( Qt::black );
1691 return Qt::SolidLine;
1695 return Qt::SolidLine;
1708 mPatternWidth( width ),
1715 setDefaultSvgParams();
1729 setDefaultSvgParams();
1781 setDefaultSvgParams();
1791 if ( properties.contains(
"width" ) )
1793 width = properties[
"width"].toDouble();
1795 if ( properties.contains(
"svgFile" ) )
1797 QString svgName = properties[
"svgFile"];
1799 svgFilePath = ( savePath.isEmpty() ? svgName : savePath );
1801 if ( properties.contains(
"angle" ) )
1803 angle = properties[
"angle"].toDouble();
1807 if ( !svgFilePath.isEmpty() )
1813 if ( properties.contains(
"data" ) )
1815 data = QByteArray::fromHex( properties[
"data"].toLocal8Bit() );
1821 if ( properties.contains(
"svgFillColor" ) )
1826 else if ( properties.contains(
"color" ) )
1830 if ( properties.contains(
"svgOutlineColor" ) )
1835 else if ( properties.contains(
"outline_color" ) )
1839 else if ( properties.contains(
"line_color" ) )
1843 if ( properties.contains(
"svgOutlineWidth" ) )
1848 else if ( properties.contains(
"outline_width" ) )
1852 else if ( properties.contains(
"line_width" ) )
1858 if ( properties.contains(
"pattern_width_unit" ) )
1862 if ( properties.contains(
"pattern_width_map_unit_scale" ) )
1866 if ( properties.contains(
"svg_outline_width_unit" ) )
1870 if ( properties.contains(
"svg_outline_width_map_unit_scale" ) )
1874 if ( properties.contains(
"outline_width_unit" ) )
1878 if ( properties.contains(
"outline_width_map_unit_scale" ) )
1883 if ( properties.contains(
"width_expression" ) )
1885 if ( properties.contains(
"svgFile_expression" ) )
1887 if ( properties.contains(
"angle_expression" ) )
1889 if ( properties.contains(
"svgFillColor_expression" ) )
1891 if ( properties.contains(
"svgOutlineColor_expression" ) )
1893 if ( properties.contains(
"svgOutlineWidth_expression" ) )
1918 if ((
int )size < 1.0 || 10000.0 < size )
1925 bool fitsInCache =
true;
1933 double hwRatio = 1.0;
1934 if ( patternPict.width() > 0 )
1936 hwRatio = ( double )patternPict.height() / ( double )patternPict.width();
1938 mSvgPattern =
new QImage((
int )size, (
int )( size * hwRatio ), QImage::Format_ARGB32_Premultiplied );
1942 p.drawPicture( QPointF( size / 2, size * hwRatio / 2 ), patternPict );
1945 QTransform brushTransform;
1949 QImage transparentImage = fitsInCache ? patternImage.copy() :
mSvgPattern->copy();
1951 brush.setTextureImage( transparentImage );
1955 brush.setTextureImage( fitsInCache ? patternImage : *
mSvgPattern );
1957 brush.setTransform( brushTransform );
1964 applyPattern(
mBrush,
mSvgFilePath,
mPatternWidth,
mPatternWidthUnit,
mColor,
mSvgOutlineColor,
mSvgOutlineWidth,
mSvgOutlineWidthUnit, context,
mPatternWidthMapUnitScale,
mSvgOutlineWidthMapUnitScale );
1991 map.insert(
"data", QString(
mSvgData.toHex() ) );
1995 map.insert(
"angle", QString::number(
mAngle ) );
2046 QDomElement symbolizerElem = doc.createElement(
"se:PolygonSymbolizer" );
2047 if ( !props.value(
"uom",
"" ).isEmpty() )
2048 symbolizerElem.setAttribute(
"uom", props.value(
"uom",
"" ) );
2049 element.appendChild( symbolizerElem );
2053 QDomElement fillElem = doc.createElement(
"se:Fill" );
2054 symbolizerElem.appendChild( fillElem );
2056 QDomElement graphicFillElem = doc.createElement(
"se:GraphicFill" );
2057 fillElem.appendChild( graphicFillElem );
2059 QDomElement graphicElem = doc.createElement(
"se:Graphic" );
2060 graphicFillElem.appendChild( graphicElem );
2070 symbolizerElem.appendChild( doc.createComment(
"SVG from data not implemented yet" ) );
2081 double angle = props.value(
"angle",
"0" ).toDouble( &ok );
2084 angleFunc = QString(
"%1 + %2" ).arg( props.value(
"angle",
"0" ) ).arg(
mAngle );
2086 else if ( angle +
mAngle != 0 )
2088 angleFunc = QString::number( angle +
mAngle );
2105 QString path, mimeType;
2107 Qt::PenStyle penStyle;
2108 double size, borderWidth;
2110 QDomElement fillElem = element.firstChildElement(
"Fill" );
2111 if ( fillElem.isNull() )
2114 QDomElement graphicFillElem = fillElem.firstChildElement(
"GraphicFill" );
2115 if ( graphicFillElem.isNull() )
2118 QDomElement graphicElem = graphicFillElem.firstChildElement(
"Graphic" );
2119 if ( graphicElem.isNull() )
2125 if ( mimeType !=
"image/svg+xml" )
2135 double d = angleFunc.toDouble( &ok );
2146 QDomElement strokeElem = element.firstChildElement(
"Stroke" );
2147 if ( !strokeElem.isNull() )
2169 if ( !widthExpression && !svgFileExpression && !fillColorExpression && !outlineColorExpression && !outlineWidthExpression && !angleExpression )
2174 if ( angleExpression )
2180 if ( widthExpression )
2182 width = widthExpression->
evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toDouble();
2185 if ( svgFileExpression )
2187 svgFile = svgFileExpression->
evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toString();
2190 if ( fillColorExpression )
2195 if ( outlineColorExpression )
2200 if ( outlineWidthExpression )
2202 outlineWidth = outlineWidthExpression->
evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toDouble();
2209 void QgsSVGFillSymbolLayer::storeViewBox()
2225 void QgsSVGFillSymbolLayer::setDefaultSvgParams()
2228 mColor = QColor( 0, 0, 0 );
2237 bool hasFillParam, hasOutlineParam, hasOutlineWidthParam;
2238 QColor defaultFillColor, defaultOutlineColor;
2239 double defaultOutlineWidth;
2241 defaultOutlineWidth );
2245 mColor = defaultFillColor;
2247 if ( hasOutlineParam )
2251 if ( hasOutlineWidthParam )
2264 , mLineAngle( 45.0 )
2267 , mFillLineSymbol( 0 )
2287 delete mFillLineSymbol;
2302 delete mFillLineSymbol;
2303 mFillLineSymbol = lineSymbol;
2314 return mFillLineSymbol;
2320 if ( mFillLineSymbol )
2375 QColor
color( Qt::black );
2378 if ( properties.contains(
"lineangle" ) )
2381 lineAngle = properties[
"lineangle"].toDouble();
2383 else if ( properties.contains(
"angle" ) )
2385 lineAngle = properties[
"angle"].toDouble();
2389 if ( properties.contains(
"distance" ) )
2391 distance = properties[
"distance"].toDouble();
2395 if ( properties.contains(
"linewidth" ) )
2398 lineWidth = properties[
"linewidth"].toDouble();
2400 else if ( properties.contains(
"outline_width" ) )
2402 lineWidth = properties[
"outline_width"].toDouble();
2404 else if ( properties.contains(
"line_width" ) )
2406 lineWidth = properties[
"line_width"].toDouble();
2410 if ( properties.contains(
"color" ) )
2414 else if ( properties.contains(
"outline_color" ) )
2418 else if ( properties.contains(
"line_color" ) )
2424 if ( properties.contains(
"offset" ) )
2426 offset = properties[
"offset"].toDouble();
2431 if ( properties.contains(
"distance_unit" ) )
2435 if ( properties.contains(
"distance_map_unit_scale" ) )
2439 if ( properties.contains(
"line_width_unit" ) )
2443 else if ( properties.contains(
"outline_width_unit" ) )
2447 if ( properties.contains(
"line_width_map_unit_scale" ) )
2451 if ( properties.contains(
"offset_unit" ) )
2455 if ( properties.contains(
"offset_map_unit_scale" ) )
2459 if ( properties.contains(
"outline_width_unit" ) )
2463 if ( properties.contains(
"outline_width_map_unit_scale" ) )
2470 if ( properties.contains(
"lineangle_expression" ) )
2474 if ( properties.contains(
"distance_expression" ) )
2478 if ( properties.contains(
"linewidth_expression" ) )
2482 if ( properties.contains(
"color_expression" ) )
2486 return patternLayer;
2491 return "LinePatternFill";
2500 mBrush.setTextureImage( QImage() );
2502 if ( !mFillLineSymbol )
2508 if ( !fillLineSymbol )
2520 double outputPixelBleed = 0;
2521 double outputPixelInterval = 0;
2533 outputPixelBleed = qMax( outputPixelBleed, outputPixelLayerBleed );
2536 if ( markerLineLayer )
2545 outputPixelInterval = qMax( outputPixelInterval, outputPixelLayerInterval );
2549 if ( outputPixelInterval > 0 )
2553 double intervalScale = qRound( outputPixelInterval ) / outputPixelInterval;
2554 outputPixelInterval = qRound( outputPixelInterval );
2561 if ( markerLineLayer )
2572 height = outputPixelDist;
2573 width = outputPixelInterval > 0 ? outputPixelInterval : height;
2577 width = outputPixelDist;
2578 height = outputPixelInterval > 0 ? outputPixelInterval : width;
2586 lineAngle = 180 * atan2((
double ) height, (
double ) width ) /
M_PI;
2592 height = qAbs( height );
2593 width = qAbs( width );
2599 int offsetHeight = qRound( qAbs( outputPixelOffset / cos(
lineAngle *
M_PI / 180 ) ) );
2600 outputPixelOffset = offsetHeight * cos(
lineAngle *
M_PI / 180 );
2609 int bufferMulti = qMax( qCeil( outputPixelBleed / width ), qCeil( outputPixelBleed / width ) );
2613 bufferMulti = qMax( bufferMulti, 1 );
2615 int xBuffer = width * bufferMulti;
2616 int yBuffer = height * bufferMulti;
2617 int innerWidth = width;
2618 int innerHeight = height;
2619 width += 2 * xBuffer;
2620 height += 2 * yBuffer;
2622 if ( width > 10000 || height > 10000 )
2627 QImage patternImage( width, height, QImage::Format_ARGB32 );
2628 patternImage.fill( 0 );
2630 QPointF p1, p2, p3, p4, p5, p6;
2633 p1 = QPointF( 0, yBuffer );
2634 p2 = QPointF( width, yBuffer );
2635 p3 = QPointF( 0, yBuffer + innerHeight );
2636 p4 = QPointF( width, yBuffer + innerHeight );
2640 p1 = QPointF( xBuffer, height );
2641 p2 = QPointF( xBuffer, 0 );
2642 p3 = QPointF( xBuffer + innerWidth, height );
2643 p4 = QPointF( xBuffer + innerWidth, 0 );
2647 dx = outputPixelDist * cos(( 90 -
lineAngle ) *
M_PI / 180.0 );
2648 dy = outputPixelDist * sin(( 90 -
lineAngle ) *
M_PI / 180.0 );
2649 p1 = QPointF( 0, height );
2650 p2 = QPointF( width, 0 );
2651 p3 = QPointF( -dx, height - dy );
2652 p4 = QPointF( width - dx, -dy );
2653 p5 = QPointF( dx, height + dy );
2654 p6 = QPointF( width + dx, dy );
2658 dx = outputPixelDist * cos(( 90 -
lineAngle ) *
M_PI / 180.0 );
2659 dy = outputPixelDist * sin(( 90 -
lineAngle ) *
M_PI / 180.0 );
2660 p1 = QPointF( width, 0 );
2661 p2 = QPointF( 0, height );
2662 p3 = QPointF( width - dx, -dy );
2663 p4 = QPointF( -dx, height - dy );
2664 p5 = QPointF( width + dx, dy );
2665 p6 = QPointF( dx, height + dy );
2669 dy = outputPixelDist * cos(( 180 -
lineAngle ) *
M_PI / 180 );
2670 dx = outputPixelDist * sin(( 180 -
lineAngle ) *
M_PI / 180 );
2671 p1 = QPointF( 0, 0 );
2672 p2 = QPointF( width, height );
2673 p5 = QPointF( dx, -dy );
2674 p6 = QPointF( width + dx, height - dy );
2675 p3 = QPointF( -dx, dy );
2676 p4 = QPointF( width - dx, height + dy );
2680 dy = outputPixelDist * cos(( 180 -
lineAngle ) *
M_PI / 180 );
2681 dx = outputPixelDist * sin(( 180 -
lineAngle ) *
M_PI / 180 );
2682 p1 = QPointF( width, height );
2683 p2 = QPointF( 0, 0 );
2684 p5 = QPointF( width + dx, height - dy );
2685 p6 = QPointF( dx, -dy );
2686 p3 = QPointF( width - dx, height + dy );
2687 p4 = QPointF( -dx, dy );
2694 p3 = QPointF( tempPt.x(), tempPt.y() );
2696 p4 = QPointF( tempPt.x(), tempPt.y() );
2698 p5 = QPointF( tempPt.x(), tempPt.y() );
2700 p6 = QPointF( tempPt.x(), tempPt.y() );
2704 p1 = QPointF( tempPt.x(), tempPt.y() );
2706 p2 = QPointF( tempPt.x(), tempPt.y() );;
2709 QPainter p( &patternImage );
2713 p.setRenderHint( QPainter::Antialiasing,
false );
2714 QPen pen( QColor( Qt::black ) );
2715 pen.setWidthF( 0.1 );
2716 pen.setCapStyle( Qt::FlatCap );
2721 QPolygon polygon = QPolygon() << QPoint( 0, 0 ) << QPoint( width - 1, 0 ) << QPoint( width - 1, height - 1 ) << QPoint( 0, height - 1 ) << QPoint( 0, 0 );
2722 p.drawPolygon( polygon );
2724 polygon = QPolygon() << QPoint( xBuffer, yBuffer ) << QPoint( width - xBuffer - 1, yBuffer ) << QPoint( width - xBuffer - 1, height - yBuffer - 1 ) << QPoint( xBuffer, height - yBuffer - 1 ) << QPoint( xBuffer, yBuffer );
2725 p.drawPolygon( polygon );
2731 p.setRenderHint( QPainter::Antialiasing,
true );
2744 QVector<QPolygonF> polygons;
2745 polygons.append( QPolygonF() << p1 << p2 );
2746 polygons.append( QPolygonF() << p3 << p4 );
2749 polygons.append( QPolygonF() << p5 << p6 );
2752 foreach ( QPolygonF polygon, polygons )
2757 fillLineSymbol->
stopRender( lineRenderContext );
2761 patternImage = patternImage.copy( xBuffer, yBuffer, patternImage.width() - 2 * xBuffer, patternImage.height() - 2 * yBuffer );
2766 QImage transparentImage = patternImage.copy();
2768 brush.setTextureImage( transparentImage );
2772 brush.setTextureImage( patternImage );
2775 QTransform brushTransform;
2777 brush.setTransform( brushTransform );
2779 delete fillLineSymbol;
2786 if ( mFillLineSymbol )
2801 map.insert(
"angle", QString::number(
mLineAngle ) );
2802 map.insert(
"distance", QString::number(
mDistance ) );
2803 map.insert(
"line_width", QString::number(
mLineWidth ) );
2805 map.insert(
"offset", QString::number(
mOffset ) );
2821 if ( mFillLineSymbol )
2830 QDomElement symbolizerElem = doc.createElement(
"se:PolygonSymbolizer" );
2831 if ( !props.value(
"uom",
"" ).isEmpty() )
2832 symbolizerElem.setAttribute(
"uom", props.value(
"uom",
"" ) );
2833 element.appendChild( symbolizerElem );
2838 QDomElement fillElem = doc.createElement(
"se:Fill" );
2839 symbolizerElem.appendChild( fillElem );
2841 QDomElement graphicFillElem = doc.createElement(
"se:GraphicFill" );
2842 fillElem.appendChild( graphicFillElem );
2844 QDomElement graphicElem = doc.createElement(
"se:Graphic" );
2845 graphicFillElem.appendChild( graphicElem );
2848 QColor lineColor = mFillLineSymbol ? mFillLineSymbol->
color() : QColor();
2849 double lineWidth = mFillLineSymbol ? mFillLineSymbol->
width() : 0.0;
2855 double angle = props.value(
"angle",
"0" ).toDouble( &ok );
2858 angleFunc = QString(
"%1 + %2" ).arg( props.value(
"angle",
"0" ) ).arg(
mLineAngle );
2862 angleFunc = QString::number( angle +
mLineAngle );
2873 QString featureStyle;
2874 featureStyle.append(
"Brush(" );
2875 featureStyle.append( QString(
"fc:%1" ).arg(
mColor.name() ) );
2876 featureStyle.append( QString(
",bc:%1" ).arg(
"#00000000" ) );
2877 featureStyle.append(
",id:\"ogr-brush-2\"" );
2878 featureStyle.append( QString(
",a:%1" ).arg(
mLineAngle ) );
2879 featureStyle.append( QString(
",s:%1" ).arg(
mLineWidth * widthScaleFactor ) );
2880 featureStyle.append(
",dx:0mm" );
2881 featureStyle.append( QString(
",dy:%1mm" ).arg(
mDistance * widthScaleFactor ) );
2882 featureStyle.append(
")" );
2883 return featureStyle;
2892 if ( !lineAngleExpression && !distanceExpression && !lineWidthExpression && !colorExpression )
2898 if ( lineAngleExpression )
2900 lineAngle = lineAngleExpression->
evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toDouble();
2903 if ( distanceExpression )
2905 distance = distanceExpression->
evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toDouble();
2908 if ( lineWidthExpression )
2910 lineWidth = lineWidthExpression->
evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toDouble();
2913 if ( colorExpression )
2917 applyPattern( context,
mBrush, lineAngle, distance, lineWidth, color );
2927 Qt::PenStyle lineStyle;
2929 QDomElement fillElem = element.firstChildElement(
"Fill" );
2930 if ( fillElem.isNull() )
2933 QDomElement graphicFillElem = fillElem.firstChildElement(
"GraphicFill" );
2934 if ( graphicFillElem.isNull() )
2937 QDomElement graphicElem = graphicFillElem.firstChildElement(
"Graphic" );
2938 if ( graphicElem.isNull() )
2944 if ( name !=
"horline" )
2952 double d = angleFunc.toDouble( &ok );
2961 offset = sqrt( pow( vectOffset.x(), 2 ) + pow( vectOffset.y(), 2 ) );
2972 QDomElement strokeElem = element.firstChildElement(
"Stroke" );
2973 if ( !strokeElem.isNull() )
2992 mDisplacementY( 0 ), mDisplacementYUnit(
QgsSymbolV2::MM )
3050 if ( properties.contains(
"distance_x" ) )
3052 layer->
setDistanceX( properties[
"distance_x"].toDouble() );
3054 if ( properties.contains(
"distance_y" ) )
3056 layer->
setDistanceY( properties[
"distance_y"].toDouble() );
3058 if ( properties.contains(
"displacement_x" ) )
3062 if ( properties.contains(
"displacement_y" ) )
3067 if ( properties.contains(
"distance_x_unit" ) )
3071 if ( properties.contains(
"distance_x_map_unit_scale" ) )
3075 if ( properties.contains(
"distance_y_unit" ) )
3079 if ( properties.contains(
"distance_y_map_unit_scale" ) )
3083 if ( properties.contains(
"displacement_x_unit" ) )
3087 if ( properties.contains(
"displacement_x_map_unit_scale" ) )
3091 if ( properties.contains(
"displacement_y_unit" ) )
3095 if ( properties.contains(
"displacement_y_map_unit_scale" ) )
3099 if ( properties.contains(
"outline_width_unit" ) )
3103 if ( properties.contains(
"outline_width_map_unit_scale" ) )
3109 if ( properties.contains(
"distance_x_expression" ) )
3113 if ( properties.contains(
"distance_y_expression" ) )
3117 if ( properties.contains(
"displacement_x_expression" ) )
3121 if ( properties.contains(
"displacement_y_expression" ) )
3130 return "PointPatternFill";
3141 if ( width > 10000 || height > 10000 )
3144 brush.setTextureImage( img );
3148 QImage patternImage( width, height, QImage::Format_ARGB32 );
3149 patternImage.fill( 0 );
3153 QPainter p( &patternImage );
3187 QImage transparentImage = patternImage.copy();
3189 brush.setTextureImage( transparentImage );
3193 brush.setTextureImage( patternImage );
3195 QTransform brushTransform;
3197 brush.setTransform( brushTransform );
3222 map.insert(
"distance_x", QString::number(
mDistanceX ) );
3223 map.insert(
"distance_y", QString::number(
mDistanceY ) );
3224 map.insert(
"displacement_x", QString::number(
mDisplacementX ) );
3225 map.insert(
"displacement_y", QString::number(
mDisplacementY ) );
3254 QDomElement symbolizerElem = doc.createElement(
"se:PolygonSymbolizer" );
3255 if ( !props.value(
"uom",
"" ).isEmpty() )
3256 symbolizerElem.setAttribute(
"uom", props.value(
"uom",
"" ) );
3257 element.appendChild( symbolizerElem );
3262 QDomElement fillElem = doc.createElement(
"se:Fill" );
3263 symbolizerElem.appendChild( fillElem );
3265 QDomElement graphicFillElem = doc.createElement(
"se:GraphicFill" );
3266 fillElem.appendChild( graphicFillElem );
3271 symbolizerElem.appendChild( distanceElem );
3277 QString errorMsg = QString(
"MarkerSymbolLayerV2 expected, %1 found. Skip it." ).arg( layer->
layerType() );
3278 graphicFillElem.appendChild( doc.createComment( errorMsg ) );
3289 Q_UNUSED( element );
3318 if ( !distanceXExpression && !distanceYExpression && !displacementXExpression && !displacementYExpression )
3325 if ( distanceXExpression )
3327 distanceX = distanceXExpression->
evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toDouble();
3330 if ( distanceYExpression )
3332 distanceY = distanceYExpression->
evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toDouble();
3335 if ( displacementXExpression )
3337 displacementX = displacementXExpression->
evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toDouble();
3340 if ( displacementYExpression )
3342 displacementY = displacementYExpression->
evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toDouble();
3344 applyPattern( context,
mBrush, distanceX, distanceY, displacementX, displacementY );
3379 if ( properties.contains(
"point_on_surface" ) )
3387 return "CentroidFill";
3479 QSet<QString> attributes;
3528 , mImageFilePath( imageFilePath )
3552 if ( properties.contains(
"imageFile" ) )
3554 imagePath = properties[
"imageFile"];
3556 if ( properties.contains(
"coordinate_mode" ) )
3560 if ( properties.contains(
"alpha" ) )
3562 alpha = properties[
"alpha"].toDouble();
3564 if ( properties.contains(
"offset" ) )
3568 if ( properties.contains(
"angle" ) )
3570 angle = properties[
"angle"].toDouble();
3572 if ( properties.contains(
"width" ) )
3574 width = properties[
"width"].toDouble();
3582 if ( properties.contains(
"offset_unit" ) )
3586 if ( properties.contains(
"offset_map_unit_scale" ) )
3590 if ( properties.contains(
"width_unit" ) )
3594 if ( properties.contains(
"width_map_unit_scale" ) )
3600 if ( properties.contains(
"file_expression" ) )
3604 if ( properties.contains(
"alpha_expression" ) )
3608 if ( properties.contains(
"angle_expression" ) )
3612 if ( properties.contains(
"width_expression" ) )
3627 return "RasterFill";
3643 p->translate( offset );
3647 QRectF boundingRect = points.boundingRect();
3648 mBrush.setTransform(
mBrush.transform().translate( boundingRect.left() -
mBrush.transform().dx(),
3649 boundingRect.top() -
mBrush.transform().dy() ) );
3655 p->translate( -offset );
3667 Q_UNUSED( context );
3675 map[
"alpha"] = QString::number(
mAlpha );
3679 map[
"angle"] = QString::number(
mAngle );
3680 map[
"width"] = QString::number(
mWidth );
3734 if ( !widthExpression && !angleExpression && !alphaExpression && !fileExpression )
3739 if ( angleExpression )
3744 if ( !widthExpression && !alphaExpression && !fileExpression )
3750 if ( widthExpression )
3752 width = widthExpression->
evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toDouble();
3755 if ( alphaExpression )
3757 alpha = alphaExpression->
evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toDouble();
3760 if ( fileExpression )
3762 file = fileExpression->
evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toString();
3764 applyPattern(
mBrush, file, width, alpha, context );
3770 if ( image.isNull() )
3774 if ( !image.hasAlphaChannel() )
3776 image = image.convertToFormat( QImage::Format_ARGB32 );
3786 pixelWidth = image.width();
3794 p.setCompositionMode( QPainter::CompositionMode_DestinationIn );
3795 QColor alphaColor( 0, 0, 0 );
3796 alphaColor.setAlphaF(
alpha );
3797 p.fillRect( image.rect(), alphaColor );
3804 image = image.scaledToWidth( pixelWidth, Qt::SmoothTransformation );
3807 brush.setTextureImage( image );
virtual QSet< QString > usedAttributes() const
QgsStringMap properties() const override
static double mapUnitScaleFactor(double scaleDenominator, QgsSymbolV2::OutputUnit symbolUnits, QGis::UnitType mapUnits)
QgsMapUnitScale mSvgOutlineWidthMapUnitScale
static QString encodeOutputUnit(QgsSymbolV2::OutputUnit unit)
void setBorderWidthMapUnitScale(const QgsMapUnitScale &scale)
QgsMapUnitScale mapUnitScale() const override
QgsSymbolV2 * subSymbol() override
Class for parsing and evaluation of expressions (formerly called "search strings").
ShapeburstColorType mColorType
bool ignoreRings() const
Returns whether the shapeburst fill is set to ignore polygon interior rings.
static Qt::BrushStyle decodeBrushStyle(QString str)
void setForceVectorOutput(bool force)
QgsSymbolV2::OutputUnit intervalUnit() const
QgsSymbolV2::OutputUnit patternWidthUnit() const
void setDistanceUnit(QgsSymbolV2::OutputUnit unit)
Sets the unit for the maximum distance to shade inside of the shape from the polygon's boundary...
QgsImageFillSymbolLayer()
double borderWidth() const
const QgsMapUnitScale & patternWidthMapUnitScale() const
#define DEFAULT_SIMPLEFILL_BORDERCOLOR
QString layerType() const override
void setDistance(double d)
void setOutputUnit(QgsSymbolV2::OutputUnit unit) override
void applyDataDefinedSettings(const QgsSymbolV2RenderContext &context) override
virtual QSet< QString > usedAttributes() const override
void setReferencePoint1(QPointF referencePoint)
Starting point of gradient fill, in the range [0,0] - [1,1].
QgsSymbolV2::OutputUnit mSvgOutlineWidthUnit
void setReferencePoint2IsCentroid(bool isCentroid)
Sets the end point of the gradient to be the feature centroid.
void startRender(QgsSymbolV2RenderContext &context) override
void setSvgOutlineWidth(double w)
QMap< QString, QgsExpression * > mDataDefinedProperties
static void multiplyImageOpacity(QImage *image, qreal alpha)
Multiplies opacity of image pixel values with a (global) transparency value.
QString ogrFeatureStyleWidth(double widthScaleFactor) const
QgsSymbolV2::OutputUnit mOffsetUnit
QgsStringMap properties() const override
FillCoordinateMode mCoordinateMode
QgsSymbolV2::OutputUnit mLineWidthUnit
virtual QString type() const =0
static Q_DECL_DEPRECATED bool wellKnownMarkerFromSld(QDomElement &element, QString &name, QColor &color, QColor &borderColor, double &borderWidth, double &size)
QgsMapUnitScale mLineWidthMapUnitScale
void setSvgFillColor(const QColor &c)
void setPatternWidthMapUnitScale(const QgsMapUnitScale &scale)
bool mReferencePoint1IsCentroid
void startRender(QgsSymbolV2RenderContext &context) override
static QgsSymbolLayerV2 * create(const QgsStringMap &properties=QgsStringMap())
void setDistanceYUnit(QgsSymbolV2::OutputUnit unit)
QString svgFilePath() const
void stopRender(QgsSymbolV2RenderContext &context) override
virtual void applyDataDefinedSettings(const QgsSymbolV2RenderContext &context)
void setOffsetUnit(QgsSymbolV2::OutputUnit unit)
const QPicture & svgAsPicture(const QString &file, double size, const QColor &fill, const QColor &outline, double outlineWidth, double widthScaleFactor, double rasterScaleFactor, bool forceVectorOutput=false)
Get SVG as QPicture&.
QVariant evaluate(const QgsFeature *f=NULL)
Evaluate the feature and return the result.
QColor selectionColor() const
QSet< QString > usedAttributes() const
void setOutlineWidthMapUnitScale(const QgsMapUnitScale &scale)
QPointF referencePoint2() const
void setMapUnitScale(const QgsMapUnitScale &scale) override
QgsLinePatternFillSymbolLayer()
double displacementX() const
bool setSubSymbol(QgsSymbolV2 *symbol) override
double svgOutlineWidth() const
Base class for polygon renderers generating texture images.
QgsMapUnitScale mOffsetMapUnitScale
void setOutputUnit(QgsSymbolV2::OutputUnit unit) override
QgsMapUnitScale mPatternWidthMapUnitScale
GradientCoordinateMode mCoordinateMode
static void createRotationElement(QDomDocument &doc, QDomElement &element, QString rotationFunc)
double rendererScale() const
void stopRender(QgsSymbolV2RenderContext &context) override
void setPointOnSurface(bool pointOnSurface)
static QgsSymbolLayerV2 * create(const QgsStringMap &properties=QgsStringMap())
QgsSymbolV2::OutputUnit svgOutlineWidthUnit() const
QgsSymbolLayerV2 * clone() const override
QGis::UnitType mapUnits() const
void setIgnoreRings(bool ignoreRings)
Sets whether the shapeburst fill should ignore polygon rings when calculating the buffered shading...
void setRendererScale(double scale)
void stopRender(QgsSymbolV2RenderContext &context) override
static QString ogrFeatureStyleBrush(const QColor &fillColr)
Create ogr feature style string for brush.
void setMapUnitScale(const QgsMapUnitScale &scale) override
void setDistanceMapUnitScale(const QgsMapUnitScale &scale)
static void fillToSld(QDomDocument &doc, QDomElement &element, Qt::BrushStyle brushStyle, QColor color=QColor())
void stopRender(QgsSymbolV2RenderContext &context) override
QString layerType() const override
const QgsMapUnitScale & intervalMapUnitScale() const
QgsMapUnitScale mapUnitScale() const
QString layerType() const override
QgsMapUnitScale mOutlineWidthMapUnitScale
Qt::BrushStyle dxfBrushStyle() const override
static QPointF decodePoint(QString str)
QgsSymbolV2::OutputUnit outputUnit() const override
void renderPolygon(const QPolygonF &points, QList< QPolygonF > *rings, QgsSymbolV2RenderContext &context) override
static bool externalGraphicFromSld(QDomElement &element, QString &path, QString &mime, QColor &color, double &size)
virtual QgsStringMap properties() const =0
static QDomElement createVendorOptionElement(QDomDocument &doc, QString name, QString value)
GradientType mGradientType
GradientCoordinateMode coordinateMode() const
Coordinate mode for gradient.
QgsSymbolV2::OutputUnit mWidthUnit
static QColor decodeColor(QString str)
QgsSymbolV2::OutputUnit mDisplacementXUnit
static QgsSymbolLayerV2 * createFromSld(QDomElement &element)
void stopRender(QgsSymbolV2RenderContext &context) override
void setDistanceXMapUnitScale(const QgsMapUnitScale &scale)
static const bool selectionIsOpaque
int blurRadius() const
Returns the blur radius, which controls the amount of blurring applied to the fill.
void setOutputUnit(QgsSymbolV2::OutputUnit unit) override
static QString encodeMapUnitScale(const QgsMapUnitScale &mapUnitScale)
void renderPolygon(const QPolygonF &points, QList< QPolygonF > *rings, QgsSymbolV2RenderContext &context) override
void renderPolygon(const QPolygonF &points, QList< QPolygonF > *rings, QgsSymbolV2RenderContext &context) override
double scaleFactor() const
virtual bool setSubSymbol(QgsSymbolV2 *symbol) override
double mDistance
Distance (in mm or map units) between lines.
static QgsSymbolLayerV2 * create(const QgsStringMap &properties=QgsStringMap())
void setSvgOutlineWidthUnit(QgsSymbolV2::OutputUnit unit)
QgsMapUnitScale mOffsetMapUnitScale
QgsStringMap properties() const override
static void createDisplacementElement(QDomDocument &doc, QDomElement &element, QPointF offset)
double mLineAngle
Vector line angle in degrees (0 = horizontal, counterclockwise)
bool setSubSymbol(QgsSymbolV2 *symbol) override
GradientSpread mGradientSpread
double estimateMaxBleed() const override
Returns the estimated maximum distance which the layer style will bleed outside the drawn shape...
void setMapUnitScale(const QgsMapUnitScale &scale) override
QColor color() const override
virtual QColor fillColor() const
Get fill color.
QgsMapUnitScale mDistanceYMapUnitScale
QgsVectorColorRampV2 * mGradientRamp
QString layerType() const override
void setOutputUnit(QgsSymbolV2::OutputUnit unit) override
QMap< QString, QString > QgsStringMap
void setColorRamp(QgsVectorColorRampV2 *ramp)
bool qgsDoubleNear(double a, double b, double epsilon=4 *DBL_EPSILON)
static double pixelSizeScaleFactor(const QgsRenderContext &c, QgsSymbolV2::OutputUnit u, const QgsMapUnitScale &scale=QgsMapUnitScale())
Returns scale factor painter units -> pixel dimensions.
void setWidth(double width)
void setMapUnitScale(const QgsMapUnitScale &scale)
QgsStringMap properties() const override
QgsMapUnitScale mapUnitScale() const override
virtual double estimateMaxBleed() const
Returns the estimated maximum distance which the layer style will bleed outside the drawn shape...
QgsSymbolV2::OutputUnit outputUnit() const override
void setSvgOutlineColor(const QColor &c)
static QString encodeColor(QColor color)
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
void setMapUnitScale(const QgsMapUnitScale &scale) override
void setInterval(double interval)
void toSld(QDomDocument &doc, QDomElement &element, QgsStringMap props) const override
void setDistanceUnit(QgsSymbolV2::OutputUnit unit)
virtual QgsExpression * expression(const QString &property) const
QgsMapUnitScale mDisplacementYMapUnitScale
void containsParams(const QString &path, bool &hasFillParam, QColor &defaultFillColor, bool &hasOutlineParam, QColor &defaultOutlineColor, bool &hasOutlineWidthParam, double &defaultOutlineWidth) const
Tests if an svg file contains parameters for fill, outline color, outline width.
static bool displacementFromSldElement(QDomElement &element, QPointF &offset)
qreal alpha() const
Get alpha transparency 1 for opaque, 0 for invisible.
static QgsSvgCache * instance()
static QString encodePenStyle(Qt::PenStyle style)
static QgsSymbolLayerV2 * create(const QgsStringMap &properties=QgsStringMap())
const QImage & svgAsImage(const QString &file, double size, const QColor &fill, const QColor &outline, double outlineWidth, double widthScaleFactor, double rasterScaleFactor, bool &fitsInCache)
Get SVG as QImage.
void toSld(QDomDocument &doc, QDomElement &element, QgsStringMap props) const override
QString mImageFilePath
Path to the image file.
QgsSymbolV2::OutputUnit mDisplacementYUnit
Perform transforms between map coordinates and device coordinates.
void setColor(const QColor &color)
static QString symbolPathToName(QString path)
Get symbols's name from its path.
virtual void writeSldMarker(QDomDocument &doc, QDomElement &element, QgsStringMap props) const
void setLineAngle(double a)
void setOutputUnit(QgsSymbolV2::OutputUnit unit) override
QgsSymbolV2::OutputUnit outputUnit() const override
void setImageFilePath(const QString &imagePath)
Sets the path to the raster image used for the fill.
static QgsSymbolLayerV2 * createMarkerLayerFromSld(QDomElement &element)
#define DEFAULT_SIMPLEFILL_BORDERSTYLE
void stopRender(QgsSymbolV2RenderContext &context) override
A class for filling symbols with a repeated raster image.
bool mReferencePoint2IsCentroid
void setOffset(QPointF offset)
Sets the offset for the shapeburst fill.
QByteArray mSvgData
SVG data.
Qt::PenStyle borderStyle() const
void setOutlineWidthUnit(QgsSymbolV2::OutputUnit unit)
QgsLineSymbolV2 * mOutline
Custom outline.
#define DEFAULT_SIMPLEFILL_STYLE
virtual ~QgsImageFillSymbolLayer()
QgsMapUnitScale mDistanceXMapUnitScale
static QString ogrFeatureStylePen(double width, double mmScaleFactor, double mapUnitsScaleFactor, const QColor &c, Qt::PenJoinStyle joinStyle=Qt::MiterJoin, Qt::PenCapStyle capStyle=Qt::FlatCap, double offset=0.0, const QVector< qreal > *dashPattern=0)
Create ogr feature style string for pen.
void startRender(QgsSymbolV2RenderContext &context) override
static bool fillFromSld(QDomElement &element, Qt::BrushStyle &brushStyle, QColor &color)
void setScaleFactor(double factor)
const QgsFeature * feature() const
Current feature being rendered - may be null.
QString layerType() const override
void setWidth(const double width)
Sets the width for scaling the image used in the fill.
void startRender(QgsSymbolV2RenderContext &context) override
double mOffset
Offset perpendicular to line direction.
QgsMapUnitScale mDistanceMapUnitScale
static QString encodePoint(QPointF point)
void setReferencePoint1IsCentroid(bool isCentroid)
Sets the starting point of the gradient to be the feature centroid.
QByteArray getImageData(const QString &path) const
Get image data.
void startRender(QgsRenderContext &context, const QgsFields *fields=0)
QgsSymbolLayerV2 * clone() const override
QgsSymbolV2::OutputUnit outputUnit() const override
static Qt::PenStyle decodePenStyle(QString str)
QgsVectorColorRampV2 * mTwoColorGradientRamp
void setLineWidthUnit(QgsSymbolV2::OutputUnit unit)
void toSld(QDomDocument &doc, QDomElement &element, QgsStringMap props) const
QgsSymbolV2::OutputUnit outputUnit() const override
QgsSymbolLayerV2 * clone() const override
virtual QgsVectorColorRampV2 * clone() const =0
virtual QSet< QString > usedAttributes() const override
~QgsCentroidFillSymbolLayerV2()
bool useWholeShape() const
Returns whether the shapeburst fill is set to cover the entire shape.
bool setSubSymbol(QgsSymbolV2 *symbol) override
static QgsSymbolLayerV2 * createFromSld(QDomElement &element)
virtual double estimateMaxBleed() const override
Returns the estimated maximum distance which the layer style will bleed outside the drawn shape...
static QgsSymbolLayerV2 * create(const QgsStringMap &properties=QgsStringMap())
void setOffsetUnit(QgsSymbolV2::OutputUnit unit)
double estimateMaxBleed() const override
Returns the estimated maximum distance which the layer style will bleed outside the drawn shape...
QgsMarkerSymbolV2 * mMarker
void setWidthMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the image's width.
QPointF offset() const
Returns the offset for the shapeburst fill.
void renderPolyline(const QPolygonF &points, const QgsFeature *f, QgsRenderContext &context, int layer=-1, bool selected=false)
static QString encodePenJoinStyle(Qt::PenJoinStyle style)
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
QgsMapUnitScale mapUnitScale() const override
void setAngle(double angle)
virtual double estimateMaxBleed() const override
Returns the estimated maximum distance which the layer style will bleed outside the drawn shape...
static QString symbolNameToPath(QString name)
Get symbol's path from its name.
void startRender(QgsSymbolV2RenderContext &context) override
QString imageFilePath() const
The path to the raster image used for the fill.
QgsSVGFillSymbolLayer(const QString &svgFilePath="", double width=20, double rotation=0.0)
~QgsLinePatternFillSymbolLayer()
virtual QgsSymbolV2 * clone() const override
void setDistanceYMapUnitScale(const QgsMapUnitScale &scale)
Qt::PenStyle mBorderStyle
QColor svgFillColor() const
QgsMapUnitScale mOffsetMapUnitScale
int symbolLayerCount()
Returns total number of symbol layers contained in the symbol.
QgsSymbolV2::OutputUnit mOffsetUnit
QgsCentroidFillSymbolLayerV2()
void setPainter(QPainter *p)
double rasterScaleFactor() const
ShapeburstColorType colorType() const
Returns the color mode used for the shapeburst fill.
QgsSymbolV2::OutputUnit outputUnit() const override
static const bool selectFillStyle
double patternWidth() const
void renderPolygon(const QPolygonF &points, QList< QPolygonF > *rings, QgsSymbolV2RenderContext &context) override
double mapUnitsPerPixel() const
Return current map units per pixel.
virtual QColor color() const
void toSld(QDomDocument &doc, QDomElement &element, QgsStringMap props) const override
static QgsSymbolLayerV2 * create(const QgsStringMap &properties=QgsStringMap())
GradientColorType gradientColorType() const
Gradient color mode, controls how gradient color stops are created.
void setDisplacementXUnit(QgsSymbolV2::OutputUnit unit)
void setCoordinateMode(const FillCoordinateMode mode)
Set the coordinate mode for fill.
QgsStringMap properties() const override
virtual bool setSubSymbol(QgsSymbolV2 *symbol) override
QgsMapUnitScale mOffsetMapUnitScale
QString layerType() const override
QgsSymbolV2::OutputUnit mOffsetUnit
void renderPoint(const QPointF &point, const QgsFeature *f, QgsRenderContext &context, int layer=-1, bool selected=false)
virtual void prepareExpressions(const QgsFields *fields, double scale=-1.0)
void startRender(QgsSymbolV2RenderContext &context) override
QgsMapUnitScale mDisplacementXMapUnitScale
void setBorderWidthUnit(QgsSymbolV2::OutputUnit unit)
void setLineWidthMapUnitScale(const QgsMapUnitScale &scale)
QSet< QString > usedAttributes() const override
QString layerType() const override
void setDisplacementXMapUnitScale(const QgsMapUnitScale &scale)
QgsMapUnitScale mOffsetMapUnitScale
QgsSymbolV2::OutputUnit mOffsetUnit
void startRender(QgsSymbolV2RenderContext &context) override
QPointF referencePoint1() const
void setOutputUnit(QgsSymbolV2::OutputUnit unit) override
QString mSvgFilePath
Path to the svg file (or empty if constructed directly from data)
QgsSymbolV2::SymbolType type() const
virtual QColor color(double value) const =0
QgsSymbolV2::OutputUnit mOffsetUnit
QgsSymbolV2::OutputUnit mOutlineWidthUnit
QgsStringMap properties() const override
double mOutlineWidth
Outline width.
void setDistanceXUnit(QgsSymbolV2::OutputUnit unit)
double mLineWidth
Line width (in mm or map units)
QgsVectorColorRampV2 * mGradientRamp
QColor svgOutlineColor() const
void applyDataDefinedSettings(const QgsSymbolV2RenderContext &context) override
void toSld(QDomDocument &doc, QDomElement &element, QgsStringMap props) const override
QgsMapUnitScale mapUnitScale() const override
GradientSpread gradientSpread() const
Gradient spread mode.
QgsStringMap properties() const override
static QgsSymbolLayerV2 * createLineLayerFromSld(QDomElement &element)
QgsMapUnitScale mapUnitScale() const override
static QgsSymbolLayerV2 * createFromSld(QDomElement &element)
QgsSymbolLayerV2 * clone() const override
QColor color2() const
Returns the color used for the endpoint of the shapeburst fill.
void setOffset(QPointF offset)
Offset for gradient fill.
virtual QString layerType() const =0
virtual ~QgsShapeburstFillSymbolLayerV2()
void setDisplacementY(double d)
double symbologyScaleDenominator() const
double estimateMaxBleed() const override
Returns the estimated maximum distance which the layer style will bleed outside the drawn shape...
void setOffsetUnit(QgsSymbolV2::OutputUnit unit)
Sets the units used for the offset for the shapeburst fill.
QgsSymbolV2::OutputUnit mDistanceYUnit
QString layerType() const override
double estimateMaxBleed() const override
Returns the estimated maximum distance which the layer style will bleed outside the drawn shape...
static QgsVectorColorRampV2 * create(const QgsStringMap &properties=QgsStringMap())
void setOffset(QPointF offset)
QgsRasterFillSymbolLayer(const QString &imageFilePath=QString())
void setLineWidth(double w)
Qt::PenJoinStyle mPenJoinStyle
QgsMapUnitScale mWidthMapUnitScale
QColor dxfBrushColor(const QgsSymbolV2RenderContext &context) const override
virtual double dxfWidth(const QgsDxfExport &e, const QgsSymbolV2RenderContext &context) const override
A class for svg fill patterns.
void setMapUnitScale(const QgsMapUnitScale &scale) override
static void lineToSld(QDomDocument &doc, QDomElement &element, Qt::PenStyle penStyle, QColor color, double width=-1, const Qt::PenJoinStyle *penJoinStyle=0, const Qt::PenCapStyle *penCapStyle=0, const QVector< qreal > *customDashPattern=0, double dashOffset=0.0)
static void createGeometryElement(QDomDocument &doc, QDomElement &element, QString geomFunc)
QgsMapUnitScale mapUnitScale() const override
Contains information about the context of a rendering operation.
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the fill's offset.
Qt::BrushStyle mBrushStyle
QColor color2() const
Color for endpoint of gradient, only used if the gradient color type is set to SimpleTwoColor.
void stopRender(QgsRenderContext &context)
QgsMapUnitScale mBorderWidthMapUnitScale
QPointF offset() const
Returns the offset for the fill.
static QString encodeBrushStyle(Qt::BrushStyle style)
static double lineWidthScaleFactor(const QgsRenderContext &c, QgsSymbolV2::OutputUnit u, const QgsMapUnitScale &scale=QgsMapUnitScale())
Returns the line width scale factor depending on the unit and the paint device.
GradientColorType mGradientColorType
QgsPointPatternFillSymbolLayer()
Struct for storing maximum and minimum scales for measurements in map units.
QgsSymbolV2::OutputUnit mDistanceXUnit
QgsMapUnitScale mDistanceMapUnitScale
void toSld(QDomDocument &doc, QDomElement &element, QgsStringMap props) const override
QgsGradientFillSymbolLayerV2(QColor color=DEFAULT_SIMPLEFILL_COLOR, QColor color2=Qt::white, GradientColorType gradientColorType=SimpleTwoColor, GradientType gradientType=Linear, GradientCoordinateMode coordinateMode=Feature, GradientSpread gradientSpread=Pad)
void setDisplacementYUnit(QgsSymbolV2::OutputUnit unit)
QList< QgsSymbolLayerV2 * > QgsSymbolLayerV2List
void applyDataDefinedSettings(const QgsSymbolV2RenderContext &context) override
QgsSymbolV2::OutputUnit outputUnit() const override
void setSvgFilePath(const QString &svgPath)
QgsStringMap properties() const override
QgsRenderContext & renderContext()
QgsSymbolV2::OutputUnit mBorderWidthUnit
Qt::PenJoinStyle penJoinStyle() const
static QgsSymbolLayerV2 * createFromSld(QDomElement &element)
void setOutputUnit(QgsSymbolV2::OutputUnit unit) override
static QgsSymbolLayerV2 * create(const QgsStringMap &properties=QgsStringMap())
virtual ~QgsGradientFillSymbolLayerV2()
void setColorRamp(QgsVectorColorRampV2 *ramp)
Sets the color ramp used to draw the shapeburst fill.
void setMapToPixel(const QgsMapToPixel &mtp)
QgsSymbolV2::OutputUnit outputUnit() const
void setOffset(const QPointF &offset)
Sets the offset for the fill.
QString ogrFeatureStyle(double mmScaleFactor, double mapUnitScaleFactor) const override
static void externalGraphicToSld(QDomDocument &doc, QDomElement &element, QString path, QString mime, QColor color, double size=-1)
QgsSymbolV2::OutputUnit mDistanceUnit
void renderPolygon(const QPolygonF &points, QList< QPolygonF > *rings, QgsSymbolV2RenderContext &context) override
void setDistanceY(double d)
QgsSymbolLayerV2 * clone() const override
QgsMarkerSymbolV2 * mMarkerSymbol
void setDisplacementYMapUnitScale(const QgsMapUnitScale &scale)
static Q_DECL_DEPRECATED void wellKnownMarkerToSld(QDomDocument &doc, QDomElement &element, QString name, QColor color, QColor borderColor=QColor(), double borderWidth=-1, double size=-1)
const QgsMapToPixel & mapToPixel() const
void setAlpha(const double alpha)
Sets the opacity for the raster image used in the fill.
QgsMapUnitScale mapUnitScale() const override
const QgsFields * fields() const
Fields of the layer.
QgsSymbolV2::OutputUnit outputUnit() const override
void startRender(QgsSymbolV2RenderContext &context) override
QgsSimpleFillSymbolLayerV2(QColor color=DEFAULT_SIMPLEFILL_COLOR, Qt::BrushStyle style=DEFAULT_SIMPLEFILL_STYLE, QColor borderColor=DEFAULT_SIMPLEFILL_BORDERCOLOR, Qt::PenStyle borderStyle=DEFAULT_SIMPLEFILL_BORDERSTYLE, double borderWidth=DEFAULT_SIMPLEFILL_BORDERWIDTH, Qt::PenJoinStyle penJoinStyle=DEFAULT_SIMPLEFILL_JOINSTYLE)
~QgsRasterFillSymbolLayer()
static Qt::PenJoinStyle decodePenJoinStyle(QString str)
QgsSymbolV2 * subSymbol() override
static bool rotationFromSldElement(QDomElement &element, QString &rotationFunc)
void applyDataDefinedSettings(const QgsSymbolV2RenderContext &context) override
GradientType gradientType() const
Type of gradient, eg linear or radial.
QColor borderColor() const
double estimateMaxBleed() const override
Returns the estimated maximum distance which the layer style will bleed outside the drawn shape...
QgsShapeburstFillSymbolLayerV2(QColor color=DEFAULT_SIMPLEFILL_COLOR, QColor color2=Qt::white, ShapeburstColorType colorType=SimpleTwoColor, int blurRadius=0, bool useWholeShape=true, double maxDistance=5)
void setDistanceX(double d)
QgsSymbolLayerV2 * clone() const override
void setMapUnitScale(const QgsMapUnitScale &scale) override
static QPointF polygonCentroid(const QPolygonF &points)
Calculate the centroid point of a QPolygonF.
void setRasterScaleFactor(double factor)
Qt::PenStyle dxfPenStyle() const override
QgsSymbolV2::OutputUnit mDistanceUnit
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
void setColor(const QColor &c) override
~QgsPointPatternFillSymbolLayer()
static QgsMapUnitScale decodeMapUnitScale(const QString &str)
QgsSymbolLayerV2 * symbolLayer(int layer)
Returns a specific symbol layers contained in the symbol.
static QgsSymbolLayerV2 * createFromSld(QDomElement &element)
void setOffset(double offset)
void setWidthUnit(const QgsSymbolV2::OutputUnit unit)
Sets the units for the image's width.
void setPatternWidthUnit(QgsSymbolV2::OutputUnit unit)
static bool lineFromSld(QDomElement &element, Qt::PenStyle &penStyle, QColor &color, double &width, Qt::PenJoinStyle *penJoinStyle=0, Qt::PenCapStyle *penCapStyle=0, QVector< qreal > *customDashPattern=0, double *dashOffset=0)
double width() const
Returns the width used for scaling the image used in the fill.
QgsSymbolV2::OutputUnit mPatternWidthUnit
static QPointF polygonPointOnSurface(const QPolygonF &points)
Calculate a point within of a QPolygonF.
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
void _renderPolygon(QPainter *p, const QPolygonF &points, const QList< QPolygonF > *rings, QgsSymbolV2RenderContext &context)
Default method to render polygon.
void setOutputUnit(QgsSymbolV2::OutputUnit unit) override
void addStopsToGradient(QGradient *gradient, double alpha=1)
copy color ramp stops to a QGradient
static const bool selectFillBorder
void setColor(const QColor &color) override
static QPointF pointOnLineWithDistance(const QPointF &startPoint, const QPointF &directionPoint, double distance)
Returns a point on the line from startPoint to directionPoint that is a certain distance away from th...
void setReferencePoint2(QPointF referencePoint)
End point of gradient fill, in the range [0,0] - [1,1].
QColor dxfColor(const QgsSymbolV2RenderContext &context) const override
virtual QgsSymbolV2 * clone() const override
const QgsMapUnitScale & svgOutlineWidthMapUnitScale() const
#define DEFAULT_SIMPLEFILL_JOINSTYLE
QgsSymbolLayerV2 * clone() const override
void setDisplacementX(double d)
void saveDataDefinedProperties(QgsStringMap &stringMap) const
Saves data defined properties to string map.
void setMapUnitScale(const QgsMapUnitScale &scale) override
void setOutputUnit(QgsSymbolV2::OutputUnit u)
QgsSymbolLayerV2 * clone() const override
void setAlpha(qreal alpha)
Set alpha transparency 1 for opaque, 0 for invisible.
virtual QColor dxfColor(const QgsSymbolV2RenderContext &context) const override
double displacementY() const
static void blurImageInPlace(QImage &image, const QRect &rect, int radius, bool alphaOnly)
Blurs an image in place, e.g.
void setMapUnitScale(const QgsMapUnitScale &scale) override
QgsMapUnitScale mapUnitScale() const override
QColor fillColor() const override
Get fill color.
static QgsSymbolLayerV2 * create(const QgsStringMap &properties=QgsStringMap())
void setOffsetUnit(const QgsSymbolV2::OutputUnit unit)
Sets the units for the fill's offset.
void stopRender(QgsSymbolV2RenderContext &context) override
static QgsSymbolV2::OutputUnit decodeOutputUnit(QString str)
void setDistanceMapUnitScale(const QgsMapUnitScale &scale)
virtual Qt::PenStyle dxfPenStyle() const override
#define DEFAULT_SIMPLEFILL_BORDERWIDTH
void copyDataDefinedProperties(QgsSymbolLayerV2 *destLayer) const
Copies data defined properties of this layer to another symbol layer.
static void premultiplyColor(QColor &rgb, int alpha)
Converts a QColor into a premultiplied ARGB QColor value using a specified alpha value.
void setOffsetUnit(QgsSymbolV2::OutputUnit unit)
Units for gradient fill offset.
void renderPolygon(const QPolygonF &points, QList< QPolygonF > *rings, QgsSymbolV2RenderContext &context) override
double dxfWidth(const QgsDxfExport &e, const QgsSymbolV2RenderContext &context) const override
QRectF mSvgViewBox
SVG view box (to keep the aspect ratio.
QImage * mSvgPattern
SVG pattern image.
double maxDistance() const
Returns the maximum distance from the shape's boundary which is shaded.
void setSvgOutlineWidthMapUnitScale(const QgsMapUnitScale &scale)
void stopRender(QgsSymbolV2RenderContext &context) override
double alpha() const
The opacity for the raster image used in the fill.
double mPatternWidth
Width of the pattern (in output units)
virtual void setDataDefinedProperty(const QString &property, const QString &expressionString)
#define DEFAULT_SIMPLEFILL_COLOR