QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
qgsvectortilebasicrendererwidget.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsvectortilebasicrendererwidget.cpp
3  --------------------------------------
4  Date : April 2020
5  Copyright : (C) 2020 by Martin Dobias
6  Email : wonder dot sk at gmail dot com
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 
17 
18 #include "qgsguiutils.h"
19 #include "qgssymbollayerutils.h"
21 #include "qgsvectortilelayer.h"
23 #include "qgsstyle.h"
24 #include "qgsmapcanvas.h"
25 #include "qgsvectortileutils.h"
26 
27 #include <QAbstractListModel>
28 #include <QInputDialog>
29 #include <QMenu>
30 
31 
33 
34 
35 QgsVectorTileBasicRendererListModel::QgsVectorTileBasicRendererListModel( QgsVectorTileBasicRenderer *r, QObject *parent )
36  : QAbstractListModel( parent )
37  , mRenderer( r )
38 {
39 }
40 
41 int QgsVectorTileBasicRendererListModel::rowCount( const QModelIndex &parent ) const
42 {
43  if ( parent.isValid() )
44  return 0;
45 
46  return mRenderer->styles().count();
47 }
48 
49 int QgsVectorTileBasicRendererListModel::columnCount( const QModelIndex & ) const
50 {
51  return 5;
52 }
53 
54 QVariant QgsVectorTileBasicRendererListModel::data( const QModelIndex &index, int role ) const
55 {
56  if ( index.row() < 0 || index.row() >= mRenderer->styles().count() )
57  return QVariant();
58 
59  const QList<QgsVectorTileBasicRendererStyle> styles = mRenderer->styles();
60  const QgsVectorTileBasicRendererStyle &style = styles[index.row()];
61 
62  switch ( role )
63  {
64  case Qt::DisplayRole:
65  case Qt::ToolTipRole:
66  {
67  if ( index.column() == 0 )
68  return style.styleName();
69  else if ( index.column() == 1 )
70  return style.layerName().isEmpty() ? tr( "(all layers)" ) : style.layerName();
71  else if ( index.column() == 2 )
72  return style.minZoomLevel() >= 0 ? style.minZoomLevel() : QVariant();
73  else if ( index.column() == 3 )
74  return style.maxZoomLevel() >= 0 ? style.maxZoomLevel() : QVariant();
75  else if ( index.column() == 4 )
76  return style.filterExpression().isEmpty() ? tr( "(no filter)" ) : style.filterExpression();
77 
78  break;
79  }
80 
81  case Qt::EditRole:
82  {
83  if ( index.column() == 0 )
84  return style.styleName();
85  else if ( index.column() == 1 )
86  return style.layerName();
87  else if ( index.column() == 2 )
88  return style.minZoomLevel();
89  else if ( index.column() == 3 )
90  return style.maxZoomLevel();
91  else if ( index.column() == 4 )
92  return style.filterExpression();
93 
94  break;
95  }
96 
97  case Qt::DecorationRole:
98  {
99  if ( index.column() == 0 && style.symbol() )
100  {
101  const int iconSize = QgsGuiUtils::scaleIconSize( 16 );
102  return QgsSymbolLayerUtils::symbolPreviewIcon( style.symbol(), QSize( iconSize, iconSize ) );
103  }
104  break;
105  }
106 
107  case Qt::CheckStateRole:
108  {
109  if ( index.column() != 0 )
110  return QVariant();
111  return style.isEnabled() ? Qt::Checked : Qt::Unchecked;
112  }
113 
114  case MinZoom:
115  return style.minZoomLevel();
116 
117  case MaxZoom:
118  return style.maxZoomLevel();
119 
120  }
121  return QVariant();
122 }
123 
124 QVariant QgsVectorTileBasicRendererListModel::headerData( int section, Qt::Orientation orientation, int role ) const
125 {
126  if ( orientation == Qt::Horizontal && role == Qt::DisplayRole && section >= 0 && section < 5 )
127  {
128  QStringList lst;
129  lst << tr( "Label" ) << tr( "Layer" ) << tr( "Min. Zoom" ) << tr( "Max. Zoom" ) << tr( "Filter" );
130  return lst[section];
131  }
132 
133  return QVariant();
134 }
135 
136 Qt::ItemFlags QgsVectorTileBasicRendererListModel::flags( const QModelIndex &index ) const
137 {
138  if ( !index.isValid() )
139  return Qt::ItemIsDropEnabled;
140 
141  Qt::ItemFlag checkable = ( index.column() == 0 ? Qt::ItemIsUserCheckable : Qt::NoItemFlags );
142 
143  return Qt::ItemIsEnabled | Qt::ItemIsSelectable |
144  Qt::ItemIsEditable | checkable |
145  Qt::ItemIsDragEnabled;
146 }
147 
148 bool QgsVectorTileBasicRendererListModel::setData( const QModelIndex &index, const QVariant &value, int role )
149 {
150  if ( !index.isValid() )
151  return false;
152 
153  QgsVectorTileBasicRendererStyle style = mRenderer->style( index.row() );
154 
155  if ( role == Qt::CheckStateRole )
156  {
157  style.setEnabled( value.toInt() == Qt::Checked );
158  mRenderer->setStyle( index.row(), style );
159  emit dataChanged( index, index );
160  return true;
161  }
162 
163  if ( role == Qt::EditRole )
164  {
165  if ( index.column() == 0 )
166  style.setStyleName( value.toString() );
167  else if ( index.column() == 1 )
168  style.setLayerName( value.toString() );
169  else if ( index.column() == 2 )
170  style.setMinZoomLevel( value.toInt() );
171  else if ( index.column() == 3 )
172  style.setMaxZoomLevel( value.toInt() );
173  else if ( index.column() == 4 )
174  style.setFilterExpression( value.toString() );
175 
176  mRenderer->setStyle( index.row(), style );
177  emit dataChanged( index, index );
178  return true;
179  }
180 
181  return false;
182 }
183 
184 bool QgsVectorTileBasicRendererListModel::removeRows( int row, int count, const QModelIndex &parent )
185 {
186  QList<QgsVectorTileBasicRendererStyle> styles = mRenderer->styles();
187 
188  if ( row < 0 || row >= styles.count() )
189  return false;
190 
191  beginRemoveRows( parent, row, row + count - 1 );
192 
193  for ( int i = 0; i < count; i++ )
194  {
195  if ( row < styles.count() )
196  {
197  styles.removeAt( row );
198  }
199  }
200 
201  mRenderer->setStyles( styles );
202 
203  endRemoveRows();
204  return true;
205 }
206 
207 void QgsVectorTileBasicRendererListModel::insertStyle( int row, const QgsVectorTileBasicRendererStyle &style )
208 {
209  beginInsertRows( QModelIndex(), row, row );
210 
211  QList<QgsVectorTileBasicRendererStyle> styles = mRenderer->styles();
212  styles.insert( row, style );
213  mRenderer->setStyles( styles );
214 
215  endInsertRows();
216 }
217 
218 Qt::DropActions QgsVectorTileBasicRendererListModel::supportedDropActions() const
219 {
220  return Qt::MoveAction;
221 }
222 
223 QStringList QgsVectorTileBasicRendererListModel::mimeTypes() const
224 {
225  QStringList types;
226  types << QStringLiteral( "application/vnd.text.list" );
227  return types;
228 }
229 
230 QMimeData *QgsVectorTileBasicRendererListModel::mimeData( const QModelIndexList &indexes ) const
231 {
232  QMimeData *mimeData = new QMimeData();
233  QByteArray encodedData;
234 
235  QDataStream stream( &encodedData, QIODevice::WriteOnly );
236 
237  const auto constIndexes = indexes;
238  for ( const QModelIndex &index : constIndexes )
239  {
240  // each item consists of several columns - let's add it with just first one
241  if ( !index.isValid() || index.column() != 0 )
242  continue;
243 
244  QgsVectorTileBasicRendererStyle style = mRenderer->style( index.row() );
245 
246  QDomDocument doc;
247  QDomElement rootElem = doc.createElement( QStringLiteral( "vector_tile_basic_renderer_style_mime" ) );
248  style.writeXml( rootElem, QgsReadWriteContext() );
249  doc.appendChild( rootElem );
250 
251  stream << doc.toString( -1 );
252  }
253 
254  mimeData->setData( QStringLiteral( "application/vnd.text.list" ), encodedData );
255  return mimeData;
256 }
257 
258 bool QgsVectorTileBasicRendererListModel::dropMimeData( const QMimeData *data,
259  Qt::DropAction action, int row, int column, const QModelIndex &parent )
260 {
261  Q_UNUSED( column )
262 
263  if ( action == Qt::IgnoreAction )
264  return true;
265 
266  if ( !data->hasFormat( QStringLiteral( "application/vnd.text.list" ) ) )
267  return false;
268 
269  if ( parent.column() > 0 )
270  return false;
271 
272  QByteArray encodedData = data->data( QStringLiteral( "application/vnd.text.list" ) );
273  QDataStream stream( &encodedData, QIODevice::ReadOnly );
274  int rows = 0;
275 
276  if ( row == -1 )
277  {
278  // the item was dropped at a parent - we may decide where to put the items - let's append them
279  row = rowCount( parent );
280  }
281 
282  while ( !stream.atEnd() )
283  {
284  QString text;
285  stream >> text;
286 
287  QDomDocument doc;
288  if ( !doc.setContent( text ) )
289  continue;
290  QDomElement rootElem = doc.documentElement();
291  if ( rootElem.tagName() != QLatin1String( "vector_tile_basic_renderer_style_mime" ) )
292  continue;
293 
295  style.readXml( rootElem, QgsReadWriteContext() );
296 
297  insertStyle( row + rows, style );
298  ++rows;
299  }
300  return true;
301 }
302 
303 
304 //
305 
306 
307 QgsVectorTileBasicRendererWidget::QgsVectorTileBasicRendererWidget( QgsVectorTileLayer *layer, QgsMapCanvas *canvas, QgsMessageBar *messageBar, QWidget *parent )
308  : QgsMapLayerConfigWidget( layer, canvas, parent )
309  , mMapCanvas( canvas )
310  , mMessageBar( messageBar )
311 {
312  setupUi( this );
313  layout()->setContentsMargins( 0, 0, 0, 0 );
314 
315  QMenu *menuAddRule = new QMenu( btnAddRule );
316  menuAddRule->addAction( tr( "Marker" ), this, [this] { addStyle( QgsWkbTypes::PointGeometry ); } );
317  menuAddRule->addAction( tr( "Line" ), this, [this] { addStyle( QgsWkbTypes::LineGeometry ); } );
318  menuAddRule->addAction( tr( "Fill" ), this, [this] { addStyle( QgsWkbTypes::PolygonGeometry ); } );
319  btnAddRule->setMenu( menuAddRule );
320 
321  connect( btnEditRule, &QPushButton::clicked, this, &QgsVectorTileBasicRendererWidget::editStyle );
322  connect( btnRemoveRule, &QAbstractButton::clicked, this, &QgsVectorTileBasicRendererWidget::removeStyle );
323 
324  connect( viewStyles, &QAbstractItemView::doubleClicked, this, &QgsVectorTileBasicRendererWidget::editStyleAtIndex );
325 
326  if ( mMapCanvas )
327  {
328  connect( mMapCanvas, &QgsMapCanvas::scaleChanged, this, [ = ]( double scale )
329  {
330  const int zoom = QgsVectorTileUtils::scaleToZoomLevel( scale, 0, 99 );
331  mLabelCurrentZoom->setText( tr( "Current zoom: %1" ).arg( zoom ) );
332  if ( mProxyModel )
333  mProxyModel->setCurrentZoom( zoom );
334  } );
335  mLabelCurrentZoom->setText( tr( "Current zoom: %1" ).arg( QgsVectorTileUtils::scaleToZoomLevel( mMapCanvas->scale(), 0, 99 ) ) );
336  }
337 
338  connect( mCheckVisibleOnly, &QCheckBox::toggled, this, [ = ]( bool filter )
339  {
340  mProxyModel->setFilterVisible( filter );
341  } );
342 
343  setLayer( layer );
344 }
345 
346 void QgsVectorTileBasicRendererWidget::setLayer( QgsVectorTileLayer *layer )
347 {
348  mVTLayer = layer;
349 
350  if ( layer && layer->renderer() && layer->renderer()->type() == QLatin1String( "basic" ) )
351  {
352  mRenderer.reset( static_cast<QgsVectorTileBasicRenderer *>( layer->renderer()->clone() ) );
353  }
354  else
355  {
356  mRenderer.reset( new QgsVectorTileBasicRenderer() );
357  }
358 
359  mModel = new QgsVectorTileBasicRendererListModel( mRenderer.get(), viewStyles );
360  mProxyModel = new QgsVectorTileBasicRendererProxyModel( mModel, viewStyles );
361  viewStyles->setModel( mProxyModel );
362 
363  if ( mMapCanvas )
364  {
365  const int zoom = QgsVectorTileUtils::scaleToZoomLevel( mMapCanvas->scale(), 0, 99 );
366  mProxyModel->setCurrentZoom( zoom );
367  }
368 
369  connect( mModel, &QAbstractItemModel::dataChanged, this, &QgsPanelWidget::widgetChanged );
370  connect( mModel, &QAbstractItemModel::rowsInserted, this, &QgsPanelWidget::widgetChanged );
371  connect( mModel, &QAbstractItemModel::rowsRemoved, this, &QgsPanelWidget::widgetChanged );
372 }
373 
374 QgsVectorTileBasicRendererWidget::~QgsVectorTileBasicRendererWidget() = default;
375 
376 void QgsVectorTileBasicRendererWidget::apply()
377 {
378  mVTLayer->setRenderer( mRenderer->clone() );
379 }
380 
381 void QgsVectorTileBasicRendererWidget::addStyle( QgsWkbTypes::GeometryType geomType )
382 {
383  QgsVectorTileBasicRendererStyle style( QString(), QString(), geomType );
384  style.setSymbol( QgsSymbol::defaultSymbol( geomType ) );
385 
386  int rows = mModel->rowCount();
387  mModel->insertStyle( rows, style );
388  viewStyles->selectionModel()->setCurrentIndex( mProxyModel->mapFromSource( mModel->index( rows, 0 ) ), QItemSelectionModel::ClearAndSelect );
389 }
390 
391 void QgsVectorTileBasicRendererWidget::editStyle()
392 {
393  editStyleAtIndex( viewStyles->selectionModel()->currentIndex() );
394 }
395 
396 void QgsVectorTileBasicRendererWidget::editStyleAtIndex( const QModelIndex &proxyIndex )
397 {
398  const QModelIndex index = mProxyModel->mapToSource( proxyIndex );
399  if ( index.row() < 0 || index.row() >= mRenderer->styles().count() )
400  return;
401 
402  QgsVectorTileBasicRendererStyle style = mRenderer->style( index.row() );
403 
404  if ( !style.symbol() )
405  return;
406 
407  std::unique_ptr< QgsSymbol > symbol( style.symbol()->clone() );
408 
409  QgsSymbolWidgetContext context;
410  context.setMapCanvas( mMapCanvas );
411  context.setMessageBar( mMessageBar );
412 
413  if ( mMapCanvas )
414  {
415  const int zoom = QgsVectorTileUtils::scaleToZoomLevel( mMapCanvas->scale(), 0, 99 );
416  QList<QgsExpressionContextScope> scopes = context.additionalExpressionContextScopes();
417  QgsExpressionContextScope tileScope;
418  tileScope.setVariable( "zoom_level", zoom, true );
419  tileScope.setVariable( "vector_tile_zoom", QgsVectorTileUtils::scaleToZoom( mMapCanvas->scale() ), true );
420  scopes << tileScope;
421  context.setAdditionalExpressionContextScopes( scopes );
422  }
423 
424  QgsVectorLayer *vectorLayer = nullptr; // TODO: have a temporary vector layer with sub-layer's fields?
425 
427  if ( panel && panel->dockMode() )
428  {
429  QgsSymbolSelectorWidget *dlg = new QgsSymbolSelectorWidget( symbol.release(), QgsStyle::defaultStyle(), vectorLayer, panel );
430  dlg->setContext( context );
431  dlg->setPanelTitle( style.styleName() );
432  connect( dlg, &QgsPanelWidget::widgetChanged, this, &QgsVectorTileBasicRendererWidget::updateSymbolsFromWidget );
433  connect( dlg, &QgsPanelWidget::panelAccepted, this, &QgsVectorTileBasicRendererWidget::cleanUpSymbolSelector );
434  openPanel( dlg );
435  }
436  else
437  {
438  QgsSymbolSelectorDialog dlg( symbol.get(), QgsStyle::defaultStyle(), vectorLayer, panel );
439  dlg.setContext( context );
440  if ( !dlg.exec() || !symbol )
441  {
442  return;
443  }
444 
445  style.setSymbol( symbol.release() );
446  mRenderer->setStyle( index.row(), style );
447  emit widgetChanged();
448  }
449 }
450 
451 void QgsVectorTileBasicRendererWidget::updateSymbolsFromWidget()
452 {
453  int index = mProxyModel->mapToSource( viewStyles->selectionModel()->currentIndex() ).row();
454  if ( index < 0 )
455  return;
456 
457  QgsVectorTileBasicRendererStyle style = mRenderer->style( index );
458 
459  QgsSymbolSelectorWidget *dlg = qobject_cast<QgsSymbolSelectorWidget *>( sender() );
460  style.setSymbol( dlg->symbol()->clone() );
461 
462  mRenderer->setStyle( index, style );
463  emit widgetChanged();
464 }
465 
466 void QgsVectorTileBasicRendererWidget::cleanUpSymbolSelector( QgsPanelWidget *container )
467 {
468  QgsSymbolSelectorWidget *dlg = qobject_cast<QgsSymbolSelectorWidget *>( container );
469  if ( !dlg )
470  return;
471 
472  delete dlg->symbol();
473 }
474 
475 void QgsVectorTileBasicRendererWidget::removeStyle()
476 {
477  const QModelIndexList sel = viewStyles->selectionModel()->selectedIndexes();
478 
479  QList<int > res;
480  for ( const QModelIndex &proxyIndex : sel )
481  {
482  const QModelIndex sourceIndex = mProxyModel->mapToSource( proxyIndex );
483  if ( !res.contains( sourceIndex.row() ) )
484  res << sourceIndex.row();
485  }
486  std::sort( res.begin(), res.end() );
487 
488  for ( int i = res.size() - 1; i >= 0; --i )
489  {
490  mModel->removeRow( res[ i ] );
491  }
492  // make sure that the selection is gone
493  viewStyles->selectionModel()->clear();
494 }
495 
496 QgsVectorTileBasicRendererProxyModel::QgsVectorTileBasicRendererProxyModel( QgsVectorTileBasicRendererListModel *source, QObject *parent )
497  : QSortFilterProxyModel( parent )
498 {
499  setSourceModel( source );
500  setDynamicSortFilter( true );
501 }
502 
503 void QgsVectorTileBasicRendererProxyModel::setCurrentZoom( int zoom )
504 {
505  mCurrentZoom = zoom;
506  invalidateFilter();
507 }
508 
509 void QgsVectorTileBasicRendererProxyModel::setFilterVisible( bool enabled )
510 {
511  mFilterVisible = enabled;
512  invalidateFilter();
513 }
514 
515 bool QgsVectorTileBasicRendererProxyModel::filterAcceptsRow( int source_row, const QModelIndex &source_parent ) const
516 {
517  if ( mCurrentZoom < 0 || !mFilterVisible )
518  return true;
519 
520  const int rowMinZoom = sourceModel()->data( sourceModel()->index( source_row, 0, source_parent ), QgsVectorTileBasicRendererListModel::MinZoom ).toInt();
521  const int rowMaxZoom = sourceModel()->data( sourceModel()->index( source_row, 0, source_parent ), QgsVectorTileBasicRendererListModel::MaxZoom ).toInt();
522 
523  if ( rowMinZoom >= 0 && rowMinZoom > mCurrentZoom )
524  return false;
525 
526  if ( rowMaxZoom >= 0 && rowMaxZoom < mCurrentZoom )
527  return false;
528 
529  return true;
530 }
531 
532 
533 
QgsSymbolSelectorDialog
Definition: qgssymbolselectordialog.h:264
QgsVectorTileRenderer::type
virtual QString type() const =0
Returns unique type name of the renderer implementation.
QgsVectorTileLayer
Implements a map layer that is dedicated to rendering of vector tiles.
Definition: qgsvectortilelayer.h:84
QgsExpressionContextScope::setVariable
void setVariable(const QString &name, const QVariant &value, bool isStatic=false)
Convenience method for setting a variable in the context scope by name name and value.
Definition: qgsexpressioncontext.cpp:78
QgsVectorTileBasicRendererStyle::writeXml
void writeXml(QDomElement &elem, const QgsReadWriteContext &context) const
Writes object content to given DOM element.
Definition: qgsvectortilebasicrenderer.cpp:59
QgsReadWriteContext
The class is used as a container of context for various read/write operations on other objects.
Definition: qgsreadwritecontext.h:35
QgsSymbol::defaultSymbol
static QgsSymbol * defaultSymbol(QgsWkbTypes::GeometryType geomType)
Returns a new default symbol for the specified geometry type.
Definition: qgssymbol.cpp:320
qgsmapcanvas.h
QgsPanelWidget::findParentPanel
static QgsPanelWidget * findParentPanel(QWidget *widget)
Traces through the parents of a widget to find if it is contained within a QgsPanelWidget widget.
Definition: qgspanelwidget.cpp:49
QgsVectorTileBasicRendererStyle::setEnabled
void setEnabled(bool enabled)
Sets whether this style is enabled (used for rendering)
Definition: qgsvectortilebasicrenderer.h:83
QgsVectorTileUtils::scaleToZoom
static double scaleToZoom(double mapScale)
Finds zoom level (assuming GoogleCRS84Quad tile matrix set) given map scale denominator.
Definition: qgsvectortileutils.cpp:63
QgsSymbolSelectorWidget::symbol
QgsSymbol * symbol()
Returns the symbol that is currently active in the widget.
Definition: qgssymbolselectordialog.h:129
qgssymbollayerutils.h
QgsVectorTileBasicRendererStyle::setSymbol
void setSymbol(QgsSymbol *sym)
Sets symbol for rendering. Takes ownership of the symbol.
Definition: qgsvectortilebasicrenderer.cpp:54
QgsVectorTileBasicRendererStyle::isEnabled
bool isEnabled() const
Returns whether this style is enabled (used for rendering)
Definition: qgsvectortilebasicrenderer.h:85
QgsSymbolWidgetContext
Contains settings which reflect the context in which a symbol (or renderer) widget is shown,...
Definition: qgssymbolwidgetcontext.h:36
QgsMapCanvas
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:85
QgsVectorTileBasicRenderer
The default vector tile renderer implementation.
Definition: qgsvectortilebasicrenderer.h:128
QgsSymbolSelectorWidget
Symbol selector widget that can be used to select and build a symbol.
Definition: qgssymbolselectordialog.h:88
QgsSymbolSelectorWidget::setContext
void setContext(const QgsSymbolWidgetContext &context)
Sets the context in which the symbol widget is shown, e.g., the associated map canvas and expression ...
Definition: qgssymbolselectordialog.cpp:355
QgsVectorTileBasicRendererStyle::maxZoomLevel
int maxZoomLevel() const
Returns maxnimum zoom level index (negative number means no limit)
Definition: qgsvectortilebasicrenderer.h:95
QgsPanelWidget::dockMode
bool dockMode()
Returns the dock mode state.
Definition: qgspanelwidget.h:83
QgsWkbTypes::PolygonGeometry
@ PolygonGeometry
Definition: qgswkbtypes.h:144
QgsGuiUtils::iconSize
QSize iconSize(bool dockableToolbar)
Returns the user-preferred size of a window's toolbar icons.
Definition: qgsguiutils.cpp:250
QgsMapLayerConfigWidget
A panel widget that can be shown in the map style dock.
Definition: qgsmaplayerconfigwidget.h:34
QgsMapCanvas::scaleChanged
void scaleChanged(double)
Emitted when the scale of the map changes.
QgsSymbolWidgetContext::setMapCanvas
void setMapCanvas(QgsMapCanvas *canvas)
Sets the map canvas associated with the widget.
Definition: qgssymbolwidgetcontext.cpp:49
QgsStyle::defaultStyle
static QgsStyle * defaultStyle()
Returns default application-wide style.
Definition: qgsstyle.cpp:127
qgsvectortilelayer.h
QgsVectorTileBasicRendererStyle
Definition of map rendering of a subset of vector tile data.
Definition: qgsvectortilebasicrenderer.h:48
QgsSymbolLayerUtils::symbolPreviewIcon
static QIcon symbolPreviewIcon(const QgsSymbol *symbol, QSize size, int padding=0, QgsLegendPatchShape *shape=nullptr)
Returns an icon preview for a color ramp.
Definition: qgssymbollayerutils.cpp:762
QgsSymbolWidgetContext::setMessageBar
void setMessageBar(QgsMessageBar *bar)
Sets the message bar associated with the widget.
Definition: qgssymbolwidgetcontext.cpp:59
QgsVectorTileBasicRendererStyle::layerName
QString layerName() const
Returns name of the sub-layer to render (empty layer means that all layers match)
Definition: qgsvectortilebasicrenderer.h:65
QgsPanelWidget
Base class for any widget that can be shown as a inline panel.
Definition: qgspanelwidget.h:30
QgsSymbolWidgetContext::setAdditionalExpressionContextScopes
void setAdditionalExpressionContextScopes(const QList< QgsExpressionContextScope > &scopes)
Sets a list of additional expression context scopes to show as available within the layer.
Definition: qgssymbolwidgetcontext.cpp:82
QgsPanelWidget::panelAccepted
void panelAccepted(QgsPanelWidget *panel)
Emitted when the panel is accepted by the user.
QgsVectorTileLayer::renderer
QgsVectorTileRenderer * renderer() const
Returns currently assigned renderer.
Definition: qgsvectortilelayer.cpp:618
QgsVectorTileBasicRendererStyle::setFilterExpression
void setFilterExpression(const QString &expr)
Sets filter expression (empty filter means that all features match)
Definition: qgsvectortilebasicrenderer.h:73
QgsMessageBar
A bar for displaying non-blocking messages to the user.
Definition: qgsmessagebar.h:61
QgsPanelWidget::widgetChanged
void widgetChanged()
Emitted when the widget state changes.
QgsPanelWidget::setPanelTitle
void setPanelTitle(const QString &panelTitle)
Set the title of the panel when shown in the interface.
Definition: qgspanelwidget.h:44
QgsVectorTileBasicRendererStyle::setLayerName
void setLayerName(const QString &name)
Sets name of the sub-layer to render (empty layer means that all layers match)
Definition: qgsvectortilebasicrenderer.h:63
QgsVectorTileUtils::scaleToZoomLevel
static int scaleToZoomLevel(double mapScale, int sourceMinZoom, int sourceMaxZoom)
Finds best fitting zoom level (assuming GoogleCRS84Quad tile matrix set) given map scale denominator ...
Definition: qgsvectortileutils.cpp:71
QgsExpressionContextScope
Single scope for storing variables and functions for use within a QgsExpressionContext.
Definition: qgsexpressioncontext.h:112
qgssymbolselectordialog.h
qgsstyle.h
QgsVectorTileBasicRendererStyle::minZoomLevel
int minZoomLevel() const
Returns minimum zoom level index (negative number means no limit)
Definition: qgsvectortilebasicrenderer.h:90
QgsSymbol::clone
virtual QgsSymbol * clone() const =0
Returns a deep copy of this symbol.
QgsWkbTypes::LineGeometry
@ LineGeometry
Definition: qgswkbtypes.h:143
QgsWkbTypes::PointGeometry
@ PointGeometry
Definition: qgswkbtypes.h:142
QgsWkbTypes::GeometryType
GeometryType
The geometry types are used to group QgsWkbTypes::Type in a coarse way.
Definition: qgswkbtypes.h:141
QgsVectorLayer
Represents a vector layer which manages a vector based data sets.
Definition: qgsvectorlayer.h:387
QgsVectorTileBasicRendererStyle::setMinZoomLevel
void setMinZoomLevel(int minZoom)
Sets minimum zoom level index (negative number means no limit)
Definition: qgsvectortilebasicrenderer.h:88
QgsVectorTileBasicRendererStyle::symbol
QgsSymbol * symbol() const
Returns symbol for rendering.
Definition: qgsvectortilebasicrenderer.h:80
QgsVectorTileBasicRendererStyle::filterExpression
QString filterExpression() const
Returns filter expression (empty filter means that all features match)
Definition: qgsvectortilebasicrenderer.h:75
qgsvectortilebasicrenderer.h
QgsVectorTileBasicRendererStyle::setMaxZoomLevel
void setMaxZoomLevel(int maxZoom)
Sets maximum zoom level index (negative number means no limit)
Definition: qgsvectortilebasicrenderer.h:93
QgsVectorTileRenderer::clone
virtual QgsVectorTileRenderer * clone() const =0
Returns a clone of the renderer.
QgsVectorTileBasicRendererStyle::setStyleName
void setStyleName(const QString &name)
Sets human readable name of this style.
Definition: qgsvectortilebasicrenderer.h:58
qgsguiutils.h
qgsvectortileutils.h
QgsGuiUtils::scaleIconSize
int scaleIconSize(int standardSize)
Scales an icon size to compensate for display pixel density, making the icon size hi-dpi friendly,...
Definition: qgsguiutils.cpp:245
QgsVectorTileBasicRendererStyle::styleName
QString styleName() const
Returns human readable name of this style.
Definition: qgsvectortilebasicrenderer.h:60
QgsVectorTileBasicRendererStyle::readXml
void readXml(const QDomElement &elem, const QgsReadWriteContext &context)
Reads object content from given DOM element.
Definition: qgsvectortilebasicrenderer.cpp:76
QgsSymbolWidgetContext::additionalExpressionContextScopes
QList< QgsExpressionContextScope > additionalExpressionContextScopes() const
Returns the list of additional expression context scopes to show as available within the layer.
Definition: qgssymbolwidgetcontext.cpp:87
qgsvectortilebasicrendererwidget.h