Skip to content

Commit d07dadf

Browse files
committedJul 23, 2015
[FEATURE][composer] Add page number combo box to atlas toolbar
(fix #13136)
1 parent b431187 commit d07dadf

File tree

5 files changed

+140
-59
lines changed

5 files changed

+140
-59
lines changed
 

‎python/core/composer/qgsatlascomposition.sip

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,11 @@ public:
216216

217217
/** Returns the current atlas feature. Must be called after prepareForFeature( i ). */
218218
QgsFeature* currentFeature();
219+
220+
/** Returns the current feature number.
221+
* @note added in QGIS 2.12
222+
*/
223+
int currentFeatureNumber() const;
219224

220225
/** Recalculates the bounds of an atlas driven map */
221226
void prepareMap( QgsComposerMap* map );
@@ -253,5 +258,9 @@ public:
253258

254259
/**Is emitted when the current atlas feature changes*/
255260
void featureChanged( QgsFeature* feature );
256-
261+
262+
/** Is emitted when the number of features for the atlas changes.
263+
* @note added in QGIS 2.12
264+
*/
265+
void numberFeaturesChanged( int numFeatures );
257266
};

‎src/app/composer/qgscomposer.cpp

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,17 @@ QgsComposer::QgsComposer( QgisApp *qgis, const QString& title )
407407
atlasExportToolButton->addAction( mActionExportAtlasAsPDF );
408408
atlasExportToolButton->setDefaultAction( mActionExportAtlasAsImage );
409409
mAtlasToolbar->insertWidget( mActionAtlasSettings, atlasExportToolButton );
410+
mAtlasPageComboBox = new QComboBox();
411+
mAtlasPageComboBox->setEditable( true );
412+
mAtlasPageComboBox->addItem( QString::number( 1 ) );
413+
mAtlasPageComboBox->setCurrentIndex( 0 );
414+
mAtlasPageComboBox->setMinimumHeight( mAtlasToolbar->height() );
415+
mAtlasPageComboBox->setMinimumContentsLength( 6 );
416+
mAtlasPageComboBox->setMaxVisibleItems( 20 );
417+
mAtlasPageComboBox->setInsertPolicy( QComboBox::NoInsert );
418+
connect( mAtlasPageComboBox->lineEdit(), SIGNAL( editingFinished() ), this, SLOT( atlasPageComboEditingFinished() ) );
419+
connect( mAtlasPageComboBox, SIGNAL( currentIndexChanged( QString ) ), this, SLOT( atlasPageComboEditingFinished() ) );
420+
mAtlasToolbar->insertWidget( mActionAtlasNext, mAtlasPageComboBox );
410421

411422
QMenu *settingsMenu = menuBar()->addMenu( tr( "&Settings" ) );
412423
settingsMenu->addAction( mActionOptions );
@@ -613,12 +624,14 @@ QgsComposer::QgsComposer( QgisApp *qgis, const QString& title )
613624
mActionAtlasNext->setEnabled( false );
614625
mActionAtlasPrev->setEnabled( false );
615626
mActionPrintAtlas->setEnabled( false );
627+
mAtlasPageComboBox->setEnabled( false );
616628
mActionExportAtlasAsImage->setEnabled( false );
617629
mActionExportAtlasAsSVG->setEnabled( false );
618630
mActionExportAtlasAsPDF->setEnabled( false );
619631
QgsAtlasComposition* atlasMap = &mComposition->atlasComposition();
620632
connect( atlasMap, SIGNAL( toggled( bool ) ), this, SLOT( toggleAtlasControls( bool ) ) );
621633
connect( atlasMap, SIGNAL( coverageLayerChanged( QgsVectorLayer* ) ), this, SLOT( updateAtlasMapLayerAction( QgsVectorLayer * ) ) );
634+
connect( atlasMap, SIGNAL( numberFeaturesChanged( int ) ), this, SLOT( updateAtlasPageComboBox( int ) ) );
622635

