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

326 lines
9.1 KiB
Plaintext
Raw Normal View History

2017-06-08 11:26:03 +02:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsrubberband.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsRubberBand: QgsMapCanvasItem
{
2017-06-08 11:26:03 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
A class for drawing transient features (e.g. digitizing lines) on the map.
2017-06-08 11:26:03 +02:00
2017-12-15 10:36:55 -04:00
The QgsRubberBand class provides a transparent overlay widget
2017-06-08 11:26:03 +02:00
for tracking the mouse while drawing polylines or polygons.
%End
2017-06-08 11:26:03 +02:00
%TypeHeaderCode
#include "qgsrubberband.h"
%End
public:
2016-02-14 03:50:23 +01:00
enum IconType
{
2017-06-08 11:26:03 +02:00
ICON_NONE,
2017-06-08 11:26:03 +02:00
ICON_CROSS,
2017-06-08 11:26:03 +02:00
ICON_X,
2017-06-08 11:26:03 +02:00
ICON_BOX,
2017-06-08 11:26:03 +02:00
ICON_CIRCLE,
2017-06-08 11:26:03 +02:00
ICON_FULL_BOX,
2017-06-08 11:26:03 +02:00
ICON_DIAMOND,
2017-06-08 11:26:03 +02:00
ICON_FULL_DIAMOND,
};
QgsRubberBand( QgsMapCanvas *mapCanvas /TransferThis/, QgsWkbTypes::GeometryType geometryType = QgsWkbTypes::LineGeometry );
2017-06-08 11:26:03 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Creates a new RubberBand.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param mapCanvas: The map canvas to draw onto. It's CRS will be used map points onto screen coordinates.
:param geometryType: Defines how the data should be drawn onto the screen. (Use Qgis.Line, Qgis.Polygon or Qgis.Point)
2017-06-08 11:26:03 +02:00
%End
void setColor( const QColor &color );
2017-06-08 11:26:03 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets the color for the rubberband
2017-12-15 21:36:08 -04:00
:param color: The color used to render this rubberband
2017-06-08 11:26:03 +02:00
%End
void setFillColor( const QColor &color );
2017-06-08 11:26:03 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets the fill color for the rubberband
2017-12-15 21:36:08 -04:00
:param color: The color used to render this rubberband
2017-12-15 10:36:55 -04:00
2017-06-08 11:26:03 +02:00
.. versionadded:: 2.6
%End
QColor fillColor() const;
2017-06-08 11:26:03 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the current fill color.
2017-06-08 11:26:03 +02:00
%End
void setStrokeColor( const QColor &color );
2017-06-08 11:26:03 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets the stroke color for the rubberband
2017-12-15 21:36:08 -04:00
:param color: The color used to render this rubberband
2017-12-15 10:36:55 -04:00
2017-06-08 11:26:03 +02:00
.. versionadded:: 2.6
%End
QColor strokeColor() const;
2017-06-08 11:26:03 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the current stroke color.
2017-06-08 11:26:03 +02:00
%End
void setSecondaryStrokeColor( const QColor &color );
2017-06-08 11:26:03 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets a secondary stroke color for the rubberband which will be drawn under the main stroke color.
Set to an invalid color to avoid drawing the secondary stroke.
2017-12-15 21:36:08 -04:00
:param color: The color used to render a secondary stroke color to this rubberband
2017-12-15 10:36:55 -04:00
2017-06-08 11:26:03 +02:00
.. versionadded:: 3.0
%End
QColor secondaryStrokeColor() const;
2017-06-08 11:26:03 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the current secondary stroke color.
2017-06-08 11:26:03 +02:00
%End
void setWidth( int width );
2017-06-08 11:26:03 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets the width of the line. Stroke width for polygon.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param width: The width for any lines painted for this rubberband
2017-06-08 11:26:03 +02:00
%End
int width() const;
2017-06-08 11:26:03 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the current width of the line or stroke width for polygon.
2017-06-08 11:26:03 +02:00
%End
void setIcon( IconType icon );
2017-06-08 11:26:03 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets the icon type to highlight point geometries.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param icon: The icon to visualize point geometries
2017-06-08 11:26:03 +02:00
%End
IconType icon() const;
2017-06-08 11:26:03 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the current icon type to highlight point geometries.
2017-06-08 11:26:03 +02:00
%End
2014-01-27 09:22:24 +01:00
void setIconSize( int iconSize );
2017-06-08 11:26:03 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets the size of the point icons
2017-06-08 11:26:03 +02:00
%End
int iconSize() const;
2017-06-08 11:26:03 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the current icon size of the point icons.
2017-06-08 11:26:03 +02:00
%End
void setLineStyle( Qt::PenStyle penStyle );
2017-06-08 11:26:03 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets the style of the line
2017-06-08 11:26:03 +02:00
%End
void setBrushStyle( Qt::BrushStyle brushStyle );
2017-06-08 11:26:03 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets the style of the brush
2017-06-08 11:26:03 +02:00
%End
void reset( QgsWkbTypes::GeometryType geometryType = QgsWkbTypes::LineGeometry );
2017-06-08 11:26:03 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Clears all the geometries in this rubberband.
Sets the representation type according to geometryType.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param geometryType: Defines how the data should be drawn onto the screen. (Use Qgis.Line, Qgis.Polygon or Qgis.Point)
2017-06-08 11:26:03 +02:00
%End
void addPoint( const QgsPointXY &p, bool doUpdate = true, int geometryIndex = 0 );
2017-06-08 11:26:03 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Adds a vertex to the rubberband and update canvas.
The rendering of the vertex depends on the current GeometryType and icon.
If adding more points consider using update=false for better performance
2017-12-15 21:36:08 -04:00
:param p: The vertex/point to add
:param doUpdate: Should the map canvas be updated immediately?
2017-12-15 10:36:55 -04:00
:param geometryIndex: The index of the feature part (in case of multipart geometries)
2017-06-08 11:26:03 +02:00
%End
2014-01-27 09:22:24 +01:00
void closePoints( bool doUpdate = true, int geometryIndex = 0 );
2017-06-08 11:26:03 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Ensures that a polygon geometry is closed and that the last vertex equals the
first vertex.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param doUpdate: set to true to update the map canvas immediately
:param geometryIndex: index of the feature part (in case of multipart geometries)
2017-06-08 11:26:03 +02:00
.. versionadded:: 2.16
%End
void removePoint( int index = 0, bool doUpdate = true, int geometryIndex = 0 );
2017-06-08 11:26:03 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Removes a vertex from the rubberband and (optionally) updates canvas.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param index: The index of the vertex/point to remove, negative indexes start at end
:param doUpdate: Should the map canvas be updated immediately?
:param geometryIndex: The index of the feature part (in case of multipart geometries)
2017-06-08 11:26:03 +02:00
%End
2014-11-21 01:17:21 +01:00
void removeLastPoint( int geometryIndex = 0, bool doUpdate = true );
2017-06-08 11:26:03 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Removes the last point. Most useful in connection with undo operations
2017-06-08 11:26:03 +02:00
%End
void movePoint( const QgsPointXY &p, int geometryIndex = 0 );
2017-06-08 11:26:03 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Moves the rubber band point specified by index. Note that if the rubber band is
not used to track the last mouse position, the first point of the rubber band has two vertices
2017-06-08 11:26:03 +02:00
%End
2014-01-27 09:22:24 +01:00
void movePoint( int index, const QgsPointXY &p, int geometryIndex = 0 );
2017-06-08 11:26:03 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Moves the rubber band point specified by index. Note that if the rubber band is
not used to track the last mouse position, the first point of the rubber band has two vertices
2017-06-08 11:26:03 +02:00
%End
2014-01-27 09:22:24 +01:00
int partSize( int geometryIndex ) const;
2017-06-08 11:26:03 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns number of vertices in feature part
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param geometryIndex: The index of the feature part (in case of multipart geometries)
:return: number of vertices
2017-06-08 11:26:03 +02:00
%End
2014-01-27 09:22:24 +01:00
void setToGeometry( const QgsGeometry &geom, QgsVectorLayer *layer );
2017-06-08 11:26:03 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets this rubber band to the geometry of an existing feature.
This is useful for feature highlighting.
In contrast to addGeometry(), this method does also change the geometry type of the rubberband.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param geom: the geometry object
:param layer: the layer containing the feature, used for coord transformation to map
crs. In case of 0 pointer, the coordinates are not going to be transformed.
2017-06-08 11:26:03 +02:00
%End
void setToCanvasRectangle( QRect rect );
2017-06-08 11:26:03 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets this rubber band to a map canvas rectangle
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param rect: rectangle in canvas coordinates
2017-06-08 11:26:03 +02:00
%End
void addGeometry( const QgsGeometry &geometry, QgsVectorLayer *layer );
2017-06-08 11:26:03 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Adds the geometry of an existing feature to a rubberband
This is useful for multi feature highlighting.
As of 2.0, this method does not change the GeometryType any more. You need to set the GeometryType
of the rubberband explicitly by calling reset() or setToGeometry() with appropriate arguments.
setToGeometry() is also to be preferred for backwards-compatibility.
2017-06-08 11:26:03 +02:00
2017-12-15 10:36:55 -04:00
:param geometry: the geometry object. Will be treated as a collection of vertices.
:param layer: the layer containing the feature, used for coord transformation to map
crs. In case of 0 pointer, the coordinates are not going to be transformed.
2017-06-08 11:26:03 +02:00
%End
void addGeometry( const QgsGeometry &geometry, const QgsCoordinateReferenceSystem &crs = QgsCoordinateReferenceSystem() );
%Docstring
2017-12-15 10:36:55 -04:00
Adds a ``geometry`` to the rubberband.
2017-12-15 10:36:55 -04:00
If ``crs`` is specified, the geometry will be automatically reprojected from ``crs``
to the canvas CRS.
.. versionadded:: 3.0
%End
void setTranslationOffset( double dx, double dy );
2017-06-08 11:26:03 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Adds translation to original coordinates (all in map coordinates)
2017-12-15 21:36:08 -04:00
:param dx: x translation
:param dy: y translation
2017-06-08 11:26:03 +02:00
%End
int size() const;
2017-06-08 11:26:03 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns number of geometries
:return: number of geometries
2017-06-08 11:26:03 +02:00
%End
int numberOfVertices() const;
2017-06-08 11:26:03 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns count of vertices in all lists of mPoint
:return: The total number of vertices
2017-06-08 11:26:03 +02:00
%End
const QgsPointXY *getPoint( int i, int j = 0 ) const;
2017-06-08 11:26:03 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns a vertex
2017-12-15 21:36:08 -04:00
:param i: The geometry index
:param j: The vertex index within geometry i
2017-06-08 11:26:03 +02:00
%End
QgsGeometry asGeometry() const;
2017-06-08 11:26:03 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the rubberband as a Geometry
:return: A geometry object which reflects the current state of the rubberband.
2017-06-08 11:26:03 +02:00
%End
2015-02-03 02:21:52 +01:00
virtual void updatePosition();
protected:
2017-06-08 11:26:03 +02:00
virtual void paint( QPainter *p );
2017-06-08 11:26:03 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Paints the rubber band in response to an update event.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param p: The QPainter object
2017-06-08 11:26:03 +02:00
%End
void drawShape( QPainter *p, const QVector<QPointF> &pts );
2017-06-08 11:26:03 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Draws shape of the rubber band.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param p: The QPainter object
:param pts: A list of points used to draw the shape
2017-06-08 11:26:03 +02:00
%End
void updateRect();
2017-06-08 11:26:03 +02:00
%Docstring
Recalculates needed rectangle
%End
};
2017-06-08 11:26:03 +02:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsrubberband.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/