37 const bool &ballparkTransformsAreAppropriate )
40 transformer.setBallparkTransformsAreAppropriate( ballparkTransformsAreAppropriate );
42 return transformer.transformBoundingBox( extent );
48 const QList<QgsCoordinateReferenceSystem> &destinations,
60 crsExtents[ destination.authid() ] = crsTransform.transformBoundingBox( extent );
72 const QList<QgsCoordinateReferenceSystem> &outputCrsList )
87 if ( ml->
crs() != project->
crs() )
139 const QList<QgsCoordinateReferenceSystem> &outputCrsList )
141 QMap< QString, QgsWmsLayerInfos > wmsLayers;
142#ifdef HAVE_SERVER_PYTHON_PLUGINS
155 if ( !ml || restrictedLayers.contains( ml->name() ) )
160#ifdef HAVE_SERVER_PYTHON_PLUGINS
168 pLayer.
id = ml->id();
173 bool hasExtent =
true;
184 if ( hasExtent && !
setBoundingRect( project, pLayer, ml, wmsExtent, wgs84, outputCrsList ) )
188 pLayer.
type = ml->type();
190 pLayer.
name = ml->name();
193 pLayer.
name = ml->id();
195 else if ( !ml->serverProperties()->shortName().isEmpty() )
197 pLayer.
name = ml->serverProperties()->shortName();
200 pLayer.
title = ml->serverProperties()->title();
201 if ( pLayer.
title.isEmpty() )
203 pLayer.
title = ml->name();
206 pLayer.
abstract = ml->serverProperties()->abstract();
210 if ( !ml->serverProperties()->keywordList().isEmpty() )
212 pLayer.
keywords = ml->serverProperties()->keywordList().split(
',' );
215 pLayer.
styles = ml->styleManager()->styles();
221 if ( ml->hasScaleBasedVisibility() )
224 pLayer.
maxScale = ml->maximumScale();
225 pLayer.
minScale = ml->minimumScale();
228 pLayer.
dataUrl = ml->serverProperties()->dataUrl();
230 pLayer.
attribution = ml->serverProperties()->attribution();
233 pLayer.
metadataUrls = ml->serverProperties()->metadataUrls();
235 wmsLayers[pLayer.
id] = pLayer;
@ Warning
Warning message.
A helper class that centralizes restrictions given by all the access control filter plugins.
bool layerReadPermission(const QgsMapLayer *layer) const
Returns the layer read right.
This class represents a coordinate reference system (CRS).
static QgsCoordinateReferenceSystem fromOgcWmsCrs(const QString &ogcCrs)
Creates a CRS from a given OGC WMS-format Coordinate Reference System string.
QgsRectangle bounds() const
Returns the approximate bounds for the region the CRS is usable within.
Contains information about the context in which a coordinate transform is executed.
Custom exception class for Coordinate Reference System related exceptions.
Base class for all map layer types.
QgsRectangle wgs84Extent(bool forceRecalculate=false) const
Returns the WGS84 extent (EPSG:4326) of the layer according to ReadFlag::FlagTrustLayerMetadata.
virtual QgsRectangle extent() const
Returns the extent of the layer.
QgsCoordinateReferenceSystem crs
@ Identifiable
If the layer is identifiable using the identify map tool and as a WMS layer.
static void logMessage(const QString &message, const QString &tag=QString(), Qgis::MessageLevel level=Qgis::MessageLevel::Warning, bool notifyUser=true)
Adds a message to the log instance (and creates it if necessary).
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
QgsCoordinateTransformContext transformContext
QgsCoordinateReferenceSystem crs
QMap< QString, QgsMapLayer * > mapLayers(const bool validOnly=false) const
Returns a map of all registered layers by layer ID.
A rectangle specified with double values.
bool isNull() const
Test if the rectangle is null (holding no spatial information).
bool isEmpty() const
Returns true if the rectangle has no area.
QgsServerInterface Class defining interfaces exposed by QGIS Server and made available to plugins.
virtual QgsAccessControl * accessControls() const =0
Gets the registered access control filters.
Represents a vector layer which manages a vector based data sets.
Q_INVOKABLE Qgis::WkbType wkbType() const FINAL
Returns the WKBType or WKBUnknown in case of error.
QString legendUrlFormat
WMS layer legend URL format.
QString title
WMS layer title.
QStringList styles
WMS layer styles.
QStringList keywords
WMS layer keywords.
QString legendUrl
WMS layer legend URL.
QString abstract
WMS layer abstract.
static QgsRectangle transformExtent(const QgsRectangle &extent, const QgsCoordinateReferenceSystem &source, const QgsCoordinateReferenceSystem &destination, const QgsCoordinateTransformContext &context, const bool &ballparkTransformsAreAppropriate=false)
Returns a transformed extent.
QString attribution
WMS layer attribution.
QString dataUrl
WMS layer dataUrl.
double maxScale
WMS layer maximum scale (if negative, no maximum scale is defined)
QMap< QString, QgsRectangle > crsExtents
WMS layer CRS extents (can be empty)
QString attributionUrl
WMS layer attribution URL.
static QMap< QString, QgsRectangle > transformExtentToCrsList(const QgsRectangle &extent, const QgsCoordinateReferenceSystem &source, const QList< QgsCoordinateReferenceSystem > &destinations, const QgsCoordinateTransformContext &context)
Returns a map with CRS authid as key and the transformed extent as value.
Qgis::LayerType type
QGIS layer type.
QString name
WMS layer name.
static QMap< QString, QgsWmsLayerInfos > buildWmsLayerInfos(QgsServerInterface *serverIface, const QgsProject *project, const QList< QgsCoordinateReferenceSystem > &outputCrsList)
Returns the WMS layers definition to build WMS capabilities.
QList< QgsMapLayerServerProperties::MetadataUrl > metadataUrls
WMS layer metadata URLs.
bool hasScaleBasedVisibility
WMS layer has scale based visibility.
double minScale
WMS layer minimum scale (if negative, no maximum scale is defined)
bool queryable
WMS layer is queryable.
QgsRectangle wgs84BoundingRect
WMS layer WGS84 bounding rectangle (can be empty)
SERVER_EXPORT QgsRectangle wmsExtent(const QgsProject &project)
Returns the WMS Extent restriction.
SERVER_EXPORT bool wmsUseLayerIds(const QgsProject &project)
Returns if layer ids are used as name in WMS.
SERVER_EXPORT QStringList wmsRestrictedLayers(const QgsProject &project)
Returns the restricted layer name list.
CONSTLATIN1STRING geoEpsgCrsAuthId()
Geographic coord sys from EPSG authority.
bool setBoundingRect(const QgsProject *project, QgsWmsLayerInfos &pLayer, QgsMapLayer *ml, const QgsRectangle &wmsExtent, const QgsCoordinateReferenceSystem &wgs84, const QList< QgsCoordinateReferenceSystem > &outputCrsList)