QGIS API Documentation 3.41.0-Master (3440c17df1d)
Loading...
Searching...
No Matches
qgsvectortileutils.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsvectortileutils.h
3 --------------------------------------
4 Date : March 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
16#ifndef QGSVECTORTILEUTILS_H
17#define QGSVECTORTILEUTILS_H
18
19#include "qgis_core.h"
20
21#include <QSet>
22#include <QVariantMap>
23
24#include "qgshttpheaders.h"
25
26
27class QPointF;
28class QPolygon;
29
31class QgsFields;
32class QgsMapToPixel;
33class QgsRectangle;
34class QgsVectorLayer;
35
36class QgsTileMatrix;
37class QgsTileRange;
38class QgsTileXYZ;
41
48class CORE_EXPORT QgsVectorTileUtils
49{
50 public:
51
57 static void updateUriSources( QString &uri SIP_INOUT, bool forceUpdate = false );
58
60 static void sortTilesByDistanceFromCenter( QVector<QgsTileXYZ> &tiles, QPointF center );
61
67 static QPolygon tilePolygon( QgsTileXYZ id, const QgsCoordinateTransform &ct, const QgsTileMatrix &tm, const QgsMapToPixel &mtp );
68
70 static QgsFields makeQgisFields( const QSet<QString> &flds );
71
80 static double scaleToZoom( double mapScale, double z0Scale = 559082264.0287178 );
81
88 static int scaleToZoomLevel( double mapScale, int sourceMinZoom, int sourceMaxZoom, double z0Scale = 559082264.0287178 );
90 static QgsVectorLayer *makeVectorLayerForTile( QgsVectorTileLayer *mvt, QgsTileXYZ tileID, const QString &layerName );
92 static QString formatXYZUrlTemplate( const QString &url, QgsTileXYZ tile, const QgsTileMatrix &tileMatrix );
94 static bool checkXYZUrlTemplate( const QString &url );
95
102 static void loadSprites( const QVariantMap &styleDefinition, QgsMapBoxGlStyleConversionContext &context, const QString &styleUrl = QString() );
103
104 private:
106 static QMap<QString, QString> parseStyleSourceUrl( const QString &styleUrl, const QgsHttpHeaders &headers = QgsHttpHeaders(), const QString &authCfg = QString() );
107
109 static QVariantList parseStyleSourceContentUrl( const QString &sourceUrl, const QgsHttpHeaders &headers = QgsHttpHeaders(), const QString &authCfg = QString() );
110
111 friend class TestQgsVectorTileUtils;
112
113};
114
115#endif // QGSVECTORTILEUTILS_H
Class for doing transforms between two map coordinate systems.
Container of fields for a vector layer.
Definition qgsfields.h:46
This class implements simple http header management.
Context for a MapBox GL style conversion operation.
Perform transforms between map coordinates and device coordinates.
A rectangle specified with double values.
Defines a matrix of tiles for a single zoom level: it is defined by its size (width *.
Definition qgstiles.h:136
Range of tiles in a tile matrix to be rendered.
Definition qgstiles.h:99
Stores coordinates of a tile in a tile matrix set.
Definition qgstiles.h:40
Represents a vector layer which manages a vector based data sets.
Implements a map layer that is dedicated to rendering of vector tiles.
Random utility functions for working with vector tiles.
#define SIP_INOUT
Definition qgis_sip.h:71