Skip to content

Commit

Permalink
Add/Fix SIP for QgsComposition, QgsComposerMap and QgsAtlasRendering
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugo Mercier committed Oct 2, 2012
1 parent aab22b2 commit 2aa566d
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 1 deletion.
3 changes: 3 additions & 0 deletions python/core/composer/qgscomposerlabel.sip
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 20 additions & 0 deletions python/core/composer/qgscomposermap.sip
Original file line number Diff line number Diff line change
Expand Up @@ -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*/
Expand Down
48 changes: 47 additions & 1 deletion python/core/composer/qgscomposition.sip
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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*/
Expand Down Expand Up @@ -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 );

Expand Down Expand Up @@ -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 );
Expand Down

0 comments on commit 2aa566d

Please sign in to comment.