QGIS API Documentation 3.99.0-Master (21b3aa880ba)
Loading...
Searching...
No Matches
qgselevationprofilelayertreeview.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgselevationprofilelayertreeview.cpp
3 -----------------
4 begin : April 2022
5 copyright : (C) 2022 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7***************************************************************************/
8
9
10/***************************************************************************
11 * *
12 * This program is free software; you can redistribute it and/or modify *
13 * it under the terms of the GNU General Public License as published by *
14 * the Free Software Foundation; either version 2 of the License, or *
15 * (at your option) any later version. *
16 * *
17 ***************************************************************************/
18
20
21#include "qgsapplication.h"
22#include "qgsfillsymbol.h"
23#include "qgslayertree.h"
24#include "qgslayertreenode.h"
25#include "qgsmaplayerutils.h"
26#include "qgsmarkersymbol.h"
31#include "qgssymbollayerutils.h"
32#include "qgsvectorlayer.h"
34
35#include <QContextMenuEvent>
36#include <QHeaderView>
37#include <QMenu>
38#include <QMimeData>
39
40#include "moc_qgselevationprofilelayertreeview.cpp"
41
42const QString QgsElevationProfileLayerTreeView::CUSTOM_NODE_ELEVATION_PROFILE_SOURCE = QStringLiteral( "elevationProfileRegistry" );
43
53
54QVariant QgsElevationProfileLayerTreeModel::data( const QModelIndex &index, int role ) const
55{
56 switch ( role )
57 {
58 case Qt::DecorationRole:
59 {
61
62 if ( node && node->nodeType() == QgsLayerTreeNode::NodeLayer )
63 {
64 if ( QgsMapLayer *layer = QgsLayerTree::toLayer( node )->layer() )
65 {
66 std::unique_ptr<QgsRenderContext> context( createTemporaryRenderContext() );
67
68 const int iconSize = scaleIconSize( 16 );
69 std::unique_ptr<QgsSymbol> symbol;
70 switch ( layer->type() )
71 {
73 {
74 QgsVectorLayerElevationProperties *elevationProperties = qgis::down_cast<QgsVectorLayerElevationProperties *>( layer->elevationProperties() );
75 QgsVectorLayer *vLayer = qobject_cast<QgsVectorLayer *>( layer );
76
77 switch ( elevationProperties->type() )
78 {
80 if ( ( vLayer->geometryType() == Qgis::GeometryType::Point && !elevationProperties->extrusionEnabled() )
81 || ( vLayer->geometryType() == Qgis::GeometryType::Line && !elevationProperties->extrusionEnabled() ) )
82 {
83 if ( QgsMarkerSymbol *markerSymbol = elevationProperties->profileMarkerSymbol() )
84 {
85 symbol.reset( markerSymbol->clone() );
86 }
87 }
88
89 if ( !symbol && vLayer->geometryType() == Qgis::GeometryType::Polygon && elevationProperties->extrusionEnabled() )
90 {
91 if ( QgsFillSymbol *fillSymbol = elevationProperties->profileFillSymbol() )
92 {
93 symbol.reset( fillSymbol->clone() );
94 }
95 }
96
97 if ( !symbol )
98 {
99 if ( QgsLineSymbol *lineSymbol = elevationProperties->profileLineSymbol() )
100 {
101 symbol.reset( lineSymbol->clone() );
102 }
103 }
104
105 if ( elevationProperties->respectLayerSymbology() )
106 {
107 if ( !symbol )
108 {
109 // just use default layer icon
110 return QgsLayerTreeModel::data( index, role );
111 }
112
113 if ( QgsSingleSymbolRenderer *renderer = dynamic_cast<QgsSingleSymbolRenderer *>( qobject_cast<QgsVectorLayer *>( layer )->renderer() ) )
114 {
115 if ( renderer->symbol()->type() == symbol->type() )
116 {
117 // take the whole renderer symbol if we can
118 symbol.reset( renderer->symbol()->clone() );
119 }
120 else
121 {
122 // otherwise emulate what happens when rendering the actual chart and just copy the color and opacity
123 symbol->setColor( renderer->symbol()->color() );
124 symbol->setOpacity( renderer->symbol()->opacity() );
125 }
126 }
127 else
128 {
129 // just use default layer icon
130 return QgsLayerTreeModel::data( index, role );
131 }
132 }
133 break;
134
136 switch ( elevationProperties->profileSymbology() )
137 {
139 if ( QgsLineSymbol *lineSymbol = elevationProperties->profileLineSymbol() )
140 {
141 symbol.reset( lineSymbol->clone() );
142 }
143 break;
146 if ( QgsFillSymbol *fillSymbol = elevationProperties->profileFillSymbol() )
147 {
148 symbol.reset( fillSymbol->clone() );
149 }
150 break;
151 }
152 break;
153 }
154 break;
155 }
156
158 {
159 QgsRasterLayerElevationProperties *rlProps = qgis::down_cast<QgsRasterLayerElevationProperties *>( layer->elevationProperties() );
160 switch ( rlProps->profileSymbology() )
161 {
163 if ( QgsLineSymbol *lineSymbol = rlProps->profileLineSymbol() )
164 {
165 symbol.reset( lineSymbol->clone() );
166 }
167 break;
170 if ( QgsFillSymbol *fillSymbol = rlProps->profileFillSymbol() )
171 {
172 symbol.reset( fillSymbol->clone() );
173 }
174 break;
175 }
176 break;
177 }
178
180 {
181 QgsMeshLayerElevationProperties *mlProps = qgis::down_cast<QgsMeshLayerElevationProperties *>( layer->elevationProperties() );
182 switch ( mlProps->profileSymbology() )
183 {
185 if ( QgsLineSymbol *lineSymbol = mlProps->profileLineSymbol() )
186 {
187 symbol.reset( lineSymbol->clone() );
188 }
189 break;
192 if ( QgsFillSymbol *fillSymbol = mlProps->profileFillSymbol() )
193 {
194 symbol.reset( fillSymbol->clone() );
195 }
196 break;
197 }
198 break;
199 }
200
207 break;
208 }
209 if ( !symbol )
210 break;
211
212 const QPixmap pix = QgsSymbolLayerUtils::symbolPreviewPixmap( symbol.get(), QSize( iconSize, iconSize ), 0, context.get() );
213 return QIcon( pix );
214 }
215 }
216 break;
217 }
218
219 case Qt::ToolTipRole:
220 {
221 // override default tooltip with elevation specific one
223 if ( node && node->nodeType() == QgsLayerTreeNode::NodeLayer )
224 {
225 if ( QgsMapLayer *layer = QgsLayerTree::toLayer( node )->layer() )
226 {
227 QString title = !layer->metadata().title().isEmpty() ? layer->metadata().title() : !layer->serverProperties()->title().isEmpty() ? layer->serverProperties()->title()
228 : !layer->serverProperties()->shortName().isEmpty() ? layer->serverProperties()->shortName()
229 : layer->name();
230
231 title = "<b>" + title.toHtmlEscaped() + "</b>";
232
233 QStringList parts;
234 parts << title;
235
236 const QString elevationPropertiesSummary = layer->elevationProperties() ? layer->elevationProperties()->htmlSummary() : QString();
237 if ( !elevationPropertiesSummary.isEmpty() )
238 parts << elevationPropertiesSummary;
239
240 return parts.join( QLatin1String( "<br/>" ) );
241 }
242 }
243 break;
244 }
245
246 default:
247 break;
248 }
249 return QgsLayerTreeModel::data( index, role );
250}
251
252bool QgsElevationProfileLayerTreeModel::setData( const QModelIndex &index, const QVariant &value, int role )
253{
254 if ( QgsLayerTreeLayer *layerNode = qobject_cast<QgsLayerTreeLayer *>( index2node( index ) ) )
255 {
256 if ( role == Qt::CheckStateRole )
257 {
258 const bool checked = static_cast<Qt::CheckState>( value.toInt() ) == Qt::Checked;
259 if ( QgsMapLayer *layer = layerNode->layer() )
260 {
261 layer->setCustomProperty( QStringLiteral( "_include_in_elevation_profiles" ), checked );
262 }
263 }
264 }
265
266 return QgsLayerTreeModel::setData( index, value, role );
267}
268
269Qt::ItemFlags QgsElevationProfileLayerTreeModel::flags( const QModelIndex &index ) const
270{
271 Qt::ItemFlags f = QgsLayerTreeModel::flags( index );
272
273 // the elevation tree model only supports group renames, not layer renames (otherwise
274 // we'd be renaming the actual layer, which is likely NOT what users expect)
276 if ( !QgsLayerTree::isGroup( node ) )
277 {
278 f.setFlag( Qt::ItemFlag::ItemIsEditable, false );
279 }
280 return f;
281}
282
283bool QgsElevationProfileLayerTreeModel::canDropMimeData( const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent ) const
284{
285 if ( action == Qt::IgnoreAction )
286 return true;
287
288 if ( !data->hasFormat( QStringLiteral( "application/qgis.layertreemodeldata" ) ) )
289 return false;
290
291 // don't accept moves from other layer trees -- only allow internal drag
292 if ( action == Qt::MoveAction )
293 {
294 const QString source = data->data( QStringLiteral( "application/qgis.layertree.source" ) );
295 if ( source.isEmpty() || source != QStringLiteral( ":0x%1" ).arg( reinterpret_cast<quintptr>( this ), 2 * QT_POINTER_SIZE, 16, QLatin1Char( '0' ) ) )
296 {
297 return false;
298 }
299 }
300
301 return QgsLayerTreeModel::canDropMimeData( data, action, row, column, parent );
302}
303
304bool QgsElevationProfileLayerTreeModel::dropMimeData( const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent )
305{
306 if ( action == Qt::IgnoreAction )
307 return true;
308
309 if ( !data->hasFormat( QStringLiteral( "application/qgis.layertreemodeldata" ) ) )
310 return false;
311
312 // don't accept moves from other layer trees -- only allow internal drag
313 const QString source = data->data( QStringLiteral( "application/qgis.layertree.source" ) );
314 if ( source.isEmpty() || source != QStringLiteral( ":0x%1" ).arg( reinterpret_cast<quintptr>( this ), 2 * QT_POINTER_SIZE, 16, QLatin1Char( '0' ) ) )
315 {
316 if ( action == Qt::CopyAction )
317 {
318 QByteArray encodedLayerTreeData = data->data( QStringLiteral( "application/qgis.layertreemodeldata" ) );
319
320 QDomDocument layerTreeDoc;
321 if ( !layerTreeDoc.setContent( QString::fromUtf8( encodedLayerTreeData ) ) )
322 return false;
323
324 QDomElement rootLayerTreeElem = layerTreeDoc.documentElement();
325 if ( rootLayerTreeElem.tagName() != QLatin1String( "layer_tree_model_data" ) )
326 return false;
327
328 QList<QgsMapLayer *> layersToAdd;
329
330 QDomElement elem = rootLayerTreeElem.firstChildElement();
331 while ( !elem.isNull() )
332 {
333 std::unique_ptr<QgsLayerTreeNode> node( QgsLayerTreeNode::readXml( elem, QgsProject::instance() ) );
334 if ( node && QgsLayerTree::isLayer( node.get() ) )
335 {
336 if ( QgsMapLayer *layer = qobject_cast<QgsLayerTreeLayer *>( node.get() )->layer() )
337 {
338 layersToAdd << layer;
339 }
340 }
341 elem = elem.nextSiblingElement();
342 }
343
344 if ( !layersToAdd.empty() )
345 emit addLayers( layersToAdd );
346
347 return true;
348 }
349 else
350 {
351 return false;
352 }
353 }
354
355 return QgsLayerTreeModel::dropMimeData( data, action, row, column, parent );
356}
357
358QMimeData *QgsElevationProfileLayerTreeModel::mimeData( const QModelIndexList &indexes ) const
359{
360 QMimeData *mimeData = QgsLayerTreeModel::mimeData( indexes );
361 if ( mimeData )
362 {
363 mimeData->setData( QStringLiteral( "application/qgis.restrictlayertreemodelsubclass" ), "QgsElevationProfileLayerTreeModel" );
364 }
365 return mimeData;
366}
367
368
369//
370// QgsElevationProfileLayerTreeProxyModel
371//
372
374 : QSortFilterProxyModel( parent )
375 , mModel( model )
376{
377 setSourceModel( mModel );
378 setDynamicSortFilter( true );
379}
380
381bool QgsElevationProfileLayerTreeProxyModel::filterAcceptsRow( int sourceRow, const QModelIndex &sourceParent ) const
382{
383 const QModelIndex sourceIndex = mModel->index( sourceRow, 0, sourceParent );
384 if ( QgsLayerTreeNode *node = mModel->index2node( sourceIndex ) )
385 {
386 switch ( node->nodeType() )
387 {
389 {
390 if ( QgsLayerTreeLayer *layerTreeLayer = QgsLayerTree::toLayer( node ) )
391 {
392 if ( QgsMapLayer *layer = layerTreeLayer->layer() )
393 {
394 // hide layers which don't have elevation
395 if ( !layer->elevationProperties() || !layer->elevationProperties()->hasElevation() )
396 return false;
397 }
398 }
399 break;
400 }
401
404 break;
405 }
406 return true;
407 }
408 else if ( QgsLayerTreeModelLegendNode *legendNode = mModel->index2legendNode( sourceIndex ) )
409 {
410 // we only show legend nodes for vector layers where the profile symbol is set to follow the layer's symbology
411 // (and the layer's renderer isn't a single symbol renderer)
412 if ( QgsLayerTreeLayer *layerTreeLayer = QgsLayerTree::toLayer( legendNode->layerNode() ) )
413 {
414 if ( QgsVectorLayer *layer = qobject_cast<QgsVectorLayer *>( layerTreeLayer->layer() ) )
415 {
416 if ( !qgis::down_cast<QgsVectorLayerElevationProperties *>( layer->elevationProperties() )->respectLayerSymbology() )
417 {
418 return false;
419 }
420 else if ( dynamic_cast<QgsSingleSymbolRenderer *>( qobject_cast<QgsVectorLayer *>( layer )->renderer() ) )
421 {
422 return false;
423 }
424 else
425 {
426 return true;
427 }
428 }
429 }
430 return false;
431 }
432 else
433 {
434 return false;
435 }
436}
437
438
440 : QgsLayerTreeViewBase( parent )
441 , mLayerTree( rootNode )
442{
443 mModel = new QgsElevationProfileLayerTreeModel( rootNode, this );
444
446 mProxyModel = new QgsElevationProfileLayerTreeProxyModel( mModel, this );
447
448 setModel( mProxyModel );
449 setLayerTreeModel( mModel );
450}
451
453{
454 const QList<QgsMapLayer *> layers = project->layers<QgsMapLayer *>().toList();
455
456 // sort layers so that types which are more likely to obscure others are rendered below
457 // e.g. vector features should be drawn above raster DEMS, or the DEM line may completely obscure
458 // the vector feature
460
461 std::reverse( sortedLayers.begin(), sortedLayers.end() );
462 for ( QgsMapLayer *layer : std::as_const( sortedLayers ) )
463 {
464 // don't re-add existing layers
465 if ( mLayerTree->findLayer( layer ) )
466 continue;
467
468 QgsLayerTreeLayer *node = mLayerTree->addLayer( layer );
469
470 if ( layer->customProperty( QStringLiteral( "_include_in_elevation_profiles" ) ).isValid() )
471 {
472 node->setItemVisibilityChecked( layer->customProperty( QStringLiteral( "_include_in_elevation_profiles" ) ).toBool() );
473 }
474 else
475 {
476 node->setItemVisibilityChecked( layer->elevationProperties() && layer->elevationProperties()->showByDefaultInElevationProfilePlots() );
477 }
478 }
479}
480
482{
483 const QList< QgsAbstractProfileSource * > sources = QgsApplication::profileSourceRegistry()->profileSources();
484 for ( QgsAbstractProfileSource *source : sources )
485 {
486 addNodeForRegisteredSource( source->profileSourceId(), source->profileSourceName() );
487 }
488
489 populateMissingLayers( project );
490}
491
492void QgsElevationProfileLayerTreeView::addNodeForRegisteredSource( const QString &sourceId, const QString &sourceName )
493{
494 auto customNode = std::make_unique< QgsLayerTreeCustomNode >( sourceId, sourceName.isEmpty() ? sourceId : sourceName );
495 customNode->setItemVisibilityChecked( true );
496 // Mark the node so that we know which custom nodes correspond to elevation profile sources
497 customNode->setCustomProperty( QStringLiteral( "source" ), QgsElevationProfileLayerTreeView::CUSTOM_NODE_ELEVATION_PROFILE_SOURCE );
498
499 QgsLayerTreeCustomNode *node = mLayerTree->insertCustomNode( -1, customNode.release() );
500 if ( !node )
501 QgsDebugError( QString( "The custom node with id '%1' could not be added!" ).arg( sourceId ) );
502}
503
505{
506 mLayerTree->removeCustomNode( sourceId );
507}
508
513
515{
516 header()->setMinimumSectionSize( viewport()->width() );
517 QTreeView::resizeEvent( event );
518}
@ Point
Points.
Definition qgis.h:359
@ Line
Lines.
Definition qgis.h:360
@ Polygon
Polygons.
Definition qgis.h:361
@ Group
Composite group layer. Added in QGIS 3.24.
Definition qgis.h:198
@ Plugin
Plugin based layer.
Definition qgis.h:193
@ TiledScene
Tiled scene layer. Added in QGIS 3.34.
Definition qgis.h:199
@ Annotation
Contains freeform, georeferenced annotations. Added in QGIS 3.16.
Definition qgis.h:196
@ Vector
Vector layer.
Definition qgis.h:191
@ VectorTile
Vector tile layer. Added in QGIS 3.14.
Definition qgis.h:195
@ Mesh
Mesh layer. Added in QGIS 3.2.
Definition qgis.h:194
@ Raster
Raster layer.
Definition qgis.h:192
@ PointCloud
Point cloud layer. Added in QGIS 3.18.
Definition qgis.h:197
@ ContinuousSurface
The features should be treated as representing values on a continuous surface (eg contour lines).
Definition qgis.h:4208
@ IndividualFeatures
Treat each feature as an individual object (eg buildings).
Definition qgis.h:4207
@ Line
The elevation surface will be rendered using a line symbol.
Definition qgis.h:4194
@ FillBelow
The elevation surface will be rendered using a fill symbol below the surface level.
Definition qgis.h:4195
@ FillAbove
The elevation surface will be rendered using a fill symbol above the surface level.
Definition qgis.h:4196
Interface for classes which can generate elevation profiles.
static QgsProfileSourceRegistry * profileSourceRegistry()
Returns registry of available profile source implementations.
A layer tree model subclass for elevation profiles.
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override
void addLayers(const QList< QgsMapLayer * > &layers)
Emitted when layers should be added to the profile, e.g.
QgsElevationProfileLayerTreeModel(QgsLayerTree *rootNode, QObject *parent=nullptr)
Construct a new tree model with given layer tree (root node must not be nullptr).
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
QMimeData * mimeData(const QModelIndexList &indexes) const override
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
bool canDropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const override
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override
QgsElevationProfileLayerTreeProxyModel(QgsElevationProfileLayerTreeModel *model, QObject *parent=nullptr)
Constructor for QgsElevationProfileLayerTreeProxyModel.
void populateInitialSources(QgsProject *project)
Initially populates the tree view using layers from a project, as well as sources from the source reg...
QgsElevationProfileLayerTreeProxyModel * proxyModel()
Returns the view's proxy model.
QgsElevationProfileLayerTreeView(QgsLayerTree *rootNode, QWidget *parent=nullptr)
Construct a new tree view with given layer tree (root node must not be nullptr).
void removeNodeForUnregisteredSource(const QString &sourceId)
Removes a custom node from the layer tree corresponding to an unregistered profile source.
void addNodeForRegisteredSource(const QString &sourceId, const QString &sourceName)
Adds a custom node in the layer tree corresponding to a registered profile source.
void populateMissingLayers(QgsProject *project)
Adds any layers from a project which currently aren't within the profile's layer tree.
void resizeEvent(QResizeEvent *event) override
void addLayers(const QList< QgsMapLayer * > &layers)
Emitted when layers should be added to the profile, e.g.
A fill symbol type, for rendering Polygon and MultiPolygon geometries.
Layer tree custom node serves as a node for objects that are not layers nor groups.
Layer tree node points to a map layer.
An abstract interface for legend items returned from QgsMapLayerLegend implementation.
QgsLayerTreeLayer * layerNode() const
Returns pointer to the parent layer node.
Flags flags() const
Returns OR-ed combination of model flags.
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
QgsLayerTreeModel(QgsLayerTree *rootNode, QObject *parent=nullptr)
Construct a new tree model with given layer tree (root node must not be nullptr).
QModelIndex parent(const QModelIndex &child) const override
void setFlag(Flag f, bool on=true)
Enable or disable a model flag.
QgsRenderContext * createTemporaryRenderContext() const
Returns a temporary render context.
QgsLayerTreeNode * index2node(const QModelIndex &index) const
Returns layer tree node for given index.
QMimeData * mimeData(const QModelIndexList &indexes) const override
static int scaleIconSize(int standardSize)
Scales an layer tree model icon size to compensate for display pixel density, making the icon size hi...
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
@ AllowNodeChangeVisibility
Allow user to set node visibility with a checkbox.
@ ShowLegendAsTree
For legends that support it, will show them in a tree instead of a list (needs also ShowLegend)....
@ AllowNodeReorder
Allow reordering with drag'n'drop.
@ AllowNodeRename
Allow renaming of groups and layers.
@ AllowLegendChangeState
Allow check boxes for legend nodes (if supported by layer's legend).
Base class for nodes in a layer tree.
@ NodeCustom
Leaf node pointing to a custom object.
@ NodeGroup
Container of other groups and layers.
@ NodeLayer
Leaf node pointing to a layer.
static QgsLayerTreeNode * readXml(QDomElement &element, const QgsReadWriteContext &context)
Read layer tree from XML.
NodeType nodeType() const
Find out about type of the node. It is usually shorter to use convenience functions from QgsLayerTree...
void setItemVisibilityChecked(bool checked)
Check or uncheck a node (independently of its ancestors or children).
void setLayerTreeModel(QgsLayerTreeModel *model)
Associates a layer tree model with the view.
QgsLayerTreeViewBase(QWidget *parent=nullptr)
Constructor for QgsLayerTreeViewBase.
Namespace with helper functions for layer tree operations.
static QgsLayerTreeLayer * toLayer(QgsLayerTreeNode *node)
Cast node to a layer.
static bool isLayer(const QgsLayerTreeNode *node)
Check whether the node is a valid layer node.
static bool isGroup(QgsLayerTreeNode *node)
Check whether the node is a valid group node.
A line symbol type, for rendering LineString and MultiLineString geometries.
static QList< QgsMapLayer * > sortLayersByType(const QList< QgsMapLayer * > &layers, const QList< Qgis::LayerType > &order)
Sorts a list of map layers by their layer type, respecting the order of types specified.
Base class for all map layer types.
Definition qgsmaplayer.h:80
A marker symbol type, for rendering Point and MultiPoint geometries.
Mesh layer specific subclass of QgsMapLayerElevationProperties.
Qgis::ProfileSurfaceSymbology profileSymbology() const
Returns the symbology option used to render the mesh profile in elevation profile plots.
QgsLineSymbol * profileLineSymbol() const
Returns the line symbol used to render the mesh profile in elevation profile plots.
QgsFillSymbol * profileFillSymbol() const
Returns the fill symbol used to render the mesh profile in elevation profile plots.
QList< QgsAbstractProfileSource * > profileSources() const
Returns a list of registered profile sources.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition qgsproject.h:109
static QgsProject * instance()
Returns the QgsProject singleton instance.
QVector< T > layers() const
Returns a list of registered map layers with a specified layer type.
Raster layer specific subclass of QgsMapLayerElevationProperties.
QgsLineSymbol * profileLineSymbol() const
Returns the line symbol used to render the raster profile in elevation profile plots.
Qgis::ProfileSurfaceSymbology profileSymbology() const
Returns the symbology option used to render the raster profile in elevation profile plots.
QgsFillSymbol * profileFillSymbol() const
Returns the fill symbol used to render the raster profile in elevation profile plots.
A feature renderer which renders all features with the same symbol.
static QPixmap symbolPreviewPixmap(const QgsSymbol *symbol, QSize size, int padding=0, QgsRenderContext *customContext=nullptr, bool selected=false, const QgsExpressionContext *expressionContext=nullptr, const QgsLegendPatchShape *shape=nullptr, const QgsScreenProperties &screen=QgsScreenProperties())
Returns a pixmap preview for a color ramp.
Vector layer specific subclass of QgsMapLayerElevationProperties.
QgsFillSymbol * profileFillSymbol() const
Returns the symbol used to render polygons for the layer in elevation profile plots.
Qgis::VectorProfileType type() const
Returns the type of profile the layer represents.
QgsLineSymbol * profileLineSymbol() const
Returns the symbol used to render lines for the layer in elevation profile plots.
QgsMarkerSymbol * profileMarkerSymbol() const
Returns the symbol used to render points for the layer in elevation profile plots.
Qgis::ProfileSurfaceSymbology profileSymbology() const
Returns the symbology option used to render the vector profile in elevation profile plots.
bool respectLayerSymbology() const
Returns true if layer symbology should be respected when rendering elevation profile plots.
bool extrusionEnabled() const
Returns true if extrusion is enabled.
Represents a vector layer which manages a vector based dataset.
Q_INVOKABLE Qgis::GeometryType geometryType() const
Returns point, line or polygon.
#define QgsDebugError(str)
Definition qgslogger.h:57