QGIS API Documentation
2.18.21-Las Palmas (9fba24a)
|
Class used to render an Atlas, iterating over geometry features. More...
#include <qgsatlascomposition.h>
Public Types | |
typedef QMap< QgsFeatureId, QVariant > | SorterKeys |
Public Slots | |
void | firstFeature () |
void | lastFeature () |
void | nextFeature () |
void | prevFeature () |
void | refreshFeature () |
Refreshes the current atlas feature, by refetching its attributes from the vector layer provider. More... | |
Signals | |
void | coverageLayerChanged (QgsVectorLayer *layer) |
Is emitted when the coverage layer for an atlas changes. More... | |
void | featureChanged (QgsFeature *feature) |
Is emitted when the current atlas feature changes. More... | |
void | numberFeaturesChanged (int numFeatures) |
Is emitted when the number of features for the atlas changes. More... | |
void | parameterChanged () |
Emitted when one of the parameters changes. More... | |
void | renderBegun () |
Is emitted when atlas rendering has begun. More... | |
void | renderEnded () |
Is emitted when atlas rendering has ended. More... | |
void | statusMsgChanged (const QString &message) |
Is emitted when the atlas has an updated status bar message for the composer window. More... | |
void | toggled (bool) |
Emitted when atlas is enabled or disabled. More... | |
Public Member Functions | |
QgsAtlasComposition (QgsComposition *composition) | |
~QgsAtlasComposition () | |
bool | beginRender () |
Begins the rendering. More... | |
Q_DECL_DEPRECATED QgsComposerMap * | composerMap () const |
Returns the map used by the atlas. More... | |
QgsComposition * | composition () |
QgsVectorLayer * | coverageLayer () const |
Returns the coverage layer used for the atlas features. More... | |
Q_DECL_DEPRECATED QgsFeature * | currentFeature () |
Returns the current atlas feature. More... | |
int | currentFeatureNumber () const |
Returns the current feature number, where a value of 0 corresponds to the first feature. More... | |
QString | currentFilename () const |
Returns the current filename. More... | |
QgsGeometry | currentGeometry (const QgsCoordinateReferenceSystem &projectedTo=QgsCoordinateReferenceSystem()) const |
Returns the current atlas geometry in the given projection system (default to the coverage layer's CRS) More... | |
QString | currentPageName () const |
Returns the name of the page for the current atlas feature. More... | |
bool | enabled () const |
Returns whether the atlas generation is enabled. More... | |
void | endRender () |
Ends the rendering. More... | |
QgsFeature | feature () const |
Returns the current atlas feature. More... | |
QString | featureFilter () const |
QString | featureFilterErrorString () const |
Returns an error string from parsing the feature filter expression. More... | |
QString | filenamePattern () const |
Returns the filename expression used for generating output filenames for each atlas page. More... | |
QString | filenamePatternErrorString () const |
Returns an error string from parsing the filename expression. More... | |
bool | filterFeatures () const |
Q_DECL_DEPRECATED bool | fixedScale () const |
Returns whether the atlas map uses a fixed scale. More... | |
bool | hideCoverage () const |
Returns true if the atlas is set to hide the coverage layer. More... | |
Q_DECL_DEPRECATED float | margin () const |
Returns the margin for the atlas map. More... | |
QString | nameForPage (int pageNumber) const |
Returns the calculated name for a specified atlas page number. More... | |
int | numFeatures () const |
Returns the number of features in the coverage layer. More... | |
QString | pageNameExpression () const |
Returns the expression used for calculating the page name. More... | |
const QVector< qreal > & | predefinedScales () const |
Returns the current list of predefined scales for the atlas. More... | |
bool | prepareForFeature (const int i, const bool updateMaps=true) |
Prepare the atlas map for the given feature. More... | |
bool | prepareForFeature (const QgsFeature *feat) |
Prepare the atlas map for the given feature. More... | |
void | prepareMap (QgsComposerMap *map) |
Recalculates the bounds of an atlas driven map. More... | |
void | readXML (const QDomElement &elem, const QDomDocument &doc) |
Reads general atlas settings from xml. More... | |
void | readXMLMapSettings (const QDomElement &elem, const QDomDocument &doc) |
Reads old (pre 2.2) map related atlas settings from xml. More... | |
Q_DECL_DEPRECATED void | setComposerMap (QgsComposerMap *map) |
Sets the map used by the atlas. More... | |
void | setCoverageLayer (QgsVectorLayer *layer) |
Sets the coverage layer to use for the atlas features. More... | |
void | setEnabled (bool enabled) |
Sets whether the atlas is enabled. More... | |
void | setFeatureFilter (const QString &expression) |
bool | setFilenamePattern (const QString &pattern) |
Sets the filename expression used for generating output filenames for each atlas page. More... | |
void | setFilterFeatures (bool doFilter) |
Q_DECL_DEPRECATED void | setFixedScale (bool fixed) |
Sets whether the atlas map should use a fixed scale. More... | |
void | setHideCoverage (bool hide) |
Sets whether the coverage layer should be hidden in map items in the composition. More... | |
Q_DECL_DEPRECATED void | setMargin (float margin) |
Sets the margin for the atlas map. More... | |
void | setPageNameExpression (const QString &pageNameExpression) |
Sets the expression used for calculating the page name. More... | |
void | setPredefinedScales (const QVector< qreal > &scales) |
Sets the list of predefined scales for the atlas. More... | |
void | setSingleFile (bool single) |
Sets whether the atlas should be exported to a single file. More... | |
void | setSortAscending (bool ascending) |
void | setSortFeatures (bool doSort) |
Q_DECL_DEPRECATED void | setSortKeyAttributeIndex (int idx) |
void | setSortKeyAttributeName (const QString &fieldName) |
bool | singleFile () const |
Returns whether the atlas will be exported to a single file. More... | |
bool | sortAscending () const |
bool | sortFeatures () const |
Q_DECL_DEPRECATED int | sortKeyAttributeIndex () const |
QString | sortKeyAttributeName () const |
int | updateFeatures () |
Requeries the current atlas coverage layer and applies filtering and sorting. More... | |
void | writeXML (QDomElement &elem, QDomDocument &doc) const |
Public Member Functions inherited from QObject | |
QObject (QObject *parent) | |
QObject (QObject *parent, const char *name) | |
virtual | ~QObject () |
bool | blockSignals (bool block) |
QObject * | child (const char *objName, const char *inheritsClass, bool recursiveSearch) const |
const QObjectList & | children () const |
const char * | className () const |
bool | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const |
void | deleteLater () |
void | destroyed (QObject *obj) |
bool | disconnect (const QObject *receiver, const char *method) |
bool | disconnect (const char *signal, const QObject *receiver, const char *method) |
void | dumpObjectInfo () |
void | dumpObjectTree () |
QList< QByteArray > | dynamicPropertyNames () const |
virtual bool | event (QEvent *e) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
T | findChild (const QString &name) const |
QList< T > | findChildren (const QRegExp ®Exp) const |
QList< T > | findChildren (const QString &name) const |
bool | inherits (const char *className) const |
void | insertChild (QObject *object) |
void | installEventFilter (QObject *filterObj) |
bool | isA (const char *className) const |
bool | isWidgetType () const |
void | killTimer (int id) |
virtual const QMetaObject * | metaObject () const |
void | moveToThread (QThread *targetThread) |
const char * | name () const |
const char * | name (const char *defaultName) const |
QString | objectName () const |
QObject * | parent () const |
QVariant | property (const char *name) const |
void | removeChild (QObject *object) |
void | removeEventFilter (QObject *obj) |
void | setName (const char *name) |
void | setObjectName (const QString &name) |
void | setParent (QObject *parent) |
bool | setProperty (const char *name, const QVariant &value) |
bool | signalsBlocked () const |
int | startTimer (int interval) |
QThread * | thread () const |
Additional Inherited Members | |
Static Public Member Functions inherited from QObject | |
bool | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) |
bool | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) |
bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) |
bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) |
QString | tr (const char *sourceText, const char *disambiguation, int n) |
QString | trUtf8 (const char *sourceText, const char *disambiguation, int n) |
Protected Member Functions inherited from QObject | |
bool | checkConnectArgs (const char *signal, const QObject *object, const char *method) |
virtual void | childEvent (QChildEvent *event) |
virtual void | connectNotify (const char *signal) |
virtual void | customEvent (QEvent *event) |
virtual void | disconnectNotify (const char *signal) |
int | receivers (const char *signal) const |
QObject * | sender () const |
int | senderSignalIndex () const |
virtual void | timerEvent (QTimerEvent *event) |
Static Protected Member Functions inherited from QObject | |
QByteArray | normalizeSignalSlot (const char *signalSlot) |
Properties inherited from QObject | |
objectName | |
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.
Definition at line 44 of file qgsatlascomposition.h.
typedef QMap< QgsFeatureId, QVariant > QgsAtlasComposition::SorterKeys |
Definition at line 372 of file qgsatlascomposition.h.
QgsAtlasComposition::QgsAtlasComposition | ( | QgsComposition * | composition | ) |
Definition at line 33 of file qgsatlascomposition.cpp.
QgsAtlasComposition::~QgsAtlasComposition | ( | ) |
Definition at line 49 of file qgsatlascomposition.cpp.
bool QgsAtlasComposition::beginRender | ( | ) |
Begins the rendering.
Returns true if successful, false if no matching atlas features found.
Definition at line 282 of file qgsatlascomposition.cpp.
QgsComposerMap * QgsAtlasComposition::composerMap | ( | ) | const |
Returns the map used by the atlas.
Definition at line 104 of file qgsatlascomposition.cpp.
|
inline |
Definition at line 233 of file qgsatlascomposition.h.
|
inline |
Returns the coverage layer used for the atlas features.
Definition at line 105 of file qgsatlascomposition.h.
|
signal |
Is emitted when the coverage layer for an atlas changes.
|
inline |
Returns the current atlas feature.
Must be called after prepareForFeature( i ).
Definition at line 299 of file qgsatlascomposition.h.
|
inline |
Returns the current feature number, where a value of 0 corresponds to the first feature.
Definition at line 253 of file qgsatlascomposition.h.
QString QgsAtlasComposition::currentFilename | ( | ) | const |
Returns the current filename.
Must be called after prepareForFeature()
Definition at line 630 of file qgsatlascomposition.cpp.
QgsGeometry QgsAtlasComposition::currentGeometry | ( | const QgsCoordinateReferenceSystem & | projectedTo = QgsCoordinateReferenceSystem() | ) | const |
Returns the current atlas geometry in the given projection system (default to the coverage layer's CRS)
Definition at line 904 of file qgsatlascomposition.cpp.
QString QgsAtlasComposition::currentPageName | ( | ) | const |
Returns the name of the page for the current atlas feature.
Must be called after prepareForFeature().
Definition at line 277 of file qgsatlascomposition.cpp.
|
inline |
Returns whether the atlas generation is enabled.
Definition at line 55 of file qgsatlascomposition.h.
void QgsAtlasComposition::endRender | ( | ) |
Ends the rendering.
Restores original extent
Definition at line 301 of file qgsatlascomposition.cpp.
|
inline |
Returns the current atlas feature.
Must be called after prepareForFeature().
Definition at line 243 of file qgsatlascomposition.h.
|
signal |
Is emitted when the current atlas feature changes.
|
inline |
Definition at line 161 of file qgsatlascomposition.h.
|
inline |
Returns an error string from parsing the feature filter expression.
Definition at line 169 of file qgsatlascomposition.h.
|
inline |
Returns the filename expression used for generating output filenames for each atlas page.
Definition at line 82 of file qgsatlascomposition.h.
|
inline |
Returns an error string from parsing the filename expression.
Definition at line 99 of file qgsatlascomposition.h.
|
inline |
Definition at line 158 of file qgsatlascomposition.h.
|
slot |
Definition at line 359 of file qgsatlascomposition.cpp.
Q_NOWARN_DEPRECATED_PUSH bool QgsAtlasComposition::fixedScale | ( | ) | const |
Returns whether the atlas map uses a fixed scale.
Definition at line 856 of file qgsatlascomposition.cpp.
|
inline |
Returns true if the atlas is set to hide the coverage layer.
Definition at line 67 of file qgsatlascomposition.h.
|
slot |
Definition at line 364 of file qgsatlascomposition.cpp.
float QgsAtlasComposition::margin | ( | ) | const |
Returns the margin for the atlas map.
Definition at line 880 of file qgsatlascomposition.cpp.
QString QgsAtlasComposition::nameForPage | ( | int | pageNumber | ) | const |
Returns the calculated name for a specified atlas page number.
pageNumber | number of page, where 0 = first page |
Definition at line 96 of file qgsatlascomposition.cpp.
|
slot |
Definition at line 337 of file qgsatlascomposition.cpp.
|
signal |
Is emitted when the number of features for the atlas changes.
int QgsAtlasComposition::numFeatures | ( | ) | const |
Returns the number of features in the coverage layer.
Definition at line 332 of file qgsatlascomposition.cpp.
|
inline |
Returns the expression used for calculating the page name.
Definition at line 119 of file qgsatlascomposition.h.
|
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.
Definition at line 180 of file qgsatlascomposition.h.
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 |
Definition at line 397 of file qgsatlascomposition.cpp.
bool QgsAtlasComposition::prepareForFeature | ( | const QgsFeature * | feat | ) |
Prepare the atlas map for the given feature.
Sets the extent and context variables
Definition at line 369 of file qgsatlascomposition.cpp.
void QgsAtlasComposition::prepareMap | ( | QgsComposerMap * | map | ) |
Recalculates the bounds of an atlas driven map.
Definition at line 502 of file qgsatlascomposition.cpp.
|
slot |
Definition at line 348 of file qgsatlascomposition.cpp.
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. |
Definition at line 676 of file qgsatlascomposition.cpp.
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. |
Definition at line 729 of file qgsatlascomposition.cpp.
|
slot |
Refreshes the current atlas feature, by refetching its attributes from the vector layer provider.
Definition at line 392 of file qgsatlascomposition.cpp.
|
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.
Definition at line 123 of file qgsatlascomposition.cpp.
void QgsAtlasComposition::setCoverageLayer | ( | QgsVectorLayer * | layer | ) |
Sets the coverage layer to use for the atlas features.
layer | vector coverage layer |
Definition at line 85 of file qgsatlascomposition.cpp.
void QgsAtlasComposition::setEnabled | ( | bool | enabled | ) |
Sets whether the atlas is enabled.
enabled | set to true to enable to atlas |
Definition at line 53 of file qgsatlascomposition.cpp.
|
inline |
Definition at line 162 of file qgsatlascomposition.h.
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 |
Definition at line 776 of file qgsatlascomposition.cpp.
|
inline |
Definition at line 159 of file qgsatlascomposition.h.
void QgsAtlasComposition::setFixedScale | ( | bool | fixed | ) |
Sets whether the atlas map should use a fixed scale.
Definition at line 868 of file qgsatlascomposition.cpp.
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 |
Definition at line 763 of file qgsatlascomposition.cpp.
void QgsAtlasComposition::setMargin | ( | float | margin | ) |
Sets the margin for the atlas map.
Definition at line 892 of file qgsatlascomposition.cpp.
|
inline |
Sets the expression used for calculating the page name.
pageNameExpression | expression string, or field name from coverage layer |
Definition at line 126 of file qgsatlascomposition.h.
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 |
Definition at line 848 of file qgsatlascomposition.cpp.
|
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. |
Definition at line 150 of file qgsatlascomposition.h.
|
inline |
Definition at line 156 of file qgsatlascomposition.h.
|
inline |
Definition at line 153 of file qgsatlascomposition.h.
void QgsAtlasComposition::setSortKeyAttributeIndex | ( | int | idx | ) |
Definition at line 145 of file qgsatlascomposition.cpp.
|
inline |
Definition at line 172 of file qgsatlascomposition.h.
|
inline |
Returns whether the atlas will be exported to a single file.
This is only applicable for PDF exports.
Definition at line 142 of file qgsatlascomposition.h.
|
inline |
Definition at line 155 of file qgsatlascomposition.h.
|
inline |
Definition at line 152 of file qgsatlascomposition.h.
int QgsAtlasComposition::sortKeyAttributeIndex | ( | ) | const |
Definition at line 136 of file qgsatlascomposition.cpp.
|
inline |
Definition at line 171 of file qgsatlascomposition.h.
|
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()
Definition at line 181 of file qgsatlascomposition.cpp.
void QgsAtlasComposition::writeXML | ( | QDomElement & | elem, |
QDomDocument & | doc | ||
) | const |
Definition at line 635 of file qgsatlascomposition.cpp.