QGIS API Documentation  2.2.0-Valmiera
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Types | Signals | Public Member Functions | Private Member Functions | Private Attributes | List of all members
QgsAtlasComposition Class Reference

Class used to render an Atlas, iterating over geometry features. More...

#include <qgsatlascomposition.h>

Collaboration diagram for QgsAtlasComposition:
Collaboration graph
[legend]

Public Types

typedef QMap< QgsFeatureId,
QVariant > 
SorterKeys

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.

Public Member Functions

 QgsAtlasComposition (QgsComposition *composition)
 ~QgsAtlasComposition ()
bool enabled () const
 Is the atlas generation enabled ?
void setEnabled (bool e)
QgsComposerMapcomposerMap () const
 Returns the map used by the atlas.
void setComposerMap (QgsComposerMap *map)
 Sets the map used by the atlas.
bool hideCoverage () const
void setHideCoverage (bool hide)
bool fixedScale () const
 Returns whether the atlas map uses a fixed scale.
void setFixedScale (bool fixed)
 Sets whether the atlas map should use a fixed scale.
float margin () const
 Returns the margin for the atlas map.
void setMargin (float margin)
 Sets the margin for the atlas map.
QString filenamePattern () const
void setFilenamePattern (const QString &pattern)
QgsVectorLayercoverageLayer () const
void setCoverageLayer (QgsVectorLayer *lmap)
bool singleFile () const
void setSingleFile (bool single)
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)
int sortKeyAttributeIndex () const
void setSortKeyAttributeIndex (int idx)
bool beginRender ()
 Begins the rendering.
void endRender ()
 Ends the rendering.
int numFeatures () const
 Returns the number of features in the coverage layer.
void prepareForFeature (int i)
 Prepare the atlas map for the given feature.
void prepareForFeature (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)
QgsCompositioncomposition ()
int updateFeatures ()
 Requeries the current atlas coverage layer and applies filtering and sorting.
void nextFeature ()
void prevFeature ()
void lastFeature ()
void firstFeature ()
QgsFeaturecurrentFeature ()
 Returns the current atlas feature.
void prepareMap (QgsComposerMap *map)
 Recalculates the bounds of an atlas driven map.

Private Member Functions

void updateFilenameExpression ()
 Updates the filename expression.
void evalFeatureFilename ()
 Evaluates filename for current feature.
void updateAtlasMaps ()
void computeExtent (QgsComposerMap *map)

Private Attributes

QgsCompositionmComposition
bool mEnabled
bool mHideCoverage
QString mFilenamePattern
QgsVectorLayermCoverageLayer
bool mSingleFile
QgsCoordinateTransform mTransform
QString mCurrentFilename
bool mSortFeatures
bool mSortAscending
int mCurrentFeatureNo
SorterKeys mFeatureKeys
int mSortKeyAttributeIdx
bool mFilterFeatures
QString mFeatureFilter
QVector< QgsFeatureIdmFeatureIds
QgsFeature mCurrentFeature
std::auto_ptr< QgsExpressionmFilenameExpr
QgsRectangle mTransformedFeatureBounds

Detailed Description

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 37 of file qgsatlascomposition.h.

Member Typedef Documentation

typedef QMap< QgsFeatureId, QVariant > QgsAtlasComposition::SorterKeys

Definition at line 179 of file qgsatlascomposition.h.

Constructor & Destructor Documentation

QgsAtlasComposition::QgsAtlasComposition ( QgsComposition composition)

Definition at line 31 of file qgsatlascomposition.cpp.

References QgsExpression::setSpecialColumn().

QgsAtlasComposition::~QgsAtlasComposition ( )

Definition at line 49 of file qgsatlascomposition.cpp.

Member Function Documentation

bool QgsAtlasComposition::beginRender ( )

Begins the rendering.

Returns true if successful, false if no matching atlas features found.

Definition at line 259 of file qgsatlascomposition.cpp.

References mComposition, mCoverageLayer, mFeatureIds, QgsComposition::numPages(), QgsExpression::setSpecialColumn(), and updateFeatures().

Referenced by QgsComposition::setAtlasMode().

QgsComposerMap * QgsAtlasComposition::composerMap ( ) const

Returns the map used by the atlas.

Deprecated:
Use QgsComposerMap::atlasDriven() instead

Definition at line 76 of file qgsatlascomposition.cpp.

References QgsComposerMap::atlasDriven(), QgsComposition::composerItems(), and mComposition.

Referenced by fixedScale(), margin(), readXML(), setFixedScale(), and setMargin().

QgsComposition* QgsAtlasComposition::composition ( )
inline

Definition at line 123 of file qgsatlascomposition.h.

void QgsAtlasComposition::computeExtent ( QgsComposerMap map)
private
QgsVectorLayer* QgsAtlasComposition::coverageLayer ( ) const
inline
void QgsAtlasComposition::coverageLayerChanged ( QgsVectorLayer layer)
signal

Is emitted when the coverage layer for an atlas changes.

Referenced by setCoverageLayer().

QgsFeature* QgsAtlasComposition::currentFeature ( )
inline

Returns the current atlas feature.

Must be called after prepareForFeature( i ).

