28#include <QDomDocument> 
   32  : mStrokeColor( QColor( 35, 35, 35 ) )
 
   35  mPen.setColor( mStrokeColor );
 
   36  mPen.setStyle( mStrokeStyle );
 
   37  mPen.setJoinStyle( mPenJoinStyle );
 
   40  mBrush.setStyle( Qt::SolidPattern );
 
 
   50  if ( 
properties.contains( QStringLiteral( 
"symbol_name" ) ) )
 
   54  if ( 
properties.contains( QStringLiteral( 
"size" ) ) )
 
   58  if ( 
properties.contains( QStringLiteral( 
"size_unit" ) ) )
 
   62  if ( 
properties.contains( QStringLiteral( 
"size_map_unit_scale" ) ) )
 
   66  if ( 
properties.contains( QStringLiteral( 
"symbol_width" ) ) )
 
   70  if ( 
properties.contains( QStringLiteral( 
"symbol_width_unit" ) ) )
 
   74  if ( 
properties.contains( QStringLiteral( 
"symbol_width_map_unit_scale" ) ) )
 
   78  if ( 
properties.contains( QStringLiteral( 
"symbol_height" ) ) )
 
   82  if ( 
properties.contains( QStringLiteral( 
"symbol_height_unit" ) ) )
 
   86  if ( 
properties.contains( QStringLiteral( 
"symbol_height_map_unit_scale" ) ) )
 
   90  if ( 
properties.contains( QStringLiteral( 
"angle" ) ) )
 
   94  if ( 
properties.contains( QStringLiteral( 
"outline_style" ) ) )
 
   98  else if ( 
properties.contains( QStringLiteral( 
"line_style" ) ) )
 
  102  if ( 
properties.contains( QStringLiteral( 
"joinstyle" ) ) )
 
  106  if ( 
properties.contains( QStringLiteral( 
"cap_style" ) ) )
 
  110  if ( 
properties.contains( QStringLiteral( 
"outline_width" ) ) )
 
  114  else if ( 
properties.contains( QStringLiteral( 
"line_width" ) ) )
 
  118  if ( 
properties.contains( QStringLiteral( 
"outline_width_unit" ) ) )
 
  122  else if ( 
properties.contains( QStringLiteral( 
"line_width_unit" ) ) )
 
  126  if ( 
properties.contains( QStringLiteral( 
"outline_width_map_unit_scale" ) ) )
 
  130  if ( 
properties.contains( QStringLiteral( 
"fill_color" ) ) )
 
  135  else if ( 
properties.contains( QStringLiteral( 
"color" ) ) )
 
  139  if ( 
properties.contains( QStringLiteral( 
"outline_color" ) ) )
 
  143  else if ( 
properties.contains( QStringLiteral( 
"line_color" ) ) )
 
  147  if ( 
properties.contains( QStringLiteral( 
"offset" ) ) )
 
  151  if ( 
properties.contains( QStringLiteral( 
"offset_unit" ) ) )
 
  155  if ( 
properties.contains( QStringLiteral( 
"offset_map_unit_scale" ) ) )
 
  159  if ( 
properties.contains( QStringLiteral( 
"horizontal_anchor_point" ) ) )
 
  163  if ( 
properties.contains( QStringLiteral( 
"vertical_anchor_point" ) ) )
 
 
  176  double scaledWidth = mSymbolWidth;
 
  177  double scaledHeight = mSymbolHeight;
 
  179  QColor brushColor = 
mColor;
 
  180  brushColor.setAlphaF( brushColor.alphaF() * context.
opacity() );
 
  181  mBrush.setColor( brushColor );
 
  183  QColor penColor = mStrokeColor;
 
  184  penColor.setAlphaF( penColor.alphaF() * context.
opacity() );
 
  185  mPen.setColor( penColor );
 
  194      double width = exprVal.toDouble( &ok );
 
  198        mPen.setWidthF( width );
 
  199        mSelPen.setWidthF( width );
 
  211      mSelPen.setStyle( mPen.style() );
 
  222      mSelPen.setJoinStyle( mPen.joinStyle() );
 
  241    brushColor.setAlphaF( brushColor.alphaF() * context.
opacity() );
 
  242    mBrush.setColor( brushColor );
 
  249    penColor.setAlphaF( penColor.alphaF() * context.
opacity() );
 
  250    mPen.setColor( penColor );
 
  262    preparePath( 
shape, context, &scaledWidth, &scaledHeight, context.
feature() );
 
  266  bool hasDataDefinedRotation = 
false;
 
  269  calculateOffsetAndRotation( context, scaledWidth, scaledHeight, hasDataDefinedRotation, 
offset, 
angle );
 
  277  QTransform transform;
 
  278  transform.translate( point.x() + 
offset.x(), point.y() + 
offset.y() );
 
  281    transform.rotate( 
angle );
 
  287    p->setPen( useSelectedColor ? mSelPen : mPen );
 
  288    p->setBrush( useSelectedColor ? mSelBrush : mBrush );
 
  292    p->setPen( useSelectedColor ? mSelPen : mPen );
 
  293    p->setBrush( QBrush() );
 
  295  p->drawPath( transform.map( mPainterPath ) );
 
 
  302    bool &hasDataDefinedRotation,
 
  304    double &angle )
 const 
  308  markerOffset( context, scaledWidth, scaledHeight, mSymbolWidthUnit, mSymbolHeightUnit, offsetX, offsetY, mSymbolWidthMapUnitScale, mSymbolHeightMapUnitScale );
 
  309  offset = QPointF( offsetX, offsetY );
 
  312  const bool ok = 
