QGIS API Documentation  3.22.4-Białowieża (ce8e65e95e)
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  const 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  const 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  const 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  switch ( geomType )
387  {
389  style.setFilterExpression( QStringLiteral( "geometry_type($geometry)='Point'" ) );
390  break;
392  style.setFilterExpression( QStringLiteral( "geometry_type($geometry)='Line'" ) );
393  break;
395  style.setFilterExpression( QStringLiteral( "geometry_type($geometry)='Polygon'" ) );
396  break;
399  break;
400  }
401 
402  const int rows = mModel->rowCount();
403  mModel->insertStyle( rows, style );
404  viewStyles->selectionModel()->setCurrentIndex( mProxyModel->mapFromSource( mModel->index( rows, 0 ) ), QItemSelectionModel::ClearAndSelect );
405 }
406 
407 void QgsVectorTileBasicRendererWidget::editStyle()
408 {
409  editStyleAtIndex( viewStyles->selectionModel()->currentIndex() );
410 }
411 
412 void QgsVectorTileBasicRendererWidget::editStyleAtIndex( const QModelIndex &proxyIndex )
413 {
414  const QModelIndex index = mProxyModel->mapToSource( proxyIndex );
415  if ( index.row() < 0 || index.row() >= mRenderer->styles().count() )
416  return;
417 
418  QgsVectorTileBasicRendererStyle style = mRenderer->style( index.row() );
419 
420  if ( !style.symbol() )
421  return;
422 
423  std::unique_ptr< QgsSymbol > symbol( style.symbol()->clone() );
424 
425  QgsSymbolWidgetContext context;
426  context.setMapCanvas( mMapCanvas );
427  context.setMessageBar( mMessageBar );
428 
429  if ( mMapCanvas )
430  {
431  const int zoom = QgsVectorTileUtils::scaleToZoomLevel( mMapCanvas->scale(), 0, 99 );
432  QList<QgsExpressionContextScope> scopes = context.additionalExpressionContextScopes();
433  QgsExpressionContextScope tileScope;
434  tileScope.setVariable( "zoom_level", zoom, true );
435  tileScope.setVariable( "vector_tile_zoom", QgsVectorTileUtils::scaleToZoom( mMapCanvas->scale() ), true );
436  scopes << tileScope;
437  context.setAdditionalExpressionContextScopes( scopes );
438  }
439 
440  QgsVectorLayer *vectorLayer = nullptr; // TODO: have a temporary vector layer with sub-layer's fields?
441 
443  if ( panel && panel->dockMode() )
444  {
445  QgsSymbolSelectorWidget *dlg = new QgsSymbolSelectorWidget( symbol.release(), QgsStyle::defaultStyle(), vectorLayer, panel );
446  dlg->setContext( context );
447  dlg->setPanelTitle( style.styleName() );
448  connect( dlg, &QgsPanelWidget::widgetChanged, this, &QgsVectorTileBasicRendererWidget::updateSymbolsFromWidget );
449  connect( dlg, &QgsPanelWidget::panelAccepted, this, &QgsVectorTileBasicRendererWidget::cleanUpSymbolSelector );
450  openPanel( dlg );
451  }
452  else
453  {
454  QgsSymbolSelectorDialog dlg( symbol.get(), QgsStyle::defaultStyle(), vectorLayer, panel );
455  dlg.setContext( context );
456  if ( !dlg.exec() || !symbol )
457  {
458  return;
459  }
460 
461  style.setSymbol( symbol.release() );
462  mRenderer->setStyle( index.row(), style );
463  emit widgetChanged();
464  }
465 }
466 
467 void QgsVectorTileBasicRendererWidget::updateSymbolsFromWidget()
468 {
469  const int index = mProxyModel->mapToSource( viewStyles->selectionModel()->currentIndex() ).row();
470  if ( index < 0 )
471  return;
472 
473  QgsVectorTileBasicRendererStyle style = mRenderer->style( index );
474 
475  QgsSymbolSelectorWidget *dlg = qobject_cast<QgsSymbolSelectorWidget *>( sender() );
476  style.setSymbol( dlg->symbol()->clone() );
477 
478  mRenderer->setStyle( index, style );
479  emit widgetChanged();
480 }
481 
482 void QgsVectorTileBasicRendererWidget::cleanUpSymbolSelector( QgsPanelWidget *container )
483 {
484  QgsSymbolSelectorWidget *dlg = qobject_cast<QgsSymbolSelectorWidget *>( container );
485  if ( !dlg )
486  return;
487 
488  delete dlg->symbol();
489 }
490 
491 void QgsVectorTileBasicRendererWidget::removeStyle()
492 {
493  const QModelIndexList sel = viewStyles->selectionModel()->selectedIndexes();
494 
495  QList<int > res;
496  for ( const QModelIndex &proxyIndex : sel )
497  {
498  const QModelIndex sourceIndex = mProxyModel->mapToSource( proxyIndex );
499  if ( !res.contains( sourceIndex.row() ) )
500  res << sourceIndex.row();
501  }
502  std::sort( res.begin(), res.end() );
503 
504  for ( int i = res.size() - 1; i >= 0; --i )
505  {
506  mModel->removeRow( res[ i ] );
507  }
508  // make sure that the selection is gone
509  viewStyles->selectionModel()->clear();
510 }
511 
512 QgsVectorTileBasicRendererProxyModel::QgsVectorTileBasicRendererProxyModel( QgsVectorTileBasicRendererListModel *source, QObject *parent )
513  : QSortFilterProxyModel( parent )
514 {
515  setSourceModel( source );
516  setDynamicSortFilter( true );
517 }
518 
519 void QgsVectorTileBasicRendererProxyModel::setCurrentZoom( int zoom )
520 {
521  mCurrentZoom = zoom;
522  invalidateFilter();
523 }
524 
525 void QgsVectorTileBasicRendererProxyModel::setFilterVisible( bool enabled )
526 {
527  mFilterVisible = enabled;
528  invalidateFilter();
529 }
530 
531 bool QgsVectorTileBasicRendererProxyModel::filterAcceptsRow( int source_row, const QModelIndex &source_parent ) const
532 {
533  if ( mCurrentZoom < 0 || !mFilterVisible )
534  return true;
535 
536  const int rowMinZoom = sourceModel()->data( sourceModel()->index( source_row, 0, source_parent ), QgsVectorTileBasicRendererListModel::MinZoom ).toInt();
537  const int rowMaxZoom = sourceModel()->data( sourceModel()->index( source_row, 0, source_parent ), QgsVectorTileBasicRendererListModel::MaxZoom ).toInt();
538 
539  if ( rowMinZoom >= 0 && rowMinZoom > mCurrentZoom )
540  return false;
541 
542  if ( rowMaxZoom >= 0 && rowMaxZoom < mCurrentZoom )
543  return false;
544 
545  return true;
546 }
547 
548 
549 
Single scope for storing variables and functions for use within a QgsExpressionContext.
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.
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:89
void scaleChanged(double)
Emitted when the scale of the map changes.
A panel widget that can be shown in the map style dock.
A bar for displaying non-blocking messages to the user.
Definition: qgsmessagebar.h:61
Base class for any widget that can be shown as a inline panel.
void panelAccepted(QgsPanelWidget *panel)
Emitted when the panel is accepted by the user.
void widgetChanged()
Emitted when the widget state changes.
static QgsPanelWidget * findParentPanel(QWidget *widget)
Traces through the parents of a widget to find if it is contained within a QgsPanelWidget widget.
void setPanelTitle(const QString &panelTitle)
Set the title of the panel when shown in the interface.
bool dockMode()
Returns the dock mode state.
The class is used as a container of context for various read/write operations on other objects.
static QgsStyle * defaultStyle()
Returns default application-wide style.
Definition: qgsstyle.cpp:131
static QIcon symbolPreviewIcon(const QgsSymbol *symbol, QSize size, int padding=0, QgsLegendPatchShape *shape=nullptr)
Returns an icon preview for a color ramp.
Symbol selector widget that can be used to select and build a symbol.
QgsSymbol * symbol()
Returns the symbol that is currently active in the widget.
void setContext(const QgsSymbolWidgetContext &context)
Sets the context in which the symbol widget is shown, e.g., the associated map canvas and expression ...
Contains settings which reflect the context in which a symbol (or renderer) widget is shown,...
QList< QgsExpressionContextScope > additionalExpressionContextScopes() const
Returns the list of additional expression context scopes to show as available within the layer.
void setMapCanvas(QgsMapCanvas *canvas)
Sets the map canvas associated with the widget.
void setAdditionalExpressionContextScopes(const QList< QgsExpressionContextScope > &scopes)
Sets a list of additional expression context scopes to show as available within the layer.
void setMessageBar(QgsMessageBar *bar)
Sets the message bar associated with the widget.
static QgsSymbol * defaultSymbol(QgsWkbTypes::GeometryType geomType)
Returns a new default symbol for the specified geometry type.
Definition: qgssymbol.cpp:355
virtual QgsSymbol * clone() const =0
Returns a deep copy of this symbol.
Represents a vector layer which manages a vector based data sets.
Definition of map rendering of a subset of vector tile data.
QgsSymbol * symbol() const
Returns symbol for rendering.
void setEnabled(bool enabled)
Sets whether this style is enabled (used for rendering)
void setMinZoomLevel(int minZoom)
Sets minimum zoom level index (negative number means no limit)
void setLayerName(const QString &name)
Sets name of the sub-layer to render (empty layer means that all layers match)
QString filterExpression() const
Returns filter expression (empty filter means that all features match)
QString styleName() const
Returns human readable name of this style.
void setFilterExpression(const QString &expr)
Sets filter expression (empty filter means that all features match)
void setSymbol(QgsSymbol *sym)
Sets symbol for rendering. Takes ownership of the symbol.
void writeXml(QDomElement &elem, const QgsReadWriteContext &context) const
Writes object content to given DOM element.
void setStyleName(const QString &name)
Sets human readable name of this style.
bool isEnabled() const
Returns whether this style is enabled (used for rendering)
void setMaxZoomLevel(int maxZoom)
Sets maximum zoom level index (negative number means no limit)
int minZoomLevel() const
Returns minimum zoom level index (negative number means no limit)
int maxZoomLevel() const
Returns maxnimum zoom level index (negative number means no limit)
QString layerName() const
Returns name of the sub-layer to render (empty layer means that all layers match)
void readXml(const QDomElement &elem, const QgsReadWriteContext &context)
Reads object content from given DOM element.
The default vector tile renderer implementation.
Implements a map layer that is dedicated to rendering of vector tiles.
QgsVectorTileRenderer * renderer() const
Returns currently assigned renderer.
virtual QgsVectorTileRenderer * clone() const =0
Returns a clone of the renderer.
virtual QString type() const =0
Returns unique type name of the renderer implementation.
static int scaleToZoomLevel(double mapScale, int sourceMinZoom, int sourceMaxZoom)
Finds best fitting zoom level (assuming GoogleCRS84Quad tile matrix set) given map scale denominator ...
static double scaleToZoom(double mapScale)
Finds zoom level (assuming GoogleCRS84Quad tile matrix set) given map scale denominator.
GeometryType
The geometry types are used to group QgsWkbTypes::Type in a coarse way.
Definition: qgswkbtypes.h:141
QSize iconSize(bool dockableToolbar)
Returns the user-preferred size of a window's toolbar icons.
int scaleIconSize(int standardSize)
Scales an icon size to compensate for display pixel density, making the icon size hi-dpi friendly,...