30 mComposition( composition ),
33 mHideCoverage( false ), mFixedScale( false ), mMargin( 0.10 ), mFilenamePattern(
"'output_'||$feature" ),
34 mCoverageLayer( 0 ), mSingleFile( false ),
35 mSortFeatures( false ), mSortAscending( true ),
36 mFilterFeatures( false ), mFeatureFilter(
"" )
69 if (
mKeys[ id1 ].type() == QVariant::Int )
71 result =
mKeys[ id1 ].toInt() <
mKeys[ id2 ].toInt();
73 else if (
mKeys[ id1 ].type() == QVariant::Double )
75 result =
mKeys[ id1 ].toDouble() <
mKeys[ id2 ].toDouble();
77 else if (
mKeys[ id1 ].type() == QVariant::String )
79 result = ( QString::localeAwareCompare(
mKeys[ id1 ].toString(),
mKeys[ id2 ].toString() ) < 0 );
111 throw std::runtime_error(
tr(
"Filename parsing error: %1" ).arg(
mFilenameExpr->parserErrorString() ).toLocal8Bit().data() );
121 std::auto_ptr<QgsExpression> filterExpression;
125 if ( filterExpression->hasParserError() )
127 throw std::runtime_error(
tr(
"Feature filter parser error: %1" ).arg( filterExpression->parserErrorString() ).toLocal8Bit().data() );
141 if ( filterExpression->hasEvalError() )
143 throw std::runtime_error(
tr(
"Feature filter eval error: %1" ).arg( filterExpression->evalErrorString() ).toLocal8Bit().data() );
147 if ( !result.toBool() )
175 if ( removeAt != -1 )
178 layerSet.removeAt( removeAt );
195 QList<QgsComposerLabel*> labels;
197 for ( QList<QgsComposerLabel*>::iterator lit = labels.begin(); lit != labels.end(); ++lit )
199 ( *lit )->setExpressionContext( 0, 0 );
235 throw std::runtime_error(
tr(
"Filename eval error: %1" ).arg(
mFilenameExpr->evalErrorString() ).toLocal8Bit().data() );
268 double geom_center_x = ( xa1 + xa2 ) / 2.0;
269 double geom_center_y = ( ya1 + ya2 ) / 2.0;
281 double geom_ratio = geom_rect.
width() / geom_rect.
height();
285 if ( geom_ratio < map_ratio )
288 double adj_width = ( map_ratio * geom_rect.
height() - geom_rect.
width() ) / 2.0;
293 else if ( geom_ratio > map_ratio )
296 double adj_height = ( geom_rect.
width() / map_ratio - geom_rect.
height() ) / 2.0;
309 QList<QgsComposerLabel*> labels;
313 for ( QList<QgsComposerLabel*>::iterator lit = labels.begin(); lit != labels.end(); ++lit )
329 QDomElement atlasElem = doc.createElement(
"Atlas" );
330 atlasElem.setAttribute(
"enabled",
mEnabled ?
"true" :
"false" );
342 atlasElem.setAttribute(
"coverageLayer",
"" );
350 atlasElem.setAttribute(
"composerMap",
"" );
352 atlasElem.setAttribute(
"hideCoverage",
mHideCoverage ?
"true" :
"false" );
353 atlasElem.setAttribute(
"fixedScale",
mFixedScale ?
"true" :
"false" );
354 atlasElem.setAttribute(
"singleFile",
mSingleFile ?
"true" :
"false" );
355 atlasElem.setAttribute(
"margin", QString::number(
mMargin ) );
358 atlasElem.setAttribute(
"sortFeatures",
mSortFeatures ?
"true" :
"false" );
362 atlasElem.setAttribute(
"sortAscending",
mSortAscending ?
"true" :
"false" );
364 atlasElem.setAttribute(
"filterFeatures",
mFilterFeatures ?
"true" :
"false" );
370 elem.appendChild( atlasElem );
375 mEnabled = atlasElem.attribute(
"enabled",
"false" ) ==
"true" ?
true :
false;
385 for ( QMap<QString, QgsMapLayer*>::const_iterator it = layers.begin(); it != layers.end(); ++it )
387 if ( it.key() == atlasElem.attribute(
"coverageLayer" ) )
396 for ( QList<const QgsComposerMap*>::const_iterator it = maps.begin(); it != maps.end(); ++it )
398 if (( *it )->id() == atlasElem.attribute(
"composerMap" ).toInt() )
404 mMargin = atlasElem.attribute(
"margin",
"0.0" ).toDouble();
405 mHideCoverage = atlasElem.attribute(
"hideCoverage",
"false" ) ==
"true" ?
true :
false;
406 mFixedScale = atlasElem.attribute(
"fixedScale",
"false" ) ==
"true" ?
true :
false;
407 mSingleFile = atlasElem.attribute(
"singleFile",
"false" ) ==
"true" ?
true :
false;
410 mSortFeatures = atlasElem.attribute(
"sortFeatures",
"false" ) ==
"true" ?
true :
false;
414 mSortAscending = atlasElem.attribute(
"sortAscending",
"true" ) ==
"true" ?
true :
false;
416 mFilterFeatures = atlasElem.attribute(
"filterFeatures",
"false" ) ==
"true" ?
true :
false;