true;
 
  314  bool usingDataDefinedRotation = 
false;
 
  319    usingDataDefinedRotation = ok;
 
  323  if ( hasDataDefinedRotation )
 
  348  return QStringLiteral( 
"EllipseMarker" );
 
 
  361    preparePath( mShape, context );
 
  363  mPen.setColor( mStrokeColor );
 
  364  mPen.setStyle( mStrokeStyle );
 
  365  mPen.setJoinStyle( mPenJoinStyle );
 
  366  mPen.setCapStyle( mPenCapStyle );
 
  368  mBrush.setColor( 
mColor );
 
  371  QColor selPenColor = selBrushColor == 
mColor ? selBrushColor : mStrokeColor;
 
  374    selBrushColor.setAlphaF( context.
opacity() );
 
  375    selPenColor.setAlphaF( context.
opacity() );
 
  377  mSelBrush = QBrush( selBrushColor );
 
  378  mSelPen = QPen( !
shapeIsFilled( mShape ) ? selBrushColor : selPenColor );
 
  379  mSelPen.setStyle( mStrokeStyle );
 
 
  422  QDomElement symbolizerElem = doc.createElement( QStringLiteral( 
"se:PointSymbolizer" ) );
 
  423  if ( !props.value( QStringLiteral( 
"uom" ), QString() ).toString().isEmpty() )
 
  424    symbolizerElem.setAttribute( QStringLiteral( 
"uom" ), props.value( QStringLiteral( 
"uom" ), QString() ).toString() );
 
  425  element.appendChild( symbolizerElem );
 
 
  436  QDomElement graphicElem = doc.createElement( QStringLiteral( 
"se:Graphic" ) );
 
  437  element.appendChild( graphicElem );
 
  446  QString angleFunc = props.
value( QStringLiteral( 
"angle" ), QString() ).toString();
 
  447  if ( angleFunc.isEmpty() )  
 
  449    if ( ddRotation && ddRotation.
isActive() )
 
  454      angleFunc = QString::number( 
mAngle );
 
  456  else if ( ddRotation && ddRotation.
isActive() )
 
  460    angleFunc = QStringLiteral( 
"%1 + %2" ).arg( angleFunc, ddRotation.
asExpression() );
 
  466    const double angle = angleFunc.toDouble( &ok );
 
  470      angleFunc = QStringLiteral( 
"%1 + %2" ).arg( angleFunc ).arg( 
mAngle );
 
  485  const double widthHeightFactor = mSymbolWidth / mSymbolHeight;
 
  487  graphicElem.appendChild( factorElem );
 
 
  494  QDomElement graphicElem = element.firstChildElement( QStringLiteral( 
"Graphic" ) );
 
  495  if ( graphicElem.isNull() )
 
  498  QString name = QStringLiteral( 
"circle" );
 
  501  double widthHeightFactor = 1.0;
 
  505  for ( QgsStringMap::iterator it = vendorOptions.begin(); it != vendorOptions.end(); ++it )
 
  507    if ( it.key() == QLatin1String( 
"widthHeightFactor" ) )
 
  510      const double v = it.value().toDouble( &ok );
 
  512        widthHeightFactor = v;
 
  519  double scaleFactor = 1.0;
 
  520  const QString uom = element.attribute( QStringLiteral( 
"uom" ) );
 
  530    const double d = angleFunc.toDouble( &ok );
 
 
  551  map[QStringLiteral( 
"symbol_name" )] = 
encodeShape( mShape );
 
  552  map[QStringLiteral( 
"symbol_width" )] = QString::number( mSymbolWidth );
 
  555  map[QStringLiteral( 
"symbol_height" )] = QString::number( mSymbolHeight );
 
  558  map[QStringLiteral( 
"angle" )] = QString::number( 
mAngle );
 
  560  map[QStringLiteral( 
"outline_width" )] = QString::number( mStrokeWidth );
 
  570  map[QStringLiteral( 
"size" )] = QString::number( 
mSize );
 
 
  578QSizeF QgsEllipseSymbolLayer::calculateSize( 
QgsSymbolRenderContext &context, 
double *scaledWidth, 
double *scaledHeight )
 
  589    width = mSymbolWidth;
 
  593    *scaledWidth = width;
 
  605    height = mSymbolHeight;
 
  609    *scaledHeight = height;
 
  612  return QSizeF( width, height );
 
  617  mPainterPath = QPainterPath();
 
  619  const QSizeF 
