19 #include "qgsdxfexport.h"
29 #include <QSvgRenderer>
30 #include <QDomDocument>
31 #include <QDomElement>
34 : mBrushStyle( style ), mBorderColor( borderColor ), mBorderStyle( borderStyle ), mBorderWidth( borderWidth ), mBorderWidthUnit(
QgsSymbolV2::MM ),
59 if ( colorExpression )
64 if ( colorBorderExpression )
69 if ( widthBorderExpression )
71 double width = widthBorderExpression->
evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toDouble();
73 pen.setWidthF( width );
74 selPen.setWidthF( width );
88 if ( props.contains(
"color" ) )
90 if ( props.contains(
"style" ) )
92 if ( props.contains(
"color_border" ) )
94 if ( props.contains(
"style_border" ) )
96 if ( props.contains(
"width_border" ) )
97 borderWidth = props[
"width_border"].toDouble();
98 if ( props.contains(
"offset" ) )
103 if ( props.contains(
"border_width_unit" ) )
105 if ( props.contains(
"offset_unit" ) )
108 if ( props.contains(
"color_expression" ) )
112 if ( props.contains(
"color_border_expression" ) )
116 if ( props.contains(
"width_border_expression" ) )
132 fillColor.setAlphaF( context.
alpha() *
mColor.alphaF() );
137 if ( rasterScaleFactor != 1.0 )
139 mBrush.setMatrix( QMatrix().scale( 1.0 / rasterScaleFactor, 1.0 / rasterScaleFactor ) );
153 mPen = QPen( borderColor );
183 p->translate( offset );
190 p->translate( -offset );
224 QDomElement symbolizerElem = doc.createElement(
"se:PolygonSymbolizer" );
225 if ( !props.value(
"uom",
"" ).isEmpty() )
226 symbolizerElem.setAttribute(
"uom", props.value(
"uom",
"" ) );
227 element.appendChild( symbolizerElem );
235 QDomElement fillElem = doc.createElement(
"se:Fill" );
236 symbolizerElem.appendChild( fillElem );
243 QDomElement strokeElem = doc.createElement(
"se:Stroke" );
244 symbolizerElem.appendChild( strokeElem );
257 symbolStyle.append(
";" );
268 Qt::BrushStyle fillStyle;
272 QDomElement fillElem = element.firstChildElement(
"Fill" );
275 QDomElement strokeElem = element.firstChildElement(
"Stroke" );
290 return penBleed + offsetBleed;
297 if ( widthBorderExpression )
299 width = widthBorderExpression->
evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toDouble();
301 return width * e.mapUnitScaleFactor( e.symbologyScaleDenominator(),
mBorderWidthUnit, e.mapUnits() );
309 if ( colorBorderExpression )
318 if ( colorExpression )
336 : mGradientColorType( colorType ),
337 mGradientRamp( NULL ),
338 mGradientType( gradientType ),
339 mCoordinateMode( coordinateMode ),
340 mGradientSpread( spread ),
341 mReferencePoint1( QPointF( 0.5, 0 ) ),
342 mReferencePoint1IsCentroid( false ),
343 mReferencePoint2( QPointF( 0.5, 1 ) ),
344 mReferencePoint2IsCentroid( false ),
367 bool refPoint1IsCentroid =
false;
369 bool refPoint2IsCentroid =
false;
374 if ( props.contains(
"type" ) )
376 if ( props.contains(
"coordinate_mode" ) )
378 if ( props.contains(
"spread" ) )
380 if ( props.contains(
"color_type" ) )
382 if ( props.contains(
"gradient_color" ) )
384 if ( props.contains(
"gradient_color2" ) )
386 if ( props.contains(
"reference_point1" ) )
388 if ( props.contains(
"reference_point1_iscentroid" ) )
389 refPoint1IsCentroid = props[
"reference_point1_iscentroid"].toInt();
390 if ( props.contains(
"reference_point2" ) )
392 if ( props.contains(
"reference_point2_iscentroid" ) )
393 refPoint2IsCentroid = props[
"reference_point2_iscentroid"].toInt();
394 if ( props.contains(
"angle" ) )
395 angle = props[
"angle"].toDouble();
396 if ( props.contains(
"offset" ) )
405 if ( props.contains(
"offset_unit" ) )
416 if ( props.contains(
"color_expression" ) )
418 if ( props.contains(
"color2_expression" ) )
420 if ( props.contains(
"angle_expression" ) )
422 if ( props.contains(
"gradient_type_expression" ) )
424 if ( props.contains(
"coordinate_mode_expression" ) )
426 if ( props.contains(
"spread_expression" ) )
428 if ( props.contains(
"reference1_x_expression" ) )
430 if ( props.contains(
"reference1_y_expression" ) )
432 if ( props.contains(
"reference1_iscentroid_expression" ) )
434 if ( props.contains(
"reference2_x_expression" ) )
436 if ( props.contains(
"reference2_y_expression" ) )
438 if ( props.contains(
"reference2_iscentroid_expression" ) )
452 return "GradientFill";
460 if ( colorExpression )
466 if ( colorExpression2 )
472 if ( angleExpression )
473 angle = angleExpression->evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toDouble();
478 if ( typeExpression )
480 QString currentType = typeExpression->
evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toString();
489 else if ( currentType ==
QObject::tr(
"conical" ) )
503 if ( coordModeExpression )
505 QString currentCoordMode = coordModeExpression->
evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toString();
506 if ( currentCoordMode ==
QObject::tr(
"feature" ) )
510 else if ( currentCoordMode ==
QObject::tr(
"viewport" ) )
524 if ( spreadExpression )
526 QString currentSpread = spreadExpression->
evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toString();
531 else if ( currentSpread ==
QObject::tr(
"repeat" ) )
535 else if ( currentSpread ==
QObject::tr(
"reflect" ) )
549 if ( ref1XExpression )
550 refPoint1X = ref1XExpression->
evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toDouble();
553 if ( ref1YExpression )
554 refPoint1Y = ref1YExpression->
evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toDouble();
557 if ( ref1IsCentroidExpression )
558 refPoint1IsCentroid = ref1IsCentroidExpression->
evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toBool();
563 if ( ref2XExpression )
564 refPoint2X = ref2XExpression->
evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toDouble();
567 if ( ref2YExpression )
568 refPoint2Y = ref2YExpression->
evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toDouble();
571 if ( ref2IsCentroidExpression )
572 refPoint2IsCentroid = ref2IsCentroidExpression->
evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toBool();
574 if ( refPoint1IsCentroid || refPoint2IsCentroid )
579 QRectF bbox = points.boundingRect();
580 double centroidX = ( centroid.x() - bbox.left() ) / bbox.width();
581 double centroidY = ( centroid.y() - bbox.top() ) / bbox.height();
583 if ( refPoint1IsCentroid )
585 refPoint1X = centroidX;
586 refPoint1Y = centroidY;
588 if ( refPoint2IsCentroid )
590 refPoint2X = centroidX;
591 refPoint2Y = centroidY;
597 spread, QPointF( refPoint1X, refPoint1Y ), QPointF( refPoint2X, refPoint2Y ), angle );
605 QLineF refLine = QLineF( QPointF( 0.5, 0.5 ), refPoint );
607 refLine.setAngle( refLine.angle() +
angle );
609 QPointF rotatedReferencePoint = refLine.p2();
611 if ( rotatedReferencePoint.x() > 1 )
612 rotatedReferencePoint.setX( 1 );
613 if ( rotatedReferencePoint.x() < 0 )
614 rotatedReferencePoint.setX( 0 );
615 if ( rotatedReferencePoint.y() > 1 )
616 rotatedReferencePoint.setY( 1 );
617 if ( rotatedReferencePoint.y() < 0 )
618 rotatedReferencePoint.setY( 0 );
620 return rotatedReferencePoint;
624 const QColor &color,
const QColor &color2,
const GradientColorType &gradientColorType,
627 const QPointF &referencePoint1,
const QPointF &referencePoint2,
const double angle )
631 fillColor.setAlphaF( context.
alpha() * fillColor.alphaF() );
632 QColor fillColor2 =
color2;
633 fillColor2.setAlphaF( context.
alpha() * fillColor2.alphaF() );
641 switch ( gradientType )
644 gradient = QLinearGradient( rotatedReferencePoint1, rotatedReferencePoint2 );
647 gradient = QRadialGradient( rotatedReferencePoint1, QLineF( rotatedReferencePoint1, rotatedReferencePoint2 ).length() );
650 gradient = QConicalGradient( rotatedReferencePoint1, QLineF( rotatedReferencePoint1, rotatedReferencePoint2 ).
angle() );
653 switch ( coordinateMode )
656 gradient.setCoordinateMode( QGradient::ObjectBoundingMode );
659 gradient.setCoordinateMode( QGradient::StretchToDeviceMode );
662 switch ( gradientSpread )
665 gradient.setSpread( QGradient::PadSpread );
668 gradient.setSpread( QGradient::ReflectSpread );
671 gradient.setSpread( QGradient::RepeatSpread );
685 gradient.setColorAt( 0.0, fillColor );
686 gradient.setColorAt( 1.0, fillColor2 );
690 brush = QBrush( gradient );
720 p->setPen( QPen( Qt::NoPen ) );
727 p->translate( offset );
734 p->translate( -offset );
751 map[
"angle"] = QString::number(
mAngle );
806 p->setPen( QPen( Qt::NoPen ) );
813 p->setBrush( QBrush( selColor ) );
823 QTransform t =
mBrush.transform();
825 QBrush rotatedBrush =
mBrush;
826 rotatedBrush.setTransform( t );
827 p->setBrush( rotatedBrush );
835 QList<QPolygonF>::const_iterator ringIt = rings->constBegin();
836 for ( ; ringIt != rings->constEnd(); ++ringIt )
877 return subLayerBleed;
886 if ( widthExpression )
888 width = widthExpression->
evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toDouble();
890 return width * e.mapUnitScaleFactor( e.symbologyScaleDenominator(),
mOutlineWidthUnit, e.mapUnits() );
898 return QColor( Qt::black );
905 return Qt::SolidLine;
909 return Qt::SolidLine;
980 if ( properties.contains(
"width" ) )
982 width = properties[
"width"].toDouble();
984 if ( properties.contains(
"svgFile" ) )
986 QString svgName = properties[
"svgFile"];
988 svgFilePath = ( savePath.isEmpty() ? svgName : savePath );
990 if ( properties.contains(
"angle" ) )
992 angle = properties[
"angle"].toDouble();
996 if ( !svgFilePath.isEmpty() )
1002 if ( properties.contains(
"data" ) )
1004 data = QByteArray::fromHex( properties[
"data"].toLocal8Bit() );
1010 if ( properties.contains(
"svgFillColor" ) )
1014 if ( properties.contains(
"svgOutlineColor" ) )
1018 if ( properties.contains(
"svgOutlineWidth" ) )
1024 if ( properties.contains(
"pattern_width_unit" ) )
1028 if ( properties.contains(
"svg_outline_width_unit" ) )
1032 if ( properties.contains(
"outline_width_unit" ) )
1037 if ( properties.contains(
"width_expression" ) )
1039 if ( properties.contains(
"svgFile_expression" ) )
1041 if ( properties.contains(
"angle_expression" ) )
1043 if ( properties.contains(
"svgFillColor_expression" ) )
1045 if ( properties.contains(
"svgOutlineColor_expression" ) )
1047 if ( properties.contains(
"svgOutlineWidth" ) )
1059 const QColor& svgFillColor,
const QColor& svgOutlineColor,
double svgOutlineWidth,
1071 if ((
int )size < 1.0 || 10000.0 <
size )
1078 bool fitsInCache =
true;
1086 double hwRatio = 1.0;
1087 if ( patternPict.width() > 0 )
1089 hwRatio = ( double )patternPict.height() / ( double )patternPict.width();
1091 mSvgPattern =
new QImage((
int )size, (
int )( size * hwRatio ), QImage::Format_ARGB32_Premultiplied );
1095 p.drawPicture( QPointF( size / 2, size * hwRatio / 2 ), patternPict );
1098 QTransform brushTransform;
1102 QImage transparentImage = fitsInCache ? patternImage.copy() :
mSvgPattern->copy();
1104 brush.setTextureImage( transparentImage );
1108 brush.setTextureImage( fitsInCache ? patternImage : *
mSvgPattern );
1110 brush.setTransform( brushTransform );
1144 map.insert(
"data", QString(
mSvgData.toHex() ) );
1148 map.insert(
"angle", QString::number(
mAngle ) );
1193 QDomElement symbolizerElem = doc.createElement(
"se:PolygonSymbolizer" );
1194 if ( !props.value(
"uom",
"" ).isEmpty() )
1195 symbolizerElem.setAttribute(
"uom", props.value(
"uom",
"" ) );
1196 element.appendChild( symbolizerElem );
1200 QDomElement fillElem = doc.createElement(
"se:Fill" );
1201 symbolizerElem.appendChild( fillElem );
1203 QDomElement graphicFillElem = doc.createElement(
"se:GraphicFill" );
1204 fillElem.appendChild( graphicFillElem );
1206 QDomElement graphicElem = doc.createElement(
"se:Graphic" );
1207 graphicFillElem.appendChild( graphicElem );
1217 symbolizerElem.appendChild( doc.createComment(
"SVG from data not implemented yet" ) );
1228 double angle = props.value(
"angle",
"0" ).toDouble( &ok );
1231 angleFunc = QString(
"%1 + %2" ).arg( props.value(
"angle",
"0" ) ).arg(
mAngle );
1233 else if ( angle +
mAngle != 0 )
1235 angleFunc = QString::number( angle +
mAngle );
1252 QString path, mimeType;
1254 Qt::PenStyle penStyle;
1255 double size, borderWidth;
1257 QDomElement fillElem = element.firstChildElement(
"Fill" );
1258 if ( fillElem.isNull() )
1261 QDomElement graphicFillElem = fillElem.firstChildElement(
"GraphicFill" );
1262 if ( graphicFillElem.isNull() )
1265 QDomElement graphicElem = graphicFillElem.firstChildElement(
"Graphic" );
1266 if ( graphicElem.isNull() )
1272 if ( mimeType !=
"image/svg+xml" )
1282 double d = angleFunc.toDouble( &ok );
1293 QDomElement strokeElem = element.firstChildElement(
"Stroke" );
1294 if ( !strokeElem.isNull() )
1316 if ( !widthExpression && !svgFileExpression && !fillColorExpression && !outlineColorExpression && !outlineWidthExpression && !angleExpression )
1321 if ( angleExpression )
1327 if ( widthExpression )
1329 width = widthExpression->
evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toDouble();
1332 if ( svgFileExpression )
1334 svgFile = svgFileExpression->
evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toString();
1337 if ( fillColorExpression )
1342 if ( outlineColorExpression )
1347 if ( outlineWidthExpression )
1349 outlineWidth = outlineWidthExpression->
evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toDouble();
1384 bool hasFillParam, hasOutlineParam, hasOutlineWidthParam;
1385 QColor defaultFillColor, defaultOutlineColor;
1386 double defaultOutlineWidth;
1388 defaultOutlineWidth );
1394 if ( hasOutlineParam )
1398 if ( hasOutlineWidthParam )
1406 mOffsetUnit(
QgsSymbolV2::MM ), mFillLineSymbol( 0 )
1486 QColor
color( Qt::black );
1489 if ( properties.contains(
"lineangle" ) )
1491 lineAngle = properties[
"lineangle"].toDouble();
1495 if ( properties.contains(
"distance" ) )
1497 distance = properties[
"distance"].toDouble();
1501 if ( properties.contains(
"linewidth" ) )
1503 lineWidth = properties[
"linewidth"].toDouble();
1507 if ( properties.contains(
"color" ) )
1513 if ( properties.contains(
"offset" ) )
1515 offset = properties[
"offset"].toDouble();
1520 if ( properties.contains(
"distance_unit" ) )
1524 if ( properties.contains(
"line_width_unit" ) )
1528 if ( properties.contains(
"offset_unit" ) )
1534 if ( properties.contains(
"lineangle_expression" ) )
1538 if ( properties.contains(
"distance_expression" ) )
1542 if ( properties.contains(
"linewidth_expression" ) )
1546 if ( properties.contains(
"color_expression" ) )
1550 return patternLayer;
1555 return "LinePatternFill";
1559 double lineWidth,
const QColor& color )
1561 Q_UNUSED( lineWidth );
1564 mBrush.setTextureImage( QImage() );
1572 if ( !fillLineSymbol )
1584 double outputPixelBleed = 0;
1585 double outputPixelInterval = 0;
1597 outputPixelBleed = qMax( outputPixelBleed, outputPixelLayerBleed );
1600 if ( markerLineLayer )
1609 outputPixelInterval = qMax( outputPixelInterval, outputPixelLayerInterval );
1613 if ( outputPixelInterval > 0 )
1617 double intervalScale = qRound( outputPixelInterval ) / outputPixelInterval;
1618 outputPixelInterval = qRound( outputPixelInterval );
1625 if ( markerLineLayer )
1636 height = outputPixelDist;
1637 width = outputPixelInterval > 0 ? outputPixelInterval : height;
1641 width = outputPixelDist;
1642 height = outputPixelInterval > 0 ? outputPixelInterval : width;
1646 height = qAbs( outputPixelDist / cos( lineAngle *
M_PI / 180 ) );
1647 width = qAbs( height / tan( lineAngle *
M_PI / 180 ) );
1650 lineAngle = 180 * qAbs( atan2((
double ) height, (
double ) width ) ) /
M_PI;
1651 outputPixelDist = height * cos( lineAngle *
M_PI / 180 );
1655 int offsetHeight = qRound( qAbs( outputPixelOffset / cos( lineAngle *
M_PI / 180 ) ) );
1656 outputPixelOffset = offsetHeight * cos( lineAngle *
M_PI / 180 );
1665 int bufferMulti = qMax( qCeil( outputPixelBleed / width ), qCeil( outputPixelBleed / width ) );
1669 bufferMulti = qMax( bufferMulti, 1 );
1671 int xBuffer = width * bufferMulti;
1672 int yBuffer = height * bufferMulti;
1673 int innerWidth = width;
1674 int innerHeight = height;
1675 width += 2 * xBuffer;
1676 height += 2 * yBuffer;
1678 if ( width > 10000 || height > 10000 )
1683 QImage patternImage( width, height, QImage::Format_ARGB32 );
1684 patternImage.fill( 0 );
1686 QPointF p1, p2, p3, p4, p5, p6;
1689 p1 = QPointF( 0, yBuffer );
1690 p2 = QPointF( width, yBuffer );
1691 p3 = QPointF( 0, yBuffer + innerHeight );
1692 p4 = QPointF( width, yBuffer + innerHeight );
1696 p1 = QPointF( xBuffer, height );
1697 p2 = QPointF( xBuffer, 0 );
1698 p3 = QPointF( xBuffer + innerWidth, height );
1699 p4 = QPointF( xBuffer + innerWidth, 0 );
1701 else if (( lineAngle > 0 && lineAngle < 90 ) || ( lineAngle > 180 && lineAngle < 270 ) )
1703 dx = outputPixelDist * cos(( 90 - lineAngle ) *
M_PI / 180.0 );
1704 dy = outputPixelDist * sin(( 90 - lineAngle ) *
M_PI / 180.0 );
1705 p1 = QPointF( 0, height );
1706 p2 = QPointF( width, 0 );
1707 p3 = QPointF( -dx, height - dy );
1708 p4 = QPointF( width - dx, -dy );
1709 p5 = QPointF( dx, height + dy );
1710 p6 = QPointF( width + dx, dy );
1712 else if (( lineAngle < 180 ) || ( lineAngle > 270 && lineAngle < 360 ) )
1714 dy = outputPixelDist * cos(( 180 - lineAngle ) *
M_PI / 180 );
1715 dx = outputPixelDist * sin(( 180 - lineAngle ) *
M_PI / 180 );
1716 p1 = QPointF( width, height );
1717 p2 = QPointF( 0, 0 );
1718 p5 = QPointF( width + dx, height - dy );
1719 p6 = QPointF( p5.x() - width, p5.y() - height );
1720 p3 = QPointF( width - dx, height + dy );
1721 p4 = QPointF( p3.x() - width, p3.y() - height );
1728 p3 = QPointF( tempPt.x(), tempPt.y() );
1730 p4 = QPointF( tempPt.x(), tempPt.y() );
1732 p5 = QPointF( tempPt.x(), tempPt.y() );
1734 p6 = QPointF( tempPt.x(), tempPt.y() );
1738 p1 = QPointF( tempPt.x(), tempPt.y() );
1740 p2 = QPointF( tempPt.x(), tempPt.y() );;
1743 QPainter p( &patternImage );
1747 p.setRenderHint( QPainter::Antialiasing,
false );
1748 QPen pen( QColor( Qt::black ) );
1749 pen.setWidthF( 0.1 );
1750 pen.setCapStyle( Qt::FlatCap );
1755 QPolygon polygon = QPolygon() << QPoint( 0, 0 ) << QPoint( width - 1, 0 ) << QPoint( width - 1, height - 1 ) << QPoint( 0, height - 1 ) << QPoint( 0, 0 ) ;
1756 p.drawPolygon( polygon );
1758 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 ) ;
1759 p.drawPolygon( polygon );
1765 p.setRenderHint( QPainter::Antialiasing,
true );
1778 QVector<QPolygonF> polygons;
1779 polygons.append( QPolygonF() << p1 << p2 );
1780 polygons.append( QPolygonF() << p3 << p4 );
1783 polygons.append( QPolygonF() << p5 << p6 );
1786 foreach ( QPolygonF polygon, polygons )
1791 fillLineSymbol->
stopRender( lineRenderContext );
1795 patternImage = patternImage.copy( xBuffer, yBuffer, patternImage.width() - 2 * xBuffer, patternImage.height() - 2 * yBuffer );
1800 QImage transparentImage = patternImage.copy();
1802 brush.setTextureImage( transparentImage );
1806 brush.setTextureImage( patternImage );
1809 QTransform brushTransform;
1811 brush.setTransform( brushTransform );
1813 delete fillLineSymbol;
1835 map.insert(
"lineangle", QString::number(
mLineAngle ) );
1836 map.insert(
"distance", QString::number(
mDistance ) );
1837 map.insert(
"linewidth", QString::number(
mLineWidth ) );
1839 map.insert(
"offset", QString::number(
mOffset ) );
1863 QDomElement symbolizerElem = doc.createElement(
"se:PolygonSymbolizer" );
1864 if ( !props.value(
"uom",
"" ).isEmpty() )
1865 symbolizerElem.setAttribute(
"uom", props.value(
"uom",
"" ) );
1866 element.appendChild( symbolizerElem );
1871 QDomElement fillElem = doc.createElement(
"se:Fill" );
1872 symbolizerElem.appendChild( fillElem );
1874 QDomElement graphicFillElem = doc.createElement(
"se:GraphicFill" );
1875 fillElem.appendChild( graphicFillElem );
1877 QDomElement graphicElem = doc.createElement(
"se:Graphic" );
1878 graphicFillElem.appendChild( graphicElem );
1885 double angle = props.value(
"angle",
"0" ).toDouble( &ok );
1888 angleFunc = QString(
"%1 + %2" ).arg( props.value(
"angle",
"0" ) ).arg(
mLineAngle );
1892 angleFunc = QString::number( angle +
mLineAngle );
1908 QString featureStyle;
1909 featureStyle.append(
"Brush(" );
1910 featureStyle.append( QString(
"fc:%1" ).arg(
mColor.name() ) );
1911 featureStyle.append( QString(
",bc:%1" ).arg(
"#00000000" ) );
1912 featureStyle.append(
",id:\"ogr-brush-2\"" );
1913 featureStyle.append( QString(
",a:%1" ).arg(
mLineAngle ) );
1914 featureStyle.append( QString(
",s:%1" ).arg(
mLineWidth * widthScaleFactor ) );
1915 featureStyle.append(
",dx:0mm" );
1916 featureStyle.append( QString(
",dy:%1mm" ).arg(
mDistance * widthScaleFactor ) );
1917 featureStyle.append(
")" );
1918 return featureStyle;
1927 if ( !lineAngleExpression && !distanceExpression && !lineWidthExpression && !colorExpression )
1933 if ( lineAngleExpression )
1935 lineAngle = lineAngleExpression->
evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toDouble();
1938 if ( distanceExpression )
1940 distance = distanceExpression->
evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toDouble();
1943 if ( lineWidthExpression )
1945 lineWidth = lineWidthExpression->
evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toDouble();
1948 if ( colorExpression )
1962 Qt::PenStyle lineStyle;
1964 QDomElement fillElem = element.firstChildElement(
"Fill" );
1965 if ( fillElem.isNull() )
1968 QDomElement graphicFillElem = fillElem.firstChildElement(
"GraphicFill" );
1969 if ( graphicFillElem.isNull() )
1972 QDomElement graphicElem = graphicFillElem.firstChildElement(
"Graphic" );
1973 if ( graphicElem.isNull() )
1979 if ( name !=
"horline" )
1987 double d = angleFunc.toDouble( &ok );
1996 offset = sqrt( pow( vectOffset.x(), 2 ) + pow( vectOffset.y(), 2 ) );
2007 QDomElement strokeElem = element.firstChildElement(
"Stroke" );
2008 if ( !strokeElem.isNull() )
2027 mDisplacementY( 0 ), mDisplacementYUnit(
QgsSymbolV2::MM )
2062 if ( properties.contains(
"distance_x" ) )
2064 layer->
setDistanceX( properties[
"distance_x"].toDouble() );
2066 if ( properties.contains(
"distance_y" ) )
2068 layer->
setDistanceY( properties[
"distance_y"].toDouble() );
2070 if ( properties.contains(
"displacement_x" ) )
2074 if ( properties.contains(
"displacement_y" ) )
2079 if ( properties.contains(
"distance_x_unit" ) )
2083 if ( properties.contains(
"distance_y_unit" ) )
2087 if ( properties.contains(
"displacement_x_unit" ) )
2091 if ( properties.contains(
"displacement_y_unit" ) )
2097 if ( properties.contains(
"distance_x_expression" ) )
2101 if ( properties.contains(
"distance_y_expression" ) )
2105 if ( properties.contains(
"displacement_x_expression" ) )
2109 if ( properties.contains(
"displacement_y_expression" ) )
2118 return "PointPatternFill";
2122 double displacementX,
double displacementY )
2129 if ( width > 10000 || height > 10000 )
2132 brush.setTextureImage( img );
2136 QImage patternImage( width, height, QImage::Format_ARGB32 );
2137 patternImage.fill( 0 );
2141 QPainter p( &patternImage );
2174 QImage transparentImage = patternImage.copy();
2176 brush.setTextureImage( transparentImage );
2180 brush.setTextureImage( patternImage );
2182 QTransform brushTransform;
2184 brush.setTransform( brushTransform );
2209 propertyMap[
"distance_x"] = QString::number(
mDistanceX );
2210 propertyMap[
"distance_y"] = QString::number(
mDistanceY );
2211 propertyMap[
"displacement_x"] = QString::number(
mDisplacementX );
2212 propertyMap[
"displacement_y"] = QString::number(
mDisplacementY );
2236 QDomElement symbolizerElem = doc.createElement(
"se:PolygonSymbolizer" );
2237 if ( !props.value(
"uom",
"" ).isEmpty() )
2238 symbolizerElem.setAttribute(
"uom", props.value(
"uom",
"" ) );
2239 element.appendChild( symbolizerElem );
2244 QDomElement fillElem = doc.createElement(
"se:Fill" );
2245 symbolizerElem.appendChild( fillElem );
2247 QDomElement graphicFillElem = doc.createElement(
"se:GraphicFill" );
2248 fillElem.appendChild( graphicFillElem );
2253 symbolizerElem.appendChild( distanceElem );
2259 QString errorMsg = QString(
"MarkerSymbolLayerV2 expected, %1 found. Skip it." ).arg( layer->
layerType() );
2260 graphicFillElem.appendChild( doc.createComment( errorMsg ) );
2271 Q_UNUSED( element );
2300 if ( !distanceXExpression && !distanceYExpression && !displacementXExpression && !displacementYExpression )
2307 if ( distanceXExpression )
2309 distanceX = distanceXExpression->
evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toDouble();
2312 if ( distanceYExpression )
2314 distanceY = distanceYExpression->
evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toDouble();
2317 if ( displacementXExpression )
2319 displacementX = displacementXExpression->
evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toDouble();
2322 if ( displacementYExpression )
2324 displacementY = displacementYExpression->
evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toDouble();
2359 Q_UNUSED( properties );
2365 return "CentroidFill";
2452 QSet<QString> attributes;
virtual QSet< QString > usedAttributes() const
static QString encodeOutputUnit(QgsSymbolV2::OutputUnit unit)
void renderPolygon(const QPolygonF &points, QList< QPolygonF > *rings, QgsSymbolV2RenderContext &context)
Class for parsing and evaluation of expressions (formerly called "search strings").
static Qt::BrushStyle decodeBrushStyle(QString str)
void setForceVectorOutput(bool force)
Added in QGIS v1.5.
QgsSymbolV2::OutputUnit intervalUnit() const
QgsSymbolV2::OutputUnit patternWidthUnit() const
QgsImageFillSymbolLayer()
double borderWidth() const
#define DEFAULT_SIMPLEFILL_BORDERCOLOR
void setDistance(double d)
double estimateMaxBleed() const
Returns the estimated maximum distance which the layer style will bleed outside the drawn shape...
double estimateMaxBleed() const
Returns the estimated maximum distance which the layer style will bleed outside the drawn shape...
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 setSvgOutlineWidth(double w)
static void multiplyImageOpacity(QImage *image, qreal alpha)
Multiplies opacity of image pixel values with a (global) transparency value.
QgsStringMap properties() const
void stopRender(QgsSymbolV2RenderContext &context)
void startRender(QgsSymbolV2RenderContext &context)
void setAngle(double angle)
Rotation angle for gradient fill.
QgsStringMap properties() const
QString ogrFeatureStyleWidth(double widthScaleFactor) const
void applyDataDefinedSettings(const QgsSymbolV2RenderContext &context)
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)
void renderPolygon(const QPolygonF &points, QList< QPolygonF > *rings, QgsSymbolV2RenderContext &context)
virtual Qt::PenStyle dxfPenStyle() const
void toSld(QDomDocument &doc, QDomElement &element, QgsStringMap props) const
void setSvgFillColor(const QColor &c)
bool mReferencePoint1IsCentroid
QgsSymbolV2::OutputUnit outputUnit() const
static QgsSymbolLayerV2 * create(const QgsStringMap &properties=QgsStringMap())
void setDistanceYUnit(QgsSymbolV2::OutputUnit unit)
QString svgFilePath() const
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
Added in QGIS v2.0.
QSet< QString > usedAttributes() const
QPointF referencePoint2() const
virtual QSet< QString > usedAttributes() const
QgsStringMap properties() const
double dxfWidth(const QgsDxfExport &e, const QgsSymbolV2RenderContext &context) const
QgsLinePatternFillSymbolLayer()
double displacementX() const
bool setSubSymbol(QgsSymbolV2 *symbol)
Base class for polygon renderers generating texture images.
QgsSymbolV2 * subSymbol()
GradientCoordinateMode mCoordinateMode
static void createRotationElement(QDomDocument &doc, QDomElement &element, QString rotationFunc)
double rendererScale() const
QgsSymbolV2::OutputUnit outputUnit() const
QgsSymbolV2::OutputUnit svgOutlineWidthUnit() const
double estimateMaxBleed() const
Returns the estimated maximum distance which the layer style will bleed outside the drawn shape...
QString layerType() const
static QString ogrFeatureStyleBrush(const QColor &fillColr)
Create ogr feature style string for brush.
static void fillToSld(QDomDocument &doc, QDomElement &element, Qt::BrushStyle brushStyle, QColor color=QColor())
QgsSymbolLayerV2 * clone() const
void addStopsToGradient(QGradient *gradient)
copy color ramp stops to a QGradient
static QPointF decodePoint(QString str)
void setOutputUnit(QgsSymbolV2::OutputUnit unit)
static bool externalGraphicFromSld(QDomElement &element, QString &path, QString &mime, QColor &color, double &size)
QgsSymbolV2::OutputUnit outputUnit() const
virtual QgsStringMap properties() const =0
static QDomElement createVendorOptionElement(QDomDocument &doc, QString name, QString value)
GradientType mGradientType
GradientCoordinateMode coordinateMode() const
Coordinate mode for gradient.
static QColor decodeColor(QString str)
QgsSymbolV2::OutputUnit mDisplacementXUnit
static QgsSymbolLayerV2 * createFromSld(QDomElement &element)
void toSld(QDomDocument &doc, QDomElement &element, QgsStringMap props) const
static const bool selectionIsOpaque
double scaleFactor() const
void stopRender(QgsSymbolV2RenderContext &context)
virtual QColor dxfColor(const QgsSymbolV2RenderContext &context) const
double mDistance
Distance (in mm or map units) between lines.
QColor fillColor() const
Get fill color.
QgsSymbolLayerV2 * clone() const
static QgsSymbolLayerV2 * create(const QgsStringMap &properties=QgsStringMap())
void setSvgOutlineWidthUnit(QgsSymbolV2::OutputUnit unit)
QgsStringMap properties() const
static void createDisplacementElement(QDomDocument &doc, QDomElement &element, QPointF offset)
double mLineAngle
Vector line angle in degrees (0 = horizontal, counterclockwise)
GradientSpread mGradientSpread
virtual QColor fillColor() const
Get fill color.
void applyDataDefinedSymbology(QgsSymbolV2RenderContext &context, const QPolygonF &points)
void renderPolygon(const QPolygonF &points, QList< QPolygonF > *rings, QgsSymbolV2RenderContext &context)
QgsVectorColorRampV2 * mGradientRamp
QMap< QString, QString > QgsStringMap
void startRender(QgsSymbolV2RenderContext &context)
QgsSymbolLayerV2 * clone() const
void setColorRamp(QgsVectorColorRampV2 *ramp)
bool qgsDoubleNear(double a, double b, double epsilon=4 *DBL_EPSILON)
QgsSymbolV2::OutputUnit outputUnit() const
void setWidth(double width)
virtual double estimateMaxBleed() const
Returns the estimated maximum distance which the layer style will bleed outside the drawn shape...
void setSvgOutlineColor(const QColor &c)
static QString encodeColor(QColor color)
void setInterval(double interval)
void applyPattern(const QgsSymbolV2RenderContext &context, QBrush &brush, double lineAngle, double distance, double lineWidth, const QColor &color)
Applies the svg pattern to the brush.
QgsSymbolV2::OutputUnit outputUnit() const
void setColor(const QColor &c)
void setDistanceUnit(QgsSymbolV2::OutputUnit unit)
virtual QgsExpression * expression(const QString &property) const
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)
virtual void prepareExpressions(const QgsVectorLayer *vl, double scale=-1.0)
bool setSubSymbol(QgsSymbolV2 *symbol)
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.
QgsSymbolV2::OutputUnit mDisplacementYUnit
Perform transforms between map coordinates and device coordinates.
void setOutputUnit(QgsSymbolV2::OutputUnit unit)
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)
static QgsSymbolLayerV2 * createMarkerLayerFromSld(QDomElement &element)
#define DEFAULT_SIMPLEFILL_BORDERSTYLE
QgsStringMap properties() const
bool mReferencePoint2IsCentroid
QByteArray mSvgData
SVG data.
Qt::PenStyle borderStyle() const
void setOutlineWidthUnit(QgsSymbolV2::OutputUnit unit)
QgsLineSymbolV2 * mOutline
Custom outline.
#define DEFAULT_SIMPLEFILL_STYLE
virtual ~QgsImageFillSymbolLayer()
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.
static bool fillFromSld(QDomElement &element, Qt::BrushStyle &brushStyle, QColor &color)
void setScaleFactor(double factor)
void setOutputUnit(QgsSymbolV2::OutputUnit unit)
const QgsFeature * feature() const
QgsSymbolLayerV2 * clone() const
double mOffset
Offset perpendicular to line direction.
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.
QColor dxfColor(const QgsSymbolV2RenderContext &context) const
static Qt::PenStyle decodePenStyle(QString str)
void setLineWidthUnit(QgsSymbolV2::OutputUnit unit)
void toSld(QDomDocument &doc, QDomElement &element, QgsStringMap props) const
virtual QgsVectorColorRampV2 * clone() const =0
~QgsCentroidFillSymbolLayerV2()
static QgsSymbolLayerV2 * createFromSld(QDomElement &element)
void toSld(QDomDocument &doc, QDomElement &element, QgsStringMap props) const
static QgsSymbolLayerV2 * create(const QgsStringMap &properties=QgsStringMap())
void setOffsetUnit(QgsSymbolV2::OutputUnit unit)
QgsMarkerSymbolV2 * mMarker
virtual QSet< QString > usedAttributes() const
void renderPolyline(const QPolygonF &points, const QgsFeature *f, QgsRenderContext &context, int layer=-1, bool selected=false)
void applyGradient(const QgsSymbolV2RenderContext &context, QBrush &brush, const QColor &color, const QColor &color2, const GradientColorType &gradientColorType, QgsVectorColorRampV2 *gradientRamp, const GradientType &gradientType, const GradientCoordinateMode &coordinateMode, const GradientSpread &gradientSpread, const QPointF &referencePoint1, const QPointF &referencePoint2, const double angle)
Applies the gradient to a brush.
static QString symbolNameToPath(QString name)
Get symbol's path from its name.
QgsSVGFillSymbolLayer(const QString &svgFilePath="", double width=20, double rotation=0.0)
~QgsLinePatternFillSymbolLayer()
Qt::PenStyle mBorderStyle
void stopRender(QgsSymbolV2RenderContext &context)
QColor svgFillColor() const
QgsCentroidFillSymbolLayerV2()
void setPainter(QPainter *p)
double rasterScaleFactor() const
static const bool selectFillStyle
static double pixelSizeScaleFactor(const QgsRenderContext &c, QgsSymbolV2::OutputUnit u)
Returns scale factor painter units -> pixel dimensions.
double mapUnitsPerPixel() const
Return current map units per pixel.
virtual QColor color() const
void applyPattern(QBrush &brush, const QString &svgFilePath, double patternWidth, QgsSymbolV2::OutputUnit patternWidthUnit, const QColor &svgFillColor, const QColor &svgOutlineColor, double svgOutlineWidth, QgsSymbolV2::OutputUnit svgOutlineWidthUnit, const QgsSymbolV2RenderContext &context)
Applies the svg pattern to the brush.
static QgsSymbolLayerV2 * create(const QgsStringMap &properties=QgsStringMap())
void setDisplacementXUnit(QgsSymbolV2::OutputUnit unit)
QgsSymbolV2::OutputUnit mOffsetUnit
void renderPoint(const QPointF &point, const QgsFeature *f, QgsRenderContext &context, int layer=-1, bool selected=false)
void setBorderWidthUnit(QgsSymbolV2::OutputUnit unit)
void startRender(QgsSymbolV2RenderContext &context)
QgsSymbolV2::OutputUnit mOffsetUnit
QPointF referencePoint1() const
QString mSvgFilePath
Path to the svg file (or empty if constructed directly from data)
QgsSymbolV2::SymbolType type() const
QgsSymbolV2::OutputUnit mOffsetUnit
QgsSymbolV2::OutputUnit mOutlineWidthUnit
double mOutlineWidth
Outline width.
QString layerType() const
double ANALYSIS_EXPORT angle(Point3D *p1, Point3D *p2, Point3D *p3, Point3D *p4)
Calculates the angle between two segments (in 2 dimension, z-values are ignored)
void setDistanceXUnit(QgsSymbolV2::OutputUnit unit)
double mLineWidth
Line width (in mm or map units)
QColor svgOutlineColor() const
void startRender(QgsSymbolV2RenderContext &context)
GradientSpread gradientSpread() const
Gradient spread mode.
static QgsSymbolLayerV2 * createLineLayerFromSld(QDomElement &element)
static QgsSymbolLayerV2 * createFromSld(QDomElement &element)
virtual bool setSubSymbol(QgsSymbolV2 *symbol)
void setOffset(QPointF offset)
Offset for gradient fill.
virtual QString layerType() const =0
void stopRender(QgsSymbolV2RenderContext &context)
void setDisplacementY(double d)
double estimateMaxBleed() const
Returns the estimated maximum distance which the layer style will bleed outside the drawn shape...
QgsSymbolV2::OutputUnit mDistanceYUnit
virtual QgsSymbolV2 * clone() const
static QgsVectorColorRampV2 * create(const QgsStringMap &properties=QgsStringMap())
void setOffset(QPointF offset)
void setLineWidth(double w)
void applyPattern(const QgsSymbolV2RenderContext &context, QBrush &brush, double distanceX, double distanceY, double displacementX, double displacementY)
A class for svg fill patterns.
bool setSubSymbol(QgsSymbolV2 *symbol)
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)
void setDefaultSvgParams()
Contains information about the context of a rendering operation.
Qt::BrushStyle mBrushStyle
QColor color2() const
Color for endpoint of gradient, only used if the gradient color type is set to SimpleTwoColor.
QPointF rotateReferencePoint(const QPointF &refPoint, double angle)
rotates a reference point by a specified angle around the point (0.5, 0.5)
void stopRender(QgsRenderContext &context)
void setColor(const QColor &color)
void storeViewBox()
Helper function that gets the view box from the byte array.
static QString encodeBrushStyle(Qt::BrushStyle style)
GradientColorType mGradientColorType
QgsPointPatternFillSymbolLayer()
QgsSymbolV2 * subSymbol()
QgsSymbolV2::OutputUnit mDistanceXUnit
QgsStringMap properties() const
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)
virtual QgsSymbolV2 * clone() const
void toSld(QDomDocument &doc, QDomElement &element, QgsStringMap props) const
QList< QgsSymbolLayerV2 * > QgsSymbolLayerV2List
void setSvgFilePath(const QString &svgPath)
QgsRenderContext & renderContext()
QgsSymbolV2::OutputUnit mBorderWidthUnit
static QgsSymbolLayerV2 * createFromSld(QDomElement &element)
void applyDataDefinedSettings(const QgsSymbolV2RenderContext &context)
void startRender(QgsRenderContext &context, const QgsVectorLayer *layer=0)
static QgsSymbolLayerV2 * create(const QgsStringMap &properties=QgsStringMap())
virtual ~QgsGradientFillSymbolLayerV2()
void setMapToPixel(const QgsMapToPixel &mtp)
QgsSymbolV2::OutputUnit outputUnit() const
static void externalGraphicToSld(QDomDocument &doc, QDomElement &element, QString path, QString mime, QColor color, double size=-1)
QgsSymbolV2::OutputUnit mDistanceUnit
QString layerType() const
void setDistanceY(double d)
QgsMarkerSymbolV2 * mMarkerSymbol
static double lineWidthScaleFactor(const QgsRenderContext &c, QgsSymbolV2::OutputUnit u)
Returns the line width scale factor depending on the unit and the paint device.
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 startRender(QgsSymbolV2RenderContext &context)
static bool rotationFromSldElement(QDomElement &element, QString &rotationFunc)
GradientType gradientType() const
Type of gradient, eg linear or radial.
QColor borderColor() const
void setDistanceX(double d)
static QPointF polygonCentroid(const QPolygonF &points)
Calculate the centroid point of a QPolygonF.
void stopRender(QgsSymbolV2RenderContext &context)
void setRasterScaleFactor(double factor)
QgsLineSymbolV2 * mFillLineSymbol
Fill line.
~QgsPointPatternFillSymbolLayer()
virtual double estimateMaxBleed() const
Returns the estimated maximum distance which the layer style will bleed outside the drawn shape...
void applyDataDefinedSettings(const QgsSymbolV2RenderContext &context)
QgsSymbolLayerV2 * symbolLayer(int layer)
static QgsSymbolLayerV2 * createFromSld(QDomElement &element)
virtual double dxfWidth(const QgsDxfExport &e, const QgsSymbolV2RenderContext &context) const
void setOffset(double offset)
void setPatternWidthUnit(QgsSymbolV2::OutputUnit unit)
void stopRender(QgsSymbolV2RenderContext &context)
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
QgsSymbolLayerV2 * clone() const
QString layerType() const
void _renderPolygon(QPainter *p, const QPolygonF &points, const QList< QPolygonF > *rings, QgsSymbolV2RenderContext &context)
Default method to render polygon.
static const bool selectFillBorder
QString layerType() const
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 toSld(QDomDocument &doc, QDomElement &element, QgsStringMap props) const
void setReferencePoint2(QPointF referencePoint)
End point of gradient fill, in the range [0,0] - [1,1].
QgsSymbolLayerV2 * clone() const
void setDisplacementX(double d)
void saveDataDefinedProperties(QgsStringMap &stringMap) const
Saves data defined properties to string map.
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)
void setAlpha(qreal alpha)
Set alpha transparency 1 for opaque, 0 for invisible.
double displacementY() const
static QgsSymbolLayerV2 * create(const QgsStringMap &properties=QgsStringMap())
void setOutputUnit(QgsSymbolV2::OutputUnit unit)
void renderPolygon(const QPolygonF &points, QList< QPolygonF > *rings, QgsSymbolV2RenderContext &context)
static QgsSymbolV2::OutputUnit decodeOutputUnit(QString str)
#define DEFAULT_SIMPLEFILL_BORDERWIDTH
void copyDataDefinedProperties(QgsSymbolLayerV2 *destLayer) const
Copies data defined properties of this layer to another symbol layer.
void setOffsetUnit(QgsSymbolV2::OutputUnit unit)
Units for gradient fill offset.
Qt::PenStyle dxfPenStyle() const
const QgsVectorLayer * layer() const
QRectF mSvgViewBox
SVG view box (to keep the aspect ratio.
QImage * mSvgPattern
SVG pattern image.
double mPatternWidth
Width of the pattern (in output units)
virtual void setDataDefinedProperty(const QString &property, const QString &expressionString)
QString layerType() const
void applyDataDefinedSymbology(QgsSymbolV2RenderContext &context, QBrush &brush, QPen &pen, QPen &selPen)
#define DEFAULT_SIMPLEFILL_COLOR
void startRender(QgsSymbolV2RenderContext &context)
QString ogrFeatureStyle(double mmScaleFactor, double mapUnitScaleFactor) const