QGIS API Documentation  2.3.0-Master
 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>

Inheritance diagram for QgsAtlasComposition:
Inheritance graph
[legend]
Collaboration diagram for QgsAtlasComposition:
Collaboration graph
[legend]

Public Types

typedef QMap< QgsFeatureId,
QVariant > 
SorterKeys
 

Signals

void parameterChanged ()
 emitted when one of the parameters changes More...
 
void toggled (bool)
 emitted when atlas is enabled or disabled More...
 
void statusMsgChanged (QString message)
 Is emitted when the atlas has an updated status bar message for the composer window. More...
 
void coverageLayerChanged (QgsVectorLayer *layer)
 Is emitted when the coverage layer for an atlas changes. More...
 
void renderBegun ()
 Is emitted when atlas rendering has begun. More...
 
void renderEnded ()
 Is emitted when atlas rendering has ended. More...
 

Public Member Functions

 QgsAtlasComposition (QgsComposition *composition)
 
 ~QgsAtlasComposition ()
 
bool enabled () const
 Is the atlas generation enabled ? More...
 
void setEnabled (bool e)
 
QgsComposerMapcomposerMap () const
 Returns the map used by the atlas. More...
 
void setComposerMap (QgsComposerMap *map)
 Sets the map used by the atlas. More...
 
bool hideCoverage () const
 
void setHideCoverage (bool hide)
 
bool fixedScale () const
 Returns whether the atlas map uses a fixed scale. More...
 
void setFixedScale (bool fixed)
 Sets whether the atlas map should use a fixed scale. More...
 
float margin () const
 Returns the margin for the atlas map. More...
 
void setMargin (float margin)
 Sets the margin for the atlas map. More...
 
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)
 
QString sortKeyAttributeName () const
 
void setSortKeyAttributeName (QString fieldName)
 
Q_DECL_DEPRECATED int sortKeyAttributeIndex () const
 
Q_DECL_DEPRECATED void setSortKeyAttributeIndex (int idx)
 
bool beginRender ()
 Begins the rendering. More...
 
void endRender ()
 Ends the rendering. More...
 
int numFeatures () const
 Returns the number of features in the coverage layer. More...
 
void prepareForFeature (int i)
 Prepare the atlas map for the given feature. More...
 
void prepareForFeature (QgsFeature *feat)
 Prepare the atlas map for the given feature. More...
 
const QString & currentFilename () const
 Returns the current filename. More...
 
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. More...
 
void nextFeature ()
 
void prevFeature ()
 
void lastFeature ()
 
void firstFeature ()
 
QgsFeaturecurrentFeature ()
 Returns the current atlas feature. More...
 
void prepareMap (QgsComposerMap *map)
 Recalculates the bounds of an atlas driven map. More...
 

Private Member Functions

void updateFilenameExpression ()
 Updates the filename expression. More...
 
void evalFeatureFilename ()
 Evaluates filename for current feature. More...
 
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
 
QString mSortKeyAttributeName
 
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 188 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 286 of file qgsatlascomposition.cpp.

References mComposition, mCoverageLayer, mFeatureIds, QgsComposition::numPages(), renderBegun(), 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 79 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 126 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 138 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 564 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 309 of file qgsatlascomposition.cpp.

References QgsComposition::composerItems(), mComposition, mCoverageLayer, renderEnded(), 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 373 of file qgsatlascomposition.cpp.

References 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 110 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 378 of file qgsatlascomposition.cpp.

References mFeatureIds, and prepareForFeature().

float QgsAtlasComposition::margin ( ) const

Returns the margin for the atlas map.

Deprecated:
Use QgsComposerMap::atlasMargin() instead

Definition at line 134 of file qgsatlascomposition.cpp.

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

Referenced by readXML().

void QgsAtlasComposition::nextFeature ( )

Definition at line 351 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 346 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 383 of file qgsatlascomposition.cpp.

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

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

Definition at line 362 of file qgsatlascomposition.cpp.

References mCurrentFeatureNo, and prepareForFeature().

void QgsAtlasComposition::readXML ( const QDomElement &  elem,
const QDomDocument &  doc 
)
void QgsAtlasComposition::renderBegun ( )
signal

Is emitted when atlas rendering has begun.

Referenced by beginRender().

void QgsAtlasComposition::renderEnded ( )
signal

Is emitted when atlas rendering has ended.

Referenced by endRender().

void QgsAtlasComposition::setComposerMap ( QgsComposerMap map)

Sets the map used by the atlas.

Deprecated:
Use QgsComposerMap::setAtlasDriven( true ) instead

Definition at line 98 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 702 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 122 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 146 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)
void QgsAtlasComposition::setSortKeyAttributeName ( QString  fieldName)
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
QString QgsAtlasComposition::sortKeyAttributeName ( ) 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 204 of file qgsatlascomposition.h.

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

int QgsAtlasComposition::mCurrentFeatureNo
private

Definition at line 185 of file qgsatlascomposition.h.

Referenced by nextFeature(), prepareForFeature(), and prevFeature().

QString QgsAtlasComposition::mCurrentFilename
private

Definition at line 178 of file qgsatlascomposition.h.

Referenced by currentFilename(), and evalFeatureFilename().

bool QgsAtlasComposition::mEnabled
private

Definition at line 171 of file qgsatlascomposition.h.

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

QString QgsAtlasComposition::mFeatureFilter
private

Definition at line 199 of file qgsatlascomposition.h.

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

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

Definition at line 192 of file qgsatlascomposition.h.

Referenced by updateFeatures().

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

Definition at line 206 of file qgsatlascomposition.h.

Referenced by evalFeatureFilename(), and updateFilenameExpression().

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

Definition at line 197 of file qgsatlascomposition.h.

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

bool QgsAtlasComposition::mHideCoverage
private

Definition at line 172 of file qgsatlascomposition.h.

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

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

Definition at line 182 of file qgsatlascomposition.h.

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

bool QgsAtlasComposition::mSortFeatures
private

Definition at line 180 of file qgsatlascomposition.h.

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

QString QgsAtlasComposition::mSortKeyAttributeName
private
QgsCoordinateTransform QgsAtlasComposition::mTransform
private

Definition at line 177 of file qgsatlascomposition.h.

Referenced by computeExtent().

QgsRectangle QgsAtlasComposition::mTransformedFeatureBounds
private

Definition at line 209 of file qgsatlascomposition.h.

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


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