QGIS API Documentation 3.40.0-Bratislava (b56115d8743)
Loading...
Searching...
No Matches
qgsvtpkvectortiledataprovider.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsvtpkvectortiledataprovider.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 QGSVTPKVECTORTILEDATAPROVIDER_H
17#define QGSVTPKVECTORTILEDATAPROVIDER_H
18
19#include "qgis_core.h"
20#include "qgis_sip.h"
22#include "qgsprovidermetadata.h"
24
25#include <QImage>
26
27#define SIP_NO_FILE
28
30
31class QgsVtpkTiles;
32
33class CORE_EXPORT QgsVtpkVectorTileDataProvider : public QgsVectorTileDataProvider
34{
35 Q_OBJECT
36
37 public:
38 QgsVtpkVectorTileDataProvider( const QString &uri,
39 const QgsDataProvider::ProviderOptions &providerOptions,
41 QgsVtpkVectorTileDataProvider( const QgsVtpkVectorTileDataProvider &other );
42
43 QgsVtpkVectorTileDataProvider &operator=( const QgsVtpkVectorTileDataProvider &other ) = delete;
44
45 Qgis::DataProviderFlags flags() const override;
48 QString name() const override;
49 QString description() const override;
50 QgsVectorTileDataProvider *clone() const override;
51 QString sourcePath() const override;
52 bool isValid() const override;
53 QgsCoordinateReferenceSystem crs() const override;
54 QgsRectangle extent() const override;
55 QgsLayerMetadata layerMetadata() const override;
56 const QgsVectorTileMatrixSet &tileMatrixSet() const override;
57 QVariantMap styleDefinition() const override;
58 QVariantMap spriteDefinition() const override;
59 QImage spriteImage() const override;
60 QgsVectorTileRawData readTile( const QgsTileMatrixSet &tileMatrix, const QgsTileXYZ &id, QgsFeedback *feedback = nullptr ) const override;
61 QList<QgsVectorTileRawData> readTiles( const QgsTileMatrixSet &, const QVector<QgsTileXYZ> &tiles, QgsFeedback *feedback = nullptr, Qgis::RendererUsage usage = Qgis::RendererUsage::Unknown ) const override;
62 QString htmlMetadata() const override;
63
64 static QString DATA_PROVIDER_KEY;
65 static QString DATA_PROVIDER_DESCRIPTION;
66
67 private:
68
70 static QgsVectorTileRawData loadFromVtpk( QgsVtpkTiles &vtpkTileReader, const QgsTileXYZ &id, QgsFeedback *feedback = nullptr );
71 bool mIsValid = false;
73 QgsRectangle mExtent;
74 QgsVectorTileMatrixSet mMatrixSet;
75 QgsLayerMetadata mLayerMetadata;
76 QVariantMap mStyleDefinition;
77 QVariantMap mSpriteDefinition;
78 QImage mSpriteImage;
79
80};
81
82
83class QgsVtpkVectorTileDataProviderMetadata : public QgsProviderMetadata
84{
85 Q_OBJECT
86 public:
87 QgsVtpkVectorTileDataProviderMetadata();
89 QgsVtpkVectorTileDataProvider *createProvider( const QString &uri, const QgsDataProvider::ProviderOptions &options, Qgis::DataProviderReadFlags flags = Qgis::DataProviderReadFlags() ) override;
90 QIcon icon() const override;
91 ProviderCapabilities providerCapabilities() const override;
92 QString filters( Qgis::FileFilterType type ) override;
93 QList< QgsProviderSublayerDetails > querySublayers( const QString &uri, Qgis::SublayerQueryFlags flags = Qgis::SublayerQueryFlags(), QgsFeedback *feedback = nullptr ) const override;
94 int priorityForUri( const QString &uri ) const override;
95 QList< Qgis::LayerType > validLayerTypesForUri( const QString &uri ) const override;
96 QVariantMap decodeUri( const QString &uri ) const override;
97 QString encodeUri( const QVariantMap &parts ) const override;
98 QString absoluteToRelativeUri( const QString &uri, const QgsReadWriteContext &context ) const override;
99 QString relativeToAbsoluteUri( const QString &uri, const QgsReadWriteContext &context ) const override;
100 QList< Qgis::LayerType > supportedLayerTypes() const override;
101};
102
103
105
106#endif // QGSVTPKVECTORTILEDATAPROVIDER_H
QFlags< DataProviderFlag > DataProviderFlags
Data provider flags.
Definition qgis.h:2147
FileFilterType
Type of file filters.
Definition qgis.h:1285
QFlags< DataProviderReadFlag > DataProviderReadFlags
Flags which control data provider construction.
Definition qgis.h:450
QFlags< VectorTileProviderCapability > VectorTileProviderCapabilities
Vector tile data provider capabilities.
Definition qgis.h:5188
QFlags< SublayerQueryFlag > SublayerQueryFlags
Sublayer query flags.
Definition qgis.h:1309
RendererUsage
Usage of the renderer.
Definition qgis.h:3188
@ Unknown
Renderer used for unknown usage.
QFlags< VectorTileProviderFlag > VectorTileProviderFlags
Vector tile data provider flags.
Definition qgis.h:5170
This class represents a coordinate reference system (CRS).
virtual QString name() const =0
Returns a provider name.
virtual Qgis::DataProviderFlags flags() const
Returns the generic data provider flags.
virtual QgsCoordinateReferenceSystem crs() const =0
Returns the coordinate system for the data source.
virtual QgsLayerMetadata layerMetadata() const
Returns layer metadata collected from the provider's source.
virtual bool isValid() const =0
Returns true if this is a valid layer.
virtual QString description() const =0
Returns description.
virtual QString htmlMetadata() const
Obtain a formatted HTML string containing assorted metadata for this data provider.
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition qgsfeedback.h:44
A structured metadata store for a map layer.
Holds data provider key, description, and associated shared library file or function pointer informat...
QFlags< ProviderMetadataCapability > ProviderMetadataCapabilities
virtual QgsProviderMetadata::ProviderCapabilities providerCapabilities() const
Returns the provider's capabilities.
virtual QgsDataProvider * createProvider(const QString &uri, const QgsDataProvider::ProviderOptions &options, Qgis::DataProviderReadFlags flags=Qgis::DataProviderReadFlags())
Class factory to return a pointer to a newly created QgsDataProvider object.
virtual QIcon icon() const
Returns an icon representing the provider.
virtual int priorityForUri(const QString &uri) const
Returns an integer representing the priority which this provider should have when opening a dataset w...
virtual QString encodeUri(const QVariantMap &parts) const
Reassembles a provider data source URI from its component paths (e.g.
virtual QList< Qgis::LayerType > validLayerTypesForUri(const QString &uri) const
Returns a list of valid layer types which the provider can be used with when opening the specified ur...
virtual QString absoluteToRelativeUri(const QString &uri, const QgsReadWriteContext &context) const
Converts absolute path(s) to relative path(s) in the given provider-specific URI.
virtual QString filters(Qgis::FileFilterType type)
Builds the list of file filter strings (supported formats)
virtual QList< Qgis::LayerType > supportedLayerTypes() const
Returns a list of the map layer types supported by the provider.
virtual QList< QgsProviderSublayerDetails > querySublayers(const QString &uri, Qgis::SublayerQueryFlags flags=Qgis::SublayerQueryFlags(), QgsFeedback *feedback=nullptr) const
Queries the specified uri and returns a list of any valid sublayers found in the dataset which can be...
virtual QgsProviderMetadata::ProviderMetadataCapabilities capabilities() const
Returns the provider metadata capabilities.
virtual QString relativeToAbsoluteUri(const QString &uri, const QgsReadWriteContext &context) const
Converts relative path(s) to absolute path(s) in the given provider-specific URI.
virtual QVariantMap decodeUri(const QString &uri) const
Breaks a provider data source URI into its component paths (e.g.
The class is used as a container of context for various read/write operations on other objects.
A rectangle specified with double values.
Defines a set of tile matrices for multiple zoom levels.
Definition qgstiles.h:252
Stores coordinates of a tile in a tile matrix set.
Definition qgstiles.h:40
Base class for vector tile layer data providers.
virtual QString sourcePath() const =0
Returns the source path for the data.
virtual QgsVectorTileDataProvider * clone() const =0
Returns a clone of the data provider.
virtual QList< QgsVectorTileRawData > readTiles(const QgsTileMatrixSet &tileMatrixSet, const QVector< QgsTileXYZ > &tiles, QgsFeedback *feedback=nullptr, Qgis::RendererUsage usage=Qgis::RendererUsage::Unknown) const =0
Returns raw tile data for a range of tiles.
QgsRectangle extent() const override
Returns the extent of the layer.
QgsVectorTileDataProvider & operator=(const QgsVectorTileDataProvider &other)=delete
virtual Qgis::VectorTileProviderCapabilities providerCapabilities() const
Returns flags containing the supported capabilities of the data provider.
virtual const QgsVectorTileMatrixSet & tileMatrixSet() const =0
Returns the tile matrix set associated with the provider.
virtual QgsVectorTileRawData readTile(const QgsTileMatrixSet &tileMatrixSet, const QgsTileXYZ &id, QgsFeedback *feedback=nullptr) const =0
Returns raw tile data for a single tile.
virtual Qgis::VectorTileProviderFlags providerFlags() const
Returns flags reflecting the behavior of the data provider.
virtual QVariantMap spriteDefinition() const
Returns the sprite definition for the provider, if available.
virtual QVariantMap styleDefinition() const
Returns the style definition for the provider, if available.
virtual QImage spriteImage() const
Returns the sprite image for the provider, if available.
Encapsulates properties of a vector tile matrix set, including tile origins and scaling information.
Keeps track of raw tile data from one or more sources that need to be decoded.
Utility class for reading and writing ESRI VTPK files.
Setting options for creating vector data providers.