sipify gui part 5

This commit is contained in:
Denis Rouzaud 2017-05-23 14:49:24 +02:00
parent 5f6d020b13
commit 801a0ea537
16 changed files with 1390 additions and 397 deletions

View File

@ -170,16 +170,6 @@ gui/qgslimitedrandomcolorrampdialog.sip
gui/qgslonglongvalidator.sip
gui/qgsludialog.sip
gui/qgsmanageconnectionsdialog.sip
gui/qgsmapcanvas.sip
gui/qgsmapcanvasannotationitem.sip
gui/qgsmapcanvasitem.sip
gui/qgsmapcanvassnappingutils.sip
gui/qgsmapcanvastracer.sip
gui/qgsmaplayeractionregistry.sip
gui/qgsmaplayerconfigwidget.sip
gui/qgsmaplayerconfigwidgetfactory.sip
gui/qgsmapmouseevent.sip
gui/qgsmapoverviewcanvas.sip
gui/qgsmaptip.sip
gui/qgsmaptool.sip
gui/qgsmaptooladvanceddigitizing.sip

View File

@ -1,274 +1,874 @@
/** \ingroup gui
* Map canvas is a class for displaying all GIS data types on a canvas.
*/
/************************************************************************
* 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
{
%Docstring
Map canvas is a class for displaying all GIS data types on a canvas.
%End
%TypeHeaderCode
#include <qgsmapcanvas.h>
#include "qgsmapcanvas.h"
%End
%ConvertToSubClassCode
if (dynamic_cast<QgsMapCanvas*>(sipCpp) != NULL)
sipType = sipType_QgsMapCanvas;
else
sipType = NULL;
if ( dynamic_cast<QgsMapCanvas *>( sipCpp ) != NULL )
sipType = sipType_QgsMapCanvas;
else
sipType = NULL;
%End
public:
//! Constructor
QgsMapCanvas( QWidget *parent /TransferThis/ = 0 );
%Docstring
Constructor
%End
~QgsMapCanvas();
double magnificationFactor() const;
%Docstring
.. versionadded:: 2.16
:rtype: float
%End
void setLayers( const QList<QgsMapLayer *> &layers );
%Docstring
Sets the list of ``layers`` that should be shown in the canvas.
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.
.. versionadded:: 3.0
.. seealso:: layers()
%End
void setCurrentLayer( QgsMapLayer *layer );
const QgsMapSettings &mapSettings() const /KeepReference/;
%Docstring
.. versionadded:: 2.4
:rtype: QgsMapSettings
%End
void setDestinationCrs( const QgsCoordinateReferenceSystem &crs );
%Docstring
.. versionadded:: 2.4
%End
void setMapSettingsFlags( QgsMapSettings::Flags flags );
%Docstring
Resets the ``flags`` for the canvas' map settings.
.. versionadded:: 3.0
%End
const QgsLabelingResults *labelingResults() const;
%Docstring
.. versionadded:: 2.4
:rtype: QgsLabelingResults
%End
void setCachingEnabled( bool enabled );
%Docstring
.. versionadded:: 2.4
%End
bool isCachingEnabled() const;
%Docstring
.. versionadded:: 2.4
:rtype: bool
%End
void clearCache();
%Docstring
.. versionadded:: 2.4
%End
void refreshAllLayers();
%Docstring
.. versionadded:: 2.9
%End
void waitWhileRendering();
%Docstring
Blocks until the rendering job has finished.
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.
.. versionadded:: 3.0
%End
void setParallelRenderingEnabled( bool enabled );
%Docstring
.. versionadded:: 2.4
%End
bool isParallelRenderingEnabled() const;
%Docstring
.. versionadded:: 2.4
:rtype: bool
%End
void setMapUpdateInterval( int timeMilliseconds );
%Docstring
.. versionadded:: 2.4
%End
int mapUpdateInterval() const;
%Docstring
.. versionadded:: 2.4
:rtype: int
%End
double scale();
%Docstring
Get the last reported scale of the canvas
:rtype: float
%End
double mapUnitsPerPixel() const;
%Docstring
Returns the mapUnitsPerPixel (map units per pixel) for the canvas
:rtype: float
%End
QgsRectangle extent() const;
%Docstring
Returns the current zoom extent of the map canvas
:rtype: QgsRectangle
%End
QgsRectangle fullExtent() const;
%Docstring
Returns the combined extent for all layers on the map canvas
:rtype: QgsRectangle
%End
void setExtent( const QgsRectangle &r, bool magnified = false );
%Docstring
Set the extent of the map canvas
%End
double rotation() const;
%Docstring
.. versionadded:: 2.8
:rtype: float
%End
void setRotation( double degrees );
%Docstring
.. versionadded:: 2.8
%End
void setCenter( const QgsPoint &center );
%Docstring
.. versionadded:: 2.8
%End
QgsPoint center() const;
%Docstring
.. versionadded:: 2.8
:rtype: QgsPoint
%End
void zoomToFullExtent();
%Docstring
Zoom to the full extent of all layers
%End
void zoomToPreviousExtent();
%Docstring
Zoom to the previous extent (view)
%End
void zoomToNextExtent();
%Docstring
Zoom to the next extent (view)
%End
void clearExtentHistory();
void zoomToSelected( QgsVectorLayer *layer = 0 );
%Docstring
Zoom to the extent of the selected features of current (vector) layer.
\param layer optionally specify different than current layer
%End
void zoomToFeatureIds( QgsVectorLayer *layer, const QgsFeatureIds &ids );
%Docstring
Set canvas extent to the bounding box of a set of features
\param layer the vector layer
\param ids the feature ids*
%End
void panToFeatureIds( QgsVectorLayer *layer, const QgsFeatureIds &ids );
%Docstring
Centers canvas extent to feature ids
\param layer the vector layer
\param ids the feature ids*
%End
void panToSelected( QgsVectorLayer *layer = 0 );
%Docstring
Pan to the selected features of current (vector) layer keeping same extent.
%End
void setMapTool( QgsMapTool *mapTool );
%Docstring
Sets the map tool currently being used on the canvas
%End
void unsetMapTool( QgsMapTool *mapTool );
%Docstring
Unset the current map tool or last non zoom tool
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 manualy, QgsMapTool takes care of it.
%End
QgsMapTool *mapTool();
%Docstring
Returns the currently active tool
:rtype: QgsMapTool
%End
void setCanvasColor( const QColor &_newVal );
%Docstring
Write property of QColor bgColor.
%End
QColor canvasColor() const;
%Docstring
Read property of QColor bgColor.
:rtype: QColor
%End
void setSelectionColor( const QColor &color );
%Docstring
.. versionadded:: 2.4
%End
void updateScale();
%Docstring
Emits signal scaleChanged to update scale in main window
%End
QgsMapLayer *layer( int index );
%Docstring
return the map layer at position index in the layer stack
:rtype: QgsMapLayer
%End
int layerCount() const;
%Docstring
return number of layers on the map
:rtype: int
%End
QList<QgsMapLayer *> layers() const;
%Docstring
Return the list of layers shown within the map canvas.
.. seealso:: setLayers()
:rtype: list of QgsMapLayer
%End
void freeze( bool frozen = true );
%Docstring
Freeze/thaw the map canvas. This is used to prevent the canvas from
responding to events while layers are being added/removed etc.
\param frozen Boolean specifying if the canvas should be frozen (true) or
thawed (false). Default is true.
.. seealso:: isFrozen()
.. seealso:: setRenderFlag(). freeze() should be used to programmatically halt map updates,
while setRenderFlag() should only be used when users disable rendering via GUI.
%End
bool isFrozen() const;
%Docstring
Returns true if canvas is frozen.
.. seealso:: renderFlag(). isFrozen() should be used to determine whether map updates
have been halted programmatically, while renderFlag() should be used to
determine whether a user has disabled rendering via GUI.
.. seealso:: freeze()
:rtype: bool
%End
bool renderFlag() const;
%Docstring
Returns true if canvas render is disabled as a result of user disabling
renders via the GUI.
.. seealso:: setRenderFlag()
.. seealso:: isFrozen(). isFrozen() should be used to determine whether map updates
have been halted programmatically, while renderFlag() should be used to
determine whether a user has disabled rendering via GUI.
:rtype: bool
%End
QgsUnitTypes::DistanceUnit mapUnits() const;
%Docstring
Convience function for returning the current canvas map units. The map units
are dictated by the canvas' destinationCrs() map units.
:rtype: QgsUnitTypes.DistanceUnit
%End
QMap<QString, QString> layerStyleOverrides() const;
%Docstring
Returns the stored overrides of styles for layers.
.. versionadded:: 2.12
.. seealso:: setLayerStyleOverrides().
:rtype: QMap<str, QString>
%End
void setLayerStyleOverrides( const QMap<QString, QString> &overrides );
%Docstring
Sets the stored overrides of styles for rendering layers.
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.
.. versionadded:: 2.12
.. seealso:: layerStyleOverrides()
%End
void setTheme( const QString &theme );
%Docstring
Sets a map ``theme`` to show in the canvas. The theme name must match
a theme present in the associated project's QgsMapThemeCollection.
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
QgsLayerTreeMapCanvasBridge.
If an empty string is passed then the current theme association will be
cleared.
.. versionadded:: 3.0
.. seealso:: theme()
%End
QString theme() const;
%Docstring
Returns the map's theme shown in the canvas, if set.
.. versionadded:: 3.0
.. seealso:: setTheme()
:rtype: str
%End
const QgsMapToPixel *getCoordinateTransform();
%Docstring
Get the current coordinate transform
:rtype: QgsMapToPixel
%End
bool isDrawing();
%Docstring
Find out whether rendering is in progress
:rtype: bool
%End
QgsMapLayer *currentLayer();
%Docstring
returns current layer (set by legend widget)
:rtype: QgsMapLayer
%End
void setWheelFactor( double factor );
%Docstring
set wheel zoom factor (should be greater than 1)
%End
void zoomScale( double scale );
%Docstring
Zoom to a specific scale
%End
void zoomByFactor( double scaleFactor, const QgsPoint *center = 0 );
%Docstring
If point is given, re-center on it
%End
void zoomWithCenter( int x, int y, bool zoomIn );
%Docstring
Zooms in/out with a given center
%End
void zoomToFeatureExtent( QgsRectangle &rect );
%Docstring
and does a pan if rect is empty (point extent)
%End
bool scaleLocked() const;
%Docstring
.. seealso:: setScaleLocked()
:rtype: bool
%End
void enableAntiAliasing( bool flag );
%Docstring
used to determine if anti-aliasing is enabled or not
%End
bool antiAliasingEnabled() const;
%Docstring
true if antialising is enabled
:rtype: bool
%End
void enableMapTileRendering( bool flag );
%Docstring
sets map tile rendering flag
%End
void panActionEnd( QPoint releasePoint );
%Docstring
Ends pan action and redraws the canvas.
%End
void panAction( QMouseEvent *event );
%Docstring
Called when mouse is moving and pan is activated
%End
QPoint mouseLastXY();
%Docstring
returns last position of mouse cursor
:rtype: QPoint
%End
void setPreviewModeEnabled( bool previewEnabled );
%Docstring
Enables a preview mode for the map canvas
\param previewEnabled set to true to enable a preview mode
.. seealso:: setPreviewMode
.. versionadded:: 2.3
%End
bool previewModeEnabled() const;
%Docstring
Returns whether a preview mode is enabled for the map canvas
:return: true if a preview mode is currently enabled
.. seealso:: setPreviewModeEnabled
.. seealso:: previewMode
.. versionadded:: 2.3
:rtype: bool
%End
void setPreviewMode( QgsPreviewEffect::PreviewMode mode );
%Docstring
Sets a preview mode for the map canvas. This setting only has an effect if
previewModeEnabled is true.
\param mode preview mode for the canvas
.. seealso:: previewMode
.. seealso:: setPreviewModeEnabled
.. seealso:: previewModeEnabled
.. versionadded:: 2.3
%End
QgsPreviewEffect::PreviewMode previewMode() const;
%Docstring
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
.. seealso:: setPreviewMode
.. seealso:: previewModeEnabled
.. versionadded:: 2.3
:rtype: QgsPreviewEffect.PreviewMode
%End
QgsSnappingUtils *snappingUtils() const;
%Docstring
Return snapping utility class that is associated with map canvas.
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.
.. versionadded:: 2.8
:rtype: QgsSnappingUtils
%End
void setSnappingUtils( QgsSnappingUtils *utils );
%Docstring
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).
.. versionadded:: 2.8
%End
void setExpressionContextScope( const QgsExpressionContextScope &scope );
%Docstring
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.
\param scope new expression context scope
.. versionadded:: 2.12
.. seealso:: expressionContextScope()
%End
QgsExpressionContextScope &expressionContextScope();
// const QgsExpressionContextScope &expressionContextScope() const;
%Docstring
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.
.. versionadded:: 2.12
.. seealso:: setExpressionContextScope()
:rtype: QgsExpressionContextScope
%End
void setSegmentationTolerance( double tolerance );
%Docstring
Sets the segmentation tolerance applied when rendering curved geometries
\param tolerance the segmentation tolerance*
%End
void setSegmentationToleranceType( QgsAbstractGeometry::SegmentationToleranceType type );
%Docstring
Sets segmentation tolerance type (maximum angle or maximum difference between curve and approximation)
\param type the segmentation tolerance typename*
%End
QList< QgsMapCanvasAnnotationItem *> annotationItems() const;
%Docstring
Returns a list of all annotation items in the canvas.
.. versionadded:: 3.0
:rtype: list of QgsMapCanvasAnnotationItem
%End
bool annotationsVisible() const;
%Docstring
Returns true if annotations are visible within the map canvas.
.. versionadded:: 3.0
.. seealso:: setAnnotationsVisible()
:rtype: bool
%End
void setAnnotationsVisible( bool visible );
%Docstring
Sets whether annotations are ``visible`` in the canvas.
.. versionadded:: 3.0
.. seealso:: annotationsVisible()
%End
void setLabelingEngineSettings( const QgsLabelingEngineSettings &settings );
%Docstring
Sets global labeling engine settings in the internal map settings
.. versionadded:: 3.0
%End
const QgsLabelingEngineSettings &labelingEngineSettings() const;
%Docstring
Returns global labeling engine settings from the internal map settings
.. versionadded:: 3.0
:rtype: QgsLabelingEngineSettings
%End
public slots:
//! Repaints the canvas map
void refresh();
%Docstring
Repaints the canvas map
%End
//! Receives signal about selection change, and pass it on with layer info
void selectionChangedSlot();
%Docstring
Receives signal about selection change, and pass it on with layer info
%End
//! Save the convtents of the map canvas to disk as an image
void saveAsImage( const QString &fileName, QPixmap *QPixmap = 0, const QString& = "PNG" );
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
//! This slot is connected to the visibility change of one or more layers
void layerStateChange();
%Docstring
This slot is connected to the visibility change of one or more layers
%End
//! This slot is connected to the layer's CRS change
void layerCrsChange();
%Docstring
This slot is connected to the layer's CRS change
%End
void setRenderFlag( bool flag );
%Docstring
Sets whether a user has disabled canvas renders via the GUI.
\param flag set to false to indicate that user has disabled renders
.. seealso:: renderFlag()
.. seealso:: freeze(). freeze() should be used to programmatically halt map updates,
while setRenderFlag() should only be used when users disable rendering via GUI.
%End
//! stop rendering (if there is any right now)
//! @note added in 2.4
void stopRendering();
%Docstring
.. versionadded:: 2.4
%End
//! called to read map canvas settings from project
void readProject( const QDomDocument & );
%Docstring
called to read map canvas settings from project
%End
//! called to write map canvas settings to project
void writeProject( QDomDocument & );
%Docstring
called to write map canvas settings to project
%End
//! ask user about datum transformation
void getDatumTransformInfo( const QgsMapLayer *ml, const QString &srcAuthId, const QString &destAuthId );
%Docstring
ask user about datum transformation
%End
//! 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 );
%Docstring
.. versionadded:: 2.16
%End
//! Lock the scale, so zooming can be performed using magnication
//! @note added in 2.16
//! @see scaleLocked()
void setScaleLocked( bool isLocked );
%Docstring
.. seealso:: scaleLocked()
%End
//! Zoom in with fixed factor
void zoomIn();
%Docstring
Zoom in with fixed factor
%End
//! Zoom out with fixed factor
void zoomOut();
%Docstring
Zoom out with fixed factor
%End
signals:
/** Emits current mouse position
\note changed in 1.3 */
void xyCoordinates( const QgsPoint &p );
%Docstring
Emits current mouse position
.. note::
changed in 1.3 *
%End
//! Emitted when the scale of the map changes
void scaleChanged( double );
%Docstring
Emitted when the scale of the map changes
%End
//! Emitted when the extents of the map change
void extentsChanged();
%Docstring
Emitted when the extents of the map change
%End
//! Emitted when the rotation of the map changes
//! @note added in 2.8
void rotationChanged( double );
%Docstring
.. versionadded:: 2.8
%End
//! Emitted when the scale of the map changes
//! @note added in 2.16
void magnificationChanged( double );
%Docstring
.. versionadded:: 2.16
%End
/** 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
* rendered. Passing the painter allows plugins to work when the map is
* being rendered onto a pixmap other than the mapCanvas own pixmap member.
*
*/
//! 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
void renderComplete( QPainter * );
%Docstring
- additional drawing shall be done directly within the renderer job or independently as a map canvas item
%End
// ### QGIS 3: renamte to mapRefreshFinished()
//! Emitted when canvas finished a refresh request.
void mapCanvasRefreshed();
%Docstring
Emitted when canvas finished a refresh request.
%End
// ### QGIS 3: rename to mapRefreshStarted()
//! Emitted when the canvas is about to be rendered.
void renderStarting();
%Docstring
Emitted when the canvas is about to be rendered.
%End
//! Emitted when a new set of layers has been received
void layersChanged();
%Docstring
Emitted when a new set of layers has been received
%End
//! Emit key press event
void keyPressed( QKeyEvent *e );
%Docstring
Emit key press event
%End
//! Emit key release event
void keyReleased( QKeyEvent *e );
%Docstring
Emit key release event
%End
void mapToolSet( QgsMapTool *newTool, QgsMapTool *oldTool );
%Docstring
Emit map tool changed with the old tool
.. versionadded:: 2.3
%End
// ### QGIS 3: remove the signal
//! Emitted when selection in any layer gets changed
void selectionChanged( QgsMapLayer *layer );
%Docstring
Emitted when selection in any layer gets changed
%End
//! Emitted when zoom last status changed
void zoomLastStatusChanged( bool );
%Docstring
Emitted when zoom last status changed
%End
//! Emitted when zoom next status changed
void zoomNextStatusChanged( bool );
%Docstring
Emitted when zoom next status changed
%End
//! Emitted when map CRS has changed
//! @note added in 2.4
void destinationCrsChanged();
%Docstring
.. versionadded:: 2.4
%End
//! Emitted when the current layer is changed
//! @note added in 2.8
void currentLayerChanged( QgsMapLayer *layer );
%Docstring
.. versionadded:: 2.8
%End
void layerStyleOverridesChanged();
%Docstring
.. versionadded:: 2.12
%End
void themeChanged( const QString &theme );
%Docstring
Emitted when the canvas has been assigned a different map theme.
.. seealso:: setTheme()
.. versionadded:: 3.0
%End
void messageEmitted( const QString &title, const QString &message, QgsMessageBar::MessageLevel = QgsMessageBar::INFO );
%Docstring
emit a message (usually to be displayed in a message bar)
%End
protected:
//! Overridden standard event to be gestures aware
bool event( QEvent *e );
virtual bool event( QEvent *e );
//! Overridden key press event
void keyPressEvent( QKeyEvent *e );
%Docstring
Overridden standard event to be gestures aware
:rtype: bool
%End
//! Overridden key release event
void keyReleaseEvent( QKeyEvent *e );
virtual void keyPressEvent( QKeyEvent *e );
//! Overridden mouse double click event
void mouseDoubleClickEvent( QMouseEvent *e );
%Docstring
Overridden key press event
%End
//! Overridden mouse move event
void mouseMoveEvent( QMouseEvent *e );
virtual void keyReleaseEvent( QKeyEvent *e );
//! Overridden mouse press event
void mousePressEvent( QMouseEvent *e );
%Docstring
Overridden key release event
%End
//! Overridden mouse release event
void mouseReleaseEvent( QMouseEvent *e );
virtual void mouseDoubleClickEvent( QMouseEvent *e );
//! Overridden mouse wheel event
void wheelEvent( QWheelEvent *e );
%Docstring
Overridden mouse double click event
%End
//! Overridden resize event
void resizeEvent( QResizeEvent *e );
virtual void mouseMoveEvent( QMouseEvent *e );
//! Overridden paint event
void paintEvent( QPaintEvent *e );
%Docstring
Overridden mouse move event
%End
//! Overridden drag enter event
void dragEnterEvent( QDragEnterEvent *e );
virtual void mousePressEvent( QMouseEvent *e );
%Docstring
Overridden mouse press event
%End
virtual void mouseReleaseEvent( QMouseEvent *e );
%Docstring
Overridden mouse release event
%End
virtual void wheelEvent( QWheelEvent *e );
%Docstring
Overridden mouse wheel event
%End
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
//! called when panning is in action, reset indicates end of panning
void moveCanvasContents( bool reset = false );
%Docstring
called when panning is in action, reset indicates end of panning
%End
//! called on resize or changed extent to notify canvas items to change their rectangle
void updateCanvasItemPositions();
%Docstring
called on resize or changed extent to notify canvas items to change their rectangle
%End
//! Make sure the datum transform store is properly populated
void updateDatumTransformEntries();
%Docstring
Make sure the datum transform store is properly populated
%End
private:
void connectNotify( const char *signal );
}; // class QgsMapCanvas
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsmapcanvas.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/