623636
//default printer page setup
624637
setPrinterPageDefaults();
@@ -968,6 +981,7 @@ void QgsComposer::toggleAtlasControls( bool atlasEnabled )
968981
mActionAtlasLast->setEnabled( false );
969982
mActionAtlasNext->setEnabled( false );
970983
mActionAtlasPrev->setEnabled( false );
984+
mAtlasPageComboBox->setEnabled( false );
971985
mActionAtlasPreview->blockSignals( false );
972986
mActionAtlasPreview->setEnabled( atlasEnabled );
973987
mActionPrintAtlas->setEnabled( atlasEnabled );
@@ -978,6 +992,20 @@ void QgsComposer::toggleAtlasControls( bool atlasEnabled )
978992
updateAtlasMapLayerAction( atlasEnabled );
979993
}
980994

995+
void QgsComposer::updateAtlasPageComboBox( int pageCount )
996+
{
997+
if ( pageCount == mAtlasPageComboBox->count() )
998+
return;
999+
1000+
mAtlasPageComboBox->blockSignals( true );
1001+
mAtlasPageComboBox->clear();
1002+
for ( int i = 1; i <= pageCount && i < 500; ++i )
1003+
{
1004+
mAtlasPageComboBox->addItem( QString::number( i ), i );
1005+
}
1006+
mAtlasPageComboBox->blockSignals( false );
1007+
}
1008+
9811009
void QgsComposer::on_mActionAtlasPreview_triggered( bool checked )
9821010
{
9831011
QgsAtlasComposition* atlasMap = &mComposition->atlasComposition();
@@ -1002,6 +1030,7 @@ void QgsComposer::on_mActionAtlasPreview_triggered( bool checked )
10021030
mActionAtlasLast->setEnabled( checked );
10031031
mActionAtlasNext->setEnabled( checked );
10041032
mActionAtlasPrev->setEnabled( checked );
1033+
mAtlasPageComboBox->setEnabled( checked );
10051034

10061035
if ( checked )
10071036
{
@@ -1022,6 +1051,7 @@ void QgsComposer::on_mActionAtlasPreview_triggered( bool checked )
10221051
mActionAtlasLast->setEnabled( false );
10231052
mActionAtlasNext->setEnabled( false );
10241053
mActionAtlasPrev->setEnabled( false );
1054+
mAtlasPageComboBox->setEnabled( false );
10251055
mActionAtlasPreview->blockSignals( false );
10261056
mStatusAtlasLabel->setText( QString() );
10271057
return;
@@ -1036,10 +1066,8 @@ void QgsComposer::on_mActionAtlasPreview_triggered( bool checked )
10361066
{
10371067
mStatusAtlasLabel->setText( QString() );
10381068
}
1039-
10401069
}
10411070

1042-
10431071
void QgsComposer::on_mActionAtlasNext_triggered()
10441072
{
10451073
QgsAtlasComposition* atlasMap = &mComposition->atlasComposition();
@@ -1100,6 +1128,23 @@ void QgsComposer::on_mActionAtlasLast_triggered()
11001128
emit atlasPreviewFeatureChanged();
11011129
}
11021130

1131+
void QgsComposer::atlasPageComboEditingFinished()
1132+
{
1133+
QString text = mAtlasPageComboBox->lineEdit()->text();
1134+
bool ok = false;
1135+
int page = text.toInt( &ok );
1136+
if ( !ok || page >= mComposition->atlasComposition().numFeatures() )
1137+
{
1138+
mAtlasPageComboBox->blockSignals( true );
1139+
mAtlasPageComboBox->setCurrentIndex( mComposition->atlasComposition().currentFeatureNumber() );
1140+
mAtlasPageComboBox->blockSignals( false );
1141+
}
1142+
else if ( page != mComposition->atlasComposition().currentFeatureNumber() + 1 )
1143+
{
1144+
mComposition->atlasComposition().prepareForFeature( page - 1 );
1145+
}
1146+
}
1147+
11031148
QgsMapCanvas *QgsComposer::mapCanvas( void )
11041149
{
11051150
return mQgis->mapCanvas();
@@ -1415,6 +1460,7 @@ void QgsComposer::setComposition( QgsComposition* composition )
14151460
toggleAtlasControls( atlasMap->enabled() );
14161461
connect( atlasMap, SIGNAL( toggled( bool ) ), this, SLOT( toggleAtlasControls( bool ) ) );
14171462
connect( atlasMap, SIGNAL( coverageLayerChanged( QgsVectorLayer* ) ), this, SLOT( updateAtlasMapLayerAction( QgsVectorLayer * ) ) );
1463+
connect( atlasMap, SIGNAL( numberFeaturesChanged( int ) ), this, SLOT( updateAtlasPageComboBox( int ) ) );
14181464

14191465
//default printer page setup
14201466
setPrinterPageDefaults();
@@ -3233,6 +3279,7 @@ void QgsComposer::readXML( const QDomElement& composerElem, const QDomDocument&
32333279
toggleAtlasControls( atlasMap->enabled() );
32343280
connect( atlasMap, SIGNAL( toggled( bool ) ), this, SLOT( toggleAtlasControls( bool ) ) );
32353281
connect( atlasMap, SIGNAL( coverageLayerChanged( QgsVectorLayer* ) ), this, SLOT( updateAtlasMapLayerAction( QgsVectorLayer * ) ) );
3282+
connect( atlasMap, SIGNAL( numberFeaturesChanged( int ) ), this, SLOT( updateAtlasPageComboBox( int ) ) );
32363283

32373284
//default printer page setup
32383285
setPrinterPageDefaults();
@@ -3716,6 +3763,7 @@ void QgsComposer::setAtlasFeature( QgsMapLayer* layer, const QgsFeature& feat )
37163763
mActionAtlasLast->setEnabled( true );
37173764
mActionAtlasNext->setEnabled( true );
37183765
mActionAtlasPrev->setEnabled( true );
3766+
mAtlasPageComboBox->setEnabled( true );
37193767
}
37203768

37213769
//bring composer window to foreground

‎src/app/composer/qgscomposer.h

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,9 @@ class QgsComposer: public QMainWindow, private Ui::QgsComposerBase
343343
//!Last atlas feature
344344
void on_mActionAtlasLast_triggered();
345345

346+
//!Jump to a specific atlas page
347+
void atlasPageComboEditingFinished();
348+
346349
//! Print the atlas
347350
void on_mActionPrintAtlas_triggered();
348351

@@ -367,40 +370,40 @@ class QgsComposer: public QMainWindow, private Ui::QgsComposerBase
367370
//! Save window state
368371
void saveWindowState();
369372

370-
/**Add a composer arrow to the item/widget map and creates a configuration widget for it*/
373+
/** Add a composer arrow to the item/widget map and creates a configuration widget for it*/
371374
void addComposerArrow( QgsComposerArrow* arrow );
372375

373-
/**Add a composer map to the item/widget map and creates a configuration widget for it*/
376+
/** Add a composer map to the item/widget map and creates a configuration widget for it*/
374377
void addComposerMap( QgsComposerMap* map );
375378

376-
/**Adds a composer label to the item/widget map and creates a configuration widget for it*/
379+
/** Adds a composer label to the item/widget map and creates a configuration widget for it*/
377380
void addComposerLabel( QgsComposerLabel* label );
378381

379-
/**Adds a composer scale bar to the item/widget map and creates a configuration widget for it*/
382+
/** Adds a composer scale bar to the item/widget map and creates a configuration widget for it*/
380383
void addComposerScaleBar( QgsComposerScaleBar* scalebar );
381384

382-
/**Adds a composer legend to the item/widget map and creates a configuration widget for it*/
385+
/** Adds a composer legend to the item/widget map and creates a configuration widget for it*/
383386
void addComposerLegend( QgsComposerLegend* legend );
384387

385-
/**Adds a composer picture to the item/widget map and creates a configuration widget*/
388+
/** Adds a composer picture to the item/widget map and creates a configuration widget*/
386389
void addComposerPicture( QgsComposerPicture* picture );
387390

388-
/**Adds a composer shape to the item/widget map and creates a configuration widget*/
391+
/** Adds a composer shape to the item/widget map and creates a configuration widget*/
389392
void addComposerShape( QgsComposerShape* shape );
390393

391-
/**Adds a composer table to the item/widget map and creates a configuration widget*/
394+
/** Adds a composer table to the item/widget map and creates a configuration widget*/
392395
void addComposerTable( QgsComposerAttributeTable* table );
393396

394-
/**Adds a composer table v2 to the item/widget map and creates a configuration widget*/
397+
/** Adds a composer table v2 to the item/widget map and creates a configuration widget*/
395398
void addComposerTableV2( QgsComposerAttributeTableV2* table, QgsComposerFrame* frame );
396399

397-
/**Adds composer html and creates a configuration widget*/
400+
/** Adds composer html and creates a configuration widget*/
398401
void addComposerHtmlFrame( QgsComposerHtml* html, QgsComposerFrame* frame );
399402

400-
/**Removes item from the item/widget map and deletes the configuration widget. Does not delete the item itself*/
403+
/** Removes item from the item/widget map and deletes the configuration widget. Does not delete the item itself*/
401404
void deleteItem( QgsComposerItem* item );
402405

403-
/**Shows the configuration widget for a composer item*/
406+
/** Shows the configuration widget for a composer item*/
404407
void showItemOptions( QgsComposerItem* i );
405408

406409
//XML, usually connected with QgsProject::readProject and QgsProject::writeProject
@@ -438,19 +441,19 @@ class QgsComposer: public QMainWindow, private Ui::QgsComposerBase
438441

439442
private:
440443

441-
/**Establishes the signal slot connections from the QgsComposerView to the composer*/
444+
/** Establishes the signal slot connections from the QgsComposerView to the composer*/
442445
void connectViewSlots();
443446

444-
/**Establishes the signal slot connections from the QgsComposition to the composer*/
447+
/** Establishes the signal slot connections from the QgsComposition to the composer*/
445448
void connectCompositionSlots();
446449

447-
/**Establishes other signal slot connections for the composer*/
450+
/** Establishes other signal slot connections for the composer*/
448451
void connectOtherSlots();
449452

450-
/**Creates the composition widget*/
453+
/** Creates the composition widget*/
451454
void createCompositionWidget();
452455

453-
/**Sets up the compositions undo/redo connections*/
456+
/** Sets up the compositions undo/redo connections*/
454457
void setupUndoView();
455458

456459
//! True if a composer map contains a WMS layer
@@ -510,19 +513,19 @@ class QgsComposer: public QMainWindow, private Ui::QgsComposerBase
510513

511514
QPrinter* printer();
512515

513-
/**Composer title*/
516+
/** Composer title*/
514517
QString mTitle;
515518

516-
/**Labels in status bar which shows current mouse position*/
519+
/** Labels in status bar which shows current mouse position*/
517520
QLabel* mStatusCursorXLabel;
518521
QLabel* mStatusCursorYLabel;
519522
QLabel* mStatusCursorPageLabel;
520-
/**Combobox in status bar which shows/adjusts current zoom level*/
523+
/** Combobox in status bar which shows/adjusts current zoom level*/
521524
QComboBox* mStatusZoomCombo;
522525
QList<double> mStatusZoomLevelsList;
523-
/**Label in status bar which shows messages from the composition*/
526+
/** Label in status bar which shows messages from the composition*/
524527
QLabel* mStatusCompositionLabel;
525-
/**Label in status bar which shows atlas details*/
528+
/** Label in status bar which shows atlas details*/
526529
QLabel* mStatusAtlasLabel;
527530

528531
//! Pointer to composer view
@@ -570,6 +573,8 @@ class QgsComposer: public QMainWindow, private Ui::QgsComposerBase
570573
QAction *mActionPreviewProtanope;
571574
QAction *mActionPreviewDeuteranope;
572575

576+
QComboBox* mAtlasPageComboBox;
577+
573578
//! We load composer map content from project xml only on demand. Therefore we need to store the real preview mode type
574579
QMap< QgsComposerMap*, int > mMapsToRestore;
575580

@@ -649,6 +654,9 @@ class QgsComposer: public QMainWindow, private Ui::QgsComposerBase
649654

650655
void dockVisibilityChanged( bool visible );
651656

657+
/** Repopulates the atlas page combo box with valid items.
658+
*/
659+
void updateAtlasPageComboBox( int pageCount );
652660
};
653661

654662
#endif

‎src/core/composer/qgsatlascomposition.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ int QgsAtlasComposition::updateFeatures()
263263
}
264264

