Skip to content

Commit

Permalink
[composer] Remove support for upgrading pre 2.2 project atlas map
Browse files Browse the repository at this point in the history
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 6ffe507
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 63 deletions.
3 changes: 2 additions & 1 deletion doc/api_break.dox
Expand Up @@ -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()
Expand Down
9 changes: 0 additions & 9 deletions python/core/composer/qgsatlascomposition.sip
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions src/app/composer/qgscomposer.cpp
Expand Up @@ -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() );
Expand Down
34 changes: 0 additions & 34 deletions src/core/composer/qgsatlascomposition.cpp
Expand Up @@ -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;
Expand Down
9 changes: 0 additions & 9 deletions src/core/composer/qgsatlascomposition.h
Expand Up @@ -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
Expand Down
6 changes: 0 additions & 6 deletions src/core/composer/qgscomposition.cpp
Expand Up @@ -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;
}

Expand Down

0 comments on commit 6ffe507

Please sign in to comment.