size = calculateSize( context, scaledWidth, scaledHeight );
 
  624      mPainterPath.addEllipse( QRectF( -
size.width() / 2.0, -
size.height() / 2.0, 
size.width(), 
size.height() ) );
 
  628      mPainterPath.arcTo( -
size.width() / 2.0, -
size.height() / 2.0, 
size.width(), 
size.height(), 0, 180 );
 
  629      mPainterPath.lineTo( 0, 0 );
 
  633      mPainterPath.arcTo( -
size.width() / 2.0, -
size.height() / 2.0, 
size.width(), 
size.height(), 90, 120 );
 
  634      mPainterPath.lineTo( 0, 0 );
 
  638      mPainterPath.arcTo( -
size.width() / 2.0, -
size.height() / 2.0, 
size.width(), 
size.height(), 90, 90 );
 
  639      mPainterPath.lineTo( 0, 0 );
 
  643      mPainterPath.addRect( QRectF( -
size.width() / 2.0, -
size.height() / 2.0, 
size.width(), 
size.height() ) );
 
  647      mPainterPath.moveTo( -
size.width() / 2.0, 0 );
 
  648      mPainterPath.lineTo( 0, 
size.height() / 2.0 );
 
  649      mPainterPath.lineTo( 
size.width() / 2.0, 0 );
 
  650      mPainterPath.lineTo( 0, -
size.height() / 2.0 );
 
  651      mPainterPath.lineTo( -
size.width() / 2.0, 0 );
 
  655      mPainterPath.moveTo( 0, -
size.height() / 2.0 );
 
  656      mPainterPath.lineTo( 0, 
size.height() / 2.0 );
 
  657      mPainterPath.moveTo( -
size.width() / 2.0, 0 );
 
  658      mPainterPath.lineTo( 
size.width() / 2.0, 0 );
 
  662      mPainterPath.moveTo( -
size.width() / 2.0, 
size.height() / 2.0 );
 
  663      mPainterPath.lineTo( 0, -
size.height() / 2.0 );
 
  664      mPainterPath.lineTo( 
size.width() / 2.0, 
size.height() / 2.0 );
 
  668      mPainterPath.moveTo( 
size.width() / 2.0, 0 );
 
  669      mPainterPath.arcTo( -
size.width() / 2.0, -
size.height() / 2.0, 
size.width(), 
size.height(), 0, 180 );
 
  673      mPainterPath.moveTo( 0, -
size.height() / 2.0 );
 
  674      mPainterPath.lineTo( -
size.width() / 2.0, 
size.height() / 2.0 );
 
  675      mPainterPath.lineTo( 
size.width() / 2.0, 
size.height() / 2.0 );
 
  676      mPainterPath.lineTo( 0, -
size.height() / 2.0 );
 
  680      mPainterPath.moveTo( 0, 
size.height() / 2.0 );
 
  681      mPainterPath.lineTo( 
size.width() / 2.0, 
size.height() / 2.0 );
 
  682      mPainterPath.lineTo( 0, -
size.height() / 2.0 );
 
  683      mPainterPath.lineTo( 0, 
size.height() / 2.0 );
 
  687      mPainterPath.moveTo( -
size.width() / 2.0, 
size.height() / 2.0 );
 
  688      mPainterPath.lineTo( 0, 
size.height() / 2.0 );
 
  689      mPainterPath.lineTo( 0, -
size.height() / 2.0 );
 
  690      mPainterPath.lineTo( -
size.width() / 2.0, 
size.height() / 2.0 );
 
  694      mPainterPath.moveTo( ( 
size.width() * -0.9511 ) / 2.0, 
size.height() / ( 2 / -0.309 ) );
 
  695      mPainterPath.lineTo( ( 
size.width() * -0.5878 ) / 2.0, 
size.height() / ( 2 / 0.8090 ) );
 
  696      mPainterPath.lineTo( ( 
size.width() * 0.5878 ) / 2.0, 
size.height() / ( 2 / 0.8090 ) );
 
  697      mPainterPath.lineTo( ( 
size.width() * 0.9511 ) / 2.0, 
size.height() / ( 2 / -0.309 ) );
 
  698      mPainterPath.lineTo( 0, 
size.height() / -2.0 );
 
  699      mPainterPath.lineTo( ( 
size.width() * -0.9511 ) / 2.0, 
size.height() / ( 2 / -0.309 ) );
 
  703      mPainterPath.moveTo( ( 
size.width() * 0.8660 ) / 2.0, 
size.height() / 4.0 );
 
  704      mPainterPath.lineTo( ( 
size.width() * 0.8660 ) / 2.0, 
size.height() / -4.0 );
 
  705      mPainterPath.lineTo( 0, 
size.height() / -2.0 );
 
  706      mPainterPath.lineTo( ( 
size.width() * 0.8660 ) / -2.0, 
size.height() / -4.0 );
 
  707      mPainterPath.lineTo( ( 
size.width() * 0.8660 ) / -2.0, 
size.height() / 4.0 );
 
  708      mPainterPath.lineTo( 0, 
size.height() / 2.0 );
 
  709      mPainterPath.lineTo( ( 
size.width() * 0.8660 ) / 2.0, 
size.height() / 4.0 );
 
  714      static constexpr double VERTEX_OFFSET_FROM_ORIGIN = 1.0 / ( 1 + M_SQRT2 );
 
  715      mPainterPath.moveTo( ( 
size.width() * VERTEX_OFFSET_FROM_ORIGIN ) / -2.0, 
size.height() / 2.0 );
 
  716      mPainterPath.lineTo( ( 
size.width() * VERTEX_OFFSET_FROM_ORIGIN ) / 2.0, 
size.height() / 2.0 );
 
  717      mPainterPath.lineTo( 
size.width() / 2.0, ( 
size.height() * VERTEX_OFFSET_FROM_ORIGIN ) / 2.0 );
 
  718      mPainterPath.lineTo( 
size.width() / 2.0, ( 
size.height() * VERTEX_OFFSET_FROM_ORIGIN ) / -2.0 );
 
  719      mPainterPath.lineTo( ( 
size.width() * VERTEX_OFFSET_FROM_ORIGIN ) / 2.0, 
size.height() / -2.0 );
 
  720      mPainterPath.lineTo( ( 
size.width() * VERTEX_OFFSET_FROM_ORIGIN ) / -2.0, 
size.height() / -2.0 );
 
  721      mPainterPath.lineTo( 
size.width() / -2.0, ( 
size.height() * VERTEX_OFFSET_FROM_ORIGIN ) / -2.0 );
 
  722      mPainterPath.lineTo( 
size.width() / -2.0, ( 
size.height() * VERTEX_OFFSET_FROM_ORIGIN ) / 2.0 );
 
  723      mPainterPath.lineTo( ( 
size.width() * VERTEX_OFFSET_FROM_ORIGIN ) / -2.0, 
size.height() / 2.0 );
 
  729      const double inner_r = std::cos( 
DEG2RAD( 72.0 ) ) / std::cos( 
DEG2RAD( 36.0 ) );
 
  730      mPainterPath.moveTo( ( 
size.width() * inner_r * std::sin( 
DEG2RAD( 324.0 ) ) ) / 2.0, ( 
size.height() * inner_r * std::cos( 
DEG2RAD( 324.0 ) ) ) / -2.0 );
 
  731      mPainterPath.lineTo( ( 
size.width() * std::sin( 
DEG2RAD( 288.0 ) ) ) / 2.0, ( 
size.height() * std::cos( 
DEG2RAD( 288.0 ) ) ) / -2.0 );
 
  732      mPainterPath.lineTo( ( 
size.width() * inner_r * std::sin( 
DEG2RAD( 252.0 ) ) ) / 2.0, ( 
size.height() * inner_r * std::cos( 
DEG2RAD( 252.0 ) ) ) / -2.0 );
 
  733      mPainterPath.lineTo( ( 
size.width() * std::sin( 
DEG2RAD( 216.0 ) ) ) / 2.0, ( 
size.height() * std::cos( 
DEG2RAD( 216.0 ) ) ) / -2.0 );
 
  734      mPainterPath.lineTo( 0, ( 
size.height() * inner_r ) / 2.0 );
 
  735      mPainterPath.lineTo( ( 
size.width() * std::sin( 
DEG2RAD( 144.0 ) ) ) / 2.0, ( 
size.height() * std::cos( 
DEG2RAD( 144.0 ) ) ) / -2.0 );
 
  736      mPainterPath.lineTo( ( 
size.width() * inner_r * std::sin( 
DEG2RAD( 108.0 ) ) ) / 2.0, ( 
size.height() * inner_r * std::cos( 
DEG2RAD( 108.0 ) ) ) / -2.0 );
 
  737      mPainterPath.lineTo( ( 
size.width() * std::sin( 
DEG2RAD( 72.0 ) ) ) / 2.0, ( 
size.height() * std::cos( 
DEG2RAD( 72.0 ) ) ) / -2.0 );
 
  738      mPainterPath.lineTo( ( 
size.width() * inner_r * std::sin( 
DEG2RAD( 36.0 ) ) ) / 2.0, ( 
size.height() * inner_r * std::cos( 
DEG2RAD( 36.0 ) ) ) / -2.0 );
 
  739      mPainterPath.lineTo( 0, 
size.height() / -2.0 );
 
  740      mPainterPath.lineTo( ( 
size.width() * inner_r * std::sin( 
DEG2RAD( 324.0 ) ) ) / 2.0, ( 
size.height() * inner_r * std::cos( 
DEG2RAD( 324.0 ) ) ) / -2.0 );
 
  776  if ( mSymbolWidth >= mSymbolHeight )
 
  778    mSymbolHeight = mSymbolHeight * 
