29 #include <QDomDocument> 30 #include <QDomElement> 35 : mPenStyle( penStyle )
38 , mUseCustomDashPattern( false )
40 , mDrawInsidePolygon( false )
90 if ( props.
contains(
"line_color" ) )
94 else if ( props.
contains(
"outline_color" ) )
98 else if ( props.
contains(
"color" ) )
103 if ( props.
contains(
"line_width" ) )
105 width = props[
"line_width"].toDouble();
107 else if ( props.
contains(
"outline_width" ) )
109 width = props[
"outline_width"].toDouble();
111 else if ( props.
contains(
"width" ) )
114 width = props[
"width"].toDouble();
116 if ( props.
contains(
"line_style" ) )
120 else if ( props.
contains(
"outline_style" ) )
124 else if ( props.
contains(
"penstyle" ) )
130 if ( props.
contains(
"line_width_unit" ) )
134 else if ( props.
contains(
"outline_width_unit" ) )
138 else if ( props.
contains(
"width_unit" ) )
143 if ( props.
contains(
"width_map_unit_scale" ) )
146 l->
setOffset( props[
"offset"].toDouble() );
147 if ( props.
contains(
"offset_unit" ) )
149 if ( props.
contains(
"offset_map_unit_scale" ) )
151 if ( props.
contains(
"joinstyle" ) )
156 if ( props.
contains(
"use_custom_dash" ) )
160 if ( props.
contains(
"customdash" ) )
164 if ( props.
contains(
"customdash_unit" ) )
168 if ( props.
contains(
"customdash_map_unit_scale" ) )
173 if ( props.
contains(
"draw_inside_polygon" ) )
201 double dashWidthDiv = scaledWidth;
204 if ( versionSplit.
size() > 1
205 && versionSplit.
at( 1 ).toInt() >= 8
260 for ( ; it != rings->
constEnd(); ++it )
275 Q_FOREACH (
const QPolygonF& ring, *rings )
303 applyDataDefinedSymbology( context,
mPen,
mSelPen, offset );
309 if ( points.
size() <= 2 &&
340 for (
int part = 0; part < mline.count(); ++part )
401 if ( !props.
value(
"uom",
"" ).isEmpty() )
448 if ( strokeElem.
isNull() )
460 &penJoinStyle, &penCapStyle,
461 &customDashVector ) )
466 if ( !perpOffsetElem.
isNull() )
501 bool hasStrokeWidthExpression =
false;
510 hasStrokeWidthExpression =
true;
536 if ( hasStrokeWidthExpression )
538 dashWidthDiv = pen.
widthF();
539 scaledWidth = pen.
widthF();
544 if ( versionSplit.
size() > 1
545 && versionSplit.
at( 1 ).toInt() >= 8
556 for ( ; dashIt != dashList.
constEnd(); ++dashIt )
675 , mIncreasing(
false )
687 mIncreasing = ( p2.
y() > p1.
y() );
692 mT = float( p2.
y() - p1.
y() ) / ( p2.
x() - p1.
x() );
693 mIncreasing = ( p2.
x() > p1.
x() );
697 double x = ( p2.
x() - p1.
x() );
698 double y = ( p2.
y() - p1.
y() );
699 mLength = sqrt( x * x + y * y );
705 double a = ( mVertical ?
M_PI / 2 : atan( mT ) );
713 QPointF diffForInterval(
double interval )
716 return ( mIncreasing ?
QPointF( 0, interval ) :
QPointF( 0, -interval ) );
718 double alpha = atan( mT );
719 double dx = cos( alpha ) * interval;
720 double dy = sin( alpha ) * interval;
724 double length() {
return mLength; }
737 mRotateMarker = rotateMarker;
738 mInterval = interval;
741 mPlacement = Interval;
742 mOffsetAlongLine = 0;
760 interval = props[
"interval"].toDouble();
762 rotate = ( props[
"rotate"] ==
"1" );
767 x->
setOffset( props[
"offset"].toDouble() );
769 if ( props.
contains(
"offset_unit" ) )
773 if ( props.
contains(
"interval_unit" ) )
777 if ( props.
contains(
"offset_along_line" ) )
781 if ( props.
contains(
"offset_along_line_unit" ) )
785 if ( props.
contains((
"offset_along_line_map_unit_scale" ) ) )
790 if ( props.
contains(
"offset_map_unit_scale" ) )
794 if ( props.
contains(
"interval_map_unit_scale" ) )
799 if ( props.
contains(
"placement" ) )
801 if ( props[
"placement"] ==
"vertex" )
803 else if ( props[
"placement"] ==
"lastvertex" )
805 else if ( props[
"placement"] ==
"firstvertex" )
807 else if ( props[
"placement"] ==
"centralpoint" )
809 else if ( props[
"placement"] ==
"curvepoint" )
827 mMarker->setColor( color );
833 return mMarker ? mMarker->color() :
mColor;
838 mMarker->setAlpha( context.
alpha() );
846 mMarker->setRenderHints( hints );
877 if ( placementString.
compare(
"vertex", Qt::CaseInsensitive ) == 0 )
881 else if ( placementString.
compare(
"lastvertex", Qt::CaseInsensitive ) == 0 )
883 placement = LastVertex;
885 else if ( placementString.
compare(
"firstvertex", Qt::CaseInsensitive ) == 0 )
887 placement = FirstVertex;
889 else if ( placementString.
compare(
"centerpoint", Qt::CaseInsensitive ) == 0 )
891 placement = CentralPoint;
893 else if ( placementString.
compare(
"curvepoint", Qt::CaseInsensitive ) == 0 )
895 placement = CurvePoint;
899 placement = Interval;
909 if ( placement == Interval )
910 renderPolylineInterval( points, context );
911 else if ( placement == CentralPoint )
912 renderPolylineCentral( points, context );
914 renderPolylineVertex( points, context, placement );
921 for (
int part = 0; part < mline.
count(); ++part )
923 const QPolygonF &points2 = mline[ part ];
925 if ( placement == Interval )
926 renderPolylineInterval( points2, context );
927 else if ( placement == CentralPoint )
928 renderPolylineCentral( points2, context );
930 renderPolylineVertex( points2, context, placement );
949 for (
int i = 0; i < rings->
size(); ++i )
967 double lengthLeft = 0;
970 double interval = mInterval;
984 double offsetAlongLine = mOffsetAlongLine;
995 for (
int i = 1; i < points.
count(); ++i )
1003 MyLine l( lastPt, pt );
1004 QPointF diff = l.diffForInterval( painterUnitInterval );
1008 double c = 1 - lengthLeft / painterUnitInterval;
1010 lengthLeft += l.length();
1013 if ( mRotateMarker )
1015 mMarker->setLineAngle( l.angle() * 180 /
M_PI );
1020 while ( lengthLeft > painterUnitInterval )
1024 lengthLeft -= painterUnitInterval;
1026 mMarker->renderPoint( lastPt, context.
feature(), rc, -1, context.
selected() );
1039 double a1 = MyLine( prevPt, pt ).angle();
1040 double a2 = MyLine( pt, nextPt ).angle();
1041 double unitX = cos( a1 ) + cos( a2 ), unitY = sin( a1 ) + sin( a2 );
1043 return atan2( unitY, unitX );
1053 double origAngle = mMarker->angle();
1055 bool isRing =
false;
1061 double offsetAlongLine = mOffsetAlongLine;
1092 x = vPoint.
x(), y = vPoint.
y();
1101 if ( mRotateMarker )
1104 mMarker->setAngle( angle * 180 /
M_PI );
1106 mMarker->renderPoint( mapPoint, context.
feature(), rc, -1, context.
selected() );
1114 if ( placement == FirstVertex )
1119 else if ( placement == LastVertex )
1121 i = points.
count() - 1;
1122 maxCount = points.
count();
1124 else if ( placement == Vertex )
1127 maxCount = points.
count();
1137 if ( offsetAlongLine > 0 && ( placement == FirstVertex || placement == LastVertex ) )
1140 distance = placement == FirstVertex ? offsetAlongLine : -offsetAlongLine;
1141 renderOffsetVertexAlongLine( points, i, distance, context );
1143 mMarker->setAngle( origAngle );
1150 for ( ; i < maxCount; ++i )
1154 if ( isRing && placement == Vertex && i == points.
count() - 1 )
1159 if ( mRotateMarker )
1161 double angle = markerAngle( points, isRing, i );
1162 mMarker->setAngle( origAngle + angle * 180 /
M_PI );
1165 mMarker->renderPoint( points.
at( i ), context.
feature(), rc, -1, context.
selected() );
1169 mMarker->setAngle( origAngle );
1177 const QPointF& pt = points[vertex];
1179 if ( isRing || ( vertex > 0 && vertex < points.
count() - 1 ) )
1181 int prevIndex = vertex - 1;
1182 int nextIndex = vertex + 1;
1184 if ( isRing && ( vertex == 0 || vertex == points.
count() - 1 ) )
1186 prevIndex = points.
count() - 2;
1191 while ( prevIndex >= 0 )
1193 prevPoint = points[ prevIndex ];
1194 if ( prevPoint != pt )
1201 while ( nextIndex < points.
count() )
1203 nextPoint = points[ nextIndex ];
1204 if ( nextPoint != pt )
1211 if ( prevIndex >= 0 && nextIndex < points.
count() )
1220 while ( vertex < points.
size() - 1 )
1222 const QPointF& nextPt = points[vertex+1];
1225 angle = MyLine( pt, nextPt ).angle();
1234 while ( vertex >= 1 )
1236 const QPointF& prevPt = points[vertex-1];
1239 angle = MyLine( prevPt, pt ).angle();
1255 double origAngle = mMarker->angle();
1259 if ( mRotateMarker )
1261 bool isRing =
false;
1264 double angle = markerAngle( points, isRing, vertex );
1265 mMarker->setAngle( origAngle + angle * 180 /
M_PI );
1267 mMarker->renderPoint( points[vertex], context.
feature(), rc, -1, context.
selected() );
1271 int pointIncrement = distance > 0 ? 1 : -1;
1272 QPointF previousPoint = points[vertex];
1273 int startPoint = distance > 0 ? qMin( vertex + 1, points.
count() - 1 ) : qMax( vertex - 1, 0 );
1274 int endPoint = distance > 0 ? points.
count() - 1 : 0;
1275 double distanceLeft = qAbs( distance );
1277 for (
int i = startPoint; pointIncrement > 0 ? i <= endPoint : i >= endPoint; i += pointIncrement )
1279 const QPointF& pt = points[i];
1281 if ( previousPoint == pt )
1285 MyLine l( previousPoint, pt );
1287 if ( distanceLeft < l.length() )
1290 QPointF markerPoint = previousPoint + l.diffForInterval( distanceLeft );
1292 if ( mRotateMarker )
1294 mMarker->setAngle( origAngle + ( l.angle() * 180 /
M_PI ) );
1296 mMarker->renderPoint( markerPoint, context.
feature(), rc, -1, context.
selected() );
1300 distanceLeft -= l.length();
1316 for ( ++it; it != points.
constEnd(); ++it )
1318 length += sqrt(( last.
x() - it->x() ) * ( last.
x() - it->x() ) +
1319 ( last.
y() - it->y() ) * ( last.
y() - it->y() ) );
1326 qreal last_at = 0, next_at = 0;
1329 for ( ++it; it != points.
constEnd(); ++it )
1332 next_at += sqrt(( last.
x() - it->x() ) * ( last.
x() - it->x() ) +
1333 ( last.
y() - it->y() ) * ( last.
y() - it->y() ) );
1334 if ( next_at >= length / 2 )
1342 MyLine l( last, next );
1343 qreal k = ( length * 0.5 - last_at ) / ( next_at - last_at );
1344 QPointF pt = last + ( next - last ) * k;
1347 double origAngle = mMarker->angle();
1348 if ( mRotateMarker )
1349 mMarker->setAngle( origAngle + l.angle() * 180 /
M_PI );
1351 if ( mRotateMarker )
1352 mMarker->setAngle( origAngle );
1360 map[
"rotate"] = ( mRotateMarker ?
"1" :
"0" );
1370 if ( mPlacement == Vertex )
1371 map[
"placement"] =
"vertex";
1372 else if ( mPlacement == LastVertex )
1373 map[
"placement"] =
"lastvertex";
1374 else if ( mPlacement == FirstVertex )
1375 map[
"placement"] =
"firstvertex";
1376 else if ( mPlacement == CentralPoint )
1377 map[
"placement"] =
"centralpoint";
1378 else if ( mPlacement == CurvePoint )
1379 map[
"placement"] =
"curvepoint";
1381 map[
"placement"] =
"interval";
1402 mColor = mMarker->color();
1426 for (
int i = 0; i < mMarker->symbolLayerCount(); i++ )
1429 if ( !props.
value(
"uom",
"" ).isEmpty() )
1437 switch ( mPlacement )
1458 if ( !mRotateMarker )
1484 if ( !gap.isEmpty() )
1506 if ( strokeElem.
isNull() )
1510 if ( graphicStrokeElem.
isNull() )
1514 bool rotateMarker =
true;
1520 if ( it.key() ==
"placement" )
1522 if ( it.value() ==
"points" ) placement = Vertex;
1523 else if ( it.value() ==
"firstPoint" ) placement = FirstVertex;
1524 else if ( it.value() ==
"lastPoint" ) placement = LastVertex;
1525 else if ( it.value() ==
"centralPoint" ) placement = CentralPoint;
1527 else if ( it.value() ==
"rotateMarker" )
1529 rotateMarker = it.value() ==
"0";
1546 double interval = 0.0;
1558 if ( !perpOffsetElem.
isNull() )
1581 mMarker->setSize( width );
1588 mMarker->setDataDefinedSize( *dataDefined );
1595 return mMarker->size();
1601 mMarker->setOutputUnit( unit );
1602 mIntervalUnit = unit;
1604 mOffsetAlongLineUnit = unit;
1610 if ( mIntervalUnit != unit ||
mOffsetUnit != unit || mOffsetAlongLineUnit != unit )
1620 mIntervalMapUnitScale = scale;
1622 mOffsetAlongLineMapUnitScale = scale;
1640 attr.
unite( mMarker->usedAttributes() );
1646 return ( mMarker->size() / 2.0 ) +
mOffset;
void setIntervalUnit(QgsSymbolV2::OutputUnit unit)
static QString encodeOutputUnit(QgsSymbolV2::OutputUnit unit)
static double mapUnitScaleFactor(double scaleDenominator, QgsSymbolV2::OutputUnit symbolUnits, QGis::UnitType mapUnits, double mapUnitsPerPixel=1.0)
Returns scale factor for conversion to map units.
Qt::PenCapStyle penCapStyle() const
#define DEFAULT_SIMPLELINE_PENSTYLE
Single variable definition for use within a QgsExpressionContextScope.
#define DEFAULT_MARKERLINE_ROTATE
const QgsCurveV2 * exteriorRing() const
static const QString EXPR_JOINSTYLE
double estimateMaxBleed() const override
Returns the estimated maximum distance which the layer style will bleed outside the drawn shape...
const QgsFields * fields() const
Fields of the layer.
void setStyle(Qt::PenStyle style)
double dxfWidth(const QgsDxfExport &e, QgsSymbolV2RenderContext &context) const override
get line width
OutputUnit
The unit of the output.
void clipValueToMapUnitScale(double &value, const QgsMapUnitScale &scale, double pixelToMMFactor) const
Clips value to scale minimum/maximum.
QVector< qreal > dxfCustomDashPattern(QgsSymbolV2::OutputUnit &unit) const override
get dash pattern
const QgsCurveV2 * interiorRing(int i) const
static bool lineFromSld(QDomElement &element, Qt::PenStyle &penStyle, QColor &color, double &width, Qt::PenJoinStyle *penJoinStyle=nullptr, Qt::PenCapStyle *penCapStyle=nullptr, QVector< qreal > *customDashPattern=nullptr, double *dashOffset=nullptr)
A container class for data source field mapping or expression.
const QgsVectorSimplifyMethod & vectorSimplifyMethod() const
Added in QGIS v2.4.
static const QString EXPR_GEOMETRY_POINT_COUNT
Inbuilt variable name for point count variable.
bool contains(const Key &key) const
void setClipPath(const QPainterPath &path, Qt::ClipOperation operation)
double markerAngle(const QPolygonF &points, bool isRing, int vertex)
void renderPolyline(const QPolygonF &points, QgsSymbolV2RenderContext &context) override
static double _averageAngle(QPointF prevPt, QPointF pt, QPointF nextPt)
Qt::PenJoinStyle penJoinStyle() const
void setRenderHint(RenderHint hint, bool on)
QDomNode appendChild(const QDomNode &newChild)
#define DEFAULT_MARKERLINE_INTERVAL
QgsStringMap properties() const override
Should be reimplemented by subclasses to return a string map that contains the configuration informat...
static double rescaleUom(double size, QgsSymbolV2::OutputUnit unit, const QgsStringMap &props)
Rescales the given size based on the uomScale found in the props, if any is found, otherwise returns the value un-modified.
static QDomElement createVendorOptionElement(QDomDocument &doc, const QString &name, const QString &value)
RenderHints renderHints() const
static void createGeometryElement(QDomDocument &doc, QDomElement &element, const QString &geomFunc)
QString attribute(const QString &name, const QString &defValue) const
QString nodeValue() const
virtual QSet< QString > usedAttributes() const
Returns the set of attributes referenced by the layer.
virtual void setWidth(double width) override
static double sizeInPixelsFromSldUom(const QString &uom, double size)
Returns the size scaled in pixels according to the uom attribute.
void setCustomDashPatternUnit(QgsSymbolV2::OutputUnit unit)
QStringList split(const QString &sep, SplitBehavior behavior, Qt::CaseSensitivity cs) const
static QString encodeColor(const QColor &color)
Placement
Defines how/where the marker should be placed on the line.
QgsMapUnitScale mCustomDashPatternMapUnitScale
Qt::PenStyle penStyle() const
void renderPolyline(const QPolygonF &points, QgsSymbolV2RenderContext &context) override
static const QString EXPR_WIDTH
static const QString EXPR_CUSTOMDASH
void drawPolyline(const QPointF *points, int pointCount)
static QgsStringMap getVendorOptionList(QDomElement &element)
const_iterator constEnd() const
The output shall be in pixels.
void startRender(QgsSymbolV2RenderContext &context) override
const T & at(int i) const
void setUseCustomDashPattern(bool b)
virtual bool hasCurvedSegments() const
Returns true if the geometry contains curved segments.
static QVector< qreal > decodeRealVector(const QString &s)
void renderPolylineInterval(const QPolygonF &points, QgsSymbolV2RenderContext &context)
QgsSymbolV2::OutputUnit outputUnit() const override
bool setSubSymbol(QgsSymbolV2 *symbol) override
set layer's subsymbol. takes ownership of the passed symbol
void setPenJoinStyle(Qt::PenJoinStyle style)
virtual bool hasDataDefinedProperties() const
Checks whether the layer has any associated data defined properties.
void setOriginalValueVariable(const QVariant &value)
Sets the original value variable value for data defined symbology.
double dxfOffset(const QgsDxfExport &e, QgsSymbolV2RenderContext &context) const override
get offset
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=nullptr)
Create ogr feature style string for pen.
void setJoinStyle(Qt::PenJoinStyle style)
Qt::PenCapStyle mPenCapStyle
static Qt::PenJoinStyle decodePenJoinStyle(const QString &str)
const QgsGeometry * constGeometry() const
Gets a const pointer to the geometry object associated with this feature.
static const bool selectionIsOpaque
const QgsFeature * feature() const
Current feature being rendered - may be null.
static QString encodeMapUnitScale(const QgsMapUnitScale &mapUnitScale)
QGis::UnitType mapUnits() const
Retrieve map units.
static const QString EXPR_OFFSET_ALONG_LINE
QgsMapUnitScale mWidthMapUnitScale
void setIntervalMapUnitScale(const QgsMapUnitScale &scale)
double y() const
Returns the point's y-coordinate.
QString layerType() const override
Returns a string that represents this layer type.
double toDouble(bool *ok) const
void setMapUnitScale(const QgsMapUnitScale &scale) override
QgsMapUnitScale mOffsetMapUnitScale
bool qgsDoubleNear(double a, double b, double epsilon=4 *DBL_EPSILON)
Compare two doubles (but allow some difference)
static const QString EXPR_OFFSET
void addVariable(const QgsExpressionContextScope::StaticVariable &variable)
Adds a variable into the context scope.
QgsSymbolV2::OutputUnit mOffsetUnit
void setWidthUnit(QgsSymbolV2::OutputUnit unit)
virtual Q_DECL_DEPRECATED QVariant evaluateDataDefinedProperty(const QString &property, const QgsFeature *feature, const QVariant &defaultVal=QVariant(), bool *ok=nullptr) const
Evaluates the matching data defined property and returns the calculated value.
void setOffsetAlongLine(double offsetAlongLine)
Sets the the offset along the line for the marker placement.
double symbologyScaleDenominator() const
Retrieve reference scale for output.
void setInterval(double interval)
The interval between individual markers.
QgsMapUnitScale mapUnitScale() const override
static QgsSymbolV2::OutputUnit decodeOutputUnit(const QString &str)
bool mUseCustomDashPattern
void setDrawInsidePolygon(bool drawInsidePolygon)
void transformInPlace(double &x, double &y) const
Transform device coordinates to map coordinates.
static QString encodePenStyle(Qt::PenStyle style)
void setCapStyle(Qt::PenCapStyle style)
Perform transforms between map coordinates and device coordinates.
virtual double width() const
QgsSimpleLineSymbolLayerV2 * clone() const override
Shall be reimplemented by subclasses to create a deep copy of the instance.
Mixed units in symbol layers.
static QgsSymbolLayerV2 * createMarkerLayerFromSld(QDomElement &element)
The output shall be in millimeters.
static const QString EXPR_PLACEMENT
QString number(int n, int base)
int count(const T &value) const
void append(const T &value)
void setDashPattern(const QVector< qreal > &pattern)
void addPolygon(const QPolygonF &polygon)
void setOffset(double offset)
void setOutputUnit(QgsSymbolV2::OutputUnit unit) override
void setMapUnitScale(const QgsMapUnitScale &scale) override
void renderPolygonOutline(const QPolygonF &points, QList< QPolygonF > *rings, QgsSymbolV2RenderContext &context) override
QgsSymbolV2::OutputUnit outputUnit() const override
static double convertToPainterUnits(const QgsRenderContext &c, double size, QgsSymbolV2::OutputUnit unit, const QgsMapUnitScale &scale=QgsMapUnitScale())
Converts a size from the specied units to painter units.
Utility class for identifying a unique vertex within a geometry.
The geometries can be rendered with 'AntiAliasing' disabled because of it is '1-pixel size'...
Qt::PenJoinStyle mPenJoinStyle
static QgsSymbolLayerV2 * create(const QgsStringMap &properties=QgsStringMap())
static bool createExpressionElement(QDomDocument &doc, QDomElement &element, const QString &function)
Creates a OGC Expression element based on the provided function expression.
void setPen(const QColor &color)
virtual QColor color() const override
The fill color.
QgsSymbolV2::OutputUnit mWidthUnit
qreal alpha() const
Get alpha transparency 1 for opaque, 0 for invisible.
void setAttribute(const QString &name, const QString &value)
void setWidthMapUnitScale(const QgsMapUnitScale &scale)
QVector< qreal > mCustomDashVector
Vector with an even number of entries for the.
Point geometry type, with support for z-dimension and m-values.
QString qgsDoubleToString(double a, int precision=17)
Returns a string representation of a double.
#define DEFAULT_SIMPLELINE_WIDTH
static QString encodePenJoinStyle(Qt::PenJoinStyle style)
void renderPolygonOutline(const QPolygonF &points, QList< QPolygonF > *rings, QgsSymbolV2RenderContext &context) override
The output shall be in map unitx.
static QgsSymbolLayerV2 * createFromSld(QDomElement &element)
Create a new MarkerLineSymbolLayerV2 from SLD.
const QgsCoordinateTransform * coordinateTransform() const
#define DEFAULT_SIMPLELINE_CAPSTYLE
QColor selectionColor() const
#define DEFAULT_SIMPLELINE_JOINSTYLE
void setWidthF(qreal width)
float threshold() const
Gets the simplification threshold of the vector layer managed.
static Qt::PenCapStyle decodePenCapStyle(const QString &str)
void setBrush(const QBrush &brush)
QString layerType() const override
Returns a string that represents this layer type.
double x() const
Returns the point's x-coordinate.
QVector< qreal > customDashVector() const
void stopRender(QgsSymbolV2RenderContext &context) override
void setOffsetAlongLineMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale used for calculating the offset in map units along line for markers...
virtual bool nextVertex(QgsVertexId &id, QgsPointV2 &vertex) const =0
Returns next vertex id and coordinates.
void toSld(QDomDocument &doc, QDomElement &element, const QgsStringMap &props) const override
Writes the SLD element following the SLD v1.1 specs.
void setOffsetAlongLineUnit(QgsSymbolV2::OutputUnit unit)
Sets the unit used for calculating the offset along line for markers.
void setColor(const QColor &color)
Single scope for storing variables and functions for use within a QgsExpressionContext.
virtual Q_DECL_DEPRECATED void prepareExpressions(const QgsFields *fields, double scale=-1.0)
Prepares all data defined property expressions for evaluation.
QGis::GeometryType type() const
Returns type of the geometry as a QGis::GeometryType.
double mapUnitsPerPixel() const
Return current map units per pixel.
virtual QColor color() const
The fill color.
double estimateMaxBleed() const override
Returns the estimated maximum distance which the layer style will bleed outside the drawn shape...
QgsSymbolV2 * subSymbol() override
void setPenCapStyle(Qt::PenCapStyle style)
static void lineToSld(QDomDocument &doc, QDomElement &element, Qt::PenStyle penStyle, const QColor &color, double width=-1, const Qt::PenJoinStyle *penJoinStyle=nullptr, const Qt::PenCapStyle *penCapStyle=nullptr, const QVector< qreal > *customDashPattern=nullptr, double dashOffset=0.0)
void setCustomDashVector(const QVector< qreal > &vector)
static QgsSymbolLayerV2 * create(const QgsStringMap &properties=QgsStringMap())
Create a new MarkerLineSymbolLayerV2.
static Qt::PenStyle decodePenStyle(const QString &str)
static const QString EXPR_CAPSTYLE
QgsMarkerLineSymbolLayerV2 * clone() const override
Shall be reimplemented by subclasses to create a deep copy of the instance.
QString ogrFeatureStyle(double mmScaleFactor, double mapUnitScaleFactor) const override
QDomText createTextNode(const QString &value)
void copyDataDefinedProperties(QgsSymbolLayerV2 *destLayer) const
Copies all data defined properties of this layer to another symbol layer.
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 saveDataDefinedProperties(QgsStringMap &stringMap) const
Saves all data defined properties to a string map.
void setOffsetUnit(QgsSymbolV2::OutputUnit unit)
static const QString EXPR_COLOR
void setDataDefinedProperty(const QString &property, QgsDataDefined *dataDefined) override
Sets a data defined property for the layer.
static QString encodeRealVector(const QVector< qreal > &v)
QgsSymbolV2::OutputUnit outputUnit() const override
QgsSymbolV2::OutputUnit mCustomDashPatternUnit
virtual QString layerType() const =0
Returns a string that represents this layer type.
QgsExpressionContext & expressionContext()
Gets the expression context.
const QgsAbstractGeometryV2 * geometry() const
Returns pointer to the unsegmentized geometry.
~QgsMarkerLineSymbolLayerV2()
virtual double vertexAngle(QgsVertexId vertex) const =0
Returns approximate angle at a vertex.
static QgsSymbolLayerV2 * createFromSld(QDomElement &element)
void copyPaintEffect(QgsSymbolLayerV2 *destLayer) const
Copies paint effect of this layer to another symbol layer.
const T & at(int i) const
#define DEFAULT_SIMPLELINE_COLOR
const_iterator constBegin() const
Contains information about the context of a rendering operation.
QgsMapUnitScale mapUnitScale() const override
QDomNode firstChild() const
const QgsMapToPixel & mapToPixel() const
void setMapUnitScale(const QgsMapUnitScale &scale) override
void drawPath(const QPainterPath &path)
QSet< T > & unite(const QSet< T > &other)
void setPlacement(Placement p)
The placement of the markers.
virtual void writeSldMarker(QDomDocument &doc, QDomElement &element, const QgsStringMap &props) const
Writes the symbol layer definition as a SLD XML element.
Struct for storing maximum and minimum scales for measurements in map units.
Qt::PenStyle dxfPenStyle() const override
get pen style
QList< QPolygonF > offsetLine(QPolygonF polyline, double dist, QGis::GeometryType geometryType)
calculate geometry shifted by a specified distance
QgsSymbolV2::OutputUnit offsetUnit() const
virtual bool hasDataDefinedProperty(const QString &property) const
Checks whether the layer has a matching data defined property and if that property is currently activ...
QgsSimpleLineSymbolLayerV2(const QColor &color=DEFAULT_SIMPLELINE_COLOR, double width=DEFAULT_SIMPLELINE_WIDTH, Qt::PenStyle penStyle=DEFAULT_SIMPLELINE_PENSTYLE)
void setCustomDashPatternMapUnitScale(const QgsMapUnitScale &scale)
void stopRender(QgsSymbolV2RenderContext &context) override
QgsRenderContext & renderContext()
void appendScope(QgsExpressionContextScope *scope)
Appends a scope to the end of the context.
void setOutputUnit(QgsSymbolV2::OutputUnit unit) override
QDomElement firstChildElement(const QString &tagName) const
QColor dxfColor(QgsSymbolV2RenderContext &context) const override
get color
int count(const T &value) const
QgsMapUnitScale mapUnitScale() const override
void setOutputUnit(QgsSymbolV2::OutputUnit unit) override
SimplifyHints simplifyHints() const
Gets the simplification hints of the vector layer managed.
void setColor(const QColor &color) override
The fill color.
void push_back(const T &value)
static const QString EXPR_GEOMETRY_POINT_NUM
Inbuilt variable name for point number variable.
void setAlphaF(qreal alpha)
double toDouble(bool *ok) const
static QColor decodeColor(const QString &str)
Abstract base class for marker symbol layers.
Curve polygon geometry type.
void restoreDataDefinedProperties(const QgsStringMap &stringMap)
Restores all data defined properties from string map.
static QgsMapUnitScale decodeMapUnitScale(const QString &str)
double rasterScaleFactor() const
QgsExpressionContextScope * popScope()
Removes the last scope from the expression context and return it.
const_iterator constEnd() const
QDomElement createElement(const QString &tagName)
const_iterator constBegin() const
void toSld(QDomDocument &doc, QDomElement &element, const QgsStringMap &props) const override
Writes the SLD element following the SLD v1.1 specs.
void startRender(QgsSymbolV2RenderContext &context) override
QgsMarkerLineSymbolLayerV2(bool rotateMarker=DEFAULT_MARKERLINE_ROTATE, double interval=DEFAULT_MARKERLINE_INTERVAL)
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
static bool isGeneralizableByDeviceBoundingBox(const QgsRectangle &envelope, float mapToPixelTol=1.0f)
Returns whether the device-envelope can be replaced by its BBOX when is applied the specified toleran...
double scaleFactor() const
int compare(const QString &other) const
static const QString EXPR_LINE_STYLE
virtual bool setSubSymbol(QgsSymbolV2 *symbol)
set layer's subsymbol. takes ownership of the passed symbol
static const QString EXPR_INTERVAL
void renderPolylineCentral(const QPolygonF &points, QgsSymbolV2RenderContext &context)
void setGeometry(const QgsAbstractGeometryV2 *geometry)
Sets pointer to original (unsegmentized) geometry.
virtual double width() const override
QSet< QString > usedAttributes() const override
Returns the set of attributes referenced by the layer.
void renderPolylineVertex(const QPolygonF &points, QgsSymbolV2RenderContext &context, Placement placement=Vertex)
QgsSymbolV2::OutputUnit widthUnit() const
const T value(const Key &key) const
static QString encodePenCapStyle(Qt::PenCapStyle style)
QgsStringMap properties() const override
Should be reimplemented by subclasses to return a string map that contains the configuration informat...
virtual Q_DECL_DEPRECATED void setDataDefinedProperty(const QString &property, const QString &expressionString)
Sets a data defined expression for a property.