Skip to content

Commit

Permalink
Add missing docs, SIP bindings, some const correctness
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed May 29, 2016
1 parent 36ff0ba commit 421ab4f
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 16 deletions.
26 changes: 23 additions & 3 deletions python/core/qgsmaprenderer.sip
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,34 @@ class QgsMapRenderer : QObject
//! sets whether map image will be for overview
void enableOverviewMode( bool isOverview = true );

/** Sets the desired size of the rendered map image.
* @param size size in pixels
* @param dpi resolution to render map using
* @see outputSize()
*/
void setOutputSize( QSize size, double dpi );

/** Sets the desired size of the rendered map image.
* @param size size in pixels
* @param dpi resolution to render map using
* @see outputSizeF()
*/
void setOutputSize( QSizeF size, double dpi );

//!accessor for output dpi
double outputDpi();
//!accessor for output size
QSize outputSize();
QSizeF outputSizeF();

/** Returns the size which the map will be rendered at.
* @see setOutputSize()
* @see outputSizeF()
*/
QSize outputSize() const;

/** Returns the size which the map will be rendered at.
* @see setOutputSize()
* @see outputSize()
*/
QSizeF outputSizeF() const;

/**
* @brief transform bounding box from layer's CRS to output CRS
Expand Down
26 changes: 20 additions & 6 deletions python/gui/qgsmapcanvas.sip
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,6 @@ class QgsMapCanvas : QGraphicsView
//! Destructor
~QgsMapCanvas();

//! Sets the factor of magnification to apply to the map canvas. Indeed, we
//! increase/decrease the DPI of the map settings according to this factor
//! in order to render marker point, labels, ... bigger.
//! @note added in 2.16
void setMagnificationFactor( double level );

//! Returns the magnification factor
//! @note added in 2.16
double magnificationFactor() const;
Expand Down Expand Up @@ -301,6 +295,11 @@ class QgsMapCanvas : QGraphicsView
//! Zooms in/out with a given center
void zoomWithCenter( int x, int y, bool zoomIn );

//! Returns whether the scale is locked, so zooming can be performed using magnication.
//! @note added in 2.16
//! @see setScaleLocked()
bool scaleLocked() const;

//! used to determine if anti-aliasing is enabled or not
void enableAntiAliasing( bool theFlag );

Expand Down Expand Up @@ -456,6 +455,17 @@ class QgsMapCanvas : QGraphicsView
//! @note added in 2.8
static void enableRotation( bool enabled );

//! Sets the factor of magnification to apply to the map canvas. Indeed, we
//! increase/decrease the DPI of the map settings according to this factor
//! in order to render marker point, labels, ... bigger.
//! @note added in 2.16
void setMagnificationFactor( double factor );

//! Lock the scale, so zooming can be performed using magnication
//! @note added in 2.16
//! @see scaleLocked()
void setScaleLocked( bool isLocked );

signals:
/** Let the owner know how far we are with render operations */
//! @deprecated since 2.4 - already unused in 2.0 anyway
Expand All @@ -475,6 +485,10 @@ class QgsMapCanvas : QGraphicsView
//! @note added in 2.8
void rotationChanged( double );

//! Emitted when the scale of the map changes
//! @note added in 2.16
void magnificationChanged( double );

/** Emitted when the canvas has rendered.
* Passes a pointer to the painter on which the map was drawn. This is
* useful for plugins that wish to draw on the map after it has been
Expand Down
4 changes: 2 additions & 2 deletions src/core/qgsmaprenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,12 @@ double QgsMapRenderer::outputDpi()
return mScaleCalculator->dpi();
}

QSize QgsMapRenderer::outputSize()
QSize QgsMapRenderer::outputSize() const
{
return mSize.toSize();
}

QSizeF QgsMapRenderer::outputSizeF()
QSizeF QgsMapRenderer::outputSizeF() const
{
return mSize;
}
Expand Down
26 changes: 23 additions & 3 deletions src/core/qgsmaprenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -247,14 +247,34 @@ class CORE_EXPORT QgsMapRenderer : public QObject
//! sets whether map image will be for overview
void enableOverviewMode( bool isOverview = true ) { mOverview = isOverview; }

/** Sets the desired size of the rendered map image.
* @param size size in pixels
* @param dpi resolution to render map using
* @see outputSize()
*/
void setOutputSize( QSize size, double dpi );

/** Sets the desired size of the rendered map image.
* @param size size in pixels
* @param dpi resolution to render map using
* @see outputSizeF()
*/
void setOutputSize( QSizeF size, double dpi );

//!accessor for output dpi
double outputDpi();
//!accessor for output size
QSize outputSize();
QSizeF outputSizeF();

/** Returns the size which the map will be rendered at.
* @see setOutputSize()
* @see outputSizeF()
*/
QSize outputSize() const;

/** Returns the size which the map will be rendered at.
* @see setOutputSize()
* @see outputSize()
*/
QSizeF outputSizeF() const;

/**
* @brief transform bounding box from layer's CRS to output CRS
Expand Down
8 changes: 6 additions & 2 deletions src/gui/qgsmapcanvas.h
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,10 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
//! Zooms in/out with a given center
void zoomWithCenter( int x, int y, bool zoomIn );

bool scaleLocked() { return mScaleLocked;}
//! Returns whether the scale is locked, so zooming can be performed using magnication.
//! @note added in 2.16
//! @see setScaleLocked()
bool scaleLocked() const { return mScaleLocked;}

//! used to determine if anti-aliasing is enabled or not
void enableAntiAliasing( bool theFlag );
Expand Down Expand Up @@ -528,8 +531,9 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
//! @note added in 2.16
void setMagnificationFactor( double factor );

//! lock the scale, so zooming can be performed using magnication
//! Lock the scale, so zooming can be performed using magnication
//! @note added in 2.16
//! @see scaleLocked()
void setScaleLocked( bool isLocked );

private slots:
Expand Down

0 comments on commit 421ab4f

Please sign in to comment.