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 )
145 if ( props.
contains(
"color_border" ) )
150 else if ( props.
contains(
"outline_color" ) )
154 else if ( props.
contains(
"line_color" ) )
159 if ( props.
contains(
"style_border" ) )
164 else if ( props.
contains(
"outline_style" ) )
168 else if ( props.
contains(
"line_style" ) )
172 if ( props.
contains(
"width_border" ) )
175 borderWidth = props[
"width_border"].toDouble();
177 else if ( props.
contains(
"outline_width" ) )
179 borderWidth = props[
"outline_width"].toDouble();
181 else if ( props.
contains(
"line_width" ) )
183 borderWidth = props[
"line_width"].toDouble();
187 if ( props.
contains(
"joinstyle" ) )
192 if ( props.
contains(
"border_width_unit" ) )
196 else if ( props.
contains(
"outline_width_unit" ) )
200 else if ( props.
contains(
"line_width_unit" ) )
204 if ( props.
contains(
"offset_unit" ) )
207 if ( props.
contains(
"border_width_map_unit_scale" ) )
209 if ( props.
contains(
"offset_map_unit_scale" ) )
231 if ( rasterScaleFactor != 1.0 )
326 if ( !props.
value(
"uom",
"" ).isEmpty() )
358 symbolStyle.
append(
";" );
369 Qt::BrushStyle fillStyle;
391 return penBleed + offsetBleed;
443 : mGradientColorType( colorType )
444 , mGradientRamp( NULL )
445 , mGradientType( gradientType )
446 , mCoordinateMode( coordinateMode )
447 , mGradientSpread( spread )
448 , mReferencePoint1(
QPointF( 0.5, 0 ) )
449 , mReferencePoint1IsCentroid( false )
450 , mReferencePoint2(
QPointF( 0.5, 1 ) )
451 , mReferencePoint2IsCentroid( false )
473 bool refPoint1IsCentroid =
false;
475 bool refPoint2IsCentroid =
false;
482 if ( props.
contains(
"coordinate_mode" ) )
486 if ( props.
contains(
"color_type" ) )
488 if ( props.
contains(
"gradient_color" ) )
493 else if ( props.
contains(
"color" ) )
497 if ( props.
contains(
"gradient_color2" ) )
502 if ( props.
contains(
"reference_point1" ) )
504 if ( props.
contains(
"reference_point1_iscentroid" ) )
505 refPoint1IsCentroid = props[
"reference_point1_iscentroid"].toInt();
506 if ( props.
contains(
"reference_point2" ) )
508 if ( props.
contains(
"reference_point2_iscentroid" ) )
509 refPoint2IsCentroid = props[
"reference_point2_iscentroid"].toInt();
511 angle = props[
"angle"].toDouble();
522 if ( props.
contains(
"offset_unit" ) )
524 if ( props.
contains(
"offset_map_unit_scale" ) )
547 return "GradientFill";
603 else if ( currentType ==
QObject::tr(
"conical" ) )
617 if ( currentCoordMode ==
QObject::tr(
"feature" ) )
621 else if ( currentCoordMode ==
QObject::tr(
"viewport" ) )
639 else if ( currentSpread ==
QObject::tr(
"repeat" ) )
643 else if ( currentSpread ==
QObject::tr(
"reflect" ) )
684 if ( refPoint1IsCentroid || refPoint2IsCentroid )
690 double centroidX = ( centroid.
x() - bbox.
left() ) / bbox.
width();
691 double centroidY = ( centroid.
y() - bbox.
top() ) / bbox.
height();
693 if ( refPoint1IsCentroid )
695 refPoint1X = centroidX;
696 refPoint1Y = centroidY;
698 if ( refPoint2IsCentroid )
700 refPoint2X = centroidX;
701 refPoint2Y = centroidY;
707 spread,
QPointF( refPoint1X, refPoint1Y ),
QPointF( refPoint2X, refPoint2Y ), angle );
710 QPointF QgsGradientFillSymbolLayerV2::rotateReferencePoint(
const QPointF & refPoint,
double angle )
719 QPointF rotatedReferencePoint = refLine.
p2();
721 if ( rotatedReferencePoint.
x() > 1 )
722 rotatedReferencePoint.
setX( 1 );
723 if ( rotatedReferencePoint.
x() < 0 )
724 rotatedReferencePoint.
setX( 0 );
725 if ( rotatedReferencePoint.
y() > 1 )
726 rotatedReferencePoint.
setY( 1 );
727 if ( rotatedReferencePoint.
y() < 0 )
728 rotatedReferencePoint.
setY( 0 );
730 return rotatedReferencePoint;
734 const QColor &color,
const QColor &color2,
const GradientColorType &gradientColorType,
736 const GradientCoordinateMode &coordinateMode,
const GradientSpread &gradientSpread,
737 const QPointF &referencePoint1,
const QPointF &referencePoint2,
const double angle )
746 QPointF rotatedReferencePoint1 = angle != 0 ? rotateReferencePoint( referencePoint1, angle ) : referencePoint1;
747 QPointF rotatedReferencePoint2 = angle != 0 ? rotateReferencePoint( referencePoint2, angle ) : referencePoint2;
751 switch ( gradientType )
754 gradient =
QLinearGradient( rotatedReferencePoint1, rotatedReferencePoint2 );
757 gradient =
QRadialGradient( rotatedReferencePoint1,
QLineF( rotatedReferencePoint1, rotatedReferencePoint2 ).length() );
763 switch ( coordinateMode )
772 switch ( gradientSpread )
775 gradient.
setSpread( QGradient::PadSpread );
778 gradient.
setSpread( QGradient::ReflectSpread );
781 gradient.
setSpread( QGradient::RepeatSpread );
800 brush =
QBrush( gradient );
826 applyDataDefinedSymbology( context, points );
919 int blurRadius,
bool useWholeShape,
double maxDistance ) :
921 mBlurRadius( blurRadius ),
922 mUseWholeShape( useWholeShape ),
923 mMaxDistance( maxDistance ),
925 mColorType( colorType ),
927 mGradientRamp( NULL ),
928 mTwoColorGradientRamp( 0 ),
929 mIgnoreRings( false ),
951 if ( props.
contains(
"color_type" ) )
955 if ( props.
contains(
"shapeburst_color" ) )
960 else if ( props.
contains(
"color" ) )
965 if ( props.
contains(
"shapeburst_color2" ) )
970 else if ( props.
contains(
"gradient_color2" ) )
974 if ( props.
contains(
"blur_radius" ) )
976 blurRadius = props[
"blur_radius"].toInt();
978 if ( props.
contains(
"use_whole_shape" ) )
980 useWholeShape = props[
"use_whole_shape"].toInt();
982 if ( props.
contains(
"max_distance" ) )
984 maxDistance = props[
"max_distance"].toDouble();
997 if ( props.
contains(
"offset_unit" ) )
1001 if ( props.
contains(
"distance_unit" ) )
1005 if ( props.
contains(
"offset_map_unit_scale" ) )
1009 if ( props.
contains(
"distance_map_unit_scale" ) )
1013 if ( props.
contains(
"ignore_rings" ) )
1029 return "ShapeburstFill";
1039 double& maxDistance,
bool& ignoreRings )
1103 Q_UNUSED( context );
1139 applyDataDefinedSymbology( context, color1, color2, blurRadius, useWholeShape, maxDistance, ignoreRings );
1142 int outputPixelMaxDist = 0;
1143 if ( !useWholeShape && maxDistance != 0 )
1160 int sideBuffer = 4 + ( blurRadius + 2 ) * 4;
1169 fillImage->
fill( Qt::black );
1172 QImage * alphaImage =
new QImage( fillImage->
width(), fillImage->
height(), QImage::Format_ARGB32_Premultiplied );
1174 alphaImage->
fill( Qt::transparent );
1178 imgPainter.
begin( alphaImage );
1189 imgPainter.
begin( fillImage );
1192 imgPainter.
drawImage( 0, 0, *alphaImage );
1208 double * dtArray = distanceTransform( fillImage );
1222 if ( blurRadius > 0 )
1228 imgPainter.
begin( fillImage );
1230 imgPainter.
drawImage( 0, 0, *alphaImage );
1262 void QgsShapeburstFillSymbolLayerV2::distanceTransform1d(
double *f,
int n,
int *v,
double *z,
double *d )
1268 for (
int q = 1; q <= n - 1; q++ )
1270 double s = (( f[q] + q * q ) - ( f[v[k]] + ( v[k] * v[k] ) ) ) / ( 2 * q - 2 * v[k] );
1274 s = (( f[q] + q * q ) - ( f[v[k]] + ( v[k] * v[k] ) ) ) / ( 2 * q - 2 * v[k] );
1283 for (
int q = 0; q <= n - 1; q++ )
1285 while ( z[k+1] < q )
1287 d[q] = ( q - v[k] ) * ( q - v[k] ) + f[v[k]];
1292 void QgsShapeburstFillSymbolLayerV2::distanceTransform2d(
double * im,
int width,
int height )
1294 int maxDimension = qMax( width, height );
1295 double *f =
new double[ maxDimension ];
1296 int *v =
new int[ maxDimension ];
1297 double *z =
new double[ maxDimension + 1 ];
1298 double *d =
new double[ maxDimension ];
1301 for (
int x = 0; x < width; x++ )
1303 for (
int y = 0; y < height; y++ )
1305 f[y] = im[ x + y * width ];
1307 distanceTransform1d( f, height, v, z, d );
1308 for (
int y = 0; y < height; y++ )
1310 im[ x + y * width ] = d[y];
1315 for (
int y = 0; y < height; y++ )
1317 for (
int x = 0; x < width; x++ )
1319 f[x] = im[ x + y*width ];
1321 distanceTransform1d( f, width, v, z, d );
1322 for (
int x = 0; x < width; x++ )
1324 im[ x + y*width ] = d[x];
1335 double * QgsShapeburstFillSymbolLayerV2::distanceTransform(
QImage *im )
1337 int width = im->
width();
1338 int height = im->
height();
1340 double * dtArray =
new double[width * height];
1345 for (
int heightIndex = 0; heightIndex < height; ++heightIndex )
1348 for (
int widthIndex = 0; widthIndex < width; ++widthIndex )
1350 tmpRgb = scanLine[widthIndex];
1351 if ( qRed( tmpRgb ) == 0 )
1359 dtArray[ idx ] =
INF;
1366 distanceTransform2d( dtArray, width, height );
1371 void QgsShapeburstFillSymbolLayerV2::dtArrayToQImage(
double * array,
QImage *im,
QgsVectorColorRampV2* ramp,
double layerAlpha,
bool useWholeShape,
int maxPixelDistance )
1373 int width = im->
width();
1374 int height = im->
height();
1377 double maxDistanceValue;
1379 if ( useWholeShape )
1382 double dtMaxValue = array[0];
1383 for (
int i = 1; i < ( width * height ); ++i )
1385 if ( array[i] > dtMaxValue )
1387 dtMaxValue = array[i];
1392 maxDistanceValue = sqrt( dtMaxValue );
1397 maxDistanceValue = maxPixelDistance;
1402 double squaredVal = 0;
1405 bool layerHasAlpha = layerAlpha < 1.0;
1407 for (
int heightIndex = 0; heightIndex < height; ++heightIndex )
1409 QRgb* scanLine = ( QRgb* )im->
scanLine( heightIndex );
1410 for (
int widthIndex = 0; widthIndex < width; ++widthIndex )
1413 squaredVal = array[idx];
1416 if ( maxDistanceValue > 0 )
1418 pixVal = squaredVal > 0 ? qMin(( sqrt( squaredVal ) / maxDistanceValue ), 1.0 ) : 0;
1426 pixColor = ramp->
color( pixVal );
1428 int pixAlpha = pixColor.
alpha();
1429 if (( layerHasAlpha ) || ( pixAlpha != 255 ) )
1432 double alpha = pixAlpha * layerAlpha;
1437 scanLine[widthIndex] = pixColor.
rgba();
1528 , mOutlineWidth( 0.0 )
1580 for ( ; ringIt != rings->
constEnd(); ++ringIt )
1640 return subLayerBleed;
1657 Q_UNUSED( context );
1660 return QColor( Qt::black );
1667 return Qt::SolidLine;
1671 return Qt::SolidLine;
1684 mPatternWidth( width ),
1691 setDefaultSvgParams();
1696 mPatternWidth( width ),
1698 mSvgData( svgData ),
1705 setDefaultSvgParams();
1757 setDefaultSvgParams();
1767 if ( properties.
contains(
"width" ) )
1769 width = properties[
"width"].toDouble();
1771 if ( properties.
contains(
"svgFile" ) )
1773 QString svgName = properties[
"svgFile"];
1775 svgFilePath = ( savePath.
isEmpty() ? svgName : savePath );
1777 if ( properties.
contains(
"angle" ) )
1779 angle = properties[
"angle"].toDouble();
1789 if ( properties.
contains(
"data" ) )
1797 if ( properties.
contains(
"svgFillColor" ) )
1802 else if ( properties.
contains(
"color" ) )
1806 if ( properties.
contains(
"svgOutlineColor" ) )
1811 else if ( properties.
contains(
"outline_color" ) )
1815 else if ( properties.
contains(
"line_color" ) )
1819 if ( properties.
contains(
"svgOutlineWidth" ) )
1824 else if ( properties.
contains(
"outline_width" ) )
1828 else if ( properties.
contains(
"line_width" ) )
1834 if ( properties.
contains(
"pattern_width_unit" ) )
1838 if ( properties.
contains(
"pattern_width_map_unit_scale" ) )
1842 if ( properties.
contains(
"svg_outline_width_unit" ) )
1846 if ( properties.
contains(
"svg_outline_width_map_unit_scale" ) )
1850 if ( properties.
contains(
"outline_width_unit" ) )
1854 if ( properties.
contains(
"outline_width_map_unit_scale" ) )
1870 const QColor& svgFillColor,
const QColor& svgOutlineColor,
double svgOutlineWidth,
1883 if ((
int )size < 1.0 || 10000.0 < size )
1890 bool fitsInCache =
true;
1898 double hwRatio = 1.0;
1899 if ( patternPict.
width() > 0 )
1901 hwRatio = ( double )patternPict.
height() / ( double )patternPict.
width();
1903 mSvgPattern =
new QImage((
int )size, (
int )( size * hwRatio ), QImage::Format_ARGB32_Premultiplied );
1907 p.drawPicture(
QPointF( size / 2, size * hwRatio / 2 ), patternPict );
1929 applyPattern(
mBrush,
mSvgFilePath,
mPatternWidth,
mPatternWidthUnit,
mSvgFillColor,
mSvgOutlineColor,
mSvgOutlineWidth,
mSvgOutlineWidthUnit, context,
mPatternWidthMapUnitScale,
mSvgOutlineWidthMapUnitScale );
2013 if ( !props.
value(
"uom",
"" ).isEmpty() )
2047 double angle = props.
value(
"angle",
"0" ).toDouble( &ok );
2052 else if ( angle +
mAngle != 0 )
2073 Qt::PenStyle penStyle;
2074 double size, borderWidth;
2081 if ( graphicFillElem.
isNull() )
2085 if ( graphicElem.
isNull() )
2091 if ( mimeType !=
"image/svg+xml" )
2101 double d = angleFunc.
toDouble( &ok );
2113 if ( !strokeElem.
isNull() )
2179 void QgsSVGFillSymbolLayer::storeViewBox()
2195 void QgsSVGFillSymbolLayer::setDefaultSvgParams()
2207 bool hasFillParam, hasOutlineParam, hasOutlineWidthParam;
2208 QColor defaultFillColor, defaultOutlineColor;
2209 double defaultOutlineWidth;
2211 defaultOutlineWidth );
2217 if ( hasOutlineParam )
2221 if ( hasOutlineWidthParam )
2234 , mLineAngle( 45.0 )
2237 , mFillLineSymbol( 0 )
2257 delete mFillLineSymbol;
2272 delete mFillLineSymbol;
2273 mFillLineSymbol = lineSymbol;
2284 return mFillLineSymbol;
2290 if ( mFillLineSymbol )
2348 if ( properties.
contains(
"lineangle" ) )
2351 lineAngle = properties[
"lineangle"].toDouble();
2353 else if ( properties.
contains(
"angle" ) )
2355 lineAngle = properties[
"angle"].toDouble();
2359 if ( properties.
contains(
"distance" ) )
2361 distance = properties[
"distance"].toDouble();
2365 if ( properties.
contains(
"linewidth" ) )
2368 lineWidth = properties[
"linewidth"].toDouble();
2370 else if ( properties.
contains(
"outline_width" ) )
2372 lineWidth = properties[
"outline_width"].toDouble();
2374 else if ( properties.
contains(
"line_width" ) )
2376 lineWidth = properties[
"line_width"].toDouble();
2380 if ( properties.
contains(
"color" ) )
2384 else if ( properties.
contains(
"outline_color" ) )
2388 else if ( properties.
contains(
"line_color" ) )
2394 if ( properties.
contains(
"offset" ) )
2396 offset = properties[
"offset"].toDouble();
2401 if ( properties.
contains(
"distance_unit" ) )
2405 if ( properties.
contains(
"distance_map_unit_scale" ) )
2409 if ( properties.
contains(
"line_width_unit" ) )
2413 else if ( properties.
contains(
"outline_width_unit" ) )
2417 if ( properties.
contains(
"line_width_map_unit_scale" ) )
2421 if ( properties.
contains(
"offset_unit" ) )
2425 if ( properties.
contains(
"offset_map_unit_scale" ) )
2429 if ( properties.
contains(
"outline_width_unit" ) )
2433 if ( properties.
contains(
"outline_width_map_unit_scale" ) )
2440 return patternLayer;
2445 return "LinePatternFill";
2449 double lineWidth,
const QColor& color )
2451 Q_UNUSED( lineWidth );
2456 if ( !mFillLineSymbol )
2462 if ( !fillLineSymbol )
2474 double outputPixelBleed = 0;
2475 double outputPixelInterval = 0;
2487 outputPixelBleed = qMax( outputPixelBleed, outputPixelLayerBleed );
2490 if ( markerLineLayer )
2499 outputPixelInterval = qMax( outputPixelInterval, outputPixelLayerInterval );
2503 if ( outputPixelInterval > 0 )
2507 double intervalScale = qRound( outputPixelInterval ) / outputPixelInterval;
2508 outputPixelInterval = qRound( outputPixelInterval );
2515 if ( markerLineLayer )
2526 height = outputPixelDist;
2527 width = outputPixelInterval > 0 ? outputPixelInterval : height;
2531 width = outputPixelDist;
2532 height = outputPixelInterval > 0 ? outputPixelInterval : width;
2536 height = outputPixelDist / cos( lineAngle *
M_PI / 180 );
2537 width = outputPixelDist / sin( lineAngle *
M_PI / 180 );
2540 lineAngle = 180 * atan2((
double ) height, (
double ) width ) /
M_PI;
2541 if ( lineAngle < 0 )
2546 height = qAbs( height );
2547 width = qAbs( width );
2549 outputPixelDist = height * cos( lineAngle *
M_PI / 180 );
2553 int offsetHeight = qRound( qAbs( outputPixelOffset / cos( lineAngle *
M_PI / 180 ) ) );
2554 outputPixelOffset = offsetHeight * cos( lineAngle *
M_PI / 180 );
2563 int bufferMulti = qMax( qCeil( outputPixelBleed / width ), qCeil( outputPixelBleed / width ) );
2567 bufferMulti = qMax( bufferMulti, 1 );
2569 int xBuffer = width * bufferMulti;
2570 int yBuffer = height * bufferMulti;
2571 int innerWidth = width;
2572 int innerHeight = height;
2573 width += 2 * xBuffer;
2574 height += 2 * yBuffer;
2576 if ( width > 10000 || height > 10000 )
2581 QImage patternImage( width, height, QImage::Format_ARGB32 );
2582 patternImage.fill( 0 );
2584 QPointF p1, p2, p3, p4, p5, p6;
2588 p2 =
QPointF( width, yBuffer );
2589 p3 =
QPointF( 0, yBuffer + innerHeight );
2590 p4 =
QPointF( width, yBuffer + innerHeight );
2594 p1 =
QPointF( xBuffer, height );
2596 p3 =
QPointF( xBuffer + innerWidth, height );
2597 p4 =
QPointF( xBuffer + innerWidth, 0 );
2599 else if ( lineAngle > 0 && lineAngle < 90 )
2601 dx = outputPixelDist * cos(( 90 - lineAngle ) *
M_PI / 180.0 );
2602 dy = outputPixelDist * sin(( 90 - lineAngle ) *
M_PI / 180.0 );
2605 p3 =
QPointF( -dx, height - dy );
2606 p4 =
QPointF( width - dx, -dy );
2607 p5 =
QPointF( dx, height + dy );
2608 p6 =
QPointF( width + dx, dy );
2610 else if ( lineAngle > 180 && lineAngle < 270 )
2612 dx = outputPixelDist * cos(( 90 - lineAngle ) *
M_PI / 180.0 );
2613 dy = outputPixelDist * sin(( 90 - lineAngle ) *
M_PI / 180.0 );
2616 p3 =
QPointF( width - dx, -dy );
2617 p4 =
QPointF( -dx, height - dy );
2618 p5 =
QPointF( width + dx, dy );
2619 p6 =
QPointF( dx, height + dy );
2621 else if ( lineAngle > 90 && lineAngle < 180 )
2623 dy = outputPixelDist * cos(( 180 - lineAngle ) *
M_PI / 180 );
2624 dx = outputPixelDist * sin(( 180 - lineAngle ) *
M_PI / 180 );
2626 p2 =
QPointF( width, height );
2628 p6 =
QPointF( width + dx, height - dy );
2630 p4 =
QPointF( width - dx, height + dy );
2632 else if ( lineAngle > 270 && lineAngle < 360 )
2634 dy = outputPixelDist * cos(( 180 - lineAngle ) *
M_PI / 180 );
2635 dx = outputPixelDist * sin(( 180 - lineAngle ) *
M_PI / 180 );
2636 p1 =
QPointF( width, height );
2638 p5 =
QPointF( width + dx, height - dy );
2640 p3 =
QPointF( width - dx, height + dy );
2660 p2 =
QPointF( tempPt.
x(), tempPt.
y() );;
2667 p.setRenderHint( QPainter::Antialiasing,
false );
2676 p.drawPolygon( polygon );
2678 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 );
2679 p.drawPolygon( polygon );
2685 p.setRenderHint( QPainter::Antialiasing,
true );
2711 fillLineSymbol->
stopRender( lineRenderContext );
2715 patternImage = patternImage.copy( xBuffer, yBuffer, patternImage.width() - 2 * xBuffer, patternImage.height() - 2 * yBuffer );
2720 QImage transparentImage = patternImage.
copy();
2733 delete fillLineSymbol;
2740 if ( mFillLineSymbol )
2775 if ( mFillLineSymbol )
2786 if ( !props.
value(
"uom",
"" ).isEmpty() )
2804 double lineWidth = mFillLineSymbol ? mFillLineSymbol->
width() : 0.0;
2810 double angle = props.
value(
"angle",
"0" ).toDouble( &ok );
2829 featureStyle.
append(
"Brush(" );
2831 featureStyle.
append(
QString(
",bc:%1" ).arg(
"#00000000" ) );
2832 featureStyle.
append(
",id:\"ogr-brush-2\"" );
2835 featureStyle.
append(
",dx:0mm" );
2837 featureStyle.
append(
")" );
2838 return featureStyle;
2872 applyPattern( context,
mBrush, lineAngle, distance, lineWidth, color );
2882 Qt::PenStyle lineStyle;
2889 if ( graphicFillElem.
isNull() )
2893 if ( graphicElem.
isNull() )
2899 if ( name !=
"horline" )
2907 double d = angleFunc.
toDouble( &ok );
2916 offset = sqrt( pow( vectOffset.
x(), 2 ) + pow( vectOffset.
y(), 2 ) );
2928 if ( !strokeElem.
isNull() )
2947 mDisplacementY( 0 ), mDisplacementYUnit(
QgsSymbolV2::MM )
3005 if ( properties.
contains(
"distance_x" ) )
3007 layer->
setDistanceX( properties[
"distance_x"].toDouble() );
3009 if ( properties.
contains(
"distance_y" ) )
3011 layer->
setDistanceY( properties[
"distance_y"].toDouble() );
3013 if ( properties.
contains(
"displacement_x" ) )
3017 if ( properties.
contains(
"displacement_y" ) )
3022 if ( properties.
contains(
"distance_x_unit" ) )
3026 if ( properties.
contains(
"distance_x_map_unit_scale" ) )
3030 if ( properties.
contains(
"distance_y_unit" ) )
3034 if ( properties.
contains(
"distance_y_map_unit_scale" ) )
3038 if ( properties.
contains(
"displacement_x_unit" ) )
3042 if ( properties.
contains(
"displacement_x_map_unit_scale" ) )
3046 if ( properties.
contains(
"displacement_y_unit" ) )
3050 if ( properties.
contains(
"displacement_y_map_unit_scale" ) )
3054 if ( properties.
contains(
"outline_width_unit" ) )
3058 if ( properties.
contains(
"outline_width_map_unit_scale" ) )
3070 return "PointPatternFill";
3074 double displacementX,
double displacementY )
3081 if ( width > 10000 || height > 10000 )
3088 QImage patternImage( width, height, QImage::Format_ARGB32 );
3089 patternImage.fill( 0 );
3127 QImage transparentImage = patternImage.
copy();
3196 if ( !props.
value(
"uom",
"" ).isEmpty() )
3230 Q_UNUSED( element );
3281 applyPattern( context,
mBrush, distanceX, distanceY, displacementX, displacementY );
3316 if ( properties.
contains(
"point_on_surface" ) )
3324 return "CentroidFill";
3466 , mImageFilePath( imageFilePath )
3490 if ( properties.
contains(
"imageFile" ) )
3492 imagePath = properties[
"imageFile"];
3494 if ( properties.
contains(
"coordinate_mode" ) )
3498 if ( properties.
contains(
"alpha" ) )
3500 alpha = properties[
"alpha"].toDouble();
3502 if ( properties.
contains(
"offset" ) )
3506 if ( properties.
contains(
"angle" ) )
3508 angle = properties[
"angle"].toDouble();
3510 if ( properties.
contains(
"width" ) )
3512 width = properties[
"width"].toDouble();
3520 if ( properties.
contains(
"offset_unit" ) )
3524 if ( properties.
contains(
"offset_map_unit_scale" ) )
3528 if ( properties.
contains(
"width_unit" ) )
3532 if ( properties.
contains(
"width_map_unit_scale" ) )
3550 return "RasterFill";
3590 Q_UNUSED( context );
3658 if ( !hasWidthExpression && !hasAngleExpression && !hasAlphaExpression && !hasFileExpression )
3664 if ( hasAngleExpression )
3671 if ( !hasWidthExpression && !hasAlphaExpression && !hasFileExpression )
3677 if ( hasWidthExpression )
3682 if ( hasAlphaExpression )
3687 if ( hasFileExpression )
3691 applyPattern(
mBrush, file, width, alpha, context );
3696 QImage image( imageFilePath );
3697 if ( image.isNull() )
3701 if ( !image.hasAlphaChannel() )
3703 image = image.convertToFormat( QImage::Format_ARGB32 );
3713 pixelWidth = image.width();
3722 QColor alphaColor( 0, 0, 0 );
3723 alphaColor.setAlphaF( alpha );
3724 p.
fillRect( image.rect(), alphaColor );
3731 image = image.scaledToWidth( pixelWidth, Qt::SmoothTransformation );
virtual QSet< QString > usedAttributes() const
Returns the set of attributes referenced by the layer.
QgsStringMap properties() const override
static double mapUnitScaleFactor(double scaleDenominator, QgsSymbolV2::OutputUnit symbolUnits, QGis::UnitType mapUnits)
QgsMapUnitScale mSvgOutlineWidthMapUnitScale
static QString encodeOutputUnit(QgsSymbolV2::OutputUnit unit)
static const QString EXPR_DISTANCE_Y
void setBorderWidthMapUnitScale(const QgsMapUnitScale &scale)
QgsMapUnitScale mapUnitScale() const override
QgsSymbolV2 * subSymbol() override
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
static const QString EXPR_DISPLACEMENT_Y
void setDistance(double d)
void setOutputUnit(QgsSymbolV2::OutputUnit unit) override
void applyDataDefinedSettings(const QgsSymbolV2RenderContext &context) override
virtual QSet< QString > usedAttributes() const override
Returns the set of attributes referenced by the layer.
void setReferencePoint1(QPointF referencePoint)
Starting point of gradient fill, in the range [0,0] - [1,1].
QgsSymbolV2::OutputUnit mSvgOutlineWidthUnit
void setStyle(Qt::PenStyle style)
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)
QString & append(QChar ch)
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
bool contains(const Key &key) const
static Q_DECL_DEPRECATED bool wellKnownMarkerFromSld(QDomElement &element, QString &name, QColor &color, QColor &borderColor, double &borderWidth, double &size)
static const QString EXPR_BORDER_COLOR
void fillRect(const QRectF &rectangle, const QBrush &brush)
void setCompositionMode(CompositionMode mode)
QgsMapUnitScale mLineWidthMapUnitScale
const uchar * constScanLine(int i) const
void setSvgFillColor(const QColor &c)
void setPatternWidthMapUnitScale(const QgsMapUnitScale &scale)
bool mReferencePoint1IsCentroid
void setRenderHint(RenderHint hint, bool on)
void startRender(QgsSymbolV2RenderContext &context) override
QDomNode appendChild(const QDomNode &newChild)
static QgsSymbolLayerV2 * create(const QgsStringMap &properties=QgsStringMap())
void setDistanceYUnit(QgsSymbolV2::OutputUnit unit)
QString svgFilePath() const
void stopRender(QgsSymbolV2RenderContext &context) override
void append(const T &value)
virtual void applyDataDefinedSettings(const QgsSymbolV2RenderContext &context)
void setOffsetUnit(QgsSymbolV2::OutputUnit unit)
static const QString EXPR_USE_WHOLE_SHAPE
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&.
static const QString EXPR_REFERENCE2_Y
QColor selectionColor() const
QMap< Key, T > & unite(const QMap< Key, T > &other)
QSet< QString > usedAttributes() const
void setOutlineWidthMapUnitScale(const QgsMapUnitScale &scale)
QPointF referencePoint2() const
void setMapUnitScale(const QgsMapUnitScale &scale) override
QgsLinePatternFillSymbolLayer()
void setMatrix(const QMatrix &matrix)
bool setSubSymbol(QgsSymbolV2 *symbol) override
void setColorAt(qreal position, const QColor &color)
Base class for polygon renderers generating texture images.
QgsMapUnitScale mOffsetMapUnitScale
void setOutputUnit(QgsSymbolV2::OutputUnit unit) override
QgsMapUnitScale mPatternWidthMapUnitScale
static const QString EXPR_DISPLACEMENT_X
GradientCoordinateMode mCoordinateMode
static void createRotationElement(QDomDocument &doc, QDomElement &element, QString rotationFunc)
double rendererScale() const
void stopRender(QgsSymbolV2RenderContext &context) override
void setPointOnSurface(bool pointOnSurface)
static const QString EXPR_WIDTH
static QgsSymbolLayerV2 * create(const QgsStringMap &properties=QgsStringMap())
QgsSymbolV2::OutputUnit svgOutlineWidthUnit() const
void scale(qreal sx, qreal sy)
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
void setTextureImage(const QImage &image)
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
static const QString EXPR_BLUR_RADIUS
void renderPolygon(const QPolygonF &points, QList< QPolygonF > *rings, QgsSymbolV2RenderContext &context) override
static bool externalGraphicFromSld(QDomElement &element, QString &path, QString &mime, QColor &color, double &size)
void setJoinStyle(Qt::PenJoinStyle style)
virtual QgsStringMap properties() const =0
static QDomElement createVendorOptionElement(QDomDocument &doc, QString name, QString value)
GradientType mGradientType
static const QString EXPR_COORDINATE_MODE
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
static const QString EXPR_COLOR2
void copyPaintEffect(QgsSymbolLayerV2 *destLayer) const
Copies paint effect of this layer to another symbol layer.
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
virtual bool hasDataDefinedProperty(const QString &property) const
Checks whether the layer has a matching data defined property and if that property is currently activ...
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)
QImage copy(const QRect &rectangle) const
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
double toDouble(bool *ok) const
QColor color() const override
virtual QColor fillColor() const
Get fill color.
QgsMapUnitScale mDistanceYMapUnitScale
void setStyle(Qt::BrushStyle style)
QgsVectorColorRampV2 * mGradientRamp
QString layerType() const override
void setOutputUnit(QgsSymbolV2::OutputUnit unit) override
QString tr(const char *sourceText, const char *disambiguation, int n)
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
static const QString EXPR_JOIN_STYLE
void setDistanceUnit(QgsSymbolV2::OutputUnit unit)
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)
static const QString EXPR_FILL_STYLE
qreal alpha() const
Get alpha transparency 1 for opaque, 0 for invisible.
static QgsSvgCache * instance()
static const QString EXPR_REFERENCE1_Y
static QString encodePenStyle(Qt::PenStyle style)
static QgsSymbolLayerV2 * create(const QgsStringMap &properties=QgsStringMap())
void setCapStyle(Qt::PenCapStyle style)
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.
static const QString EXPR_BORDER_STYLE
void setColor(const QColor &color)
static const QString EXPR_REFERENCE2_X
static const QString EXPR_REFERENCE2_ISCENTROID
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
static const QString EXPR_LINEWIDTH
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
QString number(int n, int base)
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 append(const T &value)
void setOutlineWidthUnit(QgsSymbolV2::OutputUnit unit)
QgsLineSymbolV2 * mOutline
Custom outline.
static const QString EXPR_SPREAD
#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
static const QString EXPR_LINEANGLE
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.
void fill(uint pixelValue)
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)
static const QString EXPR_ALPHA
QgsSymbolLayerV2 * clone() const override
QgsSymbolV2::OutputUnit outputUnit() const override
static Qt::PenStyle decodePenStyle(QString str)
QgsVectorColorRampV2 * mTwoColorGradientRamp
void setPen(const QColor &color)
void setLineWidthUnit(QgsSymbolV2::OutputUnit unit)
void toSld(QDomDocument &doc, QDomElement &element, QgsStringMap props) const
QgsSymbolV2::OutputUnit outputUnit() const override
QgsSymbolLayerV2 * clone() const override
void setAttribute(const QString &name, const QString &value)
virtual QgsVectorColorRampV2 * clone() const =0
virtual QSet< QString > usedAttributes() const override
Returns the set of attributes referenced by the layer.
~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...
void setAngle(qreal angle)
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
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
void setWidthF(qreal width)
QgsMapUnitScale mOffsetMapUnitScale
int symbolLayerCount()
Returns total number of symbol layers contained in the symbol.
QgsSymbolV2::OutputUnit mOffsetUnit
void setBrush(const QBrush &brush)
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
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())
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)
void setColor(const QColor &color)
virtual void prepareExpressions(const QgsFields *fields, double scale=-1.0)
Prepares all data defined property expressions for evaluation.
void startRender(QgsSymbolV2RenderContext &context) override
QgsMapUnitScale mDisplacementXMapUnitScale
void setBorderWidthUnit(QgsSymbolV2::OutputUnit unit)
static const QString EXPR_FILE
void setCoordinateMode(CoordinateMode mode)
virtual bool hasDataDefinedProperties() const
Checks whether the layer has any associated data defined properties.
void setLineWidthMapUnitScale(const QgsMapUnitScale &scale)
QSet< QString > usedAttributes() const override
Returns the set of attributes referenced by the layer.
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
static const QString EXPR_DISTANCE
QgsSymbolV2::OutputUnit mOutlineWidthUnit
QByteArray fromHex(const QByteArray &hexEncoded)
QgsStringMap properties() const override
double mOutlineWidth
Outline width.
void setDistanceXUnit(QgsSymbolV2::OutputUnit unit)
double mLineWidth
Line width (in mm or map units)
QgsVectorColorRampV2 * mGradientRamp
static const QString EXPR_COLOR
static const QString EXPR_WIDTH_BORDER
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)
static const QString EXPR_SVG_FILE
static const QString EXPR_ANGLE
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
static const QString EXPR_DISTANCE_X
QString layerType() const override
static const QString EXPR_REFERENCE1_X
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)
static const QString EXPR_GRADIENT_TYPE
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.
static const QString EXPR_SVG_FILL_COLOR
Qt::BrushStyle mBrushStyle
QColor color2() const
Color for endpoint of gradient, only used if the gradient color type is set to SimpleTwoColor.
QRectF boundingRect() const
void drawImage(const QRectF &target, const QImage &image, const QRectF &source, QFlags< Qt::ImageConversionFlag > flags)
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.
char * toString(const T &value)
QSet< T > & unite(const QSet< T > &other)
GradientColorType mGradientColorType
QgsPointPatternFillSymbolLayer()
virtual QVariant evaluateDataDefinedProperty(const QString &property, const QgsFeature *feature, const QVariant &defaultVal=QVariant(), bool *ok=0) const
Evaluates the matching data defined property and returns the calculated value.
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)
static const QString EXPR_SVG_OUTLINE_COLOR
void applyDataDefinedSettings(const QgsSymbolV2RenderContext &context) override
QgsSymbolV2::OutputUnit outputUnit() const override
void setSvgFilePath(const QString &svgPath)
QgsStringMap properties() const override
QgsRenderContext & renderContext()
QDomElement firstChildElement(const QString &tagName) const
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())
static const QString EXPR_IGNORE_RINGS
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.
static const QString EXPR_COLOR_BORDER
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 translate(const QPointF &offset)
static const QString EXPR_REFERENCE1_ISCENTROID
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
void setAlphaF(qreal alpha)
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)
iterator insert(const Key &key, const T &value)
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 const QString EXPR_SVG_OUTLINE_WIDTH
void restoreDataDefinedProperties(const QgsStringMap &stringMap)
Restores all data defined properties from string map.
static QgsMapUnitScale decodeMapUnitScale(const QString &str)
QgsSymbolLayerV2 * symbolLayer(int layer)
Returns a specific symbol layers contained in the symbol.
const_iterator constEnd() const
static QgsSymbolLayerV2 * createFromSld(QDomElement &element)
QDomElement createElement(const QString &tagName)
const_iterator constBegin() const
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)
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...
bool begin(QPaintDevice *device)
void setReferencePoint2(QPointF referencePoint)
End point of gradient fill, in the range [0,0] - [1,1].
QColor dxfColor(const QgsSymbolV2RenderContext &context) const override
static const QString EXPR_MAX_DISTANCE
void setColor(const QColor &color)
virtual QgsSymbolV2 * clone() const override
const QgsMapUnitScale & svgOutlineWidthMapUnitScale() const
#define DEFAULT_SIMPLEFILL_JOINSTYLE
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
QgsSymbolLayerV2 * clone() const override
void setDisplacementX(double d)
void setSpread(Spread method)
void saveDataDefinedProperties(QgsStringMap &stringMap) const
Saves all data defined properties to a 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
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 all 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)
const T value(const Key &key) const
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)
#define DEFAULT_SIMPLEFILL_COLOR