QGIS API Documentation
2.6.0-Brighton
|
Class used to render an Atlas, iterating over geometry features. More...
#include <qgsatlascomposition.h>
Public Types | |
typedef QMap< QgsFeatureId, QVariant > | SorterKeys |
Public Slots | |
void | refreshFeature () |
Refreshes the current atlas feature, by refetching its attributes from the vector layer provider. | |
void | nextFeature () |
void | prevFeature () |
void | lastFeature () |
void | firstFeature () |
Signals | |
void | parameterChanged () |
emitted when one of the parameters changes | |
void | toggled (bool) |
emitted when atlas is enabled or disabled | |
void | statusMsgChanged (QString message) |
Is emitted when the atlas has an updated status bar message for the composer window. | |
void | coverageLayerChanged (QgsVectorLayer *layer) |
Is emitted when the coverage layer for an atlas changes. | |
void | renderBegun () |
Is emitted when atlas rendering has begun. | |
void | renderEnded () |
Is emitted when atlas rendering has ended. | |
void | featureChanged (QgsFeature *feature) |
Is emitted when the current atlas feature changes. |
Public Member Functions | |
QgsAtlasComposition (QgsComposition *composition) | |
~QgsAtlasComposition () | |
bool | enabled () const |
Returns whether the atlas generation is enabled. | |
void | setEnabled (bool enabled) |
Sets whether the atlas is enabled. | |
Q_DECL_DEPRECATED QgsComposerMap * | composerMap () const |
Returns the map used by the atlas. | |
Q_DECL_DEPRECATED void | setComposerMap (QgsComposerMap *map) |
Sets the map used by the atlas. | |
bool | hideCoverage () const |
Returns true if the atlas is set to hide the coverage layer. | |
void | setHideCoverage (bool hide) |
Sets whether the coverage layer should be hidden in map items in the composition. | |
Q_DECL_DEPRECATED bool | fixedScale () const |
Returns whether the atlas map uses a fixed scale. | |
Q_DECL_DEPRECATED void | setFixedScale (bool fixed) |
Sets whether the atlas map should use a fixed scale. | |
Q_DECL_DEPRECATED float | margin () const |
Returns the margin for the atlas map. | |
Q_DECL_DEPRECATED void | setMargin (float margin) |
Sets the margin for the atlas map. | |
QString | filenamePattern () const |
Returns the filename expression used for generating output filenames for each atlas page. | |
bool | setFilenamePattern (const QString &pattern) |
Sets the filename expression used for generating output filenames for each atlas page. | |
QString | filenamePatternErrorString () const |
Returns an error string from parsing the filename expression. | |
QgsVectorLayer * | coverageLayer () const |
Returns the coverage layer used for the atlas features. | |
void | setCoverageLayer (QgsVectorLayer *layer) |
Sets the coverage layer to use for the atlas features. | |
bool | singleFile () const |
Returns whether the atlas will be exported to a single file. | |
void | setSingleFile (bool single) |
Sets whether the atlas should be exported to a single file. | |
bool | sortFeatures () const |
void | setSortFeatures (bool doSort) |
bool | sortAscending () const |
void | setSortAscending (bool ascending) |
bool | filterFeatures () const |
void | setFilterFeatures (bool doFilter) |
QString | featureFilter () const |
void | setFeatureFilter (const QString &expression) |
QString | featureFilterErrorString () const |
Returns an error string from parsing the feature filter expression. | |
QString | sortKeyAttributeName () const |
void | setSortKeyAttributeName (QString fieldName) |
Q_DECL_DEPRECATED int | sortKeyAttributeIndex () const |
Q_DECL_DEPRECATED void | setSortKeyAttributeIndex (int idx) |
const QVector< qreal > & | predefinedScales () const |
Returns the current list of predefined scales for the atlas. | |
void | setPredefinedScales (const QVector< qreal > &scales) |
Sets the list of predefined scales for the atlas. | |
bool | beginRender () |
Begins the rendering. | |
void | endRender () |
Ends the rendering. | |
int | numFeatures () const |
Returns the number of features in the coverage layer. | |
bool | prepareForFeature (const int i, const bool updateMaps=true) |
Prepare the atlas map for the given feature. | |
bool | prepareForFeature (const QgsFeature *feat) |
Prepare the atlas map for the given feature. | |
const QString & | currentFilename () const |
Returns the current filename. | |
void | writeXML (QDomElement &elem, QDomDocument &doc) const |
void | readXML (const QDomElement &elem, const QDomDocument &doc) |
Reads general atlas settings from xml. | |
void | readXMLMapSettings (const QDomElement &elem, const QDomDocument &doc) |
Reads old (pre 2.2) map related atlas settings from xml. | |
QgsComposition * | composition () |
int | updateFeatures () |
Requeries the current atlas coverage layer and applies filtering and sorting. | |
QgsFeature * | currentFeature () |
Returns the current atlas feature. | |
void | prepareMap (QgsComposerMap *map) |
Recalculates the bounds of an atlas driven map. |
Class used to render an Atlas, iterating over geometry features.
prepareForFeature() modifies the atlas map's extent to zoom on the given feature. This class is used for printing, exporting to PDF and images.
typedef QMap< QgsFeatureId, QVariant > QgsAtlasComposition::SorterKeys |
QgsAtlasComposition::QgsAtlasComposition | ( | QgsComposition * | composition | ) |
QgsAtlasComposition::~QgsAtlasComposition | ( | ) |
bool QgsAtlasComposition::beginRender | ( | ) |
Begins the rendering.
Returns true if successful, false if no matching atlas features found.
QgsComposerMap * QgsAtlasComposition::composerMap | ( | ) | const |
Returns the map used by the atlas.
|
inline |
|
inline |
Returns the coverage layer used for the atlas features.
|
signal |
Is emitted when the coverage layer for an atlas changes.
|
inline |
Returns the current atlas feature.
Must be called after prepareForFeature( i ).
const QString & QgsAtlasComposition::currentFilename | ( | ) | const |
Returns the current filename.
Must be called after prepareForFeature( i )
|
inline |
void QgsAtlasComposition::endRender | ( | ) |
Ends the rendering.
Restores original extent
|
signal |
Is emitted when the current atlas feature changes.
|
inline |
|
inline |
Returns an error string from parsing the feature filter expression.
|
inline |
Returns the filename expression used for generating output filenames for each atlas page.
|
inline |
Returns an error string from parsing the filename expression.
|
inline |
|
slot |
Q_NOWARN_DEPRECATED_PUSH bool QgsAtlasComposition::fixedScale | ( | ) | const |
Returns whether the atlas map uses a fixed scale.
|
inline |
Returns true if the atlas is set to hide the coverage layer.
|
slot |
float QgsAtlasComposition::margin | ( | ) | const |
Returns the margin for the atlas map.
|
slot |
int QgsAtlasComposition::numFeatures | ( | ) | const |
Returns the number of features in the coverage layer.
|
signal |
emitted when one of the parameters changes
|
inline |
Returns the current list of predefined scales for the atlas.
This is used for maps which are set to the predefined atlas scaling mode.
bool QgsAtlasComposition::prepareForFeature | ( | const int | i, |
const bool | updateMaps = true |
||
) |
Prepare the atlas map for the given feature.
Sets the extent and context variables
i | feature number |
updateMaps | set to true to redraw maps and recalculate their extent |
bool QgsAtlasComposition::prepareForFeature | ( | const QgsFeature * | feat | ) |
Prepare the atlas map for the given feature.
Sets the extent and context variables
void QgsAtlasComposition::prepareMap | ( | QgsComposerMap * | map | ) |
Recalculates the bounds of an atlas driven map.
|
slot |
void QgsAtlasComposition::readXML | ( | const QDomElement & | elem, |
const QDomDocument & | doc | ||
) |
Reads general atlas settings from xml.
elem | a QDomElement holding the atlas properties. |
doc | QDomDocument for the source xml. |
void QgsAtlasComposition::readXMLMapSettings | ( | const QDomElement & | elem, |
const QDomDocument & | doc | ||
) |
Reads old (pre 2.2) map related atlas settings from xml.
elem | a QDomElement holding the atlas map properties. |
doc | QDomDocument for the source xml. |
|
slot |
Refreshes the current atlas feature, by refetching its attributes from the vector layer provider.
|
signal |
Is emitted when atlas rendering has begun.
|
signal |
Is emitted when atlas rendering has ended.
void QgsAtlasComposition::setComposerMap | ( | QgsComposerMap * | map | ) |
Sets the map used by the atlas.
void QgsAtlasComposition::setCoverageLayer | ( | QgsVectorLayer * | layer | ) |
Sets the coverage layer to use for the atlas features.
layer | vector coverage layer |
void QgsAtlasComposition::setEnabled | ( | bool | enabled | ) |
|
inline |
bool QgsAtlasComposition::setFilenamePattern | ( | const QString & | pattern | ) |
Sets the filename expression used for generating output filenames for each atlas page.
pattern | expression to use for output filenames |
|
inline |
void QgsAtlasComposition::setFixedScale | ( | bool | fixed | ) |
Sets whether the atlas map should use a fixed scale.
void QgsAtlasComposition::setHideCoverage | ( | bool | hide | ) |
Sets whether the coverage layer should be hidden in map items in the composition.
hide | set to true to hide the coverage layer |
void QgsAtlasComposition::setMargin | ( | float | margin | ) |
Sets the margin for the atlas map.
void QgsAtlasComposition::setPredefinedScales | ( | const QVector< qreal > & | scales | ) |
Sets the list of predefined scales for the atlas.
This is used for maps which are set to the predefined atlas scaling mode.
scales | a vector of doubles representing predefined scales |
|
inline |
Sets whether the atlas should be exported to a single file.
This is only applicable for PDF exports.
single | set to true to export atlas to a single file. |
|
inline |
|
inline |
void QgsAtlasComposition::setSortKeyAttributeIndex | ( | int | idx | ) |
|
inline |
|
inline |
Returns whether the atlas will be exported to a single file.
This is only applicable for PDF exports.
|
inline |
|
inline |
int QgsAtlasComposition::sortKeyAttributeIndex | ( | ) | const |
|
inline |
|
signal |
Is emitted when the atlas has an updated status bar message for the composer window.
|
signal |
emitted when atlas is enabled or disabled
int QgsAtlasComposition::updateFeatures | ( | ) |
Requeries the current atlas coverage layer and applies filtering and sorting.
Returns number of matching features. Must be called after prepareForFeature( i )
void QgsAtlasComposition::writeXML | ( | QDomElement & | elem, |
QDomDocument & | doc | ||
) | const |