Definition at line 135 of file qgsatlascomposition.h.

Referenced by QgsComposerShape::drawShapeUsingSymbol(), QgsPaperItem::paint(), and QgsComposerLabel::QgsComposerLabel().

const QString & QgsAtlasComposition::currentFilename ( ) const

Returns the current filename.

Must be called after prepareForFeature( i )

Definition at line 533 of file qgsatlascomposition.cpp.

References mCurrentFilename.

bool QgsAtlasComposition::enabled ( ) const
inline

Is the atlas generation enabled ?

Definition at line 45 of file qgsatlascomposition.h.

Referenced by QgsComposerShape::drawShapeUsingSymbol(), and QgsPaperItem::paint().

void QgsAtlasComposition::endRender ( )

Ends the rendering.

Restores original extent

Definition at line 280 of file qgsatlascomposition.cpp.

References QgsComposition::composerItems(), mComposition, mCoverageLayer, and updateAtlasMaps().

Referenced by QgsComposition::setAtlasMode().

void QgsAtlasComposition::evalFeatureFilename ( )
private
QString QgsAtlasComposition::featureFilter ( ) const
inline

Definition at line 96 of file qgsatlascomposition.h.

QString QgsAtlasComposition::filenamePattern ( ) const
inline

Definition at line 78 of file qgsatlascomposition.h.

bool QgsAtlasComposition::filterFeatures ( ) const
inline

Definition at line 93 of file qgsatlascomposition.h.

void QgsAtlasComposition::firstFeature ( )

Definition at line 342 of file qgsatlascomposition.cpp.

References mCurrentFeatureNo, and prepareForFeature().

Referenced by updateFeatures().

bool QgsAtlasComposition::fixedScale ( ) const

Returns whether the atlas map uses a fixed scale.

Deprecated:
Use QgsComposerMap::atlasFixedScale() instead

Definition at line 107 of file qgsatlascomposition.cpp.

References QgsComposerMap::atlasFixedScale(), and composerMap().

Referenced by readXML().

bool QgsAtlasComposition::hideCoverage ( ) const
inline

Definition at line 57 of file qgsatlascomposition.h.

Referenced by QgsComposerMap::layersToRender().

void QgsAtlasComposition::lastFeature ( )

Definition at line 348 of file qgsatlascomposition.cpp.

References mCurrentFeatureNo, mFeatureIds, and prepareForFeature().

float QgsAtlasComposition::margin ( ) const

Returns the margin for the atlas map.

Deprecated:
Use QgsComposerMap::atlasMargin() instead

Definition at line 131 of file qgsatlascomposition.cpp.

References QgsComposerMap::atlasMargin(), and composerMap().

Referenced by readXML().

void QgsAtlasComposition::nextFeature ( )

Definition at line 320 of file qgsatlascomposition.cpp.

References mCurrentFeatureNo, mFeatureIds, and prepareForFeature().

int QgsAtlasComposition::numFeatures ( ) const

Returns the number of features in the coverage layer.

Definition at line 315 of file qgsatlascomposition.cpp.

References mFeatureIds.

void QgsAtlasComposition::parameterChanged ( )
signal

emitted when one of the parameters changes

Referenced by readXML().

void QgsAtlasComposition::prepareForFeature ( int  i)
void QgsAtlasComposition::prepareForFeature ( QgsFeature feat)

Prepare the atlas map for the given feature.

Sets the extent and context variables

Definition at line 354 of file qgsatlascomposition.cpp.

References QgsFeature::id(), mFeatureIds, and prepareForFeature().

void QgsAtlasComposition::prepareMap ( QgsComposerMap map)
void QgsAtlasComposition::prevFeature ( )

Definition at line 331 of file qgsatlascomposition.cpp.

References mCurrentFeatureNo, and prepareForFeature().

void QgsAtlasComposition::readXML ( const QDomElement &  elem,
const QDomDocument &  doc 
)
void QgsAtlasComposition::setComposerMap ( QgsComposerMap map)

Sets the map used by the atlas.

Deprecated:
Use QgsComposerMap::setAtlasDriven( true ) instead

Definition at line 95 of file qgsatlascomposition.cpp.

References QgsComposerMap::setAtlasDriven().

void QgsAtlasComposition::setCoverageLayer ( QgsVectorLayer lmap)
void QgsAtlasComposition::setEnabled ( bool  e)
void QgsAtlasComposition::setFeatureFilter ( const QString &  expression)
inline

Definition at line 97 of file qgsatlascomposition.h.

void QgsAtlasComposition::setFilenamePattern ( const QString &  pattern)

Definition at line 658 of file qgsatlascomposition.cpp.

References mFilenamePattern, and updateFilenameExpression().

void QgsAtlasComposition::setFilterFeatures ( bool  doFilter)
inline

Definition at line 94 of file qgsatlascomposition.h.

void QgsAtlasComposition::setFixedScale ( bool  fixed)

Sets whether the atlas map should use a fixed scale.

Deprecated:
Use QgsComposerMap::setAtlasFixedScale( bool ) instead

Definition at line 119 of file qgsatlascomposition.cpp.