View File

@ -1,9 +1,25 @@
class QgsMapCanvasAnnotationItem : public QObject, public QgsMapCanvasItem
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsmapcanvasannotationitem.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsMapCanvasAnnotationItem: QObject, QgsMapCanvasItem
{
%TypeHeaderCode
#include <qgsmapcanvasannotationitem.h>
%Docstring
An interactive map canvas item which displays a QgsAnnotation.
.. versionadded:: 3.0
%End
%TypeHeaderCode
#include "qgsmapcanvasannotationitem.h"
%End
public:
enum MouseMoveAction
@ -18,29 +34,48 @@ class QgsMapCanvasAnnotationItem : public QObject, public QgsMapCanvasItem
ResizeFrameLeftUp,
ResizeFrameRightUp,
ResizeFrameLeftDown,
ResizeFrameRightDown,
ResizeFrameRightDown
};
QgsMapCanvasAnnotationItem( QgsAnnotation *annotation /Transfer/, QgsMapCanvas *mapCanvas /TransferThis/ );
~QgsMapCanvasAnnotationItem();
%Docstring
Constructor for QgsMapCanvasAnnotationItem.
%End
//const QgsAnnotation* annotation() const { return mAnnotation; }
QgsAnnotation *annotation();
%Docstring
Returns the item's annotation.
:rtype: QgsAnnotation
%End
void updatePosition();
virtual void updatePosition();
QRectF boundingRect() const;
void paint( QPainter *painter );
virtual QRectF boundingRect() const;
virtual void paint( QPainter *painter );
/**
* Returns the mouse move behavior for a given position in scene coordinates
*/
MouseMoveAction moveActionForPosition( QPointF pos ) const;
%Docstring
Returns the mouse move behavior for a given position in scene coordinates
:rtype: MouseMoveAction
%End
/**
* Returns matching cursor shape for a mouse move action.
*/
Qt::CursorShape cursorShapeForAction( MouseMoveAction moveAction ) const;
%Docstring
Returns matching cursor shape for a mouse move action.
:rtype: Qt.CursorShape
%End
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsmapcanvasannotationitem.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/

View File

@ -1,51 +1,101 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsmapcanvasitem.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsMapCanvasItem : QGraphicsItem
{
%Docstring
An abstract class for items that can be placed on the
map canvas.
%End
%TypeHeaderCode
#include <qgsmapcanvasitem.h>
#include "qgsmapcanvasitem.h"
%End
protected:
QgsMapCanvasItem( QgsMapCanvas *mapCanvas /TransferThis/ );
%Docstring
protected constructor: cannot be constructed directly
%End
virtual ~QgsMapCanvasItem();
virtual void paint( QPainter *painter ) = 0;
%Docstring
function to be implemented by derived classes
%End
virtual void paint( QPainter *painter,
const QStyleOptionGraphicsItem *option,
QWidget *widget = 0 );
void updateCanvas();
%Docstring
schedules map canvas for repaint
%End
bool setRenderContextVariables( QPainter *p, QgsRenderContext &context ) const;
%Docstring
Sets render context parameters
\param p painter for rendering
\param context out: configured context
:return: true in case of success *
:rtype: bool
%End
public:
virtual void updatePosition();
%Docstring
called on changed extent or resize event to update position of the item
%End
virtual QRectF boundingRect() const;
QgsRectangle rect() const;
%Docstring
returns canvas item rectangle in map units
:rtype: QgsRectangle
%End
void setRect( const QgsRectangle &r, bool resetRotation = true );
%Docstring
sets canvas item rectangle in map units
%End
QgsPoint toMapCoordinates( QPoint point ) const;
%Docstring
transformation from screen coordinates to map coordinates
:rtype: QgsPoint
%End
QPointF toCanvasCoordinates( const QgsPoint &point ) const;
%Docstring
transformation from map coordinates to screen coordinates
:rtype: QPointF
%End
protected:
//! protected constructor: cannot be constructed directly
QgsMapCanvasItem( QgsMapCanvas *mapCanvas /TransferThis/ );
virtual ~QgsMapCanvasItem();
//! function to be implemented by derived classes
virtual void paint( QPainter *painter ) = 0;
virtual void paint( QPainter * painter,
const QStyleOptionGraphicsItem * option,
QWidget *widget = 0 );
//! schedules map canvas for repaint
void updateCanvas();
/** Sets render context parameters
@param p painter for rendering
@param context out: configured context
@return true in case of success */
bool setRenderContextVariables( QPainter *p, QgsRenderContext &context ) const;
public:
//! called on changed extent or resize event to update position of the item
virtual void updatePosition();
virtual QRectF boundingRect() const;
//! returns canvas item rectangle in map units
QgsRectangle rect() const;
//! sets canvas item rectangle in map units
void setRect( const QgsRectangle &r, bool resetRotation = true );
//! transformation from screen coordinates to map coordinates
QgsPoint toMapCoordinates( QPoint point ) const;
//! transformation from map coordinates to screen coordinates
QPointF toCanvasCoordinates( const QgsPoint &point ) const;
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsmapcanvasitem.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/

View File

@ -1,7 +1,24 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsmapcanvassnappingutils.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsMapCanvasSnappingUtils : QgsSnappingUtils
{
%Docstring
Snapping utils instance that is connected to a canvas and updates the configuration
(map settings + current layer) whenever that is changed in the canvas.
.. versionadded:: 2.8
%End
%TypeHeaderCode
#include <qgsmapcanvassnappingutils.h>
#include "qgsmapcanvassnappingutils.h"
%End
public:
QgsMapCanvasSnappingUtils( QgsMapCanvas *canvas, QObject *parent = 0 );
@ -9,4 +26,14 @@ class QgsMapCanvasSnappingUtils : QgsSnappingUtils
protected:
virtual void prepareIndexStarting( int count );
virtual void prepareIndexProgress( int index );
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsmapcanvassnappingutils.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/

View File

@ -1,43 +1,73 @@
/** \ingroup gui
* Extension of QgsTracer that provides extra functionality:
* - automatic updates of own configuration based on canvas settings
* - reporting of issues to the user via message bar
* - determines whether tracing is currently enabled by the user
*
* A simple registry of tracer instances associated to map canvas instances
* is kept for convenience. (Map tools do not need to create their local
* tracer instances and map canvas API is not "polluted" by this optional
* functionality).
*
* @note added in QGIS 2.14
*/
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsmapcanvastracer.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsMapCanvasTracer : QgsTracer
{
%TypeHeaderCode
#include <qgsmapcanvastracer.h>
%Docstring
Extension of QgsTracer that provides extra functionality:
- automatic updates of own configuration based on canvas settings
- reporting of issues to the user via message bar
- determines whether tracing is currently enabled by the user
A simple registry of tracer instances associated to map canvas instances
is kept for convenience. (Map tools do not need to create their local
tracer instances and map canvas API is not "polluted" by this optional
functionality).
.. versionadded:: 2.14
%End
%TypeHeaderCode
#include "qgsmapcanvastracer.h"
%End
public:
//! Create tracer associated with a particular map canvas, optionally message bar for reporting
explicit QgsMapCanvasTracer( QgsMapCanvas *canvas, QgsMessageBar *messageBar = 0 );
%Docstring
Create tracer associated with a particular map canvas, optionally message bar for reporting
%End
~QgsMapCanvasTracer();
//! Access to action that user may use to toggle tracing on/off. May be null if no action was associated
QAction *actionEnableTracing() const;
%Docstring
Access to action that user may use to toggle tracing on/off. May be null if no action was associated
:rtype: QAction
%End
//! Assign "enable tracing" checkable action to the tracer.
//! The action is used to determine whether tracing is currently enabled by the user
void setActionEnableTracing( QAction *action );
%Docstring
The action is used to determine whether tracing is currently enabled by the user
%End
//! Retrieve instance of this class associated with given canvas (if any).
//! The class keeps a simple registry of tracers associated with map canvas
//! instances for easier access to the common tracer by various map tools
static QgsMapCanvasTracer *tracerForCanvas( QgsMapCanvas *canvas );
%Docstring
instances for easier access to the common tracer by various map tools
:rtype: QgsMapCanvasTracer
%End
//! Report a path finding error to the user
void reportError( QgsTracer::PathError err, bool addingVertex );
void reportError( PathError err, bool addingVertex );
%Docstring
Report a path finding error to the user
%End
protected:
//! Sets configuration from current snapping settings and canvas settings
virtual void configure();
%Docstring
Sets configuration from current snapping settings and canvas settings
%End
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsmapcanvastracer.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/

View File

@ -1,9 +1,24 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsmaplayeractionregistry.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsMapLayerAction : QAction
{
%TypeHeaderCode
#include <qgsmaplayeractionregistry.h>
%Docstring
An action which can run on map layers
%End
%TypeHeaderCode
#include "qgsmaplayeractionregistry.h"
%End
public:
enum Target
{
@ -14,77 +29,142 @@ class QgsMapLayerAction : QAction
};
typedef QFlags<QgsMapLayerAction::Target> Targets;
//! Creates a map layer action which can run on any layer
//! @note using AllActions as a target probably does not make a lot of sense. This default action was settled for API compatibility reasons.
QgsMapLayerAction( const QString &name, QObject *parent /TransferThis/, Targets targets = AllActions, const QIcon &icon = QIcon() );
%Docstring
.. note::
using AllActions as a target probably does not make a lot of sense. This default action was settled for API compatibility reasons.
%End
//! Creates a map layer action which can run only on a specific layer
QgsMapLayerAction( const QString &name, QObject *parent /TransferThis/, QgsMapLayer *layer, Targets targets = AllActions, const QIcon &icon = QIcon() );
%Docstring
Creates a map layer action which can run only on a specific layer
%End
//! Creates a map layer action which can run on a specific type of layer
QgsMapLayerAction( const QString &name, QObject *parent /TransferThis/, QgsMapLayer::LayerType layerType, Targets targets = AllActions, const QIcon &icon = QIcon() );
%Docstring
Creates a map layer action which can run on a specific type of layer
%End
~QgsMapLayerAction();
/** True if action can run using the specified layer */
bool canRunUsingLayer( QgsMapLayer *layer ) const;
%Docstring
True if action can run using the specified layer
:rtype: bool
%End
/** Triggers the action with the specified layer and list of feature. */
void triggerForFeatures( QgsMapLayer *layer, const QList<QgsFeature> &featureList );
%Docstring
Triggers the action with the specified layer and list of feature.
%End
/** Triggers the action with the specified layer and feature. */
void triggerForFeature( QgsMapLayer *layer, const QgsFeature *feature );
%Docstring
Triggers the action with the specified layer and feature.
%End
/** Triggers the action with the specified layer. */
void triggerForLayer( QgsMapLayer *layer );
%Docstring
Triggers the action with the specified layer.
%End
/** Define the targets of the action */
void setTargets( Targets targets );
/** Return availibity of action */
%Docstring
Define the targets of the action
%End
const Targets &targets() const;
%Docstring
Return availibity of action
:rtype: Targets
%End
signals:
/** Triggered when action has been run for a specific list of features */
void triggeredForFeatures( QgsMapLayer *layer, const QList<QgsFeature> &featureList );
%Docstring
Triggered when action has been run for a specific list of features
%End
/** Triggered when action has been run for a specific feature */
void triggeredForFeature( QgsMapLayer *layer, const QgsFeature &feature );
%Docstring
Triggered when action has been run for a specific feature
%End
/** Triggered when action has been run for a specific layer */
void triggeredForLayer( QgsMapLayer *layer );
%Docstring
Triggered when action has been run for a specific layer
%End
};
QFlags<QgsMapLayerAction::Target> operator|(QgsMapLayerAction::Target f1, QFlags<QgsMapLayerAction::Target> f2);
class QgsMapLayerActionRegistry : QObject
{
%TypeHeaderCode
#include <qgsmaplayeractionregistry.h>
%Docstring
This class tracks map layer actions.
QgsMapLayerActionRegistry is not usually directly created, but rather accessed through
QgsGui.mapLayerActionRegistry().
%End
%TypeHeaderCode
#include "qgsmaplayeractionregistry.h"
%End
public:
QgsMapLayerActionRegistry( QObject *parent = 0 );
%Docstring
Constructor for QgsMapLayerActionRegistry.
~QgsMapLayerActionRegistry();
QgsMapLayerActionRegistry is not usually directly created, but rather accessed through
QgsGui.mapLayerActionRegistry().
%End
/** Adds a map layer action to the registry*/
void addMapLayerAction( QgsMapLayerAction *action );
%Docstring
Adds a map layer action to the registry
%End
/** Returns the map layer actions which can run on the specified layer*/
QList<QgsMapLayerAction *> mapLayerActions( QgsMapLayer *layer, QgsMapLayerAction::Targets targets = QgsMapLayerAction::AllActions );
%Docstring
Returns the map layer actions which can run on the specified layer
:rtype: list of QgsMapLayerAction
%End
/** Removes a map layer action from the registry*/
bool removeMapLayerAction( QgsMapLayerAction *action );
%Docstring
Removes a map layer action from the registry
:rtype: bool
%End
/** Sets the default action for a layer*/
void setDefaultActionForLayer( QgsMapLayer *layer, QgsMapLayerAction *action );
/** Returns the default action for a layer*/
%Docstring
Sets the default action for a layer
%End
QgsMapLayerAction *defaultActionForLayer( QgsMapLayer *layer );
%Docstring
Returns the default action for a layer
:rtype: QgsMapLayerAction
%End
protected:
signals:
/** Triggered when an action is added or removed from the registry */
void changed();
%Docstring
Triggered when an action is added or removed from the registry
%End
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsmaplayeractionregistry.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/

View File

@ -1,29 +1,53 @@
/** \ingroup gui
* \class QgsMapLayerConfigWidget
* \class A panel widget that can be shown in the map style dock
* \note added in QGIS 2.16
*/
class QgsMapLayerConfigWidget : public QgsPanelWidget
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsmaplayerconfigwidget.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsMapLayerConfigWidget : QgsPanelWidget
{
%TypeHeaderCode
#include <qgsmaplayerconfigwidget.h>
%Docstring
A panel widget that can be shown in the map style dock
.. versionadded:: 2.16
%End
public:
/**
* @brief A panel widget that can be shown in the map style dock
* @param layer The layer active in the dock.
* @param canvas The canvas object.
* @param parent The parent of the widget.
* @note The widget is created each time the panel is selected in the dock.
* Keep the loading light as possible for speed in the UI.
*/
QgsMapLayerConfigWidget(QgsMapLayer *layer, QgsMapCanvas *canvas, QWidget *parent = 0);
public slots:
%TypeHeaderCode
#include "qgsmaplayerconfigwidget.h"
%End
public:
/**
* @brief Called when changes to the layer need to be made.
* Will be called when live update is enabled.
*/
virtual void apply() = 0;
QgsMapLayerConfigWidget( QgsMapLayer *layer, QgsMapCanvas *canvas, QWidget *parent = 0 );
%Docstring
A panel widget that can be shown in the map style dock
\param layer The layer active in the dock.
\param canvas The canvas object.
\param parent The parent of the widget.
.. note::
The widget is created each time the panel is selected in the dock.
Keep the loading light as possible for speed in the UI.
%End
public slots:
virtual void apply() = 0;
%Docstring
Called when changes to the layer need to be made.
Will be called when live update is enabled.
%End
protected:
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsmaplayerconfigwidget.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/

View File

@ -1,89 +1,124 @@
/** \ingroup gui
* \class QgsMapLayerConfigWidgetFactory
* \note added in QGIS 2.16
* Factory class for creating custom map layer property pages
*/
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsmaplayerconfigwidgetfactory.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsMapLayerConfigWidgetFactory
{
%TypeHeaderCode
#include <qgsmaplayerconfigwidgetfactory.h>
%Docstring
.. versionadded:: 2.16
Factory class for creating custom map layer property pages
%End
%TypeHeaderCode
#include "qgsmaplayerconfigwidgetfactory.h"
%End
public:
/** Constructor */
QgsMapLayerConfigWidgetFactory();
%Docstring
Constructor
%End
/** Constructor */
QgsMapLayerConfigWidgetFactory( const QString &title, const QIcon &icon );
%Docstring
Constructor
%End
/** Destructor */
virtual ~QgsMapLayerConfigWidgetFactory();
/**
* @brief The icon that will be shown in the UI for the panel.
* @return A QIcon for the panel icon.
*/
virtual QIcon icon() const;
%Docstring
The icon that will be shown in the UI for the panel.
:return: A QIcon for the panel icon.
:rtype: QIcon
%End
/**
* Set the icon for the factory object.
* @param icon The icon to show in the interface.
*/
void setIcon( const QIcon &icon );
%Docstring
Set the icon for the factory object.
\param icon The icon to show in the interface.
%End
/**
* @brief The title of the panel.
* @note This may or may not be shown to the user.
* @return Title of the panel
*/
virtual QString title() const;
%Docstring
The title of the panel.
.. note::
This may or may not be shown to the user.
:return: Title of the panel
:rtype: str
%End
/**
* Set the title for the interface
* @note Not all users may show this as a label
* e.g style dock uses this as a tooltip.
* @param title The title to set.
*/
void setTitle( const QString &title );
%Docstring
Set the title for the interface
.. note::
Not all users may show this as a label
e.g style dock uses this as a tooltip.
\param title The title to set.
%End
/**
* Flag if widget is supported for use in style dock.
* @return True if supported
*/
virtual bool supportsStyleDock() const;
%Docstring
Flag if widget is supported for use in style dock.
:return: True if supported
:rtype: bool
%End
/**
* Set support flag for style dock
* @param supports True if this widget is supported in the style dock.
*/
void setSupportsStyleDock( bool supports );
%Docstring
Set support flag for style dock
\param supports True if this widget is supported in the style dock.
%End
/**
* Flag if widget is supported for use in layer properties dialog.
* @return True if supported
*/
virtual bool supportLayerPropertiesDialog() const;
%Docstring
Flag if widget is supported for use in layer properties dialog.
:return: True if supported
:rtype: bool
%End
/**
* Set support flag for style dock
* @param supports True if this widget is supported in the style dock.
*/
void setSupportLayerPropertiesDialog( bool supports );
%Docstring
Set support flag for style dock
\param supports True if this widget is supported in the style dock.
%End
/**
* @brief Check if the layer is supported for this widget.
* @return True if this layer is supported for this widget
*/
virtual bool supportsLayer( QgsMapLayer *layer ) const;
%Docstring
Check if the layer is supported for this widget.
:return: True if this layer is supported for this widget
:rtype: bool
%End
/**
* @brief Factory function to create the widget on demand as needed by the dock.
* @note This function is called each time the panel is selected. Keep it light for better UX.
* @param layer The active layer in the dock.
* @param canvas The map canvas.
* @param dockWidget True of the widget will be shown a dock style widget.
* @param parent The parent of the widget.
* @return A new QgsMapStylePanel which is shown in the map style dock.
*/
virtual QgsMapLayerConfigWidget *createWidget( QgsMapLayer *layer, QgsMapCanvas *canvas, bool dockWidget = true, QWidget *parent /TransferThis/ = 0 ) const = 0 /Factory/;
%Docstring
Factory function to create the widget on demand as needed by the dock.
.. note::
This function is called each time the panel is selected. Keep it light for better UX.
\param layer The active layer in the dock.
\param canvas The map canvas.
\param dockWidget True of the widget will be shown a dock style widget.
\param parent The parent of the widget.
:return: A new QgsMapStylePanel which is shown in the map style dock.
:rtype: QgsMapLayerConfigWidget
%End
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsmaplayerconfigwidgetfactory.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/

View File

@ -1,118 +1,147 @@
/***************************************************************************
qgsmapmouseevent.h - mouse event in map coordinates and ability to snap
----------------------
begin : October 2014
copyright : (C) Denis Rouzaud
email : denis.rouzaud@gmail.com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsmapmouseevent.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
/**
* A QgsMapMouseEvent is the result of a user interaction with the mouse on a QgsMapCanvas.
* It is sent whenever the user moves, clicks, releases or double clicks the mouse.
* In addition to the coordiantes in pixel space it also knows the coordinates in the mapcanvas' CRS
* as well as it knows the concept of snapping.
*/
class QgsMapMouseEvent : QMouseEvent
{
%Docstring
A QgsMapMouseEvent is the result of a user interaction with the mouse on a QgsMapCanvas.
It is sent whenever the user moves, clicks, releases or double clicks the mouse.
In addition to the coordiantes in pixel space it also knows the coordinates in the mapcanvas' CRS
as well as it knows the concept of snapping.
%End
%TypeHeaderCode
#include "qgsmapmouseevent.h"
%End
%ConvertToSubClassCode
if ( dynamic_cast<QgsMapMouseEvent*>( sipCpp ) )
sipType = sipType_QgsMapMouseEvent;
else
sipType = 0;
if ( dynamic_cast<QgsMapMouseEvent *>( sipCpp ) )
sipType = sipType_QgsMapMouseEvent;
else
sipType = 0;
%End
public:
enum SnappingMode
{
NoSnapping,
SnapProjectConfig, //!< snap according to the configuration set in the snapping settings
SnapAllLayers, //!< snap to all rendered layers (tolerance and type from defaultSettings())
SnapProjectConfig,
SnapAllLayers,
};
/**
* Creates a new QgsMapMouseEvent. Should only be required to be called from the QgsMapCanvas.
*
* @param mapCanvas The map canvas on which the event occurred
* @param event The original mouse event
*/
QgsMapMouseEvent( QgsMapCanvas *mapCanvas, QMouseEvent *event );
%Docstring
Creates a new QgsMapMouseEvent. Should only be required to be called from the QgsMapCanvas.
\param mapCanvas The map canvas on which the event occurred
\param event The original mouse event
%End
QgsMapMouseEvent( QgsMapCanvas *mapCanvas, QEvent::Type type, QPoint pos, Qt::MouseButton button = Qt::NoButton,
Qt::MouseButtons buttons = Qt::NoButton, Qt::KeyboardModifiers modifiers = Qt::NoModifier );
%Docstring
Creates a new QgsMapMouseEvent. Should only be required to be called from the QgsMapCanvas.
\param mapCanvas The map canvas on which the event occurred
\param type The type of the event
\param pos The pixel position of the mouse
\param button The pressed button
\param buttons Further buttons that are pressed
\param modifiers Keyboard modifiers
%End
/**
* @brief snapPoint will snap the points using the map canvas snapping utils configuration
* @note if snapping did not succeeded, the map point will be reset to its original position
*/
QgsPoint snapPoint( SnappingMode snappingMode );
%Docstring
snapPoint will snap the points using the map canvas snapping utils configuration
.. note::
if snapping did not succeeded, the map point will be reset to its original position
:rtype: QgsPoint
%End
/**
* Returns the first snapped segment. If the cached snapped match is a segment, it will simply return it.
* Otherwise it will try to snap a segment according to the event's snapping mode. In this case the cache
* will not be overwritten.
* @param snappingMode Specify if the default project settings or all layers should be used for snapping
* @param snapped if given, determines if a segment has been snapped
* @param allLayers if true, override snapping mode
*/
QList<QgsPoint> snapSegment( SnappingMode snappingMode, bool *snapped = 0, bool allLayers = false ) const;
%Docstring
Returns the first snapped segment. If the cached snapped match is a segment, it will simply return it.
Otherwise it will try to snap a segment according to the event's snapping mode. In this case the cache
will not be overwritten.
\param snappingMode Specify if the default project settings or all layers should be used for snapping
\param snapped if given, determines if a segment has been snapped
\param allLayers if true, override snapping mode
:rtype: list of QgsPoint
%End
/**
* Returns true if there is a snapped point cached.
* Will only be useful after snapPoint has previously been called.
*
* @return True if there is a snapped point cached.
*/
bool isSnapped() const;
%Docstring
Returns true if there is a snapped point cached.
Will only be useful after snapPoint has previously been called.
:return: True if there is a snapped point cached.
:rtype: bool
%End
/**
* @brief mapPoint returns the point in coordinates
* @return the point in map coordinates, after snapping if requested in the event.
*/
QgsPoint mapPoint() const;
%Docstring
mapPoint returns the point in coordinates
:return: the point in map coordinates, after snapping if requested in the event.
:rtype: QgsPoint
%End
/**
* Returns the matching data from the most recently snapped point.
* @return the snapping data structure
* @note added in 2.14
*/
QgsPointLocator::Match mapPointMatch() const;
%Docstring
Returns the matching data from the most recently snapped point.
:return: the snapping data structure
.. versionadded:: 2.14
:rtype: QgsPointLocator.Match
%End
/**
* Set the (snapped) point this event points to in map coordinates.
* The point in pixel coordinates will be calculated accordingly.
*
* @param point The point in map coordinates
*/
void setMapPoint( const QgsPoint &point );
%Docstring
Set the (snapped) point this event points to in map coordinates.
The point in pixel coordinates will be calculated accordingly.
\param point The point in map coordinates
%End
/**
* Returns the original, unmodified map point of the mouse cursor.
*
* @return The cursor position in map coordinates.
*/
QgsPoint originalMapPoint() const;
%Docstring
Returns the original, unmodified map point of the mouse cursor.
:return: The cursor position in map coordinates.
:rtype: QgsPoint
%End
/**
* The snapped mouse cursor in pixel coordinates.
*
* @return The snapped mouse cursor position in pixel coordinates.
*/
QPoint pixelPoint() const;
%Docstring
The snapped mouse cursor in pixel coordinates.
:return: The snapped mouse cursor position in pixel coordinates.
:rtype: QPoint
%End
/**
* The unsnapped, real mouse cursor position in pixel coordinates.
* Alias to pos()
*
* @return Mouse position in pixel coordinates
*/
QPoint originalPixelPoint() const;
%Docstring
The unsnapped, real mouse cursor position in pixel coordinates.
Alias to pos()
:return: Mouse position in pixel coordinates
:rtype: QPoint
%End
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsmapmouseevent.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/

View File

@ -1,26 +1,49 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsmapoverviewcanvas.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsMapOverviewCanvas : QWidget
{
%TypeHeaderCode
#include <qgsmapoverviewcanvas.h>
%Docstring
A widget that displays an overview map.
%End
%TypeHeaderCode
#include "qgsmapoverviewcanvas.h"
%End
public:
QgsMapOverviewCanvas( QWidget *parent /TransferThis/ = 0, QgsMapCanvas *mapCanvas = NULL );
QgsMapOverviewCanvas( QWidget *parent /TransferThis/ = 0, QgsMapCanvas *mapCanvas = 0 );
~QgsMapOverviewCanvas();
//! renders overview and updates panning widget
void refresh();
%Docstring
renders overview and updates panning widget
%End
//! changes background color
void setBackgroundColor( const QColor &color );
%Docstring
changes background color
%End
//! updates layer set for overview
void setLayers( const QList<QgsMapLayer*> &layers );
void setLayers( const QList<QgsMapLayer *> &layers );
%Docstring
updates layer set for overview
%End
//! Returns list of layers visible in the overview
QList<QgsMapLayer*> layers() const;
QList<QgsMapLayer *> layers() const;
%Docstring
Returns list of layers visible in the overview
:rtype: list of QgsMapLayer
%End
void enableAntiAliasing( bool flag );
@ -28,36 +51,80 @@ class QgsMapOverviewCanvas : QWidget
public slots:
// ### QGIS 3: make protected
//! used for overview canvas to reflect changed extent in main map canvas
void drawExtentRect();
%Docstring
used for overview canvas to reflect changed extent in main map canvas
%End
// ### QGIS 3: make protected
//! Should be called when the canvas destination CRS is changed
void destinationCrsChanged();
%Docstring
Should be called when the canvas destination CRS is changed
%End
protected slots:
void mapRenderingFinished();
void layerRepaintRequested();
void layerRepaintRequested( bool deferred = false );
%Docstring
Triggered when a layer in the overview requests a repaint.
%End
protected:
//! Overridden paint event
void paintEvent( QPaintEvent *pe );
virtual void paintEvent( QPaintEvent *pe );
//! Overridden resize event
void resizeEvent( QResizeEvent *e );
%Docstring
Overridden paint event
%End
//! Overridden mouse move event
void mouseMoveEvent( QMouseEvent *e );
virtual void showEvent( QShowEvent *e );
//! Overridden mouse press event
void mousePressEvent( QMouseEvent *e );
%Docstring
Overridden show event
%End
//! Overridden mouse release event
void mouseReleaseEvent( QMouseEvent *e );
virtual void resizeEvent( QResizeEvent *e );
%Docstring
Overridden resize event
%End
virtual void mouseMoveEvent( QMouseEvent *e );
%Docstring
Overridden mouse move event
%End
virtual void mousePressEvent( QMouseEvent *e );
%Docstring
Overridden mouse press event
%End
virtual void mouseReleaseEvent( QMouseEvent *e );
%Docstring
Overridden mouse release event
%End
//! called when panning to reflect mouse movement
void updatePanningWidget( QPoint pos );
%Docstring
called when panning to reflect mouse movement
%End
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsmapoverviewcanvas.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/

View File

@ -72,6 +72,16 @@ class QgsMapCanvasAnnotationItem;
class GUI_EXPORT QgsMapCanvas : public QGraphicsView
{
#ifdef SIP_RUN
SIP_CONVERT_TO_SUBCLASS_CODE
if ( dynamic_cast<QgsMapCanvas *>( sipCpp ) != NULL )
sipType = sipType_QgsMapCanvas;
else
sipType = NULL;
SIP_END
#endif
Q_OBJECT
Q_PROPERTY( QString theme READ theme WRITE setTheme NOTIFY themeChanged )

View File

@ -54,12 +54,13 @@ class GUI_EXPORT QgsMapCanvasAnnotationItem: public QObject, public QgsMapCanvas
/**
* Constructor for QgsMapCanvasAnnotationItem.
*/
QgsMapCanvasAnnotationItem( QgsAnnotation *annotation, QgsMapCanvas *mapCanvas );
QgsMapCanvasAnnotationItem( QgsAnnotation *annotation SIP_TRANSFER, QgsMapCanvas *mapCanvas SIP_TRANSFERTHIS );
/**
* Returns the item's annotation.
* \note not available in Python bindings
*/
const QgsAnnotation *annotation() const { return mAnnotation; }
const QgsAnnotation *annotation() const { return mAnnotation; } SIP_SKIP
/**
* Returns the item's annotation.

View File

@ -18,6 +18,7 @@
#include <QListWidgetItem>
#include "qgis_gui.h"
#include "qgis_sip.h"
class QgsMapLayer;
class QgsMapLayerConfigWidget;
@ -106,7 +107,7 @@ class GUI_EXPORT QgsMapLayerConfigWidgetFactory
* \param parent The parent of the widget.
* \returns A new QgsMapStylePanel which is shown in the map style dock.
*/
virtual QgsMapLayerConfigWidget *createWidget( QgsMapLayer *layer, QgsMapCanvas *canvas, bool dockWidget = true, QWidget *parent = 0 ) const = 0;
virtual QgsMapLayerConfigWidget *createWidget( QgsMapLayer *layer, QgsMapCanvas *canvas, bool dockWidget = true, QWidget *parent SIP_TRANSFERTHIS = 0 ) const = 0 SIP_FACTORY;
private:
QIcon mIcon;

View File

@ -33,6 +33,16 @@ class QgsMapToolAdvancedDigitizing;
*/
class GUI_EXPORT QgsMapMouseEvent : public QMouseEvent
{
#ifdef SIP_RUN
SIP_CONVERT_TO_SUBCLASS_CODE
if ( dynamic_cast<QgsMapMouseEvent *>( sipCpp ) )
sipType = sipType_QgsMapMouseEvent;
else
sipType = 0;
SIP_END
#endif
public:
enum SnappingMode

View File

@ -42,7 +42,7 @@ class GUI_EXPORT QgsMapOverviewCanvas : public QWidget
Q_OBJECT
public:
QgsMapOverviewCanvas( QWidget *parent = nullptr, QgsMapCanvas *mapCanvas = nullptr );
QgsMapOverviewCanvas( QWidget *parent SIP_TRANSFERTHIS = nullptr, QgsMapCanvas *mapCanvas = nullptr );
//! renders overview and updates panning widget
void refresh();
@ -121,6 +121,8 @@ class GUI_EXPORT QgsMapOverviewCanvas : public QWidget
};
#ifndef SIP_RUN
/// @cond PRIVATE
// Widget that serves as rectangle showing current extent in overview
class QgsPanningWidget : public QWidget
@ -140,3 +142,5 @@ class QgsPanningWidget : public QWidget
///@endcond
#endif
#endif