265265
QgsExpression::setSpecialColumn( "$numfeatures", QVariant(( int )mFeatureIds.size() ) );
266+
emit numberFeaturesChanged( mFeatureIds.size() );
266267

267268
//jump to first feature if currently using an atlas preview
268269
//need to do this in case filtering/layer change has altered matching features
@@ -396,6 +397,11 @@ bool QgsAtlasComposition::prepareForFeature( const int featureI, const bool upda
396397
return false;
397398
}
398399

400+
if ( featureI >= mFeatureIds.size() )
401+
{
402+
return false;
403+
}
404+
399405
mCurrentFeatureNo = featureI;
400406

401407
// retrieve the next feature, based on its id

‎src/core/composer/qgsatlascomposition.h

Lines changed: 44 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -45,61 +45,61 @@ class CORE_EXPORT QgsAtlasComposition : public QObject
4545
QgsAtlasComposition( QgsComposition* composition );
4646
~QgsAtlasComposition();
4747

48-
/**Returns whether the atlas generation is enabled
48+
/** Returns whether the atlas generation is enabled
4949
* @returns true if atlas is enabled
5050
* @see setEnabled
5151
*/
5252
bool enabled() const { return mEnabled; }
5353

54-
/**Sets whether the atlas is enabled
54+
/** Sets whether the atlas is enabled
5555
* @param enabled set to true to enable to atlas
5656
* @see enabled
5757
*/
5858
void setEnabled( bool enabled );
5959