References composerMap(), and QgsComposerMap::setAtlasFixedScale().

void QgsAtlasComposition::setHideCoverage ( bool  hide)
void QgsAtlasComposition::setMargin ( float  margin)

Sets the margin for the atlas map.

Deprecated:
Use QgsComposerMap::setAtlasMargin( double ) instead

Definition at line 143 of file qgsatlascomposition.cpp.

References composerMap(), and QgsComposerMap::setAtlasMargin().

void QgsAtlasComposition::setSingleFile ( bool  single)
inline

Definition at line 85 of file qgsatlascomposition.h.

void QgsAtlasComposition::setSortAscending ( bool  ascending)
inline

Definition at line 91 of file qgsatlascomposition.h.

void QgsAtlasComposition::setSortFeatures ( bool  doSort)
inline

Definition at line 88 of file qgsatlascomposition.h.

void QgsAtlasComposition::setSortKeyAttributeIndex ( int  idx)
inline

Definition at line 100 of file qgsatlascomposition.h.

bool QgsAtlasComposition::singleFile ( ) const
inline

Definition at line 84 of file qgsatlascomposition.h.

bool QgsAtlasComposition::sortAscending ( ) const
inline

Definition at line 90 of file qgsatlascomposition.h.

bool QgsAtlasComposition::sortFeatures ( ) const
inline

Definition at line 87 of file qgsatlascomposition.h.

int QgsAtlasComposition::sortKeyAttributeIndex ( ) const
inline

Definition at line 99 of file qgsatlascomposition.h.

void QgsAtlasComposition::statusMsgChanged ( QString  message)
signal

Is emitted when the atlas has an updated status bar message for the composer window.

Referenced by prepareForFeature().

void QgsAtlasComposition::toggled ( bool  )
signal

emitted when atlas is enabled or disabled

Referenced by readXML(), and setEnabled().

void QgsAtlasComposition::updateAtlasMaps ( )
private
int QgsAtlasComposition::updateFeatures ( )
void QgsAtlasComposition::updateFilenameExpression ( )
private
void QgsAtlasComposition::writeXML ( QDomElement &  elem,
QDomDocument &  doc 
) const

Member Data Documentation

QgsComposition* QgsAtlasComposition::mComposition
private
QgsVectorLayer* QgsAtlasComposition::mCoverageLayer
private
QgsFeature QgsAtlasComposition::mCurrentFeature
private

Definition at line 195 of file qgsatlascomposition.h.

Referenced by computeExtent(), evalFeatureFilename(), and prepareForFeature().

int QgsAtlasComposition::mCurrentFeatureNo
private

Definition at line 176 of file qgsatlascomposition.h.

Referenced by firstFeature(), lastFeature(), nextFeature(), and prevFeature().

QString QgsAtlasComposition::mCurrentFilename
private

Definition at line 169 of file qgsatlascomposition.h.

Referenced by currentFilename(), and evalFeatureFilename().

bool QgsAtlasComposition::mEnabled
private

Definition at line 162 of file qgsatlascomposition.h.

Referenced by readXML(), setEnabled(), and writeXML().

QString QgsAtlasComposition::mFeatureFilter
private

Definition at line 190 of file qgsatlascomposition.h.

Referenced by readXML(), updateFeatures(), and writeXML().

QVector<QgsFeatureId> QgsAtlasComposition::mFeatureIds
private
SorterKeys QgsAtlasComposition::mFeatureKeys
private

Definition at line 183 of file qgsatlascomposition.h.

Referenced by updateFeatures().

std::auto_ptr<QgsExpression> QgsAtlasComposition::mFilenameExpr
private

Definition at line 197 of file qgsatlascomposition.h.

Referenced by evalFeatureFilename(), and updateFilenameExpression().

QString QgsAtlasComposition::mFilenamePattern
private
bool QgsAtlasComposition::mFilterFeatures
private

Definition at line 188 of file qgsatlascomposition.h.

Referenced by readXML(), updateFeatures(), and writeXML().

bool QgsAtlasComposition::mHideCoverage
private

Definition at line 163 of file qgsatlascomposition.h.

Referenced by readXML(), setHideCoverage(), and writeXML().

bool QgsAtlasComposition::mSingleFile
private
bool QgsAtlasComposition::mSortAscending
private

Definition at line 173 of file qgsatlascomposition.h.

Referenced by readXML(), updateFeatures(), and writeXML().

bool QgsAtlasComposition::mSortFeatures
private

Definition at line 171 of file qgsatlascomposition.h.

Referenced by readXML(), updateFeatures(), and writeXML().

int QgsAtlasComposition::mSortKeyAttributeIdx
private

Definition at line 185 of file qgsatlascomposition.h.

Referenced by readXML(), updateFeatures(), and writeXML().

QgsCoordinateTransform QgsAtlasComposition::mTransform
private

Definition at line 168 of file qgsatlascomposition.h.

Referenced by computeExtent().

QgsRectangle QgsAtlasComposition::mTransformedFeatureBounds
private

Definition at line 200 of file qgsatlascomposition.h.

Referenced by computeExtent(), prepareForFeature(), and prepareMap().


The documentation for this class was generated from the following files: