Skip to content
Permalink
Browse files

[composer] Remove support for upgrading pre 2.2 project atlas map

settings

Open the project in a recent 2.x release and resave to upgrade
the project
  • Loading branch information
nyalldawson committed Jan 14, 2017
1 parent b548063 commit 6ffe50704f7d011624de6d1bce774638d2b97dbb
@@ -399,7 +399,8 @@ QgsAdvancedDigitizingDockWidget {#qgis_api_break_3_0_QgsAdvancedDigitizin
QgsAtlasComposition {#qgis_api_break_3_0_QgsAtlasComposition}
-------------------

- readXMLMapSettings() has been renamed to readXmlMapSettings()
- readXMLMapSettings() was removed. QGIS no longer supports upgrading pre 2.2 compositions and if this is a
requirement the projects should first be upgraded by opening and saving in 2.18.
- composerMap() and setComposerMap() were removed. Use QgsComposerMap::atlasDriven() and setAtlasDriven()
instead
- fixedScale() and setFixedScale() were removed. Use QgsComposerMap::atlasScalingMode() and setAtlasScalingMode()
@@ -189,15 +189,6 @@ public:
*/
void readXml( const QDomElement& elem, const QDomDocument& doc );

/** Reads old (pre 2.2) map related atlas settings from xml
* @param elem a QDomElement holding the atlas map properties.
* @param doc QDomDocument for the source xml.
* @see readXMLMapSettings
* @note This method should be called after restoring composer item properties
* @note added in version 2.5
*/
void readXmlMapSettings( const QDomElement& elem, const QDomDocument& doc );

QgsComposition* composition();

/** Requeries the current atlas coverage layer and applies filtering and sorting. Returns
@@ -3588,10 +3588,6 @@ void QgsComposer::readXml( const QDomElement& composerElem, const QDomDocument&
delete oldAtlasWidget;
mAtlasDock->setWidget( new QgsAtlasCompositionWidget( mAtlasDock, mComposition ) );

//read atlas map parameters (for pre 2.2 templates)
//this part must be done after adding items
mComposition->atlasComposition().readXmlMapSettings( atlasElem, doc );

//set state of atlas controls
QgsAtlasComposition* atlasMap = &mComposition->atlasComposition();
toggleAtlasControls( atlasMap->enabled() );
@@ -661,40 +661,6 @@ void QgsAtlasComposition::readXml( const QDomElement& atlasElem, const QDomDocum
emit parameterChanged();
}

void QgsAtlasComposition::readXmlMapSettings( const QDomElement &elem, const QDomDocument &doc )
{
Q_UNUSED( doc );
//look for stored composer map, to upgrade pre 2.1 projects
int composerMapNo = elem.attribute( QStringLiteral( "composerMap" ), QStringLiteral( "-1" ) ).toInt();
QgsComposerMap * composerMap = nullptr;
if ( composerMapNo != -1 )
{
QList<QgsComposerMap*> maps;
mComposition->composerItems( maps );
for ( QList<QgsComposerMap*>::iterator it = maps.begin(); it != maps.end(); ++it )
{
if (( *it )->id() == composerMapNo )
{
composerMap = ( *it );
composerMap->setAtlasDriven( true );
break;
}
}
}

//upgrade pre 2.1 projects
double margin = elem.attribute( QStringLiteral( "margin" ), QStringLiteral( "0.0" ) ).toDouble();
if ( composerMap && !qgsDoubleNear( margin, 0.0 ) )
{
composerMap->setAtlasMargin( margin );
}
bool fixedScale = elem.attribute( QStringLiteral( "fixedScale" ), QStringLiteral( "false" ) ) == QLatin1String( "true" ) ? true : false;
if ( composerMap && fixedScale )
{
composerMap->setAtlasScalingMode( QgsComposerMap::Fixed );
}
}

void QgsAtlasComposition::setHideCoverage( bool hide )
{
mHideCoverage = hide;
@@ -220,15 +220,6 @@ class CORE_EXPORT QgsAtlasComposition : public QObject
*/
void readXml( const QDomElement& elem, const QDomDocument& doc );

/** Reads old (pre 2.2) map related atlas settings from xml
* @param elem a QDomElement holding the atlas map properties.
* @param doc QDomDocument for the source xml.
* @see readXMLMapSettings
* @note This method should be called after restoring composer item properties
* @note added in version 2.5
*/
void readXmlMapSettings( const QDomElement& elem, const QDomDocument& doc );

QgsComposition* composition() { return mComposition; }

/** Requeries the current atlas coverage layer and applies filtering and sorting. Returns
@@ -1084,12 +1084,6 @@ bool QgsComposition::loadFromTemplate( const QDomDocument& doc, QMap<QString, QS
//addItemsFromXML
addItemsFromXml( importDoc.documentElement(), importDoc, nullptr, addUndoCommands, nullptr );

//read atlas map parameters (for pre 2.2 templates)
//this can only be done after items have been added
if ( clearComposition )
{
atlasComposition().readXmlMapSettings( atlasElem, importDoc );
}
return true;
}

0 comments on commit 6ffe507

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