60-
/**Returns the map used by the atlas
60+
/** Returns the map used by the atlas
6161
* @deprecated Use QgsComposerMap::atlasDriven() instead
6262
*/
6363
Q_DECL_DEPRECATED QgsComposerMap* composerMap() const;
6464

65-
/**Sets the map used by the atlas
65+
/** Sets the map used by the atlas
6666
* @deprecated Use QgsComposerMap::setAtlasDriven( true ) instead
6767
*/
6868
Q_DECL_DEPRECATED void setComposerMap( QgsComposerMap* map );
6969

70-
/**Returns true if the atlas is set to hide the coverage layer
70+
/** Returns true if the atlas is set to hide the coverage layer
7171
* @returns true if coverage layer is hidden
7272
* @see setHideCoverage
7373
*/
7474
bool hideCoverage() const { return mHideCoverage; }
7575

76-
/**Sets whether the coverage layer should be hidden in map items in the composition
76+
/** Sets whether the coverage layer should be hidden in map items in the composition
7777
* @param hide set to true to hide the coverage layer
7878
* @see hideCoverage
7979
*/
8080
void setHideCoverage( bool hide );
8181

82-
/**Returns whether the atlas map uses a fixed scale
82+
/** Returns whether the atlas map uses a fixed scale
8383
* @deprecated since 2.4 Use QgsComposerMap::atlasScalingMode() instead
8484
*/
8585
Q_DECL_DEPRECATED bool fixedScale() const;
8686

