QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Rendering context for the WMS renderer. More...
#include <qgswmsrendercontext.h>
Public Types | |
enum | Flag { UseScaleDenominator = 0x01, UseOpacity = 0x02, UseFilter = 0x04, UseSelection = 0x08, AddHighlightLayers = 0x10, UpdateExtent = 0x20, SetAccessControl = 0x40, AddQueryLayers = 0x80, UseWfsLayersOnly = 0x100, AddExternalLayers = 0x200, UseSrcWidthHeight = 0x400, UseTileBuffer = 0x800, AddAllLayers = 0x1000 } |
Available rendering options. More... | |
Public Member Functions | |
QgsWmsRenderContext (const QgsProject *project, QgsServerInterface *interface) | |
Constructor for QgsWmsRenderContext. More... | |
~QgsWmsRenderContext () | |
Destructor for QgsWmsRenderContext. More... | |
qreal | dotsPerMm () const |
Returns default dots per mm according to the current configuration. More... | |
QStringList | flattenedQueryLayers (const QStringList &layerNames) const |
Returns a list of query layer names where group names are replaced by the names of their layer components. More... | |
int | imageQuality () const |
Returns the image quality to use for rendering according to the current configuration. More... | |
bool | isExternalLayer (const QString &name) const |
Returns true if the layer is an external layer, false otherwise. More... | |
bool | isValidGroup (const QString &name) const |
Returns true if name is a group. More... | |
bool | isValidLayer (const QString &nickname) const |
Returns true if the layer has to be rendered, false otherwise. More... | |
bool | isValidWidthHeight () const |
Returns true if width and height are valid according to the maximum values defined within the project, false otherwise. More... | |
bool | isValidWidthHeight (int width, int height) const |
Returns true if width and height are valid according to the maximum image width/height. More... | |
QgsMapLayer * | layer (const QString &nickname) const |
Returns the layer corresponding to the nickname, or a nullptr if not found or if the layer do not need to be rendered. More... | |
QMap< QString, QList< QgsMapLayer * > > | layerGroups () const |
Returns a map having layer group names as keys and a list of layers as values. More... | |
QString | layerNickname (const QgsMapLayer &layer) const |
Returns the nickname (short name, id or name) of the layer according to the current configuration. More... | |
QList< QgsMapLayer * > | layers () const |
Returns a list of all layers read from the project. More... | |
QList< QgsMapLayer * > | layersFromGroup (const QString &nickname) const |
Returns the group's layers list corresponding to the nickname, or an empty list if not found. More... | |
QList< QgsMapLayer * > | layersToRender () const |
Returns a list of all layers to actually render according to the current configuration. More... | |
int | mapHeight () const |
Returns HEIGHT or SRCHEIGHT according to UseSrcWidthHeight flag. More... | |
QSize | mapSize (bool aspectRatio=true) const |
Returns the size (in pixels) of the map to render, according to width and height WMS parameters as well as the aspectRatio option. More... | |
double | mapTileBuffer (int mapWidth) const |
Returns the tile buffer in geographical units for the given map width in pixels. More... | |
int | mapWidth () const |
Returns WIDTH or SRCWIDTH according to UseSrcWidthHeight flag. More... | |
QgsWmsParameters | parameters () const |
Returns WMS parameters. More... | |
QgsWmsParametersLayer | parameters (const QgsMapLayer &layer) const |
Returns WMS parameters for a specific layer. More... | |
int | precision () const |
Returns the precision to use according to the current configuration. More... | |
const QgsProject * | project () const |
Returns the project. More... | |
bool | renderMapTiles () const |
Returns true if WMS requests should use the QgsMapSettings::RenderMapTile flag, so that no visible artifacts are visible between adjacent tiles. More... | |
double | scaleDenominator () const |
Returns the scale denominator to use for rendering according to the current configuration. More... | |
void | setFlag (Flag flag, bool on=true) |
Sets or unsets a rendering flag according to the on value. More... | |
void | setParameters (const QgsWmsParameters ¶meters) |
Sets WMS parameters. More... | |
void | setScaleDenominator (double scaleDenominator) |
Sets a custom scale denominator. More... | |
const QgsServerSettings & | settings () const |
Returns settings of the server. More... | |
QDomElement | sld (const QgsMapLayer &layer) const |
Returns a SLD document for a specific layer. More... | |
QString | style (const QgsMapLayer &layer) const |
Returns a style's name for a specific layer. More... | |
bool | testFlag (Flag flag) const |
Returns the status of a rendering flag. More... | |
int | tileBuffer () const |
Returns the tile buffer value to use for rendering according to the current configuration. More... | |
bool | updateExtent () const |
Returns true if the extent has to be updated before the rendering, false otherwise. More... | |
Rendering context for the WMS renderer.
Definition at line 47 of file qgswmsrendercontext.h.
Available rendering options.
Definition at line 51 of file qgswmsrendercontext.h.
QgsWmsRenderContext::~QgsWmsRenderContext | ( | ) |
Destructor for QgsWmsRenderContext.
Definition at line 35 of file qgswmsrendercontext.cpp.
QgsWmsRenderContext::QgsWmsRenderContext | ( | const QgsProject * | project, |
QgsServerInterface * | interface | ||
) |
Constructor for QgsWmsRenderContext.
project | The project to use for the rendering |
interface | The server interface |
Definition at line 28 of file qgswmsrendercontext.cpp.
qreal QgsWmsRenderContext::dotsPerMm | ( | ) | const |
Returns default dots per mm according to the current configuration.
Definition at line 172 of file qgswmsrendercontext.cpp.
QStringList QgsWmsRenderContext::flattenedQueryLayers | ( | const QStringList & | layerNames | ) | const |
Returns a list of query layer names where group names are replaced by the names of their layer components.
Definition at line 187 of file qgswmsrendercontext.cpp.
int QgsWmsRenderContext::imageQuality | ( | ) | const |
Returns the image quality to use for rendering according to the current configuration.
Definition at line 131 of file qgswmsrendercontext.cpp.
bool QgsWmsRenderContext::isExternalLayer | ( | const QString & | name | ) | const |
Returns true if the layer is an external layer, false otherwise.
Definition at line 826 of file qgswmsrendercontext.cpp.
bool QgsWmsRenderContext::isValidGroup | ( | const QString & | name | ) | const |
Returns true if name is a group.
Definition at line 315 of file qgswmsrendercontext.cpp.
bool QgsWmsRenderContext::isValidLayer | ( | const QString & | nickname | ) | const |
Returns true if the layer has to be rendered, false otherwise.
Definition at line 305 of file qgswmsrendercontext.cpp.
bool QgsWmsRenderContext::isValidWidthHeight | ( | ) | const |
Returns true if width and height are valid according to the maximum values defined within the project, false otherwise.
Definition at line 632 of file qgswmsrendercontext.cpp.
bool QgsWmsRenderContext::isValidWidthHeight | ( | int | width, |
int | height | ||
) | const |
Returns true if width and height are valid according to the maximum image width/height.
width | the image width in pixels |
height | the image height in pixels |
Definition at line 637 of file qgswmsrendercontext.cpp.
QgsMapLayer * QgsWmsRenderContext::layer | ( | const QString & | nickname | ) | const |
Returns the layer corresponding to the nickname, or a nullptr if not found or if the layer do not need to be rendered.
Definition at line 289 of file qgswmsrendercontext.cpp.
QMap< QString, QList< QgsMapLayer * > > QgsWmsRenderContext::layerGroups | ( | ) | const |
Returns a map having layer group names as keys and a list of layers as values.
Definition at line 601 of file qgswmsrendercontext.cpp.
QString QgsWmsRenderContext::layerNickname | ( | const QgsMapLayer & | layer | ) | const |
Returns the nickname (short name, id or name) of the layer according to the current configuration.
Definition at line 268 of file qgswmsrendercontext.cpp.
QList< QgsMapLayer * > QgsWmsRenderContext::layers | ( | ) | const |
Returns a list of all layers read from the project.
Definition at line 229 of file qgswmsrendercontext.cpp.
QList< QgsMapLayer * > QgsWmsRenderContext::layersFromGroup | ( | const QString & | nickname | ) | const |
Returns the group's layers list corresponding to the nickname, or an empty list if not found.
Definition at line 310 of file qgswmsrendercontext.cpp.
QList< QgsMapLayer * > QgsWmsRenderContext::layersToRender | ( | ) | const |
Returns a list of all layers to actually render according to the current configuration.
Definition at line 224 of file qgswmsrendercontext.cpp.
int QgsWmsRenderContext::mapHeight | ( | ) | const |
Returns HEIGHT or SRCHEIGHT according to UseSrcWidthHeight flag.
Definition at line 619 of file qgswmsrendercontext.cpp.
QSize QgsWmsRenderContext::mapSize | ( | bool | aspectRatio = true | ) | const |
Returns the size (in pixels) of the map to render, according to width and height WMS parameters as well as the aspectRatio option.
Definition at line 731 of file qgswmsrendercontext.cpp.
double QgsWmsRenderContext::mapTileBuffer | ( | int | mapWidth | ) | const |
Returns the tile buffer in geographical units for the given map width in pixels.
Definition at line 711 of file qgswmsrendercontext.cpp.
int QgsWmsRenderContext::mapWidth | ( | ) | const |
Returns WIDTH or SRCWIDTH according to UseSrcWidthHeight flag.
Definition at line 606 of file qgswmsrendercontext.cpp.
QgsWmsParameters QgsWmsRenderContext::parameters | ( | ) | const |
Returns WMS parameters.
Definition at line 72 of file qgswmsrendercontext.cpp.
QgsWmsParametersLayer QgsWmsRenderContext::parameters | ( | const QgsMapLayer & | layer | ) | const |
Returns WMS parameters for a specific layer.
An empty instance is returned if not available.
Definition at line 113 of file qgswmsrendercontext.cpp.
int QgsWmsRenderContext::precision | ( | ) | const |
Returns the precision to use according to the current configuration.
Definition at line 160 of file qgswmsrendercontext.cpp.
const QgsProject * QgsWmsRenderContext::project | ( | ) | const |
Returns the project.
Definition at line 82 of file qgswmsrendercontext.cpp.
bool QgsWmsRenderContext::renderMapTiles | ( | ) | const |
Returns true
if WMS requests should use the QgsMapSettings::RenderMapTile flag, so that no visible artifacts are visible between adjacent tiles.
This flag can slow down rendering considerably, so it is only used if the corresponding if explicitly opted in.
Definition at line 155 of file qgswmsrendercontext.cpp.
double QgsWmsRenderContext::scaleDenominator | ( | ) | const |
Returns the scale denominator to use for rendering according to the current configuration.
Definition at line 234 of file qgswmsrendercontext.cpp.
void QgsWmsRenderContext::setFlag | ( | Flag | flag, |
bool | on = true |
||
) |
Sets or unsets a rendering flag according to the on value.
Definition at line 55 of file qgswmsrendercontext.cpp.
void QgsWmsRenderContext::setParameters | ( | const QgsWmsParameters & | parameters | ) |
Sets WMS parameters.
Definition at line 41 of file qgswmsrendercontext.cpp.
void QgsWmsRenderContext::setScaleDenominator | ( | double | scaleDenominator | ) |
Sets a custom scale denominator.
In this case, layers to render are updated according to their scale visibility.
Definition at line 250 of file qgswmsrendercontext.cpp.
const QgsServerSettings & QgsWmsRenderContext::settings | ( | ) | const |
Returns settings of the server.
Definition at line 77 of file qgswmsrendercontext.cpp.
QDomElement QgsWmsRenderContext::sld | ( | const QgsMapLayer & | layer | ) | const |
Returns a SLD document for a specific layer.
An empty document is returned if not available.
Definition at line 87 of file qgswmsrendercontext.cpp.
QString QgsWmsRenderContext::style | ( | const QgsMapLayer & | layer | ) | const |
Returns a style's name for a specific layer.
An empty string is returned if not available.
Definition at line 100 of file qgswmsrendercontext.cpp.
bool QgsWmsRenderContext::testFlag | ( | Flag | flag | ) | const |
Returns the status of a rendering flag.
flag | The flag to test |
Definition at line 67 of file qgswmsrendercontext.cpp.
int QgsWmsRenderContext::tileBuffer | ( | ) | const |
Returns the tile buffer value to use for rendering according to the current configuration.
Definition at line 143 of file qgswmsrendercontext.cpp.
bool QgsWmsRenderContext::updateExtent | ( | ) | const |
Returns true if the extent has to be updated before the rendering, false otherwise.
Definition at line 256 of file qgswmsrendercontext.cpp.