size / mSymbolWidth;
 
  783    mSymbolWidth = mSymbolWidth * 
size / mSymbolHeight;
 
  784    mSymbolHeight = 
size;
 
 
  804  mSymbolWidthUnit = unit;
 
  805  mSymbolHeightUnit = unit;
 
  806  mStrokeWidthUnit = unit;
 
 
  812  if ( mSymbolWidthUnit != unit || mSymbolHeightUnit != unit || mStrokeWidthUnit != unit )
 
 
  830  mSymbolWidthMapUnitScale = scale;
 
  831  mSymbolHeightMapUnitScale = scale;
 
  832  mStrokeWidthMapUnitScale = scale;
 
 
  838       mSymbolWidthMapUnitScale == mSymbolHeightMapUnitScale &&
 
  839       mSymbolHeightMapUnitScale == mStrokeWidthMapUnitScale )
 
  841    return mSymbolWidthMapUnitScale;
 
 
  848  const QSizeF 
size = calculateSize( context );
 
  850  bool hasDataDefinedRotation = 
false;
 
  853  calculateOffsetAndRotation( context, 
size.width(), 
size.height(), hasDataDefinedRotation, 
offset, 
angle );
 
  855  QTransform transform;
 
  858  transform.translate( point.x() + 
offset.x(), point.y() + 
offset.y() );
 
  861    transform.rotate( 
angle );
 
  863  double penWidth = mStrokeWidth;
 
  872      const double strokeWidth = exprVal.toDouble( &ok );
 
  890  else if ( mStrokeStyle == Qt::NoPen )
 
  896  QRectF symbolBounds = transform.mapRect( QRectF( -
size.width() / 2.0,
 
  897                        -
size.height() / 2.0,
 
  902  symbolBounds.adjust( -penWidth / 2.0, -penWidth / 2.0,
 
  903                       penWidth / 2.0, penWidth / 2.0 );
 
 
  957  QColor oc = mStrokeColor;
 
  976  QPointF off( offsetX, offsetY );
 
  979  double rotation = 0.0;
 
  989  rotation = -rotation; 
 
  994  t.translate( shift.x() + offsetX, shift.y() + offsetY );
 
  997    t.rotate( rotation );
 
 1008        const QgsPoint pt( t.map( QPointF( 0, 0 ) ) );
 
 1015        const double stepsize = 2 * M_PI / 40;
 
 1016        for ( 
int i = 0; i < 39; ++i )
 
 1018          const double angle = stepsize * i;
 
 1019          const double x = halfWidth * std::cos( 
angle );
 
 1020          const double y = halfHeight * std::sin( 
angle );
 
 1021          line << 
QgsPoint( t.map( QPointF( x, y ) ) );
 
 1024        line << line.at( 0 );
 
 1026        if ( mBrush.style() != Qt::NoBrush )
 
 1028        if ( mPen.style() != Qt::NoPen )
 
 1037      p << 
QgsPoint( t.map( QPointF( -halfWidth, -halfHeight ) ) )
 
 1038        << 
QgsPoint( t.map( QPointF( halfWidth, -halfHeight ) ) )
 
 1039        << 
QgsPoint( t.map( QPointF( halfWidth, halfHeight ) ) )
 
 1040        << 
QgsPoint( t.map( QPointF( -halfWidth, halfHeight ) ) );
 
 1043      if ( mBrush.style() != Qt::NoBrush )
 
 1045      if ( mPen.style() != Qt::NoPen )
 
 1051      if ( mPen.style() != Qt::NoPen )
 
 1054                         << 
QgsPoint( t.map( QPointF( -halfWidth, 0 ) ) )
 
 1055                         << 
QgsPoint( t.map( QPointF( halfWidth, 0 ) ) ),
 
 1056                         layerName, QStringLiteral( 
"CONTINUOUS" ), oc, 
strokeWidth );
 
 1058                         << 
QgsPoint( t.map( QPointF( 0, halfHeight ) ) )
 
 1059                         << 
QgsPoint( t.map( QPointF( 0, -halfHeight ) ) ),
 
 1060                         layerName, QStringLiteral( 
"CONTINUOUS" ), oc, 
strokeWidth );
 
 1069      p << 