87-
/**Sets whether the atlas map should use a fixed scale
87+
/** Sets whether the atlas map should use a fixed scale
8888
* @deprecated since 2.4 Use QgsComposerMap::setAtlasScalingMode() instead
8989
*/
9090
Q_DECL_DEPRECATED void setFixedScale( bool fixed );
9191

92-
/**Returns the margin for the atlas map
92+
/** Returns the margin for the atlas map
9393
* @deprecated Use QgsComposerMap::atlasMargin() instead
9494
*/
9595
Q_DECL_DEPRECATED float margin() const;
9696

97-
/**Sets the margin for the atlas map
97+
/** Sets the margin for the atlas map
9898
* @deprecated Use QgsComposerMap::setAtlasMargin( double ) instead
9999
*/
100100
Q_DECL_DEPRECATED void setMargin( float margin );
101101

102-
/**Returns the filename expression used for generating output filenames for each
102+
/** Returns the filename expression used for generating output filenames for each
103103
* atlas page.
104104
* @returns filename pattern
105105
* @see setFilenamePattern
@@ -108,7 +108,7 @@ class CORE_EXPORT QgsAtlasComposition : public QObject
108108
*/
109109
QString filenamePattern() const { return mFilenamePattern; }
110110

111-
/**Sets the filename expression used for generating output filenames for each
111+
/** Sets the filename expression used for generating output filenames for each
112112
* atlas page.
113113
* @returns true if filename expression could be successful set, false if expression is invalid
114114
* @param pattern expression to use for output filenames
@@ -118,34 +118,34 @@ class CORE_EXPORT QgsAtlasComposition : public QObject
118118
*/
119119
bool setFilenamePattern( const QString& pattern );
120120

