QGIS/python/gui/auto_generated/qgsmapcanvas.sip.in

1047 lines
25 KiB
Plaintext
Raw Normal View History

2017-05-23 14:49:24 +02:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsmapcanvas.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsMapCanvas : QGraphicsView
{
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Map canvas is a class for displaying all GIS data types on a canvas.
2017-05-23 14:49:24 +02:00
%End
%TypeHeaderCode
2017-05-23 14:49:24 +02:00
#include "qgsmapcanvas.h"
%End
%ConvertToSubClassCode
2017-05-23 14:49:24 +02:00
if ( dynamic_cast<QgsMapCanvas *>( sipCpp ) != NULL )
sipType = sipType_QgsMapCanvas;
else
sipType = NULL;
%End
public:
QgsMapCanvas( QWidget *parent /TransferThis/ = 0 );
2017-05-23 14:49:24 +02:00
%Docstring
Constructor
%End
~QgsMapCanvas();
2017-05-23 14:49:24 +02:00
2016-05-12 09:42:51 +02:00
double magnificationFactor() const;
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the magnification factor
2017-05-23 14:49:24 +02:00
.. versionadded:: 2.16
%End
void setLayers( const QList<QgsMapLayer *> &layers );
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets the list of ``layers`` that should be shown in the canvas.
2017-05-23 14:49:24 +02:00
2017-12-15 10:36:55 -04:00
If the map canvas has been associated with a map theme via a call
to setTheme(), then any calls to setLayers() are ignored. It is necessary
to first clear the theme association by calling setTheme() with an
empty string before setLayers() calls can be made.
2017-05-23 14:49:24 +02:00
.. seealso:: :py:func:`layers`
2018-05-28 11:31:08 -04:00
.. versionadded:: 3.0
2017-05-23 14:49:24 +02:00
%End
void setCurrentLayer( QgsMapLayer *layer );
2017-05-23 14:49:24 +02:00
const QgsMapSettings &mapSettings() const /KeepReference/;
2017-05-23 14:49:24 +02:00
%Docstring
Gets access to properties used for map rendering
2017-12-15 10:36:55 -04:00
2017-05-23 14:49:24 +02:00
.. versionadded:: 2.4
%End
void setDestinationCrs( const QgsCoordinateReferenceSystem &crs );
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
sets destination coordinate reference system
2017-05-23 14:49:24 +02:00
.. versionadded:: 2.4
%End
void setMapSettingsFlags( QgsMapSettings::Flags flags );
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Resets the ``flags`` for the canvas' map settings.
2017-05-23 14:49:24 +02:00
.. versionadded:: 3.0
%End
const QgsLabelingResults *labelingResults() const;
2017-05-23 14:49:24 +02:00
%Docstring
Gets access to the labeling results (may be null)
2017-12-15 10:36:55 -04:00
2017-05-23 14:49:24 +02:00
.. versionadded:: 2.4
%End
void setCachingEnabled( bool enabled );
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Set whether to cache images of rendered layers
2017-05-23 14:49:24 +02:00
.. versionadded:: 2.4
%End
bool isCachingEnabled() const;
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Check whether images of rendered layers are curerently being cached
2017-05-23 14:49:24 +02:00
.. versionadded:: 2.4
%End
void clearCache();
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Make sure to remove any rendered images from cache (does nothing if cache is not enabled)
2017-05-23 14:49:24 +02:00
.. versionadded:: 2.4
%End
void waitWhileRendering();
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Blocks until the rendering job has finished.
2017-05-23 14:49:24 +02:00
2017-12-15 10:36:55 -04:00
In almost all cases you do NOT want to call this, as it will hang the UI
until the rendering job is complete. It's included in API solely for
unit testing and standalone Python scripts.
2017-05-23 14:49:24 +02:00
.. versionadded:: 3.0
%End
void setParallelRenderingEnabled( bool enabled );
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Set whether the layers are rendered in parallel or sequentially
2017-05-23 14:49:24 +02:00
.. versionadded:: 2.4
%End
bool isParallelRenderingEnabled() const;
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Check whether the layers are rendered in parallel or sequentially
2017-05-23 14:49:24 +02:00
.. versionadded:: 2.4
%End
void setMapUpdateInterval( int timeMilliseconds );
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Set how often map preview should be updated while it is being rendered (in milliseconds)
2017-05-23 14:49:24 +02:00
.. versionadded:: 2.4
%End
2013-12-11 21:12:24 +07:00
int mapUpdateInterval() const;
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Find out how often map preview should be updated while it is being rendered (in milliseconds)
2017-05-23 14:49:24 +02:00
.. versionadded:: 2.4
%End
double scale() const;
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the last reported scale of the canvas.
The ``scale`` value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.
2017-05-23 14:49:24 +02:00
%End
double mapUnitsPerPixel() const;
2017-05-23 14:49:24 +02:00
%Docstring
Returns the mapUnitsPerPixel (map units per pixel) for the canvas
%End
QgsRectangle extent() const;
2017-05-23 14:49:24 +02:00
%Docstring
Returns the current zoom extent of the map canvas
%End
QgsRectangle fullExtent() const;
2017-05-23 14:49:24 +02:00
%Docstring
Returns the combined extent for all layers on the map canvas
%End
void setExtent( const QgsRectangle &r, bool magnified = false );
2017-05-23 14:49:24 +02:00
%Docstring
Sets the extent of the map canvas
2017-05-23 14:49:24 +02:00
%End
double rotation() const;
2017-05-23 14:49:24 +02:00
%Docstring
Gets the current map canvas rotation in clockwise degrees
2017-12-15 10:36:55 -04:00
2017-05-23 14:49:24 +02:00
.. versionadded:: 2.8
%End
void setRotation( double degrees );
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Set the rotation of the map canvas in clockwise degrees
2017-05-23 14:49:24 +02:00
.. versionadded:: 2.8
%End
void setCenter( const QgsPointXY &center );
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Set the center of the map canvas, in geographical coordinates
2017-05-23 14:49:24 +02:00
.. versionadded:: 2.8
%End
QgsPointXY center() const;
2017-05-23 14:49:24 +02:00
%Docstring
Gets map center, in geographical coordinates
2017-12-15 10:36:55 -04:00
2017-05-23 14:49:24 +02:00
.. versionadded:: 2.8
%End
void zoomToFullExtent();
2017-05-23 14:49:24 +02:00
%Docstring
Zoom to the full extent of all layers
%End
void zoomToPreviousExtent();
2017-05-23 14:49:24 +02:00
%Docstring
Zoom to the previous extent (view)
%End
void zoomToNextExtent();
2017-05-23 14:49:24 +02:00
%Docstring
Zoom to the next extent (view)
%End
void clearExtentHistory();
2017-05-23 14:49:24 +02:00
void zoomToFeatureIds( QgsVectorLayer *layer, const QgsFeatureIds &ids );
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Set canvas extent to the bounding box of a set of features
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param layer: the vector layer
:param ids: the feature ids*
2017-05-23 14:49:24 +02:00
%End
void panToFeatureIds( QgsVectorLayer *layer, const QgsFeatureIds &ids );
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Centers canvas extent to feature ids
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param layer: the vector layer
:param ids: the feature ids*
2017-05-23 14:49:24 +02:00
%End
void panToSelected( QgsVectorLayer *layer = 0 );
2017-05-23 14:49:24 +02:00
%Docstring
Pan to the selected features of current (vector) layer keeping same extent.
%End
void flashFeatureIds( QgsVectorLayer *layer, const QgsFeatureIds &ids,
const QColor &startColor = QColor( 255, 0, 0, 255 ), const QColor &endColor = QColor( 255, 0, 0, 0 ),
int flashes = 3, int duration = 500 );
%Docstring
2017-12-15 10:36:55 -04:00
Causes a set of features with matching ``ids`` from a vector ``layer`` to flash
within the canvas.
2017-12-15 10:36:55 -04:00
The ``startColor`` and ``endColor`` can be specified, along with the number of
``flashes`` and ``duration`` of each flash (in milliseconds).
2017-09-29 11:00:32 +10:00
.. note::
If the features or geometries are already available, flashGeometries() is much more efficient.
.. seealso:: :py:func:`flashGeometries`
2018-05-28 11:31:08 -04:00
.. versionadded:: 3.0
2017-09-29 11:00:32 +10:00
%End
void flashGeometries( const QList< QgsGeometry > &geometries, const QgsCoordinateReferenceSystem &crs = QgsCoordinateReferenceSystem(),
2017-09-29 11:00:32 +10:00
const QColor &startColor = QColor( 255, 0, 0, 255 ), const QColor &endColor = QColor( 255, 0, 0, 0 ),
int flashes = 3, int duration = 500 );
%Docstring
2017-12-15 10:36:55 -04:00
Causes a set of ``geometries`` to flash within the canvas.
2017-09-29 11:00:32 +10:00
2017-12-15 10:36:55 -04:00
If ``crs`` is a valid coordinate reference system, the geometries will be automatically
transformed from this CRS to the canvas CRS.
2017-09-29 11:00:32 +10:00
2017-12-15 10:36:55 -04:00
The ``startColor`` and ``endColor`` can be specified, along with the number of
``flashes`` and ``duration`` of each flash (in milliseconds).
2017-09-29 11:00:32 +10:00
.. seealso:: :py:func:`flashFeatureIds`
2018-05-28 11:31:08 -04:00
.. versionadded:: 3.0
2017-05-23 14:49:24 +02:00
%End
2017-10-16 22:13:47 +02:00
void setMapTool( QgsMapTool *mapTool, bool clean = false );
2017-05-23 14:49:24 +02:00
%Docstring
Sets the map tool currently being used on the canvas
2017-05-23 14:49:24 +02:00
%End
void unsetMapTool( QgsMapTool *mapTool );
2017-05-23 14:49:24 +02:00
%Docstring
Unset the current map tool or last non zoom tool
2017-05-23 14:49:24 +02:00
2017-12-15 10:36:55 -04:00
This is called from destructor of map tools to make sure
that this map tool won't be used any more.
You don't have to call it manually, QgsMapTool takes care of it.
2017-05-23 14:49:24 +02:00
%End
QgsMapTool *mapTool();
2017-05-23 14:49:24 +02:00
%Docstring
Returns the currently active tool
%End
void setCanvasColor( const QColor &_newVal );
2017-05-23 14:49:24 +02:00
%Docstring
Write property of QColor bgColor.
%End
QColor canvasColor() const;
2017-05-23 14:49:24 +02:00
%Docstring
Read property of QColor bgColor.
%End
void setSelectionColor( const QColor &color );
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Set color of selected vector features
2017-05-23 14:49:24 +02:00
.. versionadded:: 2.4
%End
2017-08-05 11:50:36 +02:00
QColor selectionColor() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns color for selected features
2017-08-05 11:50:36 +02:00
.. versionadded:: 3.0
%End
void updateScale();
2017-05-23 14:49:24 +02:00
%Docstring
Emits signal scaleChanged to update scale in main window
%End
QgsMapLayer *layer( int index );
2017-05-23 14:49:24 +02:00
%Docstring
Returns the map layer at position index in the layer stack
2017-05-23 14:49:24 +02:00
%End
int layerCount() const;
2017-05-23 14:49:24 +02:00
%Docstring
Returns number of layers on the map
2017-05-23 14:49:24 +02:00
%End
QList<QgsMapLayer *> layers() const;
2017-05-23 14:49:24 +02:00
%Docstring
Returns the list of layers shown within the map canvas.
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`setLayers`
2017-05-23 14:49:24 +02:00
%End
void freeze( bool frozen = true );
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Freeze/thaw the map canvas. This is used to prevent the canvas from
responding to events while layers are being added/removed etc.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param frozen: Boolean specifying if the canvas should be frozen (true) or
thawed (false). Default is true.
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`isFrozen`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`setRenderFlag`
while setRenderFlag() should only be used when users disable rendering via GUI.
2017-05-23 14:49:24 +02:00
%End
bool isFrozen() const;
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns true if canvas is frozen.
.. seealso:: :py:func:`renderFlag`
2017-12-15 10:36:55 -04:00
have been halted programmatically, while renderFlag() should be used to
determine whether a user has disabled rendering via GUI.
.. seealso:: :py:func:`freeze`
2017-05-23 14:49:24 +02:00
%End
bool renderFlag() const;
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns true if canvas render is disabled as a result of user disabling
renders via the GUI.
.. seealso:: :py:func:`setRenderFlag`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`isFrozen`
2017-12-15 10:36:55 -04:00
have been halted programmatically, while renderFlag() should be used to
determine whether a user has disabled rendering via GUI.
2017-05-23 14:49:24 +02:00
%End
QgsUnitTypes::DistanceUnit mapUnits() const;
2017-05-23 14:49:24 +02:00
%Docstring
2018-05-08 08:47:30 +10:00
Convenience function for returning the current canvas map units. The map units
2017-12-15 10:36:55 -04:00
are dictated by the canvas' destinationCrs() map units.
2017-05-23 14:49:24 +02:00
%End
QMap<QString, QString> layerStyleOverrides() const;
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the stored overrides of styles for layers.
.. seealso:: :py:func:`setLayerStyleOverrides`
2018-05-28 11:31:08 -04:00
.. versionadded:: 2.12
2017-05-23 14:49:24 +02:00
%End
void setLayerStyleOverrides( const QMap<QString, QString> &overrides );
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets the stored overrides of styles for rendering layers.
2017-05-23 14:49:24 +02:00
2017-12-15 10:36:55 -04:00
If the map canvas has been associated with a map theme via a call
to setTheme(), then any calls to setLayerStyleOverrides() are ignored. It is necessary
to first clear the theme association by calling setTheme() with an
empty string before setLayerStyleOverrides() calls can be made.
2017-05-23 14:49:24 +02:00
.. seealso:: :py:func:`layerStyleOverrides`
2018-05-28 11:31:08 -04:00
.. versionadded:: 2.12
2017-05-23 14:49:24 +02:00
%End
void setTheme( const QString &theme );
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets a map ``theme`` to show in the canvas. The theme name must match
2017-12-19 11:43:52 -04:00
a theme present in the associated project's :py:class:`QgsMapThemeCollection`.
2017-12-15 10:36:55 -04:00
When the canvas is associated to a map theme, it will automatically follow
the layer selection and layer styles from that theme. Calls to setLayers()
or setLayerStyleOverrides() will have no effect, and canvases associated
with a QgsLayerTreeMapCanvasBridge will no longer synchronize their
state with the layer tree. In these cases it is necessary to call
setTheme() with an empty string to clear the theme association and
allow map updates with setLayers(), setLayerStyleOverrides(), or via
2017-12-19 11:43:52 -04:00
:py:class:`QgsLayerTreeMapCanvasBridge`.
2017-05-23 14:49:24 +02:00
2017-12-15 10:36:55 -04:00
If an empty string is passed then the current theme association will be
cleared.
2017-05-23 14:49:24 +02:00
.. seealso:: :py:func:`theme`
2018-05-28 11:31:08 -04:00
.. versionadded:: 3.0
2017-05-23 14:49:24 +02:00
%End
QString theme() const;
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the map's theme shown in the canvas, if set.
.. seealso:: :py:func:`setTheme`
2018-05-28 11:31:08 -04:00
.. versionadded:: 3.0
2017-05-23 14:49:24 +02:00
%End
const QgsMapToPixel *getCoordinateTransform();
2017-05-23 14:49:24 +02:00
%Docstring
Gets the current coordinate transform
2017-05-23 14:49:24 +02:00
%End
bool isDrawing();
2017-05-23 14:49:24 +02:00
%Docstring
Find out whether rendering is in progress
%End
QgsMapLayer *currentLayer();
2017-05-23 14:49:24 +02:00
%Docstring
returns current layer (set by legend widget)
%End
void setWheelFactor( double factor );
2017-05-23 14:49:24 +02:00
%Docstring
Sets wheel zoom factor (should be greater than 1)
2017-05-23 14:49:24 +02:00
%End
void zoomScale( double scale );
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Zooms the canvas to a specific ``scale``.
The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.
2017-05-23 14:49:24 +02:00
%End
void zoomByFactor( double scaleFactor, const QgsPointXY *center = 0 );
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Zoom with the factor supplied. Factor > 1 zooms out, interval (0,1) zooms in
If point is given, re-center on it
2017-05-23 14:49:24 +02:00
%End
void zoomWithCenter( int x, int y, bool zoomIn );
2017-05-23 14:49:24 +02:00
%Docstring
Zooms in/out with a given center
%End
void zoomToFeatureExtent( QgsRectangle &rect );
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Zooms to feature extent. Adds a small margin around the extent
and does a pan if rect is empty (point extent)
2017-05-23 14:49:24 +02:00
%End
bool scaleLocked() const;
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns whether the scale is locked, so zooming can be performed using magnication.
.. seealso:: :py:func:`setScaleLocked`
2018-05-28 11:31:08 -04:00
.. versionadded:: 2.16
2017-05-23 14:49:24 +02:00
%End
void enableAntiAliasing( bool flag );
2017-05-23 14:49:24 +02:00
%Docstring
used to determine if anti-aliasing is enabled or not
%End
bool antiAliasingEnabled() const;
2017-05-23 14:49:24 +02:00
%Docstring
true if antialising is enabled
%End
void enableMapTileRendering( bool flag );
2017-05-23 14:49:24 +02:00
%Docstring
sets map tile rendering flag
%End
void panActionEnd( QPoint releasePoint );
2017-05-23 14:49:24 +02:00
%Docstring
Ends pan action and redraws the canvas.
%End
void panAction( QMouseEvent *event );
2017-05-23 14:49:24 +02:00
%Docstring
Called when mouse is moving and pan is activated
%End
QPoint mouseLastXY();
2017-05-23 14:49:24 +02:00
%Docstring
returns last position of mouse cursor
%End
void setPreviewModeEnabled( bool previewEnabled );
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Enables a preview mode for the map canvas
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param previewEnabled: set to true to enable a preview mode
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setPreviewMode`
2017-12-15 10:36:55 -04:00
2017-05-23 14:49:24 +02:00
.. versionadded:: 2.3
%End
bool previewModeEnabled() const;
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns whether a preview mode is enabled for the map canvas
:return: true if a preview mode is currently enabled
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setPreviewModeEnabled`
2017-12-15 10:36:55 -04:00
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`previewMode`
2017-12-15 10:36:55 -04:00
2017-05-23 14:49:24 +02:00
.. versionadded:: 2.3
%End
void setPreviewMode( QgsPreviewEffect::PreviewMode mode );
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets a preview mode for the map canvas. This setting only has an effect if
previewModeEnabled is true.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param mode: preview mode for the canvas
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`previewMode`
2017-12-15 10:36:55 -04:00
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setPreviewModeEnabled`
2017-12-15 10:36:55 -04:00
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`previewModeEnabled`
2017-12-15 10:36:55 -04:00
2017-05-23 14:49:24 +02:00
.. versionadded:: 2.3
%End
2014-05-27 23:22:50 +02:00
QgsPreviewEffect::PreviewMode previewMode() const;
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the current preview mode for the map canvas. This setting only has an effect if
previewModeEnabled is true.
:return: preview mode for map canvas
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setPreviewMode`
2017-12-15 10:36:55 -04:00
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`previewModeEnabled`
2017-12-15 10:36:55 -04:00
2017-05-23 14:49:24 +02:00
.. versionadded:: 2.3
%End
QgsSnappingUtils *snappingUtils() const;
2017-05-23 14:49:24 +02:00
%Docstring
Returns snapping utility class that is associated with map canvas.
2017-12-15 10:36:55 -04:00
If no snapping utils instance has been associated previously, an internal will be created for convenience
(so map tools do not need to test for existence of the instance).
Main canvas in QGIS returns an instance which is always up-to-date with the project's snapping configuration.
2017-05-23 14:49:24 +02:00
.. versionadded:: 2.8
%End
void setSnappingUtils( QgsSnappingUtils *utils );
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Assign an instance of snapping utils to the map canvas.
The instance is not owned by the canvas, so it is possible to use one instance in multiple canvases.
For main canvas in QGIS, do not associate a different instance from the existing one (it is updated from
the project's snapping configuration).
2017-05-23 14:49:24 +02:00
.. versionadded:: 2.8
%End
void setExpressionContextScope( const QgsExpressionContextScope &scope );
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets an expression context scope for the map canvas. This scope is injected into the expression
context used for rendering the map, and can be used to apply specific variable overrides for
expression evaluation for the map canvas render. This method will overwrite the existing expression
context scope for the canvas.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param scope: new expression context scope
.. seealso:: :py:func:`expressionContextScope`
2018-05-28 11:31:08 -04:00
.. seealso:: :py:func:`defaultExpressionContextScope`
2018-05-28 11:31:08 -04:00
.. versionadded:: 2.12
2017-05-23 14:49:24 +02:00
%End
QgsExpressionContextScope &expressionContextScope();
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns a reference to the expression context scope for the map canvas. This scope is injected
into the expression context used for rendering the map, and can be used to apply specific variable
overrides for expression evaluation for the map canvas render.
.. seealso:: :py:func:`setExpressionContextScope`
2018-05-28 11:31:08 -04:00
.. seealso:: :py:func:`defaultExpressionContextScope`
2018-05-28 11:31:08 -04:00
.. versionadded:: 2.12
2017-05-23 14:49:24 +02:00
%End
QgsExpressionContextScope *defaultExpressionContextScope() /Factory/;
%Docstring
Creates a new scope which contains default variables and functions relating to the map canvas.
.. seealso:: :py:func:`expressionContextScope`
.. seealso:: :py:func:`setExpressionContextScope`
.. versionadded:: 3.4
%End
void setSegmentationTolerance( double tolerance );
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets the segmentation tolerance applied when rendering curved geometries
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param tolerance: the segmentation tolerance*
2017-05-23 14:49:24 +02:00
%End
2016-08-06 11:01:42 +02:00
void setSegmentationToleranceType( QgsAbstractGeometry::SegmentationToleranceType type );
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets segmentation tolerance type (maximum angle or maximum difference between curve and approximation)
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param type: the segmentation tolerance typename*
2017-05-23 14:49:24 +02:00
%End
QList< QgsMapCanvasAnnotationItem *> annotationItems() const;
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns a list of all annotation items in the canvas.
2017-05-23 14:49:24 +02:00
.. versionadded:: 3.0
%End
bool annotationsVisible() const;
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns true if annotations are visible within the map canvas.
.. seealso:: :py:func:`setAnnotationsVisible`
2018-05-28 11:31:08 -04:00
.. versionadded:: 3.0
2017-05-23 14:49:24 +02:00
%End
void setAnnotationsVisible( bool visible );
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets whether annotations are ``visible`` in the canvas.
.. seealso:: :py:func:`annotationsVisible`
2018-05-28 11:31:08 -04:00
.. versionadded:: 3.0
2017-05-23 14:49:24 +02:00
%End
void setLabelingEngineSettings( const QgsLabelingEngineSettings &settings );
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets global labeling engine settings in the internal map settings
2017-05-23 14:49:24 +02:00
.. versionadded:: 3.0
%End
const QgsLabelingEngineSettings &labelingEngineSettings() const;
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns global labeling engine settings from the internal map settings
2017-05-23 14:49:24 +02:00
.. versionadded:: 3.0
%End
bool previewJobsEnabled() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns true if canvas map preview jobs (low priority render jobs which render portions
of the view just outside of the canvas extent, to allow preview of these
out-of-canvas areas when panning or zooming out the map) are enabled
for the canvas.
.. seealso:: :py:func:`setPreviewJobsEnabled`
2017-12-15 10:36:55 -04:00
.. versionadded:: 3.0
%End
void setPreviewJobsEnabled( bool enabled );
%Docstring
2017-12-15 10:36:55 -04:00
Sets whether canvas map preview jobs (low priority render jobs which render portions
of the view just outside of the canvas extent, to allow preview of these
out-of-canvas areas when panning or zooming out the map) are ``enabled``
for the canvas.
.. seealso:: :py:func:`previewJobsEnabled`
2017-12-15 10:36:55 -04:00
.. versionadded:: 3.0
%End
public slots:
void refresh();
2017-05-23 14:49:24 +02:00
%Docstring
Repaints the canvas map
%End
void refreshAllLayers();
%Docstring
Reload all layers, clear the cache and refresh the canvas
.. versionadded:: 2.9
2017-05-23 14:49:24 +02:00
%End
void selectionChangedSlot();
2017-05-23 14:49:24 +02:00
%Docstring
Receives signal about selection change, and pass it on with layer info
%End
2017-05-23 14:49:24 +02:00
void saveAsImage( const QString &fileName, QPixmap *QPixmap = 0, const QString & = "PNG" );
%Docstring
Save the convtents of the map canvas to disk as an image
%End
void layerStateChange();
2017-05-23 14:49:24 +02:00
%Docstring
This slot is connected to the visibility change of one or more layers
%End
void setRenderFlag( bool flag );
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets whether a user has disabled canvas renders via the GUI.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param flag: set to false to indicate that user has disabled renders
.. seealso:: :py:func:`renderFlag`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`freeze`
while setRenderFlag() should only be used when users disable rendering via GUI.
2017-05-23 14:49:24 +02:00
%End
void stopRendering();
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
stop rendering (if there is any right now)
2017-05-23 14:49:24 +02:00
.. versionadded:: 2.4
%End
void readProject( const QDomDocument & );
2017-05-23 14:49:24 +02:00
%Docstring
called to read map canvas settings from project
%End
void writeProject( QDomDocument & );
2017-05-23 14:49:24 +02:00
%Docstring
called to write map canvas settings to project
%End
2014-01-27 09:22:24 +01:00
void setMagnificationFactor( double factor );
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
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.
2017-05-23 14:49:24 +02:00
.. versionadded:: 2.16
%End
void setScaleLocked( bool isLocked );
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Lock the scale, so zooming can be performed using magnication
.. seealso:: :py:func:`scaleLocked`
2018-05-28 11:31:08 -04:00
.. versionadded:: 2.16
2017-05-23 14:49:24 +02:00
%End
void zoomIn();
2017-05-23 14:49:24 +02:00
%Docstring
Zoom in with fixed factor
%End
void zoomOut();
2017-05-23 14:49:24 +02:00
%Docstring
Zoom out with fixed factor
%End
void zoomToSelected( QgsVectorLayer *layer = 0 );
%Docstring
Zoom to the extent of the selected features of provided (vector) layer.
:param layer: optionally specify different than current layer
2017-05-23 14:49:24 +02:00
%End
signals:
void xyCoordinates( const QgsPointXY &p );
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Emits current mouse position
2017-05-23 14:49:24 +02:00
.. note::
changed in 1.3 *
%End
void scaleChanged( double );
2017-05-23 14:49:24 +02:00
%Docstring
Emitted when the scale of the map changes
%End
void extentsChanged();
2017-05-23 14:49:24 +02:00
%Docstring
Emitted when the extents of the map change
%End
void rotationChanged( double );
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Emitted when the rotation of the map changes
2017-05-23 14:49:24 +02:00
.. versionadded:: 2.8
%End
void magnificationChanged( double );
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Emitted when the scale of the map changes
2017-05-23 14:49:24 +02:00
.. versionadded:: 2.16
%End
void canvasColorChanged();
%Docstring
2017-12-15 10:36:55 -04:00
Emitted when canvas background color changes
.. versionadded:: 3.0
2017-05-23 14:49:24 +02:00
%End
void renderComplete( QPainter * );
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
TODO: deprecate when decorations are reimplemented as map canvas items
- anything related to rendering progress is not visible outside of map canvas
- additional drawing shall be done directly within the renderer job or independently as a map canvas item
2017-05-23 14:49:24 +02:00
%End
void mapCanvasRefreshed();
2017-05-23 14:49:24 +02:00
%Docstring
Emitted when canvas finished a refresh request.
%End
void renderStarting();
2017-05-23 14:49:24 +02:00
%Docstring
Emitted when the canvas is about to be rendered.
%End
void layersChanged();
2017-05-23 14:49:24 +02:00
%Docstring
Emitted when a new set of layers has been received
%End
void keyPressed( QKeyEvent *e );
2017-05-23 14:49:24 +02:00
%Docstring
Emit key press event
%End
void keyReleased( QKeyEvent *e );
2017-05-23 14:49:24 +02:00
%Docstring
Emit key release event
%End
void mapToolSet( QgsMapTool *newTool, QgsMapTool *oldTool );
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Emit map tool changed with the old tool
2017-05-23 14:49:24 +02:00
.. versionadded:: 2.3
%End
void selectionChanged( QgsVectorLayer *layer );
2017-05-23 14:49:24 +02:00
%Docstring
Emitted when selection in any layer gets changed
%End
void zoomLastStatusChanged( bool );
2017-05-23 14:49:24 +02:00
%Docstring
Emitted when zoom last status changed
%End
void zoomNextStatusChanged( bool );
2017-05-23 14:49:24 +02:00
%Docstring
Emitted when zoom next status changed
%End
void destinationCrsChanged();
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Emitted when map CRS has changed
2017-05-23 14:49:24 +02:00
.. versionadded:: 2.4
%End
void transformContextChanged();
%Docstring
Emitted when the canvas transform context is changed.
.. versionadded:: 3.0
2017-05-23 14:49:24 +02:00
%End
void currentLayerChanged( QgsMapLayer *layer );
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Emitted when the current layer is changed
2017-05-23 14:49:24 +02:00
.. versionadded:: 2.8
%End
void layerStyleOverridesChanged();
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Emitted when the configuration of overridden layer styles changes
2017-05-23 14:49:24 +02:00
.. versionadded:: 2.12
%End
void themeChanged( const QString &theme );
2017-05-23 14:49:24 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Emitted when the canvas has been assigned a different map theme.
.. seealso:: :py:func:`setTheme`
2017-12-15 10:36:55 -04:00
2017-05-23 14:49:24 +02:00
.. versionadded:: 3.0
%End
void messageEmitted( const QString &title, const QString &message, Qgis::MessageLevel = Qgis::Info );
2017-05-23 14:49:24 +02:00
%Docstring
emit a message (usually to be displayed in a message bar)
%End
protected:
2017-05-23 14:49:24 +02:00
virtual bool event( QEvent *e );
%Docstring
Overridden standard event to be gestures aware
%End
virtual void keyPressEvent( QKeyEvent *e );
%Docstring
Overridden key press event
%End
virtual void keyReleaseEvent( QKeyEvent *e );
%Docstring
Overridden key release event
%End
virtual void mouseDoubleClickEvent( QMouseEvent *e );
2017-05-23 14:49:24 +02:00
%Docstring
Overridden mouse double-click event
2017-05-23 14:49:24 +02:00
%End
2017-05-23 14:49:24 +02:00
virtual void mouseMoveEvent( QMouseEvent *e );
2017-05-23 14:49:24 +02:00
%Docstring
Overridden mouse move event
%End
2017-05-23 14:49:24 +02:00
virtual void mousePressEvent( QMouseEvent *e );
2017-05-23 14:49:24 +02:00
%Docstring
Overridden mouse press event
%End
2017-05-23 14:49:24 +02:00
virtual void mouseReleaseEvent( QMouseEvent *e );
2017-05-23 14:49:24 +02:00
%Docstring
Overridden mouse release event
%End
2017-05-23 14:49:24 +02:00
virtual void wheelEvent( QWheelEvent *e );
2017-05-23 14:49:24 +02:00
%Docstring
Overridden mouse wheel event
%End
2017-05-23 14:49:24 +02:00
virtual void resizeEvent( QResizeEvent *e );
%Docstring
Overridden resize event
%End
virtual void paintEvent( QPaintEvent *e );
%Docstring
Overridden paint event
%End
virtual void dragEnterEvent( QDragEnterEvent *e );
%Docstring
Overridden drag enter event
%End
void moveCanvasContents( bool reset = false );
2017-05-23 14:49:24 +02:00
%Docstring
called when panning is in action, reset indicates end of panning
%End
2017-05-23 14:49:24 +02:00
protected slots:
void updateCanvasItemPositions();
%Docstring
called on resize or changed extent to notify canvas items to change their rectangle
2017-05-23 14:49:24 +02:00
%End
}; // class QgsMapCanvas
2017-05-23 14:49:24 +02:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsmapcanvas.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/