Skip to content
Permalink
Browse files

Add/Fix SIP for QgsComposition, QgsComposerMap and QgsAtlasRendering

  • Loading branch information
Hugo Mercier
Hugo Mercier committed Oct 2, 2012
1 parent aab22b2 commit 2aa566d316f5c2d3bc5dde030e0ade2b9c588cec
@@ -26,6 +26,9 @@ class QgsComposerLabel : QgsComposerItem
@note this function was added in version 1.2*/
QString displayText() const;

/** Sets the current feature, the current layer and a list of local variable substitutions for evaluating expressions */
void setExpressionContext( QgsFeature* feature, QgsVectorLayer* layer, QMap<QString, QVariant> substitutions = QMap<QString, QVariant>() );

QFont font() const;
void setFont( const QFont& f );
/** Accessor for the vertical alignment of the label
@@ -285,9 +285,29 @@ class QgsComposerMap : QgsComposerItem
Usually, this function is called before adding the composer map to the composition*/
void assignFreeId();

bool atlasHideCoverage() const;
void setAtlasHideCoverage( bool hide );

bool atlasFixedScale() const;
void setAtlasFixedScale( bool fixed );

float atlasMargin() const;
void setAtlasMargin( float margin );

QString atlasFilenamePattern() const;
void setAtlasFilenamePattern( const QString& pattern );

QgsVectorLayer* atlasCoverageLayer() const;
void setAtlasCoverageLayer( QgsVectorLayer* lmap );

bool atlasSingleFile() const;
void setAtlasSingleFile( bool single );

signals:
void extentChanged();

void atlasCoverageLayerChanged( QgsVectorLayer* );

public slots:

/**Called if map canvas has changed*/
@@ -1,3 +1,31 @@
/** \ingroup MapComposer
* 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.
* */
class QgsAtlasRendering
{
%TypeHeaderCode
#include <qgscomposition.h>
%End
public:
QgsAtlasRendering( QgsComposition* composition );

/** Begins the rendering. Sets an optional output filename pattern */
void begin( const QString& filenamePattern = "" );
/** Ends the rendering. Restores original extent*/
void end();

/** Returns the number of features in the coverage layer */
size_t numFeatures() const;

/** Prepare the atlas map for the given feature. Sets the extent and context variables */
void prepareForFeature( size_t i );

/** Returns the current filename. Must be called after prepareForFeature( i ) */
const QString& currentFilename() const;
};

/** \ingroup MapComposer
* Graphics scene for map printing. The class manages the paper item which always
* is the item in the back (z-value 0). It maintains the z-Values of the items and stores
@@ -70,6 +98,12 @@ class QgsComposition: QGraphicsScene
/**Returns the topmose composer item. Ignores mPaperItem*/
QgsComposerItem* composerItemAt( const QPointF & position );

/** Returns the page number (0-bsaed) given a coordinate */
int pageNumberAt( const QPointF& position ) const;

/** Returns on which page number (0-based) is displayed an item */
int itemPageNumber( const QgsComposerItem* ) const;

QList<QgsComposerItem*> selectedComposerItems();

/**Returns pointers to all composer maps in the scene*/
@@ -111,6 +145,9 @@ class QgsComposition: QGraphicsScene
/**Returns pointer to map renderer of qgis map canvas*/
QgsMapRenderer* mapRenderer();

QgsComposerMap* atlasMap();
void setAtlasMap( QgsComposerMap* map );

QgsComposition::PlotStyle plotStyle();
void setPlotStyle( QgsComposition::PlotStyle style );

@@ -219,10 +256,19 @@ class QgsComposition: QGraphicsScene

//printing

void exportAsPDF( const QString& file );
/** Prepare the printer for printing */
void beginPrint( QPrinter& printer );
/** Prepare the printer for printing in a PDF */
void beginPrintAsPDF( QPrinter& printer, const QString& file );
/** Print on a preconfigured printer */
void doPrint( QPrinter& printer, QPainter& painter );

/** Convenience function that prepares the printer and prints */
void print( QPrinter &printer );

/** Convenience function that prepares the printer for printing in PDF and prints */
void exportAsPDF( const QString& file );

//! print composer page to image
//! If the image does not fit into memory, a null image is returned
QImage printPageAsRaster( int page );

0 comments on commit 2aa566d

Please sign in to comment.
You can’t perform that action at this time.