121-
/**Returns an error string from parsing the filename expression.
121+
/** Returns an error string from parsing the filename expression.
122122
* @returns filename pattern parser error
123123
* @see setFilenamePattern
124124
* @see filenamePattern
125125
*/
126126
QString filenamePatternErrorString() const { return mFilenameParserError; }
127127

128-
/**Returns the coverage layer used for the atlas features
128+
/** Returns the coverage layer used for the atlas features
129129
* @returns atlas coverage layer
130130
* @see setCoverageLayer
131131
*/
132132
QgsVectorLayer* coverageLayer() const { return mCoverageLayer; }
133133

134-
/**Sets the coverage layer to use for the atlas features
134+
/** Sets the coverage layer to use for the atlas features
135135
* @param layer vector coverage layer
136136
* @see coverageLayer
137137
*/
138138
void setCoverageLayer( QgsVectorLayer* layer );
139139

140-
/**Returns whether the atlas will be exported to a single file. This is only
140+
/** Returns whether the atlas will be exported to a single file. This is only
141141
* applicable for PDF exports.
142142
* @returns true if atlas will be exported to a single file
143143
* @see setSingleFile
144144
* @note This property is only used for PDF exports.
145145
*/
146146
bool singleFile() const { return mSingleFile; }
147147

148-
/**Sets whether the atlas should be exported to a single file. This is only
148+
/** Sets whether the atlas should be exported to a single file. This is only
149149
* applicable for PDF exports.
150150
* @param single set to true to export atlas to a single file.
151151
* @see singleFile
@@ -165,7 +165,7 @@ class CORE_EXPORT QgsAtlasComposition : public QObject
165165
QString featureFilter() const { return mFeatureFilter; }
166166
void setFeatureFilter( const QString& expression ) { mFeatureFilter = expression; }
167167

168-
/**Returns an error string from parsing the feature filter expression.
168+
/** Returns an error string from parsing the feature filter expression.
169169
* @returns filename pattern parser error
170170
* @see setFilenamePattern
171171
* @see filenamePattern
@@ -178,15 +178,15 @@ class CORE_EXPORT QgsAtlasComposition : public QObject
178178
Q_DECL_DEPRECATED int sortKeyAttributeIndex() const;
179179
Q_DECL_DEPRECATED void setSortKeyAttributeIndex( int idx );
180180

181-
/**Returns the current list of predefined scales for the atlas. This is used
181+
/** Returns the current list of predefined scales for the atlas. This is used
182182
* for maps which are set to the predefined atlas scaling mode.
183183
* @returns a vector of doubles representing predefined scales
184184
* @see setPredefinedScales
185185
* @see QgsComposerMap::atlasScalingMode
186186
*/
187187
const QVector<qreal>& predefinedScales() const { return mPredefinedScales; }
188188

189-
/**Sets the list of predefined scales for the atlas. This is used
189+
/** Sets the list of predefined scales for the atlas. This is used
190190
* for maps which are set to the predefined atlas scaling mode.
191191
* @param scales a vector of doubles representing predefined scales
192192
* @see predefinedScales
@@ -203,14 +203,14 @@ class CORE_EXPORT QgsAtlasComposition : public QObject
203203
/** Returns the number of features in the coverage layer */
204204
int numFeatures() const;
205205

206-
/**Prepare the atlas map for the given feature. Sets the extent and context variables
206+
/** Prepare the atlas map for the given feature. Sets the extent and context variables
207207
* @param i feature number
208208
* @param updateMaps set to true to redraw maps and recalculate their extent
209209
* @returns true if feature was successfully prepared
210210
*/
211211
bool prepareForFeature( const int i, const bool updateMaps = true );
212212