QgsPoint( t.map( QPointF( -halfWidth, -halfHeight ) ) )
 
 1070        << 
QgsPoint( t.map( QPointF( halfWidth, -halfHeight ) ) )
 
 1071        << 
QgsPoint( t.map( QPointF( 0, halfHeight ) ) );
 
 1073      if ( mBrush.style() != Qt::NoBrush )
 
 1075      if ( mPen.style() != Qt::NoPen )
 
 
 1102  const QString cleaned = name.toLower().trimmed();
 
 1104  if ( cleaned == QLatin1String( 
"circle" ) )
 
 1106  else if ( cleaned == QLatin1String( 
"square" ) || cleaned == QLatin1String( 
"rectangle" ) )
 
 1108  else if ( cleaned == QLatin1String( 
"diamond" ) )
 
 1110  else if ( cleaned == QLatin1String( 
"cross" ) )
 
 1112  else if ( cleaned == QLatin1String( 
"arrow" ) )
 
 1114  else if ( cleaned == QLatin1String( 
"half_arc" ) )
 
 1116  else if ( cleaned == QLatin1String( 
"triangle" ) )
 
 1118  else if ( cleaned == QLatin1String( 
"right_half_triangle" ) )
 
 1120  else if ( cleaned == QLatin1String( 
"left_half_triangle" ) )
 
 1122  else if ( cleaned == QLatin1String( 
"semi_circle" ) )
 
 1124  else if ( cleaned == QLatin1String( 
"third_circle" ) )
 
 1126  else if ( cleaned == QLatin1String( 
"quarter_circle" ) )
 
 1128  else if ( cleaned == QLatin1String( 
"pentagon" ) )
 
 1130  else if ( cleaned == QLatin1String( 
"hexagon" ) )
 
 1132  else if ( cleaned == QLatin1String( 
"octagon" ) )
 
 1134  else if ( cleaned == QLatin1String( 
"star" ) )
 
 1135    return Star;  
if ( ok )
 
 
 1145      return QStringLiteral( 
"circle" );
 
 1147      return QStringLiteral( 
"rectangle" );
 
 1149      return QStringLiteral( 
"diamond" );
 
 1151      return QStringLiteral( 
"cross" );
 
 1153      return QStringLiteral( 
"arrow" );
 
 1155      return QStringLiteral( 
"half_arc" );
 
 1157      return QStringLiteral( 
"triangle" );
 
 1159      return QStringLiteral( 
"right_half_triangle" );
 
 1161      return QStringLiteral( 
"left_half_triangle" );
 
 1163      return QStringLiteral( 
"semi_circle" );
 
 1165      return QStringLiteral( 
"third_circle" );
 
 1167      return QStringLiteral( 
"quarter_circle" );
 
 1169      return QStringLiteral( 
"pentagon" );
 
 1171      return QStringLiteral( 
"hexagon" );
 
 1173      return QStringLiteral( 
"octagon" );
 
 1175      return QStringLiteral( 
"star" );
 
 
 1182  QList< Shape > shapes;
 
 
