mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
[FEATURE][composer] Add page number combo box to atlas toolbar
(fix #13136)
This commit is contained in:
parent
b4311877f7
commit
d07dadf333
@ -216,6 +216,11 @@ public:
|
||||
|
||||
/** Returns the current atlas feature. Must be called after prepareForFeature( i ). */
|
||||
QgsFeature* currentFeature();
|
||||
|
||||
/** Returns the current feature number.
|
||||
* @note added in QGIS 2.12
|
||||
*/
|
||||
int currentFeatureNumber() const;
|
||||
|
||||
/** Recalculates the bounds of an atlas driven map */
|
||||
void prepareMap( QgsComposerMap* map );
|
||||
@ -253,5 +258,9 @@ public:
|
||||
|
||||
/**Is emitted when the current atlas feature changes*/
|
||||
void featureChanged( QgsFeature* feature );
|
||||
|
||||
|
||||
/** Is emitted when the number of features for the atlas changes.
|
||||
* @note added in QGIS 2.12
|
||||
*/
|
||||
void numberFeaturesChanged( int numFeatures );
|
||||
};
|
||||
|
@ -407,6 +407,17 @@ QgsComposer::QgsComposer( QgisApp *qgis, const QString& title )
|
||||
atlasExportToolButton->addAction( mActionExportAtlasAsPDF );
|
||||
atlasExportToolButton->setDefaultAction( mActionExportAtlasAsImage );
|
||||
mAtlasToolbar->insertWidget( mActionAtlasSettings, atlasExportToolButton );
|
||||
mAtlasPageComboBox = new QComboBox();
|
||||
mAtlasPageComboBox->setEditable( true );
|
||||
mAtlasPageComboBox->addItem( QString::number( 1 ) );
|
||||
mAtlasPageComboBox->setCurrentIndex( 0 );
|
||||
mAtlasPageComboBox->setMinimumHeight( mAtlasToolbar->height() );
|
||||
mAtlasPageComboBox->setMinimumContentsLength( 6 );
|
||||
mAtlasPageComboBox->setMaxVisibleItems( 20 );
|
||||
mAtlasPageComboBox->setInsertPolicy( QComboBox::NoInsert );
|
||||
connect( mAtlasPageComboBox->lineEdit(), SIGNAL( editingFinished() ), this, SLOT( atlasPageComboEditingFinished() ) );
|
||||
connect( mAtlasPageComboBox, SIGNAL( currentIndexChanged( QString ) ), this, SLOT( atlasPageComboEditingFinished() ) );
|
||||
mAtlasToolbar->insertWidget( mActionAtlasNext, mAtlasPageComboBox );
|
||||
|
||||
QMenu *settingsMenu = menuBar()->addMenu( tr( "&Settings" ) );
|
||||
settingsMenu->addAction( mActionOptions );
|
||||
@ -613,12 +624,14 @@ QgsComposer::QgsComposer( QgisApp *qgis, const QString& title )
|
||||
mActionAtlasNext->setEnabled( false );
|
||||
mActionAtlasPrev->setEnabled( false );
|
||||
mActionPrintAtlas->setEnabled( false );
|
||||
mAtlasPageComboBox->setEnabled( false );
|
||||
mActionExportAtlasAsImage->setEnabled( false );
|
||||
mActionExportAtlasAsSVG->setEnabled( false );
|
||||
mActionExportAtlasAsPDF->setEnabled( false );
|
||||
QgsAtlasComposition* atlasMap = &mComposition->atlasComposition();
|
||||
connect( atlasMap, SIGNAL( toggled( bool ) ), this, SLOT( toggleAtlasControls( bool ) ) );
|
||||
connect( atlasMap, SIGNAL( coverageLayerChanged( QgsVectorLayer* ) ), this, SLOT( updateAtlasMapLayerAction( QgsVectorLayer * ) ) );
|
||||
connect( atlasMap, SIGNAL( numberFeaturesChanged( int ) ), this, SLOT( updateAtlasPageComboBox( int ) ) );
|
||||
|
||||
//default printer page setup
|
||||
setPrinterPageDefaults();
|
||||
@ -968,6 +981,7 @@ void QgsComposer::toggleAtlasControls( bool atlasEnabled )
|
||||
mActionAtlasLast->setEnabled( false );
|
||||
mActionAtlasNext->setEnabled( false );
|
||||
mActionAtlasPrev->setEnabled( false );
|
||||
mAtlasPageComboBox->setEnabled( false );
|
||||
mActionAtlasPreview->blockSignals( false );
|
||||
mActionAtlasPreview->setEnabled( atlasEnabled );
|
||||
mActionPrintAtlas->setEnabled( atlasEnabled );
|
||||
@ -978,6 +992,20 @@ void QgsComposer::toggleAtlasControls( bool atlasEnabled )
|
||||
updateAtlasMapLayerAction( atlasEnabled );
|
||||
}
|
||||
|
||||
void QgsComposer::updateAtlasPageComboBox( int pageCount )
|
||||
{
|
||||
if ( pageCount == mAtlasPageComboBox->count() )
|
||||
return;
|
||||
|
||||
mAtlasPageComboBox->blockSignals( true );
|
||||
mAtlasPageComboBox->clear();
|
||||
for ( int i = 1; i <= pageCount && i < 500; ++i )
|
||||
{
|
||||
mAtlasPageComboBox->addItem( QString::number( i ), i );
|
||||
}
|
||||
mAtlasPageComboBox->blockSignals( false );
|
||||
}
|
||||
|
||||
void QgsComposer::on_mActionAtlasPreview_triggered( bool checked )
|
||||
{
|
||||
QgsAtlasComposition* atlasMap = &mComposition->atlasComposition();
|
||||
@ -1002,6 +1030,7 @@ void QgsComposer::on_mActionAtlasPreview_triggered( bool checked )
|
||||
mActionAtlasLast->setEnabled( checked );
|
||||
mActionAtlasNext->setEnabled( checked );
|
||||
mActionAtlasPrev->setEnabled( checked );
|
||||
mAtlasPageComboBox->setEnabled( checked );
|
||||
|
||||
if ( checked )
|
||||
{
|
||||
@ -1022,6 +1051,7 @@ void QgsComposer::on_mActionAtlasPreview_triggered( bool checked )
|
||||
mActionAtlasLast->setEnabled( false );
|
||||
mActionAtlasNext->setEnabled( false );
|
||||
mActionAtlasPrev->setEnabled( false );
|
||||
mAtlasPageComboBox->setEnabled( false );
|
||||
mActionAtlasPreview->blockSignals( false );
|
||||
mStatusAtlasLabel->setText( QString() );
|
||||
return;
|
||||
@ -1036,10 +1066,8 @@ void QgsComposer::on_mActionAtlasPreview_triggered( bool checked )
|
||||
{
|
||||
mStatusAtlasLabel->setText( QString() );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void QgsComposer::on_mActionAtlasNext_triggered()
|
||||
{
|
||||
QgsAtlasComposition* atlasMap = &mComposition->atlasComposition();
|
||||
@ -1100,6 +1128,23 @@ void QgsComposer::on_mActionAtlasLast_triggered()
|
||||
emit atlasPreviewFeatureChanged();
|
||||
}
|
||||
|
||||
void QgsComposer::atlasPageComboEditingFinished()
|
||||
{
|
||||
QString text = mAtlasPageComboBox->lineEdit()->text();
|
||||
bool ok = false;
|
||||
int page = text.toInt( &ok );
|
||||
if ( !ok || page >= mComposition->atlasComposition().numFeatures() )
|
||||
{
|
||||
mAtlasPageComboBox->blockSignals( true );
|
||||
mAtlasPageComboBox->setCurrentIndex( mComposition->atlasComposition().currentFeatureNumber() );
|
||||
mAtlasPageComboBox->blockSignals( false );
|
||||
}
|
||||
else if ( page != mComposition->atlasComposition().currentFeatureNumber() + 1 )
|
||||
{
|
||||
mComposition->atlasComposition().prepareForFeature( page - 1 );
|
||||
}
|
||||
}
|
||||
|
||||
QgsMapCanvas *QgsComposer::mapCanvas( void )
|
||||
{
|
||||
return mQgis->mapCanvas();
|
||||
@ -1415,6 +1460,7 @@ void QgsComposer::setComposition( QgsComposition* composition )
|
||||
toggleAtlasControls( atlasMap->enabled() );
|
||||
connect( atlasMap, SIGNAL( toggled( bool ) ), this, SLOT( toggleAtlasControls( bool ) ) );
|
||||
connect( atlasMap, SIGNAL( coverageLayerChanged( QgsVectorLayer* ) ), this, SLOT( updateAtlasMapLayerAction( QgsVectorLayer * ) ) );
|
||||
connect( atlasMap, SIGNAL( numberFeaturesChanged( int ) ), this, SLOT( updateAtlasPageComboBox( int ) ) );
|
||||
|
||||
//default printer page setup
|
||||
setPrinterPageDefaults();
|
||||
@ -3233,6 +3279,7 @@ void QgsComposer::readXML( const QDomElement& composerElem, const QDomDocument&
|
||||
toggleAtlasControls( atlasMap->enabled() );
|
||||
connect( atlasMap, SIGNAL( toggled( bool ) ), this, SLOT( toggleAtlasControls( bool ) ) );
|
||||
connect( atlasMap, SIGNAL( coverageLayerChanged( QgsVectorLayer* ) ), this, SLOT( updateAtlasMapLayerAction( QgsVectorLayer * ) ) );
|
||||
connect( atlasMap, SIGNAL( numberFeaturesChanged( int ) ), this, SLOT( updateAtlasPageComboBox( int ) ) );
|
||||
|
||||
//default printer page setup
|
||||
setPrinterPageDefaults();
|
||||
@ -3716,6 +3763,7 @@ void QgsComposer::setAtlasFeature( QgsMapLayer* layer, const QgsFeature& feat )
|
||||
mActionAtlasLast->setEnabled( true );
|
||||
mActionAtlasNext->setEnabled( true );
|
||||
mActionAtlasPrev->setEnabled( true );
|
||||
mAtlasPageComboBox->setEnabled( true );
|
||||
}
|
||||
|
||||
//bring composer window to foreground
|
||||
|
@ -343,6 +343,9 @@ class QgsComposer: public QMainWindow, private Ui::QgsComposerBase
|
||||
//!Last atlas feature
|
||||
void on_mActionAtlasLast_triggered();
|
||||
|
||||
//!Jump to a specific atlas page
|
||||
void atlasPageComboEditingFinished();
|
||||
|
||||
//! Print the atlas
|
||||
void on_mActionPrintAtlas_triggered();
|
||||
|
||||
@ -367,40 +370,40 @@ class QgsComposer: public QMainWindow, private Ui::QgsComposerBase
|
||||
//! Save window state
|
||||
void saveWindowState();
|
||||
|
||||
/**Add a composer arrow to the item/widget map and creates a configuration widget for it*/
|
||||
/** Add a composer arrow to the item/widget map and creates a configuration widget for it*/
|
||||
void addComposerArrow( QgsComposerArrow* arrow );
|
||||
|
||||
/**Add a composer map to the item/widget map and creates a configuration widget for it*/
|
||||
/** Add a composer map to the item/widget map and creates a configuration widget for it*/
|
||||
void addComposerMap( QgsComposerMap* map );
|
||||
|
||||
/**Adds a composer label to the item/widget map and creates a configuration widget for it*/
|
||||
/** Adds a composer label to the item/widget map and creates a configuration widget for it*/
|
||||
void addComposerLabel( QgsComposerLabel* label );
|
||||
|
||||
/**Adds a composer scale bar to the item/widget map and creates a configuration widget for it*/
|
||||
/** Adds a composer scale bar to the item/widget map and creates a configuration widget for it*/
|
||||
void addComposerScaleBar( QgsComposerScaleBar* scalebar );
|
||||
|
||||
/**Adds a composer legend to the item/widget map and creates a configuration widget for it*/
|
||||
/** Adds a composer legend to the item/widget map and creates a configuration widget for it*/
|
||||
void addComposerLegend( QgsComposerLegend* legend );
|
||||
|
||||
/**Adds a composer picture to the item/widget map and creates a configuration widget*/
|
||||
/** Adds a composer picture to the item/widget map and creates a configuration widget*/
|
||||
void addComposerPicture( QgsComposerPicture* picture );
|
||||
|
||||
/**Adds a composer shape to the item/widget map and creates a configuration widget*/
|
||||
/** Adds a composer shape to the item/widget map and creates a configuration widget*/
|
||||
void addComposerShape( QgsComposerShape* shape );
|
||||
|
||||
/**Adds a composer table to the item/widget map and creates a configuration widget*/
|
||||
/** Adds a composer table to the item/widget map and creates a configuration widget*/
|
||||
void addComposerTable( QgsComposerAttributeTable* table );
|
||||
|
||||
/**Adds a composer table v2 to the item/widget map and creates a configuration widget*/
|
||||
/** Adds a composer table v2 to the item/widget map and creates a configuration widget*/
|
||||
void addComposerTableV2( QgsComposerAttributeTableV2* table, QgsComposerFrame* frame );
|
||||
|
||||
/**Adds composer html and creates a configuration widget*/
|
||||
/** Adds composer html and creates a configuration widget*/
|
||||
void addComposerHtmlFrame( QgsComposerHtml* html, QgsComposerFrame* frame );
|
||||
|
||||
/**Removes item from the item/widget map and deletes the configuration widget. Does not delete the item itself*/
|
||||
/** Removes item from the item/widget map and deletes the configuration widget. Does not delete the item itself*/
|
||||
void deleteItem( QgsComposerItem* item );
|
||||
|
||||
/**Shows the configuration widget for a composer item*/
|
||||
/** Shows the configuration widget for a composer item*/
|
||||
void showItemOptions( QgsComposerItem* i );
|
||||
|
||||
//XML, usually connected with QgsProject::readProject and QgsProject::writeProject
|
||||
@ -438,19 +441,19 @@ class QgsComposer: public QMainWindow, private Ui::QgsComposerBase
|
||||
|
||||
private:
|
||||
|
||||
/**Establishes the signal slot connections from the QgsComposerView to the composer*/
|
||||
/** Establishes the signal slot connections from the QgsComposerView to the composer*/
|
||||
void connectViewSlots();
|
||||
|
||||
/**Establishes the signal slot connections from the QgsComposition to the composer*/
|
||||
/** Establishes the signal slot connections from the QgsComposition to the composer*/
|
||||
void connectCompositionSlots();
|
||||
|
||||
/**Establishes other signal slot connections for the composer*/
|
||||
/** Establishes other signal slot connections for the composer*/
|
||||
void connectOtherSlots();
|
||||
|
||||
/**Creates the composition widget*/
|
||||
/** Creates the composition widget*/
|
||||
void createCompositionWidget();
|
||||
|
||||
/**Sets up the compositions undo/redo connections*/
|
||||
/** Sets up the compositions undo/redo connections*/
|
||||
void setupUndoView();
|
||||
|
||||
//! True if a composer map contains a WMS layer
|
||||
@ -510,19 +513,19 @@ class QgsComposer: public QMainWindow, private Ui::QgsComposerBase
|
||||
|
||||
QPrinter* printer();
|
||||
|
||||
/**Composer title*/
|
||||
/** Composer title*/
|
||||
QString mTitle;
|
||||
|
||||
/**Labels in status bar which shows current mouse position*/
|
||||
/** Labels in status bar which shows current mouse position*/
|
||||
QLabel* mStatusCursorXLabel;
|
||||
QLabel* mStatusCursorYLabel;
|
||||
QLabel* mStatusCursorPageLabel;
|
||||
/**Combobox in status bar which shows/adjusts current zoom level*/
|
||||
/** Combobox in status bar which shows/adjusts current zoom level*/
|
||||
QComboBox* mStatusZoomCombo;
|
||||
QList<double> mStatusZoomLevelsList;
|
||||
/**Label in status bar which shows messages from the composition*/
|
||||
/** Label in status bar which shows messages from the composition*/
|
||||
QLabel* mStatusCompositionLabel;
|
||||
/**Label in status bar which shows atlas details*/
|
||||
/** Label in status bar which shows atlas details*/
|
||||
QLabel* mStatusAtlasLabel;
|
||||
|
||||
//! Pointer to composer view
|
||||
@ -570,6 +573,8 @@ class QgsComposer: public QMainWindow, private Ui::QgsComposerBase
|
||||
QAction *mActionPreviewProtanope;
|
||||
QAction *mActionPreviewDeuteranope;
|
||||
|
||||
QComboBox* mAtlasPageComboBox;
|
||||
|
||||
//! We load composer map content from project xml only on demand. Therefore we need to store the real preview mode type
|
||||
QMap< QgsComposerMap*, int > mMapsToRestore;
|
||||
|
||||
@ -649,6 +654,9 @@ class QgsComposer: public QMainWindow, private Ui::QgsComposerBase
|
||||
|
||||
void dockVisibilityChanged( bool visible );
|
||||
|
||||
/** Repopulates the atlas page combo box with valid items.
|
||||
*/
|
||||
void updateAtlasPageComboBox( int pageCount );
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -263,6 +263,7 @@ int QgsAtlasComposition::updateFeatures()
|
||||
}
|
||||
|
||||
QgsExpression::setSpecialColumn( "$numfeatures", QVariant(( int )mFeatureIds.size() ) );
|
||||
emit numberFeaturesChanged( mFeatureIds.size() );
|
||||
|
||||
//jump to first feature if currently using an atlas preview
|
||||
//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
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( featureI >= mFeatureIds.size() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
mCurrentFeatureNo = featureI;
|
||||
|
||||
// retrieve the next feature, based on its id
|
||||
|
@ -45,61 +45,61 @@ class CORE_EXPORT QgsAtlasComposition : public QObject
|
||||
QgsAtlasComposition( QgsComposition* composition );
|
||||
~QgsAtlasComposition();
|
||||
|
||||
/**Returns whether the atlas generation is enabled
|
||||
/** Returns whether the atlas generation is enabled
|
||||
* @returns true if atlas is enabled
|
||||
* @see setEnabled
|
||||
*/
|
||||
bool enabled() const { return mEnabled; }
|
||||
|
||||
/**Sets whether the atlas is enabled
|
||||
/** Sets whether the atlas is enabled
|
||||
* @param enabled set to true to enable to atlas
|
||||
* @see enabled
|
||||
*/
|
||||
void setEnabled( bool enabled );
|
||||
|
||||
/**Returns the map used by the atlas
|
||||
/** Returns the map used by the atlas
|
||||
* @deprecated Use QgsComposerMap::atlasDriven() instead
|
||||
*/
|
||||
Q_DECL_DEPRECATED QgsComposerMap* composerMap() const;
|
||||
|
||||
/**Sets the map used by the atlas
|
||||
/** Sets the map used by the atlas
|
||||
* @deprecated Use QgsComposerMap::setAtlasDriven( true ) instead
|
||||
*/
|
||||
Q_DECL_DEPRECATED void setComposerMap( QgsComposerMap* map );
|
||||
|
||||
/**Returns true if the atlas is set to hide the coverage layer
|
||||
/** Returns true if the atlas is set to hide the coverage layer
|
||||
* @returns true if coverage layer is hidden
|
||||
* @see setHideCoverage
|
||||
*/
|
||||
bool hideCoverage() const { return mHideCoverage; }
|
||||
|
||||
/**Sets whether the coverage layer should be hidden in map items in the composition
|
||||
/** Sets whether the coverage layer should be hidden in map items in the composition
|
||||
* @param hide set to true to hide the coverage layer
|
||||
* @see hideCoverage
|
||||
*/
|
||||
void setHideCoverage( bool hide );
|
||||
|
||||
/**Returns whether the atlas map uses a fixed scale
|
||||
/** Returns whether the atlas map uses a fixed scale
|
||||
* @deprecated since 2.4 Use QgsComposerMap::atlasScalingMode() instead
|
||||
*/
|
||||
Q_DECL_DEPRECATED bool fixedScale() const;
|
||||
|
||||
/**Sets whether the atlas map should use a fixed scale
|
||||
/** Sets whether the atlas map should use a fixed scale
|
||||
* @deprecated since 2.4 Use QgsComposerMap::setAtlasScalingMode() instead
|
||||
*/
|
||||
Q_DECL_DEPRECATED void setFixedScale( bool fixed );
|
||||
|
||||
/**Returns the margin for the atlas map
|
||||
/** Returns the margin for the atlas map
|
||||
* @deprecated Use QgsComposerMap::atlasMargin() instead
|
||||
*/
|
||||
Q_DECL_DEPRECATED float margin() const;
|
||||
|
||||
/**Sets the margin for the atlas map
|
||||
/** Sets the margin for the atlas map
|
||||
* @deprecated Use QgsComposerMap::setAtlasMargin( double ) instead
|
||||
*/
|
||||
Q_DECL_DEPRECATED void setMargin( float margin );
|
||||
|
||||
/**Returns the filename expression used for generating output filenames for each
|
||||
/** Returns the filename expression used for generating output filenames for each
|
||||
* atlas page.
|
||||
* @returns filename pattern
|
||||
* @see setFilenamePattern
|
||||
@ -108,7 +108,7 @@ class CORE_EXPORT QgsAtlasComposition : public QObject
|
||||
*/
|
||||
QString filenamePattern() const { return mFilenamePattern; }
|
||||
|
||||
/**Sets the filename expression used for generating output filenames for each
|
||||
/** Sets the filename expression used for generating output filenames for each
|
||||
* atlas page.
|
||||
* @returns true if filename expression could be successful set, false if expression is invalid
|
||||
* @param pattern expression to use for output filenames
|
||||
@ -118,26 +118,26 @@ class CORE_EXPORT QgsAtlasComposition : public QObject
|
||||
*/
|
||||
bool setFilenamePattern( const QString& pattern );
|
||||
|
||||
/**Returns an error string from parsing the filename expression.
|
||||
/** Returns an error string from parsing the filename expression.
|
||||
* @returns filename pattern parser error
|
||||
* @see setFilenamePattern
|
||||
* @see filenamePattern
|
||||
*/
|
||||
QString filenamePatternErrorString() const { return mFilenameParserError; }
|
||||
|
||||
/**Returns the coverage layer used for the atlas features
|
||||
/** Returns the coverage layer used for the atlas features
|
||||
* @returns atlas coverage layer
|
||||
* @see setCoverageLayer
|
||||
*/
|
||||
QgsVectorLayer* coverageLayer() const { return mCoverageLayer; }
|
||||
|
||||
/**Sets the coverage layer to use for the atlas features
|
||||
/** Sets the coverage layer to use for the atlas features
|
||||
* @param layer vector coverage layer
|
||||
* @see coverageLayer
|
||||
*/
|
||||
void setCoverageLayer( QgsVectorLayer* layer );
|
||||
|
||||
/**Returns whether the atlas will be exported to a single file. This is only
|
||||
/** Returns whether the atlas will be exported to a single file. This is only
|
||||
* applicable for PDF exports.
|
||||
* @returns true if atlas will be exported to a single file
|
||||
* @see setSingleFile
|
||||
@ -145,7 +145,7 @@ class CORE_EXPORT QgsAtlasComposition : public QObject
|
||||
*/
|
||||
bool singleFile() const { return mSingleFile; }
|
||||
|
||||
/**Sets whether the atlas should be exported to a single file. This is only
|
||||
/** Sets whether the atlas should be exported to a single file. This is only
|
||||
* applicable for PDF exports.
|
||||
* @param single set to true to export atlas to a single file.
|
||||
* @see singleFile
|
||||
@ -165,7 +165,7 @@ class CORE_EXPORT QgsAtlasComposition : public QObject
|
||||
QString featureFilter() const { return mFeatureFilter; }
|
||||
void setFeatureFilter( const QString& expression ) { mFeatureFilter = expression; }
|
||||
|
||||
/**Returns an error string from parsing the feature filter expression.
|
||||
/** Returns an error string from parsing the feature filter expression.
|
||||
* @returns filename pattern parser error
|
||||
* @see setFilenamePattern
|
||||
* @see filenamePattern
|
||||
@ -178,7 +178,7 @@ class CORE_EXPORT QgsAtlasComposition : public QObject
|
||||
Q_DECL_DEPRECATED int sortKeyAttributeIndex() const;
|
||||
Q_DECL_DEPRECATED void setSortKeyAttributeIndex( int idx );
|
||||
|
||||
/**Returns the current list of predefined scales for the atlas. This is used
|
||||
/** Returns the current list of predefined scales for the atlas. This is used
|
||||
* for maps which are set to the predefined atlas scaling mode.
|
||||
* @returns a vector of doubles representing predefined scales
|
||||
* @see setPredefinedScales
|
||||
@ -186,7 +186,7 @@ class CORE_EXPORT QgsAtlasComposition : public QObject
|
||||
*/
|
||||
const QVector<qreal>& predefinedScales() const { return mPredefinedScales; }
|
||||
|
||||
/**Sets the list of predefined scales for the atlas. This is used
|
||||
/** Sets the list of predefined scales for the atlas. This is used
|
||||
* for maps which are set to the predefined atlas scaling mode.
|
||||
* @param scales a vector of doubles representing predefined scales
|
||||
* @see predefinedScales
|
||||
@ -203,14 +203,14 @@ class CORE_EXPORT QgsAtlasComposition : public QObject
|
||||
/** Returns the number of features in the coverage layer */
|
||||
int numFeatures() const;
|
||||
|
||||
/**Prepare the atlas map for the given feature. Sets the extent and context variables
|
||||
/** Prepare the atlas map for the given feature. Sets the extent and context variables
|
||||
* @param i feature number
|
||||
* @param updateMaps set to true to redraw maps and recalculate their extent
|
||||
* @returns true if feature was successfully prepared
|
||||
*/
|
||||
bool prepareForFeature( const int i, const bool updateMaps = true );
|
||||
|
||||
/**Prepare the atlas map for the given feature. Sets the extent and context variables
|
||||
/** Prepare the atlas map for the given feature. Sets the extent and context variables
|
||||
* @returns true if feature was successfully prepared
|
||||
*/
|
||||
bool prepareForFeature( const QgsFeature *feat );
|
||||
@ -220,7 +220,7 @@ class CORE_EXPORT QgsAtlasComposition : public QObject
|
||||
|
||||
void writeXML( QDomElement& elem, QDomDocument& doc ) const;
|
||||
|
||||
/**Reads general atlas settings from xml
|
||||
/** Reads general atlas settings from xml
|
||||
* @param elem a QDomElement holding the atlas properties.
|
||||
* @param doc QDomDocument for the source xml.
|
||||
* @see readXMLMapSettings
|
||||
@ -228,7 +228,7 @@ 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
|
||||
/** 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
|
||||
@ -246,12 +246,17 @@ class CORE_EXPORT QgsAtlasComposition : public QObject
|
||||
/** Returns the current atlas feature. Must be called after prepareForFeature( i ). */
|
||||
QgsFeature* currentFeature() { return &mCurrentFeature; }
|
||||
|
||||
/** Returns the current feature number.
|
||||
* @note added in QGIS 2.12
|
||||
*/
|
||||
int currentFeatureNumber() const { return mCurrentFeatureNo; }
|
||||
|
||||
/** Recalculates the bounds of an atlas driven map */
|
||||
void prepareMap( QgsComposerMap* map );
|
||||
|
||||
public slots:
|
||||
|
||||
/**Refreshes the current atlas feature, by refetching its attributes from the vector layer provider
|
||||
/** Refreshes the current atlas feature, by refetching its attributes from the vector layer provider
|
||||
* @note added in QGIS 2.5
|
||||
*/
|
||||
void refreshFeature();
|
||||
@ -262,34 +267,39 @@ class CORE_EXPORT QgsAtlasComposition : public QObject
|
||||
void firstFeature();
|
||||
|
||||
signals:
|
||||
/** emitted when one of the parameters changes */
|
||||
/** Emitted when one of the parameters changes */
|
||||
void parameterChanged();
|
||||
|
||||
/** emitted when atlas is enabled or disabled */
|
||||
/** Emitted when atlas is enabled or disabled */
|
||||
void toggled( bool );
|
||||
|
||||
/**Is emitted when the atlas has an updated status bar message for the composer window*/
|
||||
/** Is emitted when the atlas has an updated status bar message for the composer window*/
|
||||
void statusMsgChanged( QString message );
|
||||
|
||||
/**Is emitted when the coverage layer for an atlas changes*/
|
||||
/** Is emitted when the coverage layer for an atlas changes*/
|
||||
void coverageLayerChanged( QgsVectorLayer* layer );
|
||||
|
||||
/**Is emitted when atlas rendering has begun*/
|
||||
/** Is emitted when atlas rendering has begun*/
|
||||
void renderBegun();
|
||||
|
||||
/**Is emitted when atlas rendering has ended*/
|
||||
/** Is emitted when atlas rendering has ended*/
|
||||
void renderEnded();
|
||||
|
||||
/**Is emitted when the current atlas feature changes*/
|
||||
/** Is emitted when the current atlas feature changes*/
|
||||
void featureChanged( QgsFeature* feature );
|
||||
|
||||
/** Is emitted when the number of features for the atlas changes.
|
||||
* @note added in QGIS 2.12
|
||||
*/
|
||||
void numberFeaturesChanged( int numFeatures );
|
||||
|
||||
private:
|
||||
/**Updates the filename expression.
|
||||
/** Updates the filename expression.
|
||||
* @returns true if expression was successfully parsed, false if expression is invalid
|
||||
*/
|
||||
bool updateFilenameExpression();
|
||||
|
||||
/**Evaluates filename for current feature
|
||||
/** Evaluates filename for current feature
|
||||
* @returns true if feature filename was successfully evaluated
|
||||
*/
|
||||
bool evalFeatureFilename();
|
||||
|
Loading…
x
Reference in New Issue
Block a user