Skip to content
Permalink
Browse files

Remove some unused methods

  • Loading branch information
pblottiere committed Mar 27, 2019
1 parent 5f4c052 commit dcd43dc5c3aea92de6b1f3c57d89028ec722206c
Showing with 0 additions and 150 deletions.
  1. +0 −127 src/server/services/wms/qgswmsrenderer.cpp
  2. +0 −23 src/server/services/wms/qgswmsrenderer.h
@@ -113,23 +113,6 @@ namespace QgsWms

} // namespace


QgsRenderer::QgsRenderer( QgsServerInterface *serverIface,
const QgsProject *project,
const QgsWmsParameters &parameters )
: mWmsParameters( parameters )
#ifdef HAVE_SERVER_PYTHON_PLUGINS
, mAccessControl( serverIface->accessControls() )
#endif
, mSettings( *serverIface->serverSettings() )
, mProject( project )
{
mWmsParameters.dump();

initRestrictedLayers();
initNicknameLayers();
}

QgsRenderer::QgsRenderer( const QgsWmsRenderContext &context )
: mContext( context )
{
@@ -2554,20 +2537,6 @@ namespace QgsWms
return name;
}

bool QgsRenderer::layerScaleVisibility( const QgsMapLayer &layer, double scaleDenominator ) const
{
bool visible = false;
bool scaleBasedVisibility = layer.hasScaleBasedVisibility();
bool useScaleConstraint = ( scaleDenominator > 0 && scaleBasedVisibility );

if ( !useScaleConstraint || layer.isInScaleRange( scaleDenominator ) )
{
visible = true;
}

return visible;
}

QList<QgsMapLayer *> QgsRenderer::highlightLayers( QList<QgsWmsParametersHighlightLayer> params )
{
QList<QgsMapLayer *> highlightLayers;
@@ -2741,60 +2710,6 @@ namespace QgsWms
return layers;
}

QList<QgsMapLayer *> QgsRenderer::sldStylizedLayers( const QString &sld ) const
{
QList<QgsMapLayer *> layers;

if ( !sld.isEmpty() )
{
QDomDocument doc;
( void )doc.setContent( sld, true );
QDomElement docEl = doc.documentElement();

QDomElement root = doc.firstChildElement( "StyledLayerDescriptor" );
QDomElement namedElem = root.firstChildElement( "NamedLayer" );

if ( !docEl.isNull() )
{
QDomNodeList named = docEl.elementsByTagName( "NamedLayer" );
for ( int i = 0; i < named.size(); ++i )
{
QDomNodeList names = named.item( i ).toElement().elementsByTagName( "Name" );
if ( !names.isEmpty() )
{
QString lname = names.item( 0 ).toElement().text();
QString err;
if ( mNicknameLayers.contains( lname ) && !mRestrictedLayers.contains( lname ) )
{
mNicknameLayers[lname]->readSld( namedElem, err );
mNicknameLayers[lname]->setCustomProperty( "readSLD", true );
layers.append( mNicknameLayers[lname] );
}
else if ( mLayerGroups.contains( lname ) )
{
for ( QgsMapLayer *layer : mLayerGroups[lname] )
{
if ( !mRestrictedLayers.contains( layerNickname( *layer ) ) )
{
layer->readSld( namedElem, err );
layer->setCustomProperty( "readSLD", true );
layers.insert( 0, layer );
}
}
}
else
{
throw QgsBadRequestException( QStringLiteral( "LayerNotDefined" ),
QStringLiteral( "Layer \"%1\" does not exist" ).arg( lname ) );
}
}
}
}
}

return layers;
}

QList<QgsMapLayer *> QgsRenderer::stylizedLayers( const QList<QgsWmsParametersLayer> &params )
{
QList<QgsMapLayer *> layers;
@@ -3043,48 +2958,6 @@ namespace QgsWms
return scaledImage;
}

void QgsRenderer::checkLayerReadPermissions( QgsMapLayer *layer ) const
{
#ifdef HAVE_SERVER_PYTHON_PLUGINS
if ( !mAccessControl->layerReadPermission( layer ) )
{
throw QgsSecurityException( QStringLiteral( "You are not allowed to access to the layer: %1" ).arg( layer->name() ) );
}
#else
Q_UNUSED( layer );
#endif
}

void QgsRenderer::removeUnwantedLayers( QList<QgsMapLayer *> &layers, double scaleDenominator ) const
{
QList<QgsMapLayer *> wantedLayers;

for ( QgsMapLayer *layer : layers )
{
if ( !layerScaleVisibility( *layer, scaleDenominator ) )
continue;

if ( mRestrictedLayers.contains( layerNickname( *layer ) ) )
continue;

wantedLayers.append( layer );
}

layers = wantedLayers;
}

void QgsRenderer::removeNonIdentifiableLayers( QList<QgsMapLayer *> &layers ) const
{
QList<QgsMapLayer *>::iterator it = layers.begin();
while ( it != layers.end() )
{
if ( !( *it )->flags().testFlag( QgsMapLayer::Identifiable ) )
it = layers.erase( it );
else
++it;
}
}

QgsLayerTreeModel *QgsRenderer::buildLegendTreeModel( const QList<QgsMapLayer *> &layers, double scaleDenominator, QgsLayerTree &rootGroup )
{
// get params
@@ -63,13 +63,6 @@ namespace QgsWms
{
public:

/**
* Constructor. Does _NOT_ take ownership of
QgsConfigParser and QgsCapabilitiesCache*/
QgsRenderer( QgsServerInterface *serverIface,
const QgsProject *project,
const QgsWmsParameters &parameters );

QgsRenderer( const QgsWmsRenderContext &context );

~QgsRenderer();
@@ -137,16 +130,6 @@ namespace QgsWms
// the project configuration)
QString layerNickname( const QgsMapLayer &layer ) const;

// Return true if the layer has to be displayed according to he current
// scale
bool layerScaleVisibility( const QgsMapLayer &layer, double scaleDenominator ) const;

// Remove unwanted layers (restricted, not visible, etc)
void removeUnwantedLayers( QList<QgsMapLayer *> &layers, double scaleDenominator = -1 ) const;

// Remove non identifiable layers (restricted, not visible, etc)
void removeNonIdentifiableLayers( QList<QgsMapLayer *> &layers ) const;

// Rendering step for layers
QPainter *layersRendering( const QgsMapSettings &mapSettings, QImage &image, HitTest *hitTest = nullptr ) const;

@@ -156,9 +139,6 @@ namespace QgsWms
// Return a list of layers stylized with LAYERS/STYLES parameters
QList<QgsMapLayer *> stylizedLayers( const QList<QgsWmsParametersLayer> &params );

// Return a list of layers stylized with SLD parameter
QList<QgsMapLayer *> sldStylizedLayers( const QString &sld ) const;

// Set layer opacity
void setLayerOpacity( QgsMapLayer *layer, int opacity ) const;

@@ -177,9 +157,6 @@ namespace QgsWms
// Scale image with WIDTH/HEIGHT if necessary
QImage *scaleImage( const QImage *image ) const;

// Check layer read permissions
void checkLayerReadPermissions( QgsMapLayer *layer ) const;

// Build a layer tree model for legend
QgsLayerTreeModel *buildLegendTreeModel( const QList<QgsMapLayer *> &layers, double scaleDenominator, QgsLayerTree &rootGroup );

0 comments on commit dcd43dc

Please sign in to comment.
You can’t perform that action at this time.