@ DynamicRotation
Rotation of symbol may be changed during rendering and symbol should not be cached.
 
@ CanCalculateMaskGeometryPerFeature
If present, indicates that mask geometry can safely be calculated per feature for the symbol layer....
 
QFlags< SymbolLayerFlag > SymbolLayerFlags
Symbol layer flags.
 
RenderUnit
Rendering size units.
 
@ Millimeters
Millimeters.
 
@ Unknown
Mixed or unknown units.
 
@ MetersInMapUnits
Meters value as Map units.
 
QColor valueAsColor(int key, const QgsExpressionContext &context, const QColor &defaultColor=QColor(), bool *ok=nullptr) const
Calculates the current value of the property with the specified key and interprets it as a color.
 
double valueAsDouble(int key, const QgsExpressionContext &context, double defaultValue=0.0, bool *ok=nullptr) const
Calculates the current value of the property with the specified key and interprets it as a double.
 
QString valueAsString(int key, const QgsExpressionContext &context, const QString &defaultString=QString(), bool *ok=nullptr) const
Calculates the current value of the property with the specified key and interprets it as a string.
 
static QColor colorFromString(const QString &string)
Decodes a string into a color value.
 
static QString colorToString(const QColor &color)
Encodes a color into a string value.
 
Exports QGIS layers to the DXF format.
 
void writeFilledCircle(const QString &layer, const QColor &color, const QgsPoint &pt, double radius)
Write filled circle (as hatch)
 
void writePolygon(const QgsRingSequence &polygon, const QString &layer, const QString &hatchPattern, const QColor &color)
Draw dxf filled polygon (HATCH)
 
void writePolyline(const QgsPointSequence &line, const QString &layer, const QString &lineStyleName, const QColor &color, double width=-1)
Draw dxf primitives (LWPOLYLINE)
 
