Skip to content
Permalink
Browse files

Merge pull request #278 from Oslandia/atlas

Fix atlas parameter loading when loading from a template composer
  • Loading branch information
mhugent committed Oct 8, 2012
2 parents 3f412e4 + 6c652a0 commit 301279446491f9f7fa8fc313e4a8f2b929192ff6
Showing with 9 additions and 13 deletions.
  1. +4 −3 src/app/composer/qgsatlascompositionwidget.cpp
  2. +5 −10 src/core/composer/qgscomposition.cpp
@@ -36,7 +36,7 @@ QgsAtlasCompositionWidget::QgsAtlasCompositionWidget( QWidget* parent, QgsCompos
// Only consider vector layers
if ( dynamic_cast<QgsVectorLayer*>(it.value()) )
{
mAtlasCoverageLayerComboBox->insertItem( idx++, it.key(), /* userdata */ qVariantFromValue( (void*)it.value() ) );
mAtlasCoverageLayerComboBox->insertItem( idx++, it.value()->name(), /* userdata */ qVariantFromValue( (void*)it.value() ) );
}
}

@@ -93,7 +93,8 @@ void QgsAtlasCompositionWidget::onLayerRemoved( QString layerName )
// update the atlas coverage layer combo box
for ( int i = 0; i < mAtlasCoverageLayerComboBox->count(); ++i )
{
if ( mAtlasCoverageLayerComboBox->itemText( i ) == layerName )
const QgsMapLayer* layer = reinterpret_cast<const QgsMapLayer*>( mAtlasCoverageLayerComboBox->itemData( i ).value<void*>() );
if ( layer->id() == layerName )
{
mAtlasCoverageLayerComboBox->removeItem( i );
break;
@@ -112,7 +113,7 @@ void QgsAtlasCompositionWidget::onLayerAdded( QgsMapLayer* map )
QgsVectorLayer* vectorLayer = dynamic_cast<QgsVectorLayer*>( map );
if ( vectorLayer )
{
mAtlasCoverageLayerComboBox->addItem( map->id(), qVariantFromValue( (void*)map ) );
mAtlasCoverageLayerComboBox->addItem( map->name(), qVariantFromValue( (void*)map ) );
}
if ( mAtlasCoverageLayerComboBox->count() == 1 )
{
@@ -431,6 +431,11 @@ bool QgsComposition::loadFromTemplate( const QDomDocument& doc, QMap<QString, QS

//addItemsFromXML
addItemsFromXML( importDoc.documentElement(), importDoc, 0, addUndoCommands, 0 );

// read atlas parameters
QDomElement atlasElem = importDoc.documentElement().firstChildElement( "Atlas" );
atlasComposition().readXML( atlasElem, importDoc );

return true;
}

@@ -1629,13 +1634,3 @@ QString QgsComposition::encodeStringForXML( const QString& str )
return modifiedStr;
}

#if 0
void QgsComposition::setAtlasComposerMap( QgsAtlasComposerMap* map )
{
if ( mAtlasComposerMap != 0 )
{
delete mAtlasComposerMap;
}
mAtlasComposerMap = map;
}
#endif

0 comments on commit 3012794

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