mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-05 00:05:32 -04:00
Remove temporary layers (highlight layers and external wms layers)
This commit is contained in:
parent
40201b2ef5
commit
2dda2abc98
@ -132,6 +132,11 @@ namespace QgsWms
|
||||
initNicknameLayers();
|
||||
}
|
||||
|
||||
QgsRenderer::~QgsRenderer()
|
||||
{
|
||||
removeTemporaryLayers();
|
||||
}
|
||||
|
||||
|
||||
QImage *QgsRenderer::getLegendGraphics()
|
||||
{
|
||||
@ -2557,6 +2562,7 @@ namespace QgsWms
|
||||
}
|
||||
}
|
||||
|
||||
mTemporaryLayers.append( highlightLayers );
|
||||
return highlightLayers;
|
||||
}
|
||||
|
||||
@ -2602,7 +2608,7 @@ namespace QgsWms
|
||||
return layers;
|
||||
}
|
||||
|
||||
QList<QgsMapLayer *> QgsRenderer::stylizedLayers( const QList<QgsWmsParametersLayer> ¶ms ) const
|
||||
QList<QgsMapLayer *> QgsRenderer::stylizedLayers( const QList<QgsWmsParametersLayer> ¶ms )
|
||||
{
|
||||
QList<QgsMapLayer *> layers;
|
||||
|
||||
@ -2618,6 +2624,7 @@ namespace QgsWms
|
||||
if ( externalWMSLayer )
|
||||
{
|
||||
layers.append( externalWMSLayer );
|
||||
mTemporaryLayers.append( externalWMSLayer );
|
||||
}
|
||||
}
|
||||
else if ( mNicknameLayers.contains( nickname ) && !mRestrictedLayers.contains( nickname ) )
|
||||
@ -2672,6 +2679,12 @@ namespace QgsWms
|
||||
return wmsLayer;
|
||||
}
|
||||
|
||||
void QgsRenderer::removeTemporaryLayers()
|
||||
{
|
||||
qDeleteAll( mTemporaryLayers );
|
||||
mTemporaryLayers.clear();
|
||||
}
|
||||
|
||||
QPainter *QgsRenderer::layersRendering( const QgsMapSettings &mapSettings, QImage &image, HitTest *hitTest ) const
|
||||
{
|
||||
QPainter *painter = nullptr;
|
||||
|
@ -84,6 +84,8 @@ namespace QgsWms
|
||||
const QgsProject *project,
|
||||
const QgsServerRequest::Parameters ¶meters );
|
||||
|
||||
~QgsRenderer();
|
||||
|
||||
/**
|
||||
* Returns the map legend as an image (or a null pointer in case of error). The caller takes ownership
|
||||
of the image object*/
|
||||
@ -154,7 +156,7 @@ namespace QgsWms
|
||||
void annotationsRendering( QPainter *painter ) const;
|
||||
|
||||
// Return a list of layers stylized with LAYERS/STYLES parameters
|
||||
QList<QgsMapLayer *> stylizedLayers( const QList<QgsWmsParametersLayer> ¶ms ) const;
|
||||
QList<QgsMapLayer *> stylizedLayers( const QList<QgsWmsParametersLayer> ¶ms );
|
||||
|
||||
// Return a list of layers stylized with SLD parameter
|
||||
QList<QgsMapLayer *> sldStylizedLayers( const QString &sld ) const;
|
||||
@ -277,6 +279,8 @@ namespace QgsWms
|
||||
//! Creates external WMS layer. Caller takes ownership
|
||||
QgsMapLayer *createExternalWMSLayer( const QString &externalLayerId ) const;
|
||||
|
||||
void removeTemporaryLayers();
|
||||
|
||||
private:
|
||||
|
||||
const QgsServerRequest::Parameters &mParameters;
|
||||
@ -289,6 +293,7 @@ namespace QgsWms
|
||||
QgsWmsParameters mWmsParameters;
|
||||
QStringList mRestrictedLayers;
|
||||
QMap<QString, QgsMapLayer *> mNicknameLayers;
|
||||
QList<QgsMapLayer *> mTemporaryLayers;
|
||||
|
||||
public:
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user