A symbol layer for rendering objects with major and minor axis (e.g.
 
void setPenCapStyle(Qt::PenCapStyle style)
Sets the marker's stroke cap style (e.g., flat, round, etc).
 
bool writeDxf(QgsDxfExport &e, double mmMapUnitScaleFactor, const QString &layerName, QgsSymbolRenderContext &context, QPointF shift=QPointF(0.0, 0.0)) const override
write as DXF
 
void setStrokeWidth(double w)
 
void setSymbolHeightMapUnitScale(const QgsMapUnitScale &scale)
 
void setSymbolWidthMapUnitScale(const QgsMapUnitScale &scale)
 
QVariantMap properties() const override
Should be reimplemented by subclasses to return a string map that contains the configuration informat...
 
QRectF bounds(QPointF point, QgsSymbolRenderContext &context) override
Returns the approximate bounding box of the marker symbol layer, taking into account any data defined...
 
Qgis::RenderUnit outputUnit() const override
Returns the units to use for sizes and widths within the symbol layer.
 
void setSymbolWidth(double w)
 
void renderPoint(QPointF point, QgsSymbolRenderContext &context) override
Renders a marker at the specified point.
 
void toSld(QDomDocument &doc, QDomElement &element, const QVariantMap &props) const override
Saves the symbol layer as SLD.
 
double strokeWidth() const
 
void setStrokeColor(const QColor &c) override
Sets the stroke color for the symbol layer.
 
void setStrokeStyle(Qt::PenStyle strokeStyle)
 
static QgsEllipseSymbolLayer::Shape decodeShape(const QString &name, bool *ok=nullptr)
Attempts to decode a string representation of a shape name to the corresponding shape.
 
void setStrokeWidthUnit(Qgis::RenderUnit unit)
Sets the units for the symbol's stroke width.
 
void setSize(double size) override
Sets the symbol size.
 
QgsMapUnitScale mapUnitScale() const override
 
Shape
Marker symbol shapes.
 
@ ThirdCircle
Third Circle.
 
@ Cross
Stroke-only cross.
 
@ QuarterCircle
Quarter Circle.
 
@ HalfArc
Stroke-only half arc.
 
@ Arrow
Stroke-only arrow.
 
@ RightHalfTriangle
Right half of a triangle.
 
@ LeftHalfTriangle
Left half of a triangle.
 
QColor fillColor() const override
Returns the fill color for the symbol layer.
 
QgsEllipseSymbolLayer::Shape shape() const
Returns the shape for the rendered ellipse marker symbol.
 
bool usesMapUnits() const override
Returns true if the symbol layer has any components which use map unit based sizes.
 
void setFillColor(const QColor &c) override
Sets the fill color for the symbol layer.
 
void setShape(QgsEllipseSymbolLayer::Shape shape)
Sets the rendered ellipse marker shape.
 
static QList< QgsEllipseSymbolLayer::Shape > availableShapes()
Returns a list of all available shape types.
 
Qt::PenStyle strokeStyle() const
 
static QgsSymbolLayer * create(const QVariantMap &properties=QVariantMap())
Creates the symbol layer.
 
static QgsSymbolLayer * createFromSld(QDomElement &element)
 
Qgis::SymbolLayerFlags flags() const override
Returns flags which control the symbol layer's behavior.
 
void setOutputUnit(Qgis::RenderUnit unit) override
Sets the units to use for sizes and widths within the symbol layer.
 
static QString encodeShape(QgsEllipseSymbolLayer::Shape shape)
Encodes a shape to its string representation.
 
double symbolWidth() const
 
void setStrokeWidthMapUnitScale(const QgsMapUnitScale &scale)
 
void setSymbolHeightUnit(Qgis::RenderUnit unit)
Sets the units for the symbol's height.
 
void stopRender(QgsSymbolRenderContext &context) override
Called after a set of rendering operations has finished on the supplied render context.
 
QString layerType() const override
Returns a string that represents this layer type.
 
QColor strokeColor() const override
Returns the stroke color for the symbol layer.
 
void setPenJoinStyle(Qt::PenJoinStyle style)
Set stroke join style.
 
static bool shapeIsFilled(const QgsEllipseSymbolLayer::Shape &shape)
Returns true if a shape has a fill.
 
void setSymbolWidthUnit(Qgis::RenderUnit unit)
Sets the units for the symbol's width.
 
void startRender(QgsSymbolRenderContext &context) override
Called before a set of rendering operations commences on the supplied render context.
 
~QgsEllipseSymbolLayer() override
 
void setMapUnitScale(const QgsMapUnitScale &scale) override
 
double symbolHeight() const
 
void setSymbolHeight(double h)
 
void writeSldMarker(QDomDocument &doc, QDomElement &element, const QVariantMap &props) const override
Writes the symbol layer definition as a SLD XML element.
 
QgsEllipseSymbolLayer * clone() const override
Shall be reimplemented by subclasses to create a deep copy of the instance.
 
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
 
A geometry is the spatial representation of a feature.
 
Perform transforms between map coordinates and device coordinates.
 
double mapRotation() const
Returns the current map rotation in degrees (clockwise).
 
Struct for storing maximum and minimum scales for measurements in map units.
 
virtual void setSize(double size)
Sets the symbol size.
 
Qgis::RenderUnit mOffsetUnit
Offset units.
 
QPointF offset() const
Returns the marker's offset, which is the horizontal and vertical displacement which the rendered mar...
 
double mLineAngle
Line rotation angle (see setLineAngle() for details)
 
HorizontalAnchorPoint
Symbol horizontal anchor points.
 
void setOffsetUnit(Qgis::RenderUnit unit)
Sets the units for the symbol's offset.
 
void setAngle(double angle)
Sets the rotation angle for the marker.
 
Qgis::RenderUnit outputUnit() const override
Returns the units to use for sizes and widths within the symbol layer.
 
void setVerticalAnchorPoint(VerticalAnchorPoint v)
Sets the vertical anchor point for positioning the symbol.
 
QPointF mOffset
Marker offset.
 
void setHorizontalAnchorPoint(HorizontalAnchorPoint h)
Sets the horizontal anchor point for positioning the symbol.
 
QgsMapUnitScale mapUnitScale() const override
 
void setOffset(QPointF offset)
Sets the marker's offset, which is the horizontal and vertical displacement which the rendered marker...
 
void setSizeMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the symbol's size.
 
double size() const
Returns the symbol size.
 
QgsMapUnitScale mOffsetMapUnitScale
Offset map unit scale.
 
HorizontalAnchorPoint mHorizontalAnchorPoint
Horizontal anchor point.
 
static QPointF _rotatedOffset(QPointF offset, double angle)
Adjusts a marker offset to account for rotation.
 
QgsMapUnitScale mSizeMapUnitScale
Marker size map unit scale.
 
Qgis::RenderUnit mSizeUnit
Marker size unit.
 
void setOutputUnit(Qgis::RenderUnit unit) override
Sets the units to use for sizes and widths within the symbol layer.
 
void setSizeUnit(Qgis::RenderUnit unit)
Sets the units for the symbol's size.
 
VerticalAnchorPoint
Symbol vertical anchor points.
 
void markerOffset(QgsSymbolRenderContext &context, double &offsetX, double &offsetY) const
Calculates the required marker offset, including both the symbol offset and any displacement required...
 
VerticalAnchorPoint mVerticalAnchorPoint
Vertical anchor point.
 
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the symbol's offset.
 
double mAngle
Marker rotation angle, in degrees clockwise from north.
 
void startRender(QgsSymbolRenderContext &context) override
Called before a set of rendering operations commences on the supplied render context.
 
double angle() const
Returns the rotation angle for the marker, in degrees clockwise from north.
 
void setMapUnitScale(const QgsMapUnitScale &scale) override
 
Point geometry type, with support for z-dimension and m-values.
 
QVariant value(int key, const QgsExpressionContext &context, const QVariant &defaultValue=QVariant()) const final
Returns the calculated value of the property with the specified key from within the collection.
 
bool isActive(int key) const final
Returns true if the collection contains an active property with the specified key.
 
QgsProperty property(int key) const final
Returns a matching property from the collection, if one exists.
 
A store for object properties.
 
QString asExpression() const
Returns an expression string representing the state of the property, or an empty string if the proper...
 
QVariant value(const QgsExpressionContext &context, const QVariant &defaultValue=QVariant(), bool *ok=nullptr) const
Calculates the current value of the property, including any transforms which are set for the property...
 
bool isActive() const
Returns whether the property is currently active.
 
double convertToPainterUnits(double size, Qgis::RenderUnit unit, const QgsMapUnitScale &scale=QgsMapUnitScale(), Qgis::RenderSubcomponentProperty property=Qgis::RenderSubcomponentProperty::Generic) const
Converts a size from the specified units to painter units (pixels).
 
QPainter * painter()
Returns the destination QPainter for the render operation.
 
QgsExpressionContext & expressionContext()
Gets the expression context.
 
const QgsMapToPixel & mapToPixel() const
Returns the context's map to pixel transform, which transforms between map coordinates and device coo...
 
QColor selectionColor() const
Returns the color to use when rendering selected features.
 
static bool rotationFromSldElement(QDomElement &element, QString &rotationFunc)
 
static QString encodePenStyle(Qt::PenStyle style)
 
static Qt::PenJoinStyle decodePenJoinStyle(const QString &str)
 
static QString encodeMapUnitScale(const QgsMapUnitScale &mapUnitScale)
 
static QgsMapUnitScale decodeMapUnitScale(const QString &str)
 
static double rescaleUom(double size, Qgis::RenderUnit unit, const QVariantMap &props)
Rescales the given size based on the uomScale found in the props, if any is found,...
 
static Qt::PenCapStyle decodePenCapStyle(const QString &str)
 
static QString encodePenCapStyle(Qt::PenCapStyle style)
 
static QDomElement createVendorOptionElement(QDomDocument &doc, const QString &name, const QString &value)
 
static bool wellKnownMarkerFromSld(QDomElement &element, QString &name, QColor &color, QColor &strokeColor, Qt::PenStyle &strokeStyle, double &strokeWidth, double &size)
 
static void createDisplacementElement(QDomDocument &doc, QDomElement &element, QPointF offset)
 
static QString encodeColor(const QColor &color)
 
static Qgis::RenderUnit decodeSldUom(const QString &str, double *scaleFactor=nullptr)
Decodes a SLD unit of measure string to a render unit.
 
static void createGeometryElement(QDomDocument &doc, QDomElement &element, const QString &geomFunc)
 
static void wellKnownMarkerToSld(QDomDocument &doc, QDomElement &element, const QString &name, const QColor &color, const QColor &strokeColor, Qt::PenStyle strokeStyle, double strokeWidth=-1, double size=-1)
 
static Qt::PenStyle decodePenStyle(const QString &str)
 
static void createRotationElement(QDomDocument &doc, QDomElement &element, const QString &rotationFunc)
 
static QString encodePoint(QPointF point)
Encodes a QPointF to a string.
 
static QString encodePenJoinStyle(Qt::PenJoinStyle style)
 
static QgsStringMap getVendorOptionList(QDomElement &element)
 
static QPointF decodePoint(const QString &string)
Decodes a QSizeF from a string.
 
bool shouldRenderUsingSelectionColor(const QgsSymbolRenderContext &context) const
Returns true if the symbol layer should be rendered using the selection color from the render context...
 
static const bool SELECTION_IS_OPAQUE
Whether styles for selected features ignore symbol alpha.
 
void copyDataDefinedProperties(QgsSymbolLayer *destLayer) const
Copies all data defined properties of this layer to another symbol layer.
 
@ StrokeStyle
Stroke style (eg solid, dashed)
 
@ Name
Name, eg shape name for simple markers.
 
@ StrokeColor
Stroke color.
 
@ CapStyle
Line cap style.
 
@ JoinStyle
Line join style.
 
@ StrokeWidth
Stroke width.
 
void restoreOldDataDefinedProperties(const QVariantMap &stringMap)
Restores older data defined properties from string map.
 
virtual void setColor(const QColor &color)
Sets the "representative" color for the symbol layer.
 
virtual QColor color() const
Returns the "representative" color of the symbol layer.
 
void copyPaintEffect(QgsSymbolLayer *destLayer) const
Copies paint effect of this layer to another symbol layer.
 
virtual Qgis::SymbolLayerFlags flags() const
Returns flags which control the symbol layer's behavior.
 
QgsPropertyCollection mDataDefinedProperties
 
QgsPropertyCollection & dataDefinedProperties()
Returns a reference to the symbol layer's property collection, used for data defined overrides.
 
const QgsFeature * feature() const
Returns the current feature being rendered.
 
Qgis::SymbolRenderHints renderHints() const
Returns the rendering hint flags for the symbol.
 
void setOriginalValueVariable(const QVariant &value)
Sets the original value variable value for data defined symbology.
 
qreal opacity() const
Returns the opacity for the symbol.
 
QgsRenderContext & renderContext()
Returns a reference to the context's render context.
 
static Q_INVOKABLE Qgis::RenderUnit decodeRenderUnit(const QString &string, bool *ok=nullptr)
Decodes a render unit from a string.
 
static Q_INVOKABLE QString encodeUnit(Qgis::DistanceUnit unit)
Encodes a distance unit to a string.
 
static bool isNull(const QVariant &variant, bool silenceNullWarnings=false)
Returns true if the specified variant should be considered a NULL value.
 
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
 
QMap< QString, QString > QgsStringMap
 
QVector< QgsPointSequence > QgsRingSequence
 
QVector< QgsPoint > QgsPointSequence
 
#define QgsDebugMsgLevel(str, level)