QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
qgshighlight.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgshighlight.cpp - widget to highlight features on the map
3 --------------------------------------
4 Date : 02-03-2011
5 Copyright : (C) 2011 by Juergen E. Fischer, norBIT GmbH
6 Email : jef at norbit dot de
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#include "qgshighlight.h"
17
20#include "qgsfillsymbollayer.h"
21#include "qgsgeometry.h"
22#include "qgslinesymbollayer.h"
23#include "qgsmapcanvas.h"
24#include "qgsmaplayer.h"
26#include "qgspointcloudlayer.h"
28#include "qgsrendercontext.h"
29#include "qgsrenderer.h"
30#include "qgssymbol.h"
31#include "qgssymbollayer.h"
32#include "qgsvectorlayer.h"
33
34#include <QImage>
35
36#include "moc_qgshighlight.cpp"
37
38/* Few notes about highlighting (RB):
39 - The highlight fill must always be partially transparent because above highlighted layer
40 may be another layer which must remain partially visible.
41 - Because single highlight color does not work well with layers using similar layer color
42 there were considered various possibilities but no optimal solution was found.
43 What does not work:
44 - lighter/darker color: it would work more or less for fully opaque highlight, but
45 overlaying transparent lighter color over original has small visual effect.
46 - complemetary color: mixing transparent (128) complement color with original color
47 results in grey for all colors
48 - contrast line style/ fill pattern: impression is not highligh but just different style
49 - line buffer with contrast (or 2 contrast) color: the same as with patterns, no highlight impression
50 - fill with highlight or contrast color but opaque and using pattern
51 (e.g. Qt::Dense7Pattern): again no highlight impression
52*/
53
55 : QgsMapCanvasItem( mapCanvas )
56 , mGeometry( geom )
57 , mLayer( layer )
58
59{
60 init();
61}
62
64 : QgsMapCanvasItem( mapCanvas )
65 , mLayer( layer )
66 , mFeature( feature )
67{
68 init();
69}
70
71void QgsHighlight::init()
72{
73 mOriginalGeometry = mGeometry.isNull() ? mFeature.geometry() : mGeometry;
74 setColor( QColor( Qt::lightGray ) );
75
76 connect( mMapCanvas, &QgsMapCanvas::destinationCrsChanged, this, &QgsHighlight::updateTransformedGeometry );
77 updateTransformedGeometry();
78
79 if ( mGeometry.type() == Qgis::GeometryType::Point )
80 {
81 mRenderContext = createRenderContext();
82 }
83}
84
85void QgsHighlight::updateTransformedGeometry()
86{
87 const QgsCoordinateTransform ct = mMapCanvas->mapSettings().layerTransform( mLayer );
88
89 // we don't auto-transform if we are highlighting a feature -- the renderer will take care
90 // of that for us
91 if ( ct.isValid() && !mGeometry.isNull() )
92 {
93 // reset to original geometry and transform
94 mGeometry = mOriginalGeometry;
95 try
96 {
97 mGeometry.transform( ct );
98 }
99 catch ( QgsCsException & )
100 {
101 QgsDebugError( QStringLiteral( "Could not transform highlight geometry to canvas CRS" ) );
102 }
103 }
104 updateRect();
105 update();
106}
107
109
110void QgsHighlight::setColor( const QColor &color )
111{
112 mColor = color;
113 mPen.setColor( color );
114 QColor fillColor( color.red(), color.green(), color.blue(), 63 );
115 mBrush.setColor( fillColor );
116 mBrush.setStyle( Qt::SolidPattern );
117}
118
120{
121 mFillColor = fillColor;
122 mBrush.setColor( fillColor );
123 mBrush.setStyle( Qt::SolidPattern );
124}
125
126std::unique_ptr<QgsFeatureRenderer> QgsHighlight::createRenderer( QgsRenderContext &context, const QColor &color, const QColor &fillColor )
127{
128 std::unique_ptr<QgsFeatureRenderer> renderer;
129 QgsVectorLayer *layer = qobject_cast<QgsVectorLayer *>( mLayer );
130 if ( layer && layer->renderer() )
131 {
132 renderer.reset( layer->renderer()->clone() );
133 }
134 if ( renderer )
135 {
136 const QgsSymbolList symbols = renderer->symbols( context );
137 for ( QgsSymbol *symbol : symbols )
138 {
139 if ( !symbol )
140 continue;
141 setSymbol( symbol, context, color, fillColor );
142 }
143 }
144 return renderer;
145}
146
147void QgsHighlight::setSymbol( QgsSymbol *symbol, const QgsRenderContext &context, const QColor &color, const QColor &fillColor )
148{
149 if ( !symbol )
150 return;
151
152 for ( int i = symbol->symbolLayerCount() - 1; i >= 0; i-- )
153 {
154 QgsSymbolLayer *symbolLayer = symbol->symbolLayer( i );
155 if ( !symbolLayer )
156 continue;
157
158 if ( symbolLayer->subSymbol() )
159 {
160 setSymbol( symbolLayer->subSymbol(), context, color, fillColor );
161 }
162 else
163 {
164 symbolLayer->setColor( color ); // line symbology layers
165 symbolLayer->setStrokeColor( color ); // marker and fill symbology layers
166 symbolLayer->setFillColor( fillColor ); // marker and fill symbology layers
167
168 // Data defined widths overwrite what we set here (widths do not work with data defined)
169 QgsSimpleMarkerSymbolLayer *simpleMarker = dynamic_cast<QgsSimpleMarkerSymbolLayer *>( symbolLayer );
170 if ( simpleMarker )
171 {
172 simpleMarker->setStrokeWidth( getSymbolWidth( context, simpleMarker->strokeWidth(), simpleMarker->strokeWidthUnit() ) );
173 }
174 QgsSimpleLineSymbolLayer *simpleLine = dynamic_cast<QgsSimpleLineSymbolLayer *>( symbolLayer );
175 if ( simpleLine )
176 {
177 simpleLine->setWidth( getSymbolWidth( context, simpleLine->width(), simpleLine->widthUnit() ) );
178 }
179 QgsSimpleFillSymbolLayer *simpleFill = dynamic_cast<QgsSimpleFillSymbolLayer *>( symbolLayer );
180 if ( simpleFill )
181 {
182 simpleFill->setStrokeWidth( getSymbolWidth( context, simpleFill->strokeWidth(), simpleFill->outputUnit() ) );
183 }
184 symbolLayer->setDataDefinedProperty( QgsSymbolLayer::Property::FillColor, QgsProperty() );
186 }
187 }
188}
189
190double QgsHighlight::getSymbolWidth( const QgsRenderContext &context, double width, Qgis::RenderUnit unit )
191{
192 const double widthInPainterUnits = context.convertToPainterUnits( width, unit );
193 const double bufferInPainterUnits = context.convertToPainterUnits( mBuffer, Qgis::RenderUnit::Millimeters );
194 const double minWidthInPainterUnits = context.convertToPainterUnits( mMinWidth, Qgis::RenderUnit::Millimeters );
195
196 const double adjustedWidthInPainterUnits = std::max( widthInPainterUnits + 2 * bufferInPainterUnits, minWidthInPainterUnits );
197 return context.convertFromPainterUnits( adjustedWidthInPainterUnits, unit ) / mMapCanvas->magnificationFactor();
198}
199
201{
202 mWidth = width;
203 mPen.setWidth( width );
204}
205
206void QgsHighlight::paintPoint( QgsRenderContext &context, const QgsPoint *point, double size, Qgis::RenderUnit sizeUnit, PointSymbol symbol )
207{
208 if ( !point )
209 return;
210
211 const double radius = context.convertToPainterUnits( size, sizeUnit );
212 const double xMin = toCanvasCoordinates( *point ).x() - radius - pos().x();
213 const double yMin = toCanvasCoordinates( *point ).y() - radius - pos().y();
214
215 switch ( symbol )
216 {
217 case QgsHighlight::Square:
218 {
219 const double xMax = xMin + 2 * radius;
220 const double yMax = yMin + 2 * radius;
221 QPolygonF r( QVector<QPointF> { QPointF( xMin, yMin ), QPointF( xMax, yMin ), QPointF( xMax, yMax ), QPointF( xMin, yMax ), QPointF( xMin, yMin ) } );
222 context.painter()->drawPolygon( r );
223 break;
224 }
225
226 case QgsHighlight::Circle:
227 {
228 context.painter()->drawEllipse( QRectF( xMin, yMin, radius * 2, radius * 2 ) );
229 break;
230 }
231 }
232}
233
234void QgsHighlight::paintLine( QPainter *p, QgsPolylineXY line )
235{
236 QPolygonF polygon( line.size() );
237
238 for ( int i = 0; i < line.size(); i++ )
239 {
240 polygon[i] = toCanvasCoordinates( line[i] ) - pos();
241 }
242
243 p->drawPolyline( polygon );
244}
245
246void QgsHighlight::paintPolygon( QPainter *p, const QgsPolygonXY &polygon )
247{
248 // OddEven fill rule by default
249 QPainterPath path;
250
251 p->setPen( mPen );
252 p->setBrush( mBrush );
253
254 for ( const auto &sourceRing : polygon )
255 {
256 if ( sourceRing.empty() )
257 continue;
258
259 QPolygonF ring;
260 ring.reserve( sourceRing.size() + 1 );
261
262 QPointF lastVertex;
263 for ( const auto &sourceVertex : sourceRing )
264 {
265 //adding point only if it is more than a pixel apart from the previous one
266 const QPointF curVertex = toCanvasCoordinates( sourceVertex ) - pos();
267 if ( ring.isEmpty() || std::abs( ring.back().x() - curVertex.x() ) > 1 || std::abs( ring.back().y() - curVertex.y() ) > 1 )
268 {
269 ring.push_back( curVertex );
270 }
271 lastVertex = curVertex;
272 }
273
274 ring.push_back( ring.at( 0 ) );
275
276 path.addPolygon( ring );
277 }
278
279 p->drawPath( path );
280}
281
282QgsRenderContext QgsHighlight::createRenderContext()
283{
284 QgsMapSettings mapSettings = mMapCanvas->mapSettings();
285 QgsRenderContext context = QgsRenderContext::fromMapSettings( mapSettings );
287 return context;
288}
289
291{
292 if ( !isVisible() )
293 return;
294
295 if ( mGeometry.type() == Qgis::GeometryType::Point )
296 {
297 mRenderContext = createRenderContext();
298 }
299
300 updateRect();
301}
302
304{
305 const QgsSettings settings;
306 QColor color = QColor( settings.value( QStringLiteral( "Map/highlight/color" ), Qgis::DEFAULT_HIGHLIGHT_COLOR.name() ).toString() );
307 const int alpha = settings.value( QStringLiteral( "Map/highlight/colorAlpha" ), Qgis::DEFAULT_HIGHLIGHT_COLOR.alpha() ).toInt();
308 const double buffer = settings.value( QStringLiteral( "Map/highlight/buffer" ), Qgis::DEFAULT_HIGHLIGHT_BUFFER_MM ).toDouble();
309 const double minWidth = settings.value( QStringLiteral( "Map/highlight/minWidth" ), Qgis::DEFAULT_HIGHLIGHT_MIN_WIDTH_MM ).toDouble();
310
311 setColor( color ); // sets also fill with default alpha
312 color.setAlpha( alpha );
313 setFillColor( color ); // sets fill with alpha
314 setBuffer( buffer );
315 setMinWidth( minWidth );
316}
317
318void QgsHighlight::paint( QPainter *p )
319{
320 if ( mFeature.hasGeometry() )
321 {
322 QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( mLayer );
323 if ( !vlayer )
324 return;
325
326 QgsRenderContext context = createRenderContext();
327 const QgsCoordinateTransform layerToCanvasTransform = mMapCanvas->mapSettings().layerTransform( mLayer );
328 context.setCoordinateTransform( layerToCanvasTransform );
329 QgsRectangle mapExtentInLayerCrs = mMapCanvas->mapSettings().visibleExtent();
330 if ( layerToCanvasTransform.isValid() )
331 {
332 QgsCoordinateTransform approxTransform = layerToCanvasTransform;
333 approxTransform.setBallparkTransformsAreAppropriate( true );
334 try
335 {
336 mapExtentInLayerCrs = approxTransform.transformBoundingBox( mapExtentInLayerCrs, Qgis::TransformDirection::Reverse );
337 }
338 catch ( QgsCsException & )
339 {
340 QgsDebugError( QStringLiteral( "Error transforming canvas extent to layer CRS" ) );
341 }
342 }
343 if ( !mapExtentInLayerCrs.isFinite() )
344 {
345 return;
346 }
347 context.setExtent( mapExtentInLayerCrs );
348
349 // Because lower level outlines must be covered by upper level fill color
350 // we render first with temporary opaque color, which is then replaced
351 // by final transparent fill color.
352 QColor tmpColor( 255, 0, 0, 255 );
353 QColor tmpFillColor( 0, 255, 0, 255 );
354
355 std::unique_ptr<QgsFeatureRenderer> renderer = createRenderer( context, tmpColor, tmpFillColor );
356 if ( renderer )
357 {
358 QSize imageSize( mMapCanvas->mapSettings().outputSize() );
359 QImage image = QImage( imageSize.width(), imageSize.height(), QImage::Format_ARGB32 );
360 image.fill( 0 );
361 QPainter imagePainter( &image );
362 imagePainter.setRenderHint( QPainter::Antialiasing, true );
363
364 context.setPainter( &imagePainter );
365 renderer->startRender( context, mFeature.fields() );
366 context.expressionContext().setFeature( mFeature );
367 renderer->renderFeature( mFeature, context );
368 renderer->stopRender( context );
369
370 imagePainter.end();
371
372 // true output color
373 int penRed = mPen.color().red();
374 int penGreen = mPen.color().green();
375 int penBlue = mPen.color().blue();
376 // coefficient to subtract alpha using green (temporary fill)
377 double k = ( 255. - mBrush.color().alpha() ) / 255.;
378 QRgb *line = nullptr;
379 const int height = image.height();
380 const int width = image.width();
381 for ( int r = 0; r < height; r++ )
382 {
383 line = reinterpret_cast<QRgb *>( image.scanLine( r ) );
384 for ( int c = 0; c < width; c++ )
385 {
386 int alpha = qAlpha( line[c] );
387 if ( alpha > 0 )
388 {
389 int green = qGreen( line[c] );
390 line[c] = qRgba( penRed, penGreen, penBlue, std::clamp( static_cast<int>( alpha - ( green * k ) ), 30, 255 ) );
391 }
392 }
393 }
394
395 p->drawImage( 0, 0, image );
396 }
397 }
398 else if ( !mGeometry.isNull() )
399 {
400 p->setPen( mPen );
401 p->setBrush( mBrush );
402
403 switch ( mGeometry.type() )
404 {
406 {
407 setRenderContextVariables( p, mRenderContext );
408
409 // default to 1.5 mm radius square points
410 double pointSizeRadius = mPointSizeRadiusMM;
412 PointSymbol symbol = mPointSymbol;
413
414 // but for point clouds, use actual sizes (+a little margin!)
415 if ( QgsPointCloudLayer *pcLayer = qobject_cast<QgsPointCloudLayer *>( mLayer ) )
416 {
417 if ( QgsPointCloudRenderer *pcRenderer = pcLayer->renderer() )
418 {
419 pointSizeRadius = 1.2 * 0.5 * mRenderContext.convertToPainterUnits( pcRenderer->pointSize(), pcRenderer->pointSizeUnit(), pcRenderer->pointSizeMapUnitScale() );
420 sizeUnit = Qgis::RenderUnit::Pixels;
421 switch ( pcRenderer->pointSymbol() )
422 {
424 symbol = Circle;
425 break;
427 symbol = Square;
428 break;
429 }
430 }
431 }
432
433 for ( auto it = mGeometry.const_parts_begin(); it != mGeometry.const_parts_end(); ++it )
434 {
435 paintPoint( mRenderContext, qgsgeometry_cast<const QgsPoint *>( *it ), pointSizeRadius, sizeUnit, symbol );
436 }
437 }
438 break;
439
441 {
442 if ( !mGeometry.isMultipart() )
443 {
444 paintLine( p, mGeometry.asPolyline() );
445 }
446 else
447 {
448 QgsMultiPolylineXY m = mGeometry.asMultiPolyline();
449
450 for ( int i = 0; i < m.size(); i++ )
451 {
452 paintLine( p, m[i] );
453 }
454 }
455 break;
456 }
457
459 {
460 if ( !mGeometry.isMultipart() )
461 {
462 paintPolygon( p, mGeometry.asPolygon() );
463 }
464 else
465 {
466 QgsMultiPolygonXY m = mGeometry.asMultiPolygon();
467 for ( int i = 0; i < m.size(); i++ )
468 {
469 paintPolygon( p, m[i] );
470 }
471 }
472 break;
473 }
474
477 return;
478 }
479 }
480}
481
483{
484 if ( qobject_cast<QgsPointCloudLayer *>( mLayer ) || mFeature.hasGeometry() )
485 {
486 // We are currently using full map canvas extent for two reasons:
487 // 1) currently there is no method in QgsFeatureRenderer to get rendered feature
488 // bounding box
489 // 2) using different extent would result in shifted fill patterns
490
491 // This is an hack to pass QgsMapCanvasItem::setRect what it
492 // expects (encoding of position and size of the item)
493 const QgsMapToPixel &m2p = mMapCanvas->mapSettings().mapToPixel();
494 QgsPointXY topLeft = m2p.toMapCoordinates( 0, 0 );
495 double res = m2p.mapUnitsPerPixel();
496 QSizeF imageSize = mMapCanvas->mapSettings().outputSize();
497 QgsRectangle rect( topLeft.x(), topLeft.y(), topLeft.x() + imageSize.width() * res, topLeft.y() - imageSize.height() * res );
498 setRect( rect );
499
500 setVisible( true );
501 }
502 else if ( !mGeometry.isNull() )
503 {
504 QgsRectangle r = mGeometry.boundingBox();
505
506 if ( r.isEmpty() )
507 {
508 double d = mMapCanvas->extent().width() * 0.005;
509 r.setXMinimum( r.xMinimum() - d );
510 r.setYMinimum( r.yMinimum() - d );
511 r.setXMaximum( r.xMaximum() + d );
512 r.setYMaximum( r.yMaximum() + d );
513 }
514
515 setRect( r );
516 setVisible( true );
517 }
518 else
519 {
521 }
522}
@ Circle
Renders points as circles.
Definition qgis.h:4248
@ Square
Renders points as squares.
Definition qgis.h:4247
static const double DEFAULT_HIGHLIGHT_MIN_WIDTH_MM
Default highlight line/stroke minimum width in mm.
Definition qgis.h:6194
static const double DEFAULT_HIGHLIGHT_BUFFER_MM
Default highlight buffer in mm.
Definition qgis.h:6189
static const QColor DEFAULT_HIGHLIGHT_COLOR
Default highlight color.
Definition qgis.h:6184
@ Point
Points.
Definition qgis.h:359
@ Line
Lines.
Definition qgis.h:360
@ Polygon
Polygons.
Definition qgis.h:361
@ Unknown
Unknown types.
Definition qgis.h:362
@ Null
No geometry.
Definition qgis.h:363
RenderUnit
Rendering size units.
Definition qgis.h:5183
@ Millimeters
Millimeters.
Definition qgis.h:5184
@ Pixels
Pixels.
Definition qgis.h:5186
@ Reverse
Reverse/inverse transform (from destination to source).
Definition qgis.h:2673
Handles coordinate transforms between two coordinate systems.
void setBallparkTransformsAreAppropriate(bool appropriate)
Sets whether approximate "ballpark" results are appropriate for this coordinate transform.
QgsRectangle transformBoundingBox(const QgsRectangle &rectangle, Qgis::TransformDirection direction=Qgis::TransformDirection::Forward, bool handle180Crossover=false) const
Transforms a rectangle from the source CRS to the destination CRS.
bool isValid() const
Returns true if the coordinate transform is valid, ie both the source and destination CRS have been s...
Custom exception class for Coordinate Reference System related exceptions.
static QgsExpressionContextScope * layerScope(const QgsMapLayer *layer)
Creates a new scope which contains variables and functions relating to a QgsMapLayer.
void setFeature(const QgsFeature &feature)
Convenience function for setting a feature for the context.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition qgsfeature.h:58
QgsGeometry geometry
Definition qgsfeature.h:69
A geometry is the spatial representation of a feature.
Qgis::GeometryType type
void updatePosition() override
called on changed extent or resize event to update position of the item
QgsMapLayer * layer() const
Returns the layer for which this highlight has been created.
QgsHighlight(QgsMapCanvas *mapCanvas, const QgsGeometry &geom, QgsMapLayer *layer)
Constructor for QgsHighlight.
void setBuffer(double buffer)
Sets the line/stroke buffer size (in millimeters).
QColor fillColor
~QgsHighlight() override
void setMinWidth(double width)
Sets the minimum line/stroke width (in millimeters).
void setFillColor(const QColor &fillColor)
Fill color for the highlight.
void applyDefaultStyle()
Applies the default style from the user settings to the highlight.
void setWidth(int width)
Set stroke width.
void paint(QPainter *p) override
function to be implemented by derived classes
void updateRect()
recalculates needed rectangle
void setColor(const QColor &color)
Set line/stroke to color, polygon fill to color with alpha = 63.
virtual void setWidth(double width)
Sets the width of the line symbol layer.
virtual double width() const
Returns the estimated width for the line symbol layer.
Qgis::RenderUnit widthUnit() const
Returns the units for the line's width.
QgsRectangle rect() const
returns canvas item rectangle in map units
QPointF toCanvasCoordinates(const QgsPointXY &point) const
transformation from map coordinates to screen coordinates
QgsMapCanvas * mMapCanvas
pointer to map canvas
void setRect(const QgsRectangle &r, bool resetRotation=true)
sets canvas item rectangle in map units
QgsMapCanvasItem(QgsMapCanvas *mapCanvas)
protected constructor: cannot be constructed directly
bool setRenderContextVariables(QPainter *p, QgsRenderContext &context) const
Sets render context parameters.
Map canvas is a class for displaying all GIS data types on a canvas.
void destinationCrsChanged()
Emitted when map CRS has changed.
Base class for all map layer types.
Definition qgsmaplayer.h:80
virtual QgsMapLayer * clone() const =0
Returns a new instance equivalent to this one except for the id which is still unique.
Perform transforms between map coordinates and device coordinates.
double mapUnitsPerPixel() const
Returns the current map units per pixel.
QgsPointXY toMapCoordinates(int x, int y) const
Transforms device coordinates to map (world) coordinates.
Represents a map layer supporting display of point clouds.
Abstract base class for 2d point cloud renderers.
Represents a 2D point.
Definition qgspointxy.h:60
double y
Definition qgspointxy.h:64
double x
Definition qgspointxy.h:63
Point geometry type, with support for z-dimension and m-values.
Definition qgspoint.h:49
A rectangle specified with double values.
double xMinimum
double yMinimum
double xMaximum
void setYMinimum(double y)
Set the minimum y value.
void setXMinimum(double x)
Set the minimum x value.
void setYMaximum(double y)
Set the maximum y value.
void setXMaximum(double x)
Set the maximum x value.
double yMaximum
bool isFinite() const
Returns true if the rectangle has finite boundaries.
Contains information about the context of a rendering operation.
void setCoordinateTransform(const QgsCoordinateTransform &t)
Sets the current coordinate transform for the context.
double convertFromPainterUnits(double size, Qgis::RenderUnit unit) const
Converts a size from painter units (pixels) to the specified render unit.
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.
void setExtent(const QgsRectangle &extent)
When rendering a map layer, calling this method sets the "clipping" extent for the layer (in the laye...
void setPainter(QPainter *p)
Sets the destination QPainter for the render operation.
static QgsRenderContext fromMapSettings(const QgsMapSettings &mapSettings)
create initialized QgsRenderContext instance from given QgsMapSettings
Stores settings for use within QGIS.
Definition qgssettings.h:65
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), Section section=NoSection) const
Returns the value for setting key.
void setStrokeWidth(double strokeWidth)
Qgis::RenderUnit outputUnit() const override
Returns the units to use for sizes and widths within the symbol layer.
void setStrokeWidth(double w)
Sets the width of the marker's stroke.
Qgis::RenderUnit strokeWidthUnit() const
Returns the unit for the width of the marker's stroke.
double strokeWidth() const
Returns the width of the marker's stroke.
virtual void setStrokeColor(const QColor &color)
Sets the stroke color for the symbol layer.
virtual void setFillColor(const QColor &color)
Sets the fill color for the symbol layer.
virtual void setDataDefinedProperty(Property key, const QgsProperty &property)
Sets a data defined property for the layer.
virtual void setColor(const QColor &color)
Sets the "representative" color for the symbol layer.
virtual QgsSymbol * subSymbol()
Returns the symbol's sub symbol, if present.
Abstract base class for all rendered symbols.
Definition qgssymbol.h:231
QgsSymbolLayer * symbolLayer(int layer)
Returns the symbol layer at the specified index.
int symbolLayerCount() const
Returns the total number of symbol layers contained in the symbol.
Definition qgssymbol.h:353
Represents a vector layer which manages a vector based dataset.
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into c
T qgsgeometry_cast(QgsAbstractGeometry *geom)
QVector< QgsPolylineXY > QgsPolygonXY
Polygon: first item of the list is outer ring, inner rings (if any) start from second item.
Definition qgsgeometry.h:90
QVector< QgsPolylineXY > QgsMultiPolylineXY
A collection of QgsPolylines that share a common collection of attributes.
QVector< QgsPointXY > QgsPolylineXY
Polyline as represented as a vector of two-dimensional points.
Definition qgsgeometry.h:61
QVector< QgsPolygonXY > QgsMultiPolygonXY
A collection of QgsPolygons that share a common collection of attributes.
#define QgsDebugError(str)
Definition qgslogger.h:57
QList< QgsSymbol * > QgsSymbolList
Definition qgsrenderer.h:49