Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
More const correctness, fix crash with atlas
- Loading branch information
|
@@ -177,12 +177,12 @@ public: |
|
|
/**Prepare the atlas map for the given feature. Sets the extent and context variables |
|
|
* @returns true if feature was successfully prepared |
|
|
*/ |
|
|
bool prepareForFeature( int i ); |
|
|
bool prepareForFeature( const int i ); |
|
|
|
|
|
/**Prepare the atlas map for the given feature. Sets the extent and context variables |
|
|
* @returns true if feature was successfully prepared |
|
|
*/ |
|
|
bool prepareForFeature( QgsFeature * feat ); |
|
|
bool prepareForFeature( const QgsFeature * feat ); |
|
|
|
|
|
/** Returns the current filename. Must be called after prepareForFeature( i ) */ |
|
|
const QString& currentFilename() const; |
|
|
|
@@ -3531,7 +3531,7 @@ void QgsComposer::writeWorldFile( QString worldFileName, double a, double b, dou |
|
|
} |
|
|
|
|
|
|
|
|
void QgsComposer::setAtlasFeature( QgsMapLayer* layer, QgsFeature * feat ) |
|
|
void QgsComposer::setAtlasFeature( QgsMapLayer* layer, const QgsFeature * feat ) |
|
|
{ |
|
|
//update expression variables |
|
|
QgsExpression::setSpecialColumn( "$atlasfeatureid", feat->id() ); |
|
@@ -3581,7 +3581,7 @@ void QgsComposer::updateAtlasMapLayerAction( QgsVectorLayer *coverageLayer ) |
|
|
{ |
|
|
mAtlasFeatureAction = new QgsMapLayerAction( QString( tr( "Set as atlas feature for %1" ) ).arg( mTitle ), this, coverageLayer, QgsMapLayerAction::SingleFeature ); |
|
|
QgsMapLayerActionRegistry::instance()->addMapLayerAction( mAtlasFeatureAction ); |
|
|
connect( mAtlasFeatureAction, SIGNAL( triggeredForFeature( QgsMapLayer*, QgsFeature* ) ), this, SLOT( setAtlasFeature( QgsMapLayer*, QgsFeature* ) ) ); |
|
|
connect( mAtlasFeatureAction, SIGNAL( triggeredForFeature( QgsMapLayer*, const QgsFeature* ) ), this, SLOT( setAtlasFeature( QgsMapLayer*, const QgsFeature* ) ) ); |
|
|
} |
|
|
} |
|
|
|
|
@@ -3626,7 +3626,7 @@ void QgsComposer::updateAtlasMapLayerAction( bool atlasEnabled ) |
|
|
QgsAtlasComposition& atlas = mComposition->atlasComposition(); |
|
|
mAtlasFeatureAction = new QgsMapLayerAction( QString( tr( "Set as atlas feature for %1" ) ).arg( mTitle ), this, atlas.coverageLayer(), QgsMapLayerAction::SingleFeature ); |
|
|
QgsMapLayerActionRegistry::instance()->addMapLayerAction( mAtlasFeatureAction ); |
|
|
connect( mAtlasFeatureAction, SIGNAL( triggeredForFeature( QgsMapLayer*, QgsFeature* ) ), this, SLOT( setAtlasFeature( QgsMapLayer*, QgsFeature* ) ) ); |
|
|
connect( mAtlasFeatureAction, SIGNAL( triggeredForFeature( QgsMapLayer*, const QgsFeature* ) ), this, SLOT( setAtlasFeature( QgsMapLayer*, const QgsFeature* ) ) ); |
|
|
} |
|
|
} |
|
|
|
|
|
|
@@ -620,7 +620,7 @@ class QgsComposer: public QMainWindow, private Ui::QgsComposerBase |
|
|
|
|
|
//! Sets the specified feature as the current atlas feature |
|
|
//! @note added in 2.1 |
|
|
void setAtlasFeature( QgsMapLayer* layer, QgsFeature * feat ); |
|
|
void setAtlasFeature( QgsMapLayer* layer, const QgsFeature *feat ); |
|
|
|
|
|
//! Updates the "set as atlas feature" map layer action when atlas coverage layer changes |
|
|
void updateAtlasMapLayerAction( QgsVectorLayer* coverageLayer ); |
|
|
|
@@ -333,13 +333,19 @@ void QgsAtlasComposition::lastFeature() |
|
|
prepareForFeature( mFeatureIds.size() - 1 ); |
|
|
} |
|
|
|
|
|
bool QgsAtlasComposition::prepareForFeature( QgsFeature * feat ) |
|
|
bool QgsAtlasComposition::prepareForFeature( const QgsFeature * feat ) |
|
|
{ |
|
|
int featureI = mFeatureIds.indexOf( feat->id() ); |
|
|
if ( featureI < 0 ) |
|
|
{ |
|
|
//feature not found |
|
|
return false; |
|
|
} |
|
|
|
|
|
return prepareForFeature( featureI ); |
|
|
} |
|
|
|
|
|
bool QgsAtlasComposition::prepareForFeature( int featureI ) |
|
|
bool QgsAtlasComposition::prepareForFeature( const int featureI ) |
|
|
{ |
|
|
if ( !mCoverageLayer ) |
|
|
{ |
|
|
|
@@ -205,12 +205,12 @@ class CORE_EXPORT QgsAtlasComposition : public QObject |
|
|
/**Prepare the atlas map for the given feature. Sets the extent and context variables |
|
|
* @returns true if feature was successfully prepared |
|
|
*/ |
|
|
bool prepareForFeature( int i ); |
|
|
bool prepareForFeature( const int i ); |
|
|
|
|
|
/**Prepare the atlas map for the given feature. Sets the extent and context variables |
|
|
* @returns true if feature was successfully prepared |
|
|
*/ |
|
|
bool prepareForFeature( QgsFeature * feat ); |
|
|
bool prepareForFeature( const QgsFeature *feat ); |
|
|
|
|
|
/** Returns the current filename. Must be called after prepareForFeature( i ) */ |
|
|
const QString& currentFilename() const; |
|
|