27 #include <QSvgRenderer>
30 #include <QDomDocument>
31 #include <QDomElement>
53 : mOutlineStyle( Qt::SolidLine ), mOutlineWidth( 0 ), mOutlineWidthUnit(
QgsSymbolV2::MM )
64 mAngleExpression = NULL;
65 mNameExpression = NULL;
78 if ( props.contains(
"name" ) )
80 if ( props.contains(
"color" ) )
82 if ( props.contains(
"color_border" ) )
87 else if ( props.contains(
"outline_color" ) )
91 else if ( props.contains(
"line_color" ) )
95 if ( props.contains(
"size" ) )
96 size = props[
"size"].toDouble();
97 if ( props.contains(
"angle" ) )
98 angle = props[
"angle"].toDouble();
99 if ( props.contains(
"scale_method" ) )
103 if ( props.contains(
"offset" ) )
105 if ( props.contains(
"offset_unit" ) )
107 if ( props.contains(
"offset_map_unit_scale" ) )
109 if ( props.contains(
"size_unit" ) )
111 if ( props.contains(
"size_map_unit_scale" ) )
114 if ( props.contains(
"outline_style" ) )
118 else if ( props.contains(
"line_style" ) )
122 if ( props.contains(
"outline_width" ) )
126 else if ( props.contains(
"line_width" ) )
130 if ( props.contains(
"outline_width_unit" ) )
134 if ( props.contains(
"line_width_unit" ) )
138 if ( props.contains(
"outline_width_map_unit_scale" ) )
143 if ( props.contains(
"horizontal_anchor_point" ) )
147 if ( props.contains(
"vertical_anchor_point" ) )
153 if ( props.contains(
"name_expression" ) )
157 if ( props.contains(
"color_expression" ) )
161 if ( props.contains(
"color_border_expression" ) )
165 if ( props.contains(
"outline_style_expression" ) )
169 if ( props.contains(
"outline_width_expression" ) )
173 if ( props.contains(
"size_expression" ) )
177 if ( props.contains(
"angle_expression" ) )
181 if ( props.contains(
"offset_expression" ) )
185 if ( props.contains(
"horizontal_anchor_point_expression" ) )
189 if ( props.contains(
"vertical_anchor_point_expression" ) )
199 return "SimpleMarker";
204 QColor brushColor =
mColor;
207 brushColor.setAlphaF(
mColor.alphaF() * context.
alpha() );
210 mBrush = QBrush( brushColor );
211 mPen = QPen( penColor );
217 if ( context.
alpha() < 1 )
219 selBrushColor.setAlphaF( context.
alpha() );
220 selPenColor.setAlphaF( context.
alpha() );
247 if (
mName !=
"circle" )
248 mSelPen.setColor( selBrushColor );
260 if ( !hasDataDefinedSize )
265 double half = scaledSize / 2.0;
266 transform.scale( half, half );
270 if ( !hasDataDefinedRotation &&
mAngle != 0 )
272 transform.rotate(
mAngle );
306 double pw = ((
mPen.widthF() == 0 ? 1 :
mPen.widthF() ) + 1 ) / 2 * 2;
307 int imageSize = (( int ) scaledSize + pw ) / 2 * 2 + 1;
308 double center = imageSize / 2.0;
315 mCache = QImage( QSize( imageSize, imageSize ), QImage::Format_ARGB32_Premultiplied );
320 p.setRenderHint( QPainter::Antialiasing );
323 p.translate( QPointF( center, center ) );
331 mSelCache = QImage( QSize( imageSize, imageSize ), QImage::Format_ARGB32_Premultiplied );
335 p.setRenderHint( QPainter::Antialiasing );
338 p.translate( QPointF( center, center ) );
349 p.setRenderHint( QPainter::Antialiasing );
350 p.fillRect( 0, 0, imageSize, imageSize, selColor );
353 p.translate( QPointF( center, center ) );
375 if ( name ==
"square" || name ==
"rectangle" )
377 mPolygon = QPolygonF( QRectF( QPointF( -1, -1 ), QPointF( 1, 1 ) ) );
380 else if ( name ==
"diamond" )
382 mPolygon << QPointF( -1, 0 ) << QPointF( 0, 1 )
383 << QPointF( 1, 0 ) << QPointF( 0, -1 );
386 else if ( name ==
"pentagon" )
395 else if ( name ==
"triangle" )
397 mPolygon << QPointF( -1, 1 ) << QPointF( 1, 1 ) << QPointF( 0, -1 );
400 else if ( name ==
"equilateral_triangle" )
407 else if ( name ==
"star" )
409 double sixth = 1.0 / 3;
412 << QPointF( -sixth, -sixth )
413 << QPointF( -1, -sixth )
414 << QPointF( -sixth, 0 )
416 << QPointF( 0, + sixth )
418 << QPointF( + sixth, 0 )
419 << QPointF( 1, -sixth )
420 << QPointF( + sixth, -sixth );
423 else if ( name ==
"regular_star" )
429 << QPointF( inner_r * sin(
DEG2RAD( 252.0 ) ), - inner_r * cos(
DEG2RAD( 252.0 ) ) )
431 << QPointF( 0, inner_r )
433 << QPointF( inner_r * sin(
DEG2RAD( 108.0 ) ), - inner_r * cos(
DEG2RAD( 108.0 ) ) )
435 << QPointF( inner_r * sin(
DEG2RAD( 36.0 ) ), - inner_r * cos(
DEG2RAD( 36.0 ) ) )
439 else if ( name ==
"arrow" )
443 << QPointF( 0.5, -0.5 )
444 << QPointF( 0.25, -0.5 )
445 << QPointF( 0.25, 1 )
446 << QPointF( -0.25, 1 )
447 << QPointF( -0.25, -0.5 )
448 << QPointF( -0.5, -0.5 );
451 else if ( name ==
"filled_arrowhead" )
453 mPolygon << QPointF( 0, 0 ) << QPointF( -1, 1 ) << QPointF( -1, -1 );
462 mPath = QPainterPath();
468 if ( name ==
"circle" )
470 mPath.addEllipse( QRectF( -1, -1, 2, 2 ) );
473 else if ( name ==
"cross" )
475 mPath.moveTo( -1, 0 );
476 mPath.lineTo( 1, 0 );
477 mPath.moveTo( 0, -1 );
478 mPath.lineTo( 0, 1 );
481 else if ( name ==
"x" || name ==
"cross2" )
483 mPath.moveTo( -1, -1 );
484 mPath.lineTo( 1, 1 );
485 mPath.moveTo( 1, -1 );
486 mPath.lineTo( -1, 1 );
489 else if ( name ==
"line" )
491 mPath.moveTo( 0, -1 );
492 mPath.lineTo( 0, 1 );
495 else if ( name ==
"arrowhead" )
497 mPath.moveTo( 0, 0 );
498 mPath.lineTo( -1, -1 );
499 mPath.moveTo( 0, 0 );
500 mPath.lineTo( -1, 1 );
518 double scaledSize =
mSize;
519 if ( hasDataDefinedSize )
521 if ( sizeExpression )
523 scaledSize = sizeExpression->
evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toDouble();
528 scaledSize = sqrt( scaledSize );
535 markerOffset( context, scaledSize, scaledSize, offsetX, offsetY );
536 QPointF off( offsetX, offsetY );
540 if ( mAngleExpression )
542 angle = mAngleExpression->
evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toDouble();
546 if ( hasDataDefinedRotation )
569 bool createdNewPath =
false;
570 if ( mNameExpression )
572 QString
name = mNameExpression->
evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toString();
577 createdNewPath =
true;
586 p->drawImage( QRectF( point.x() - s / 2.0 + off.x(),
587 point.y() - s / 2.0 + off.y(),
595 transform.translate( point.x() + off.x(), point.y() + off.y() );
598 if ( hasDataDefinedSize || createdNewPath )
601 double half = s / 2.0;
602 transform.scale( half, half );
605 if ( angle != 0 && ( hasDataDefinedRotation || createdNewPath ) )
606 transform.rotate( angle );
612 if ( colorExpression )
616 if ( colorBorderExpression )
621 if ( outlineWidthExpression )
627 if ( outlineStyleExpression )
638 p->drawPolygon( transform.map(
mPolygon ) );
640 p->drawPath( transform.map(
mPath ) );
651 map[
"size"] = QString::number(
mSize );
654 map[
"angle"] = QString::number(
mAngle );
693 QDomElement graphicElem = doc.createElement(
"se:Graphic" );
694 element.appendChild( graphicElem );
701 double angle = props.value(
"angle",
"0" ).toDouble( &ok );
704 angleFunc = QString(
"%1 + %2" ).arg( props.value(
"angle",
"0" ) ).arg(
mAngle );
706 else if ( angle +
mAngle != 0 )
708 angleFunc = QString::number( angle +
mAngle );
718 Q_UNUSED( mmScaleFactor );
719 Q_UNUSED( mapUnitScaleFactor );
721 QString ogrType =
"3";
722 if (
mName ==
"square" )
726 else if (
mName ==
"triangle" )
730 else if (
mName ==
"star" )
734 else if (
mName ==
"circle" )
738 else if (
mName ==
"cross" )
746 else if (
mName ==
"line" )
752 ogrString.append(
"SYMBOL(" );
753 ogrString.append(
"id:" );
754 ogrString.append(
"\"" );
755 ogrString.append(
"ogr-sym-" );
756 ogrString.append( ogrType );
757 ogrString.append(
"\"" );
758 ogrString.append(
",c:" );
759 ogrString.append(
mColor.name() );
760 ogrString.append(
",o:" );
762 ogrString.append( QString(
",s:%1mm" ).arg(
mSize ) );
763 ogrString.append(
")" );
768 ogrString.append(
"PEN(" );
769 ogrString.append(
"c:" );
770 ogrString.append(
mColor.name() );
771 ogrString.append(
",w:" );
772 ogrString.append( QString::number(
mSize ) );
773 ogrString.append(
"mm" );
774 ogrString.append(
")" );
782 QDomElement graphicElem = element.firstChildElement(
"Graphic" );
783 if ( graphicElem.isNull() )
786 QString
name =
"square";
788 double borderWidth,
size;
789 Qt::PenStyle borderStyle;
799 double d = angleFunc.toDouble( &ok );
824 p->drawPath(
mPath );
834 bool hasDataDefinedSize =
false;
841 if ( hasDataDefinedSize )
843 if ( sizeExpression )
845 size = sizeExpression->
evaluate( const_cast<QgsFeature*>( context->
feature() ) ).toDouble();
861 size *= mmMapUnitScaleFactor;
863 double halfSize = size / 2.0;
868 if ( context && outlineWidthExpression )
870 outlineWidth = outlineWidthExpression->
evaluate( const_cast<QgsFeature*>( context->
feature() ) ).toDouble();
874 outlineWidth *= mmMapUnitScaleFactor;
878 QColor pc =
mPen.color();
879 QColor bc =
mBrush.color();
882 if ( colorExpression )
888 if ( outlinecolorExpression )
900 QPointF off( offsetX, offsetY );
905 if ( context && angleExpression )
907 angle = angleExpression->
evaluate( const_cast<QgsFeature*>( context->
feature() ) ).toDouble();
915 off *= mmMapUnitScaleFactor;
919 t.translate( shift.x() + offsetX, shift.y() + offsetY );
926 if (
mName ==
"circle" )
928 if (
mBrush.style() != Qt::NoBrush )
930 if (
mPen.style() != Qt::NoPen )
931 e.
writeCircle( layerName, pc, shift, halfSize,
"CONTINUOUS", outlineWidth );
933 else if (
mName ==
"square" ||
mName ==
"rectangle" )
937 QPointF pt1 = t.map( QPointF( -halfSize, -halfSize ) );
938 QPointF pt2 = t.map( QPointF( halfSize, -halfSize ) );
939 QPointF pt3 = t.map( QPointF( -halfSize, halfSize ) );
940 QPointF pt4 = t.map( QPointF( halfSize, halfSize ) );
942 if (
mBrush.style() != Qt::NoBrush )
943 e.
writeSolid( layerName, bc, pt1, pt2, pt3, pt4 );
945 if (
mPen.style() != Qt::NoPen )
947 e.
writeLine( pt1, pt2, layerName,
"CONTINUOUS", pc, outlineWidth );
948 e.
writeLine( pt2, pt4, layerName,
"CONTINUOUS", pc, outlineWidth );
949 e.
writeLine( pt4, pt3, layerName,
"CONTINUOUS", pc, outlineWidth );
950 e.
writeLine( pt3, pt1, layerName,
"CONTINUOUS", pc, outlineWidth );
953 else if (
mName ==
"diamond" )
955 QPointF pt1 = t.map( QPointF( -halfSize, 0 ) );
956 QPointF pt2 = t.map( QPointF( 0, -halfSize ) );
957 QPointF pt3 = t.map( QPointF( 0, halfSize ) );
958 QPointF pt4 = t.map( QPointF( halfSize, 0 ) );
960 if (
mBrush.style() != Qt::NoBrush )
961 e.
writeSolid( layerName, bc, pt1, pt2, pt3, pt4 );
963 if (
mPen.style() != Qt::NoPen )
965 e.
writeLine( pt1, pt2, layerName,
"CONTINUOUS", pc, outlineWidth );
966 e.
writeLine( pt2, pt3, layerName,
"CONTINUOUS", pc, outlineWidth );
967 e.
writeLine( pt3, pt4, layerName,
"CONTINUOUS", pc, outlineWidth );
968 e.
writeLine( pt4, pt1, layerName,
"CONTINUOUS", pc, outlineWidth );
971 else if (
mName ==
"triangle" )
973 QPointF pt1 = t.map( QPointF( -halfSize, -halfSize ) );
974 QPointF pt2 = t.map( QPointF( halfSize, -halfSize ) );
975 QPointF pt3 = t.map( QPointF( 0, halfSize ) );
977 if (
mBrush.style() != Qt::NoBrush )
978 e.
writeSolid( layerName, bc, pt1, pt2, pt3, pt3 );
980 if (
mPen.style() != Qt::NoPen )
982 e.
writeLine( pt1, pt2, layerName,
"CONTINUOUS", pc, outlineWidth );
983 e.
writeLine( pt2, pt3, layerName,
"CONTINUOUS", pc, outlineWidth );
984 e.
writeLine( pt3, pt1, layerName,
"CONTINUOUS", pc, outlineWidth );
988 else if (
mName ==
"equilateral_triangle" )
993 else if (
mName ==
"line" )
995 QPointF pt1 = t.map( QPointF( 0, halfSize ) );
996 QPointF pt2 = t.map( QPointF( 0, -halfSize ) );
998 if (
mPen.style() != Qt::NoPen )
999 e.
writeLine( pt1, pt2, layerName,
"CONTINUOUS", pc, outlineWidth );
1001 else if (
mName ==
"cross" )
1003 QPointF pt1 = t.map( QPointF( -halfSize, 0 ) );
1004 QPointF pt2 = t.map( QPointF( halfSize, 0 ) );
1005 QPointF pt3 = t.map( QPointF( 0, -halfSize ) );
1006 QPointF pt4 = t.map( QPointF( 0, halfSize ) );
1008 if (
mPen.style() != Qt::NoPen )
1010 e.
writeLine( pt1, pt2, layerName,
"CONTINUOUS", pc, outlineWidth );
1011 e.
writeLine( pt3, pt4, layerName,
"CONTINUOUS", pc, outlineWidth );
1014 else if (
mName ==
"x" ||
mName ==
"cross2" )
1016 QPointF pt1 = t.map( QPointF( -halfSize, -halfSize ) );
1017 QPointF pt2 = t.map( QPointF( halfSize, halfSize ) );
1018 QPointF pt3 = t.map( QPointF( -halfSize, halfSize ) );
1019 QPointF pt4 = t.map( QPointF( halfSize, -halfSize ) );
1021 if (
mPen.style() != Qt::NoPen )
1023 e.
writeLine( pt1, pt2, layerName,
"CONTINUOUS", pc, outlineWidth );
1024 e.
writeLine( pt3, pt4, layerName,
"CONTINUOUS", pc, outlineWidth );
1027 else if (
mName ==
"arrowhead" )
1029 QPointF pt1 = t.map( QPointF( -halfSize, halfSize ) );
1030 QPointF pt2 = t.map( QPointF( 0, 0 ) );
1031 QPointF pt3 = t.map( QPointF( -halfSize, -halfSize ) );
1033 if (
mPen.style() != Qt::NoPen )
1035 e.
writeLine( pt1, pt2, layerName,
"CONTINUOUS", pc, outlineWidth );
1036 e.
writeLine( pt3, pt2, layerName,
"CONTINUOUS", pc, outlineWidth );
1039 else if (
mName ==
"filled_arrowhead" )
1041 QPointF pt1 = t.map( QPointF( -halfSize, halfSize ) );
1042 QPointF pt2 = t.map( QPointF( 0, 0 ) );
1043 QPointF pt3 = t.map( QPointF( -halfSize, -halfSize ) );
1045 if (
mBrush.style() != Qt::NoBrush )
1047 e.
writeSolid( layerName, bc, pt1, pt2, pt3, pt3 );
1113 if ( props.contains(
"name" ) )
1114 name = props[
"name"];
1115 if ( props.contains(
"size" ) )
1116 size = props[
"size"].toDouble();
1117 if ( props.contains(
"angle" ) )
1118 angle = props[
"angle"].toDouble();
1119 if ( props.contains(
"scale_method" ) )
1125 if ( !props.contains(
"fill" ) && !props.contains(
"color" ) && !props.contains(
"outline" ) &&
1126 !props.contains(
"outline_color" ) && !props.contains(
"outline-width" ) && !props.contains(
"outline_width" ) )
1130 bool hasFillParam, hasOutlineParam, hasOutlineWidthParam;
1136 if ( hasOutlineParam )
1140 if ( hasOutlineWidthParam )
1146 if ( props.contains(
"size_unit" ) )
1148 if ( props.contains(
"size_map_unit_scale" ) )
1150 if ( props.contains(
"offset" ) )
1152 if ( props.contains(
"offset_unit" ) )
1154 if ( props.contains(
"offset_map_unit_scale" ) )
1156 if ( props.contains(
"fill" ) )
1161 else if ( props.contains(
"color" ) )
1165 if ( props.contains(
"outline" ) )
1170 else if ( props.contains(
"outline_color" ) )
1174 else if ( props.contains(
"line_color" ) )
1179 if ( props.contains(
"outline-width" ) )
1184 else if ( props.contains(
"outline_width" ) )
1188 else if ( props.contains(
"line_width" ) )
1193 if ( props.contains(
"outline_width_unit" ) )
1197 else if ( props.contains(
"line_width_unit" ) )
1201 if ( props.contains(
"outline_width_map_unit_scale" ) )
1204 if ( props.contains(
"horizontal_anchor_point" ) )
1208 if ( props.contains(
"vertical_anchor_point" ) )
1214 if ( props.contains(
"size_expression" ) )
1218 if ( props.contains(
"outline-width_expression" ) )
1222 if ( props.contains(
"angle_expression" ) )
1226 if ( props.contains(
"offset_expression" ) )
1230 if ( props.contains(
"name_expression" ) )
1234 if ( props.contains(
"fill_expression" ) )
1238 if ( props.contains(
"outline_expression" ) )
1242 if ( props.contains(
"horizontal_anchor_point_expression" ) )
1246 if ( props.contains(
"vertical_anchor_point_expression" ) )
1258 bool hasFillParam, hasOutlineParam, hasOutlineWidthParam;
1264 if ( hasOutlineParam )
1268 if ( hasOutlineWidthParam )
1283 Q_UNUSED( context );
1289 Q_UNUSED( context );
1298 double scaledSize =
mSize;
1303 if ( sizeExpression )
1305 scaledSize = sizeExpression->
evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toDouble();
1308 if ( hasDataDefinedSize )
1313 scaledSize = sqrt( scaledSize );
1323 if ((
int )size < 1 || 10000.0 <
size )
1333 markerOffset( context, scaledSize, scaledSize, offsetX, offsetY );
1334 QPointF outputOffset( offsetX, offsetY );
1338 if ( angleExpression )
1340 angle = angleExpression->
evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toDouble();
1344 if ( hasDataDefinedRotation )
1365 p->translate( point + outputOffset );
1373 if ( nameExpression )
1375 path = nameExpression->
evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toString();
1380 if ( outlineWidthExpression )
1382 outlineWidth = outlineWidthExpression->
evaluate( const_cast<QgsFeature*>( context.
feature() ) ).toDouble();
1387 if ( fillExpression )
1394 if ( outlineExpression )
1400 bool fitsInCache =
true;
1401 bool usePict =
true;
1402 double hwRatio = 1.0;
1408 if ( fitsInCache && img.width() > 1 )
1413 QImage transparentImage = img.copy();
1415 p->drawImage( -transparentImage.width() / 2.0, -transparentImage.height() / 2.0, transparentImage );
1416 hwRatio = ( double )transparentImage.height() / ( double )transparentImage.width();
1420 p->drawImage( -img.width() / 2.0, -img.height() / 2.0, img );
1421 hwRatio = ( double )img.height() / ( double )img.width();
1426 if ( usePict || !fitsInCache )
1428 p->setOpacity( context.
alpha() );
1432 if ( pct.width() > 1 )
1436 p->drawPicture( 0, 0, pct );
1438 hwRatio = ( double )pct.height() / ( double )pct.width();
1446 if ( penWidth > size / 20 )
1449 penWidth = size / 20;
1451 double penOffset = penWidth / 2;
1452 pen.setWidth( penWidth );
1454 p->setBrush( Qt::NoBrush );
1455 double wSize = size + penOffset;
1456 double hSize = size * hwRatio + penOffset;
1457 p->drawRect( QRectF( -wSize / 2.0, -hSize / 2.0, wSize, hSize ) );
1468 map[
"size"] = QString::number(
mSize );
1471 map[
"angle"] = QString::number(
mAngle );
1541 QDomElement graphicElem = doc.createElement(
"se:Graphic" );
1542 element.appendChild( graphicElem );
1549 double angle = props.value(
"angle",
"0" ).toDouble( &ok );
1552 angleFunc = QString(
"%1 + %2" ).arg( props.value(
"angle",
"0" ) ).arg(
mAngle );
1554 else if ( angle +
mAngle != 0 )
1556 angleFunc = QString::number( angle +
mAngle );
1569 QDomElement graphicElem = element.firstChildElement(
"Graphic" );
1570 if ( graphicElem.isNull() )
1573 QString
path, mimeType;
1580 if ( mimeType !=
"image/svg+xml" )
1588 double d = angleFunc.toDouble( &ok );
1606 const QPointF& shift )
const
1608 Q_UNUSED( layerName );
1611 QSvgRenderer r(
mPath );
1625 if ( sizeExpression )
1627 size = sizeExpression->
evaluate( *f ).toDouble();
1630 if ( hasDataDefinedSize )
1635 size = sqrt( size );
1644 size *= mmMapUnitScaleFactor;
1647 double halfSize = size / 2.0;
1652 if ( offsetExpression )
1654 QString offsetString = offsetExpression->
evaluate( *f ).toString();
1657 double offsetX = offset.x();
1658 double offsetY = offset.y();
1661 offsetX *= mmMapUnitScaleFactor;
1662 offsetY *= mmMapUnitScaleFactor;
1665 QPointF outputOffset( offsetX, offsetY );
1669 if ( angleExpression )
1671 angle = angleExpression->
evaluate( *f ).toDouble();
1681 p.translate( r.defaultSize().width() / 2.0, r.defaultSize().height() / 2.0 );
1683 p.translate( -r.defaultSize().width() / 2.0, -r.defaultSize().height() / 2.0 );
1686 pd.
setOutputSize( QRectF( -halfSize, -halfSize, size, size ) );
1716 if ( props.contains(
"font" ) )
1717 fontFamily = props[
"font"];
1718 if ( props.contains(
"chr" ) && props[
"chr"].length() > 0 )
1719 chr = props[
"chr"].at( 0 );
1720 if ( props.contains(
"size" ) )
1721 pointSize = props[
"size"].toDouble();
1722 if ( props.contains(
"color" ) )
1724 if ( props.contains(
"angle" ) )
1725 angle = props[
"angle"].toDouble();
1728 if ( props.contains(
"offset" ) )
1730 if ( props.contains(
"offset_unit" ) )
1732 if ( props.contains(
"offset_map_unit_scale" ) )
1734 if ( props.contains(
"size_unit" ) )
1736 if ( props.contains(
"size_map_unit_scale" ) )
1738 if ( props.contains(
"horizontal_anchor_point" ) )
1742 if ( props.contains(
"vertical_anchor_point" ) )
1751 return "FontMarker";
1758 QFontMetrics fm(
mFont );
1766 Q_UNUSED( context );
1776 penColor.setAlphaF(
mColor.alphaF() * context.
alpha() );
1777 p->setPen( penColor );
1778 p->setFont(
mFont );
1785 QPointF outputOffset( offsetX, offsetY );
1788 p->translate( point + outputOffset );
1807 props[
"chr"] =
mChr;
1808 props[
"size"] = QString::number(
mSize );
1812 props[
"angle"] = QString::number(
mAngle );
1837 QDomElement graphicElem = doc.createElement(
"se:Graphic" );
1838 element.appendChild( graphicElem );
1840 QString fontPath = QString(
"ttf://%1" ).arg(
mFontFamily );
1841 int markIndex =
mChr.unicode();
1847 double angle = props.value(
"angle",
"0" ).toDouble( &ok );
1850 angleFunc = QString(
"%1 + %2" ).arg( props.value(
"angle",
"0" ) ).arg(
mAngle );
1852 else if ( angle +
mAngle != 0 )
1854 angleFunc = QString::number( angle +
mAngle );
1866 QDomElement graphicElem = element.firstChildElement(
"Graphic" );
1867 if ( graphicElem.isNull() )
1870 QString name, format;
1878 if ( !name.startsWith(
"ttf://" ) || format !=
"ttf" )
1888 double d = angleFunc.toDouble( &ok );