213-
/**Prepare the atlas map for the given feature. Sets the extent and context variables
213+
/** Prepare the atlas map for the given feature. Sets the extent and context variables
214214
* @returns true if feature was successfully prepared
215215
*/
216216
bool prepareForFeature( const QgsFeature *feat );
@@ -220,15 +220,15 @@ class CORE_EXPORT QgsAtlasComposition : public QObject
220220

221221
void writeXML( QDomElement& elem, QDomDocument& doc ) const;
222222

223-
/**Reads general atlas settings from xml
223+
/** Reads general atlas settings from xml
224224
* @param elem a QDomElement holding the atlas properties.
225225
* @param doc QDomDocument for the source xml.
226226
* @see readXMLMapSettings
227227
* @note This method should be called before restoring composer item properties
228228
*/
229229
void readXML( const QDomElement& elem, const QDomDocument& doc );
230230

231-
/**Reads old (pre 2.2) map related atlas settings from xml
231+
/** Reads old (pre 2.2) map related atlas settings from xml
232232
* @param elem a QDomElement holding the atlas map properties.
233233
* @param doc QDomDocument for the source xml.
234234
* @see readXMLMapSettings
@@ -246,12 +246,17 @@ class CORE_EXPORT QgsAtlasComposition : public QObject
246246
/** Returns the current atlas feature. Must be called after prepareForFeature( i ). */
247247
QgsFeature* currentFeature() { return &mCurrentFeature; }
248248

249+
/** Returns the current feature number.
250+
* @note added in QGIS 2.12
251+
*/
252+
int currentFeatureNumber() const { return mCurrentFeatureNo; }
253+
249254
/** Recalculates the bounds of an atlas driven map */
250255
void prepareMap( QgsComposerMap* map );
251256

252257
public slots:
253258

254-
/**Refreshes the current atlas feature, by refetching its attributes from the vector layer provider
259+
/** Refreshes the current atlas feature, by refetching its attributes from the vector layer provider
255260
* @note added in QGIS 2.5
256261
*/
257262
void refreshFeature();
@@ -262,34 +267,39 @@ class CORE_EXPORT QgsAtlasComposition : public QObject
262267
void firstFeature();
263268

264269
signals:
265-
/** emitted when one of the parameters changes */
270+
/** Emitted when one of the parameters changes */
266271
void parameterChanged();
267272

268-
/** emitted when atlas is enabled or disabled */
273+
/** Emitted when atlas is enabled or disabled */
269274
void toggled( bool );
270275

271-
/**Is emitted when the atlas has an updated status bar message for the composer window*/
276+
/** Is emitted when the atlas has an updated status bar message for the composer window*/
272277
void statusMsgChanged( QString message );
273278

274-
/**Is emitted when the coverage layer for an atlas changes*/
279+
/** Is emitted when the coverage layer for an atlas changes*/
275280
void coverageLayerChanged( QgsVectorLayer* layer );
276281

277-
/**Is emitted when atlas rendering has begun*/
282+
/** Is emitted when atlas rendering has begun*/
278283
void renderBegun();
279284

280-
/**Is emitted when atlas rendering has ended*/
285+
/** Is emitted when atlas rendering has ended*/
281286
void renderEnded();
282287

283-
/**Is emitted when the current atlas feature changes*/
288+
/** Is emitted when the current atlas feature changes*/
284289
void featureChanged( QgsFeature* feature );
285290

291+
/** Is emitted when the number of features for the atlas changes.
292+
* @note added in QGIS 2.12
293+
*/
294+
void numberFeaturesChanged( int numFeatures );
295+
286296
private:
287-
/**Updates the filename expression.
297+
/** Updates the filename expression.
288298
* @returns true if expression was successfully parsed, false if expression is invalid
289299
*/
290300
bool updateFilenameExpression();
291301

292-
/**Evaluates filename for current feature
302+
/** Evaluates filename for current feature
293303
* @returns true if feature filename was successfully evaluated
294304
*/
295305
bool evalFeatureFilename();

0 commit comments

Comments
 (0)
Please sign in to comment.