QGIS API Documentation 4.1.0-Master (5bf3c20f3c9)
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#include <QString>
40
41#include "moc_qgselevationprofilelayertreeview.cpp"
42
43using namespace Qt::StringLiterals;
44
45const QString QgsElevationProfileLayerTreeView::CUSTOM_NODE_ELEVATION_PROFILE_SOURCE = u"elevationProfileRegistry"_s;
46
55
56QVariant QgsElevationProfileLayerTreeModel::data( const QModelIndex &index, int role ) const
57{
58 switch ( role )
59 {
60 case Qt::DecorationRole:
61 {
63
64 if ( node && node->nodeType() == QgsLayerTreeNode::NodeLayer )
65 {
66 if ( QgsMapLayer *layer = QgsLayerTree::toLayer( node )->layer() )
67 {
68 std::unique_ptr<QgsRenderContext> context( createTemporaryRenderContext() );
69
70 const int iconSize = scaleIconSize( 16 );
71 std::unique_ptr<QgsSymbol> symbol;
72 switch ( layer->type() )
73 {
75 {
76 QgsVectorLayerElevationProperties *elevationProperties = qgis::down_cast<QgsVectorLayerElevationProperties *>( layer->elevationProperties() );
77 QgsVectorLayer *vLayer = qobject_cast<QgsVectorLayer *>( layer );
78
79 switch ( elevationProperties->type() )
80 {
82 if ( ( vLayer->geometryType() == Qgis::GeometryType::Point && !elevationProperties->extrusionEnabled() )
83 || ( vLayer->geometryType() == Qgis::GeometryType::Line && !elevationProperties->extrusionEnabled() ) )
84 {
85 if ( QgsMarkerSymbol *markerSymbol = elevationProperties->profileMarkerSymbol() )
86 {
87 symbol.reset( markerSymbol->clone() );
88 }
89 }
90
91 if ( !symbol && vLayer->geometryType() == Qgis::GeometryType::Polygon && elevationProperties->extrusionEnabled() )
92 {
93 if ( QgsFillSymbol *fillSymbol = elevationProperties->profileFillSymbol() )
94 {
95 symbol.reset( fillSymbol->clone() );
96 }
97 }
98
99 if ( !symbol )
100 {
101 if ( QgsLineSymbol *lineSymbol = elevationProperties->profileLineSymbol() )
102 {
103 symbol.reset( lineSymbol->clone() );
104 }
105 }
106
107 if ( elevationProperties->respectLayerSymbology() )
108 {
109 if ( !symbol )
110 {
111 // just use default layer icon
112 return QgsLayerTreeModel::data( index, role );
113 }
114
115 if ( QgsSingleSymbolRenderer *renderer = dynamic_cast<QgsSingleSymbolRenderer *>( qobject_cast<QgsVectorLayer *>( layer )->renderer() ) )
116 {
117 if ( renderer->symbol()->type() == symbol->type() )
118 {
119 // take the whole renderer symbol if we can
120 symbol.reset( renderer->symbol()->clone() );
121 }
122 else
123 {
124 // otherwise emulate what happens when rendering the actual chart and just copy the color and opacity
125 symbol->setColor( renderer->symbol()->color() );
126 symbol->setOpacity( renderer->symbol()->opacity() );
127 }
128 }
129 else
130 {
131 // just use default layer icon
132 return QgsLayerTreeModel::data( index, role );
133 }
134 }
135 break;
136
138 switch ( elevationProperties->profileSymbology() )
139 {
141 if ( QgsLineSymbol *lineSymbol = elevationProperties->profileLineSymbol() )
142 {
143 symbol.reset( lineSymbol->clone() );
144 }
145 break;
148 if ( QgsFillSymbol *fillSymbol = elevationProperties->profileFillSymbol() )
149 {
150 symbol.reset( fillSymbol->clone() );
151 }
152 break;
153 }
154 break;
155 }
156 break;
157 }
158
160 {
161 QgsRasterLayerElevationProperties *rlProps = qgis::down_cast<QgsRasterLayerElevationProperties *>( layer->elevationProperties() );
162 switch ( rlProps->profileSymbology() )
163 {
165 if ( QgsLineSymbol *lineSymbol = rlProps->profileLineSymbol() )
166 {
167 symbol.reset( lineSymbol->clone() );
168 }
169 break;
172 if ( QgsFillSymbol *fillSymbol = rlProps->profileFillSymbol() )
173 {
174 symbol.reset( fillSymbol->clone() );
175 }
176 break;
177 }
178 break;
179 }
180
182 {
183 QgsMeshLayerElevationProperties *mlProps = qgis::down_cast<QgsMeshLayerElevationProperties *>( layer->elevationProperties() );
184 switch ( mlProps->profileSymbology() )
185 {
187 if ( QgsLineSymbol *lineSymbol = mlProps->profileLineSymbol() )
188 {
189 symbol.reset( lineSymbol->clone() );
190 }
191 break;
194 if ( QgsFillSymbol *fillSymbol = mlProps->profileFillSymbol() )
195 {
196 symbol.reset( fillSymbol->clone() );
197 }
198 break;
199 }
200 break;
201 }
202
209 break;
210 }
211 if ( !symbol )
212 break;
213
214 const QPixmap pix = QgsSymbolLayerUtils::symbolPreviewPixmap( symbol.get(), QSize( iconSize, iconSize ), 0, context.get() );
215 return QIcon( pix );
216 }
217 }
218 break;
219 }
220
221 case Qt::ToolTipRole:
222 {
223 // override default tooltip with elevation specific one
225 if ( node && node->nodeType() == QgsLayerTreeNode::NodeLayer )
226 {
227 if ( QgsMapLayer *layer = QgsLayerTree::toLayer( node )->layer() )
228 {
229 QString title = !layer->metadata().title().isEmpty() ? layer->metadata().title()
230 : !layer->serverProperties()->title().isEmpty() ? layer->serverProperties()->title()
231 : !layer->serverProperties()->shortName().isEmpty() ? layer->serverProperties()->shortName()
232 : layer->name();
233
234 title = "<b>" + title.toHtmlEscaped() + "</b>";
235
236 QStringList parts;
237 parts << title;
238
239 const QString elevationPropertiesSummary = layer->elevationProperties() ? layer->elevationProperties()->htmlSummary() : QString();
240 if ( !elevationPropertiesSummary.isEmpty() )
241 parts << elevationPropertiesSummary;
242
243 return parts.join( "<br/>"_L1 );
244 }
245 }
246 break;
247 }
248
249 default:
250 break;
251 }
252 return QgsLayerTreeModel::data( index, role );
253}
254
255bool QgsElevationProfileLayerTreeModel::setData( const QModelIndex &index, const QVariant &value, int role )
256{
257 if ( !mAllowModifications )
258 return false;
259
260 if ( QgsLayerTreeLayer *layerNode = qobject_cast<QgsLayerTreeLayer *>( index2node( index ) ) )
261 {
262 if ( role == Qt::CheckStateRole )
263 {
264 const bool checked = static_cast<Qt::CheckState>( value.toInt() ) == Qt::Checked;
265 if ( QgsMapLayer *layer = layerNode->layer() )
266 {
267 layer->setCustomProperty( u"_include_in_elevation_profiles"_s, checked );
268 }
269 }
270 }
271
272 return QgsLayerTreeModel::setData( index, value, role );
273}
274
275Qt::ItemFlags QgsElevationProfileLayerTreeModel::flags( const QModelIndex &index ) const
276{
277 Qt::ItemFlags f = QgsLayerTreeModel::flags( index );
278
279 // the elevation tree model only supports group renames, not layer renames (otherwise
280 // we'd be renaming the actual layer, which is likely NOT what users expect)
282 if ( !mAllowModifications || !QgsLayerTree::isGroup( node ) )
283 {
284 f.setFlag( Qt::ItemFlag::ItemIsEditable, false );
285 }
286 return f;
287}
288
289bool QgsElevationProfileLayerTreeModel::canDropMimeData( const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent ) const
290{
291 if ( !mAllowModifications )
292 return false;
293
294 if ( action == Qt::IgnoreAction )
295 return true;
296
297 if ( !data->hasFormat( u"application/qgis.layertreemodeldata"_s ) )
298 return false;
299
300 // don't accept moves from other layer trees -- only allow internal drag
301 if ( action == Qt::MoveAction )
302 {
303 const QString source = data->data( u"application/qgis.layertree.source"_s );
304 if ( source.isEmpty() || source != u":0x%1"_s.arg( reinterpret_cast<quintptr>( this ), 2 * QT_POINTER_SIZE, 16, '0'_L1 ) )
305 {
306 return false;
307 }
308 }
309
310 return QgsLayerTreeModel::canDropMimeData( data, action, row, column, parent );
311}
312
313bool QgsElevationProfileLayerTreeModel::dropMimeData( const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent )
314{
315 if ( !mAllowModifications )
316 return false;
317
318 if ( action == Qt::IgnoreAction )
319 return true;
320
321 if ( !data->hasFormat( u"application/qgis.layertreemodeldata"_s ) )
322 return false;
323
324 // don't accept moves from other layer trees -- only allow internal drag
325 const QString source = data->data( u"application/qgis.layertree.source"_s );
326 if ( source.isEmpty() || source != u":0x%1"_s.arg( reinterpret_cast<quintptr>( this ), 2 * QT_POINTER_SIZE, 16, '0'_L1 ) )
327 {
328 if ( action == Qt::CopyAction )
329 {
330 QByteArray encodedLayerTreeData = data->data( u"application/qgis.layertreemodeldata"_s );
331
332 QDomDocument layerTreeDoc;
333 if ( !layerTreeDoc.setContent( QString::fromUtf8( encodedLayerTreeData ) ) )
334 return false;
335
336 QDomElement rootLayerTreeElem = layerTreeDoc.documentElement();
337 if ( rootLayerTreeElem.tagName() != "layer_tree_model_data"_L1 )
338 return false;
339
340 QList<QgsMapLayer *> layersToAdd;
341
342 QDomElement elem = rootLayerTreeElem.firstChildElement();
343 while ( !elem.isNull() )
344 {
345 std::unique_ptr<QgsLayerTreeNode> node( QgsLayerTreeNode::readXml( elem, QgsProject::instance() ) );
346 if ( node && QgsLayerTree::isLayer( node.get() ) )
347 {
348 if ( QgsMapLayer *layer = qobject_cast<QgsLayerTreeLayer *>( node.get() )->layer() )
349 {
350 layersToAdd << layer;
351 }
352 }
353 elem = elem.nextSiblingElement();
354 }
355
356 if ( !layersToAdd.empty() )
357 emit addLayers( layersToAdd );
358
359 return true;
360 }
361 else
362 {
363 return false;
364 }
365 }
366
367 return QgsLayerTreeModel::dropMimeData( data, action, row, column, parent );
368}
369
370QMimeData *QgsElevationProfileLayerTreeModel::mimeData( const QModelIndexList &indexes ) const
371{
372 if ( !mAllowModifications )
373 return nullptr;
374
375 QMimeData *mimeData = QgsLayerTreeModel::mimeData( indexes );
376 if ( mimeData )
377 {
378 mimeData->setData( u"application/qgis.restrictlayertreemodelsubclass"_s, "QgsElevationProfileLayerTreeModel" );
379 }
380 return mimeData;
381}
382
390
391
392//
393// QgsElevationProfileLayerTreeProxyModel
394//
395
397 : QSortFilterProxyModel( parent )
398 , mModel( model )
399{
400 setSourceModel( mModel );
401 setDynamicSortFilter( true );
402}
403
404bool QgsElevationProfileLayerTreeProxyModel::filterAcceptsRow( int sourceRow, const QModelIndex &sourceParent ) const
405{
406 const QModelIndex sourceIndex = mModel->index( sourceRow, 0, sourceParent );
407 if ( QgsLayerTreeNode *node = mModel->index2node( sourceIndex ) )
408 {
409 switch ( node->nodeType() )
410 {
412 {
413 if ( QgsLayerTreeLayer *layerTreeLayer = QgsLayerTree::toLayer( node ) )
414 {
415 if ( QgsMapLayer *layer = layerTreeLayer->layer() )
416 {
417 // hide layers which don't have elevation
418 if ( !layer->elevationProperties() || !layer->elevationProperties()->hasElevation() )
419 return false;
420 }
421 }
422 break;
423 }
424
427 break;
428 }
429 return true;
430 }
431 else if ( QgsLayerTreeModelLegendNode *legendNode = mModel->index2legendNode( sourceIndex ) )
432 {
433 // we only show legend nodes for vector layers where the profile symbol is set to follow the layer's symbology
434 // (and the layer's renderer isn't a single symbol renderer)
435 if ( QgsLayerTreeLayer *layerTreeLayer = QgsLayerTree::toLayer( legendNode->layerNode() ) )
436 {
437 if ( QgsVectorLayer *layer = qobject_cast<QgsVectorLayer *>( layerTreeLayer->layer() ) )
438 {
439 if ( !qgis::down_cast<QgsVectorLayerElevationProperties *>( layer->elevationProperties() )->respectLayerSymbology() )
440 {
441 return false;
442 }
443 else if ( dynamic_cast<QgsSingleSymbolRenderer *>( qobject_cast<QgsVectorLayer *>( layer )->renderer() ) )
444 {
445 return false;
446 }
447 else
448 {
449 return true;
450 }
451 }
452 }
453 return false;
454 }
455 else
456 {
457 return false;
458 }
459}
460
461
463 : QgsLayerTreeViewBase( parent )
464{
465 setLayerTree( rootNode );
466}
467
469{
470 QgsElevationProfileLayerTreeModel *oldModel = mModel;
471
472 mLayerTree = rootNode;
473
474 mModel = new QgsElevationProfileLayerTreeModel( mLayerTree, this );
475
477 mProxyModel = new QgsElevationProfileLayerTreeProxyModel( mModel, this );
478
479 setModel( mProxyModel );
480 setLayerTreeModel( mModel );
481
482 delete oldModel;
483}
484
486{
487 const QList<QgsMapLayer *> layers = project->layers<QgsMapLayer *>().toList();
488
489 // sort layers so that types which are more likely to obscure others are rendered below
490 // e.g. vector features should be drawn above raster DEMS, or the DEM line may completely obscure
491 // the vector feature
493
494 std::reverse( sortedLayers.begin(), sortedLayers.end() );
495 for ( QgsMapLayer *layer : std::as_const( sortedLayers ) )
496 {
497 // don't re-add existing layers
498 if ( mLayerTree->findLayer( layer ) )
499 continue;
500
501 QgsLayerTreeLayer *node = mLayerTree->addLayer( layer );
502
503 if ( layer->customProperty( u"_include_in_elevation_profiles"_s ).isValid() )
504 {
505 node->setItemVisibilityChecked( layer->customProperty( u"_include_in_elevation_profiles"_s ).toBool() );
506 }
507 else
508 {
509 node->setItemVisibilityChecked( layer->elevationProperties() && layer->elevationProperties()->showByDefaultInElevationProfilePlots() );
510 }
511 }
512}
513
515{
516 const QList< QgsAbstractProfileSource * > sources = QgsApplication::profileSourceRegistry()->profileSources();
517 for ( QgsAbstractProfileSource *source : sources )
518 {
519 addNodeForRegisteredSource( source->profileSourceId(), source->profileSourceName() );
520 }
521
522 populateMissingLayers( project );
523}
524
525void QgsElevationProfileLayerTreeView::addNodeForRegisteredSource( const QString &sourceId, const QString &sourceName )
526{
527 auto customNode = std::make_unique< QgsLayerTreeCustomNode >( sourceId, sourceName.isEmpty() ? sourceId : sourceName );
528 customNode->setItemVisibilityChecked( true );
529 // Mark the node so that we know which custom nodes correspond to elevation profile sources
530 customNode->setCustomProperty( u"source"_s, QgsElevationProfileLayerTreeView::CUSTOM_NODE_ELEVATION_PROFILE_SOURCE );
531
532 QgsLayerTreeCustomNode *node = mLayerTree->insertCustomNode( 0, customNode.release() );
533 if ( !node )
534 QgsDebugError( u"The custom node with id '%1' could not be added!"_s.arg( sourceId ) );
535}
536
538{
539 QgsLayerTreeCustomNode *node = mLayerTree->findCustomNode( sourceId );
540 if ( node )
541 {
542 qobject_cast< QgsLayerTreeGroup * >( node->parent() )->removeChildNode( node );
543 }
544 else
545 {
546 QgsDebugError( u"The custom node with id '%1' was not found and couldn't be removed!"_s.arg( sourceId ) );
547 }
548}
549
554
556{
557 header()->setMinimumSectionSize( viewport()->width() );
558 QTreeView::resizeEvent( event );
559}
@ Point
Points.
Definition qgis.h:380
@ Line
Lines.
Definition qgis.h:381
@ Polygon
Polygons.
Definition qgis.h:382
@ Group
Composite group layer. Added in QGIS 3.24.
Definition qgis.h:214
@ Plugin
Plugin based layer.
Definition qgis.h:209
@ TiledScene
Tiled scene layer. Added in QGIS 3.34.
Definition qgis.h:215
@ Annotation
Contains freeform, georeferenced annotations. Added in QGIS 3.16.
Definition qgis.h:212
@ Vector
Vector layer.
Definition qgis.h:207
@ VectorTile
Vector tile layer. Added in QGIS 3.14.
Definition qgis.h:211
@ Mesh
Mesh layer. Added in QGIS 3.2.
Definition qgis.h:210
@ Raster
Raster layer.
Definition qgis.h:208
@ PointCloud
Point cloud layer. Added in QGIS 3.18.
Definition qgis.h:213
@ ContinuousSurface
The features should be treated as representing values on a continuous surface (eg contour lines).
Definition qgis.h:4337
@ IndividualFeatures
Treat each feature as an individual object (eg buildings).
Definition qgis.h:4336
@ Line
The elevation surface will be rendered using a line symbol.
Definition qgis.h:4323
@ FillBelow
The elevation surface will be rendered using a fill symbol below the surface level.
Definition qgis.h:4324
@ FillAbove
The elevation surface will be rendered using a fill symbol above the surface level.
Definition qgis.h:4325
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
void setAllowModifications(bool allow)
Sets whether modifications like renaming, reordering nodes are supported.
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.
void setLayerTree(QgsLayerTree *rootNode)
Sets a new layer tree root node to use for the view.
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.
QgsLayerTreeNode * parent()
Gets pointer to the parent. If parent is nullptr, the node is a root node.
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:83
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:113
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:59