QGIS API Documentation 3.99.0-Master (26c88405ac0)
Loading...
Searching...
No Matches
qgsmaplayerutils.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsmaplayerutils.h
3 -------------------
4 begin : May 2021
5 copyright : (C) 2021 Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17#ifndef QGSMAPLAYERUTILS_H
18#define QGSMAPLAYERUTILS_H
19
20#define MAXIMUM_OPENSTREETMAP_TILES_FETCH 5000
21
22#include "qgis.h"
23#include "qgis_core.h"
24#include "qgis_sip.h"
25
26class QgsMapLayer;
27class QgsRectangle;
31class QgsGeometry;
32
38class CORE_EXPORT QgsMapLayerUtils
39{
40
41 public:
42
48 static QgsRectangle combinedExtent( const QList<QgsMapLayer *> &layers, const QgsCoordinateReferenceSystem &crs, const QgsCoordinateTransformContext &transformContext );
49
56
64 static bool layerSourceMatchesPath( const QgsMapLayer *layer, const QString &path );
65
74 static bool updateLayerSourcePath( QgsMapLayer *layer, const QString &newPath );
75
84 static QList< QgsMapLayer * > sortLayersByType( const QList< QgsMapLayer * > &layers, const QList< Qgis::LayerType > &order );
85
98 static QString launderLayerName( const QString &name );
99
105 static bool isOpenStreetMapLayer( QgsMapLayer *layer );
106
112 static QString layerTypeToString( Qgis::LayerType type );
113
114};
115
116#endif // QGSMAPLAYERUTILS_H
117
118
LayerType
Types of layers that can be added to a map.
Definition qgis.h:190
Provides common functionality for database based connections.
Represents a coordinate reference system (CRS).
Contains information about the context in which a coordinate transform is executed.
A geometry is the spatial representation of a feature.
Contains utility functions for working with map layers.
static bool updateLayerSourcePath(QgsMapLayer *layer, const QString &newPath)
Updates a layer's data source, replacing its data source with a path referring to newPath.
static QgsRectangle combinedExtent(const QList< QgsMapLayer * > &layers, const QgsCoordinateReferenceSystem &crs, const QgsCoordinateTransformContext &transformContext)
Returns the combined extent of a list of layers.
static QgsAbstractDatabaseProviderConnection * databaseConnection(const QgsMapLayer *layer)
Creates and returns the (possibly nullptr) database connection for a layer.
static QString layerTypeToString(Qgis::LayerType type)
Returns the translated name of the type for a given layer type.
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.
static QString launderLayerName(const QString &name)
Launders a layer's name, converting it into a format which is general suitable for file names or data...
static bool isOpenStreetMapLayer(QgsMapLayer *layer)
Returns true if the layer is served by OpenStreetMap server.
static bool layerSourceMatchesPath(const QgsMapLayer *layer, const QString &path)
Returns true if the source of the specified layer matches the given path.
Base class for all map layer types.
Definition qgsmaplayer.h:80
A rectangle specified with double values.
#define SIP_FACTORY
Definition qgis_sip.h:84