Skip to content
Permalink
Browse files

[composer] Cleanup handling of wms layer/advanced effect detection

  • Loading branch information
nyalldawson committed Jan 16, 2017
1 parent 8a9cee0 commit f96364e8dc1a0b83a992e8419acbafbe1142a412
Showing with 15 additions and 24 deletions.
  1. +12 −22 src/app/composer/qgscomposer.cpp
  2. +3 −2 src/core/composer/qgscomposermap.cpp
@@ -3800,45 +3800,35 @@ void QgsComposer::setSelectionTool()

bool QgsComposer::containsWmsLayer() const
{
QMap<QgsComposerItem*, QgsPanelWidget*>::const_iterator item_it = mItemWidgetMap.constBegin();
QgsComposerItem* currentItem = nullptr;
QgsComposerMap* currentMap = nullptr;
QList< QgsComposerMap *> maps;
mComposition->composerItems( maps );

for ( ; item_it != mItemWidgetMap.constEnd(); ++item_it )
Q_FOREACH ( QgsComposerMap* map, maps )
{
currentItem = item_it.key();
currentMap = dynamic_cast<QgsComposerMap *>( currentItem );
if ( currentMap )
{
if ( currentMap->containsWmsLayer() )
{
return true;
}
}
if ( map->containsWmsLayer() )
return true;
}
return false;
}

bool QgsComposer::containsAdvancedEffects() const
{
// Check if composer contains any blend modes or flattened layers for transparency
QMap<QgsComposerItem*, QgsPanelWidget*>::const_iterator item_it = mItemWidgetMap.constBegin();
QgsComposerItem* currentItem = nullptr;
QgsComposerMap* currentMap = nullptr;
QList< QgsComposerItem *> items;
mComposition->composerItems( items );

for ( ; item_it != mItemWidgetMap.constEnd(); ++item_it )
Q_FOREACH ( QgsComposerItem* currentItem, items )
{
currentItem = item_it.key();
// Check composer item's blend mode
if ( currentItem->blendMode() != QPainter::CompositionMode_SourceOver )
{
return true;
}

// If item is a composer map, check if it contains any advanced effects
currentMap = dynamic_cast<QgsComposerMap *>( currentItem );
if ( currentMap && currentMap->containsAdvancedEffects() )
if ( QgsComposerMap * currentMap = dynamic_cast<QgsComposerMap *>( currentItem ) )
{
return true;
if ( currentMap->containsAdvancedEffects() )
return true;
}
}
return false;
@@ -1128,7 +1128,7 @@ void QgsComposerMap::updateItem()

bool QgsComposerMap::containsWmsLayer() const
{
Q_FOREACH ( QgsMapLayer* layer, mComposition->mapSettings().layers() )
Q_FOREACH ( QgsMapLayer* layer, layersToRender() )
{
if ( QgsRasterLayer* currentRasterLayer = qobject_cast<QgsRasterLayer *>( layer ) )
{
@@ -1164,7 +1164,7 @@ bool QgsComposerMap::containsAdvancedEffects() const
// check if map contains advanced effects like blend modes, or flattened layers for transparency

QgsTextFormat layerFormat;
Q_FOREACH ( QgsMapLayer* layer, mComposition->mapSettings().layers() )
Q_FOREACH ( QgsMapLayer* layer, layersToRender() )
{
if ( layer )
{
@@ -1188,6 +1188,7 @@ bool QgsComposerMap::containsAdvancedEffects() const
if ( QgsPalLabeling::staticWillUseLayer( currentVectorLayer ) )
{
// Check all label blending properties

layerFormat.readFromLayer( currentVectorLayer );
if ( layerFormat.containsAdvancedEffects() )
return true;

0 comments on commit f96364e

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