QgsSnapToGridCanvasItem class
Shows a grid on the map canvas given a spatial resolution.
Contents
Base classes
- class QgsMapCanvasItem
- An abstract class for items that can be placed on the map canvas.
Constructors, destructors, conversion operators
- QgsSnapToGridCanvasItem(QgsMapCanvas* mapCanvas)
- Will automatically be added to the mapCanvas.
Public functions
- auto crs() const -> QgsCoordinateReferenceSystem
- The CRS in which the grid should be calculated.
- auto enabled() const -> bool
- Enable this item.
- void paint(QPainter* painter) override
- function to be implemented by derived classes
- auto point() const -> QgsPointXY
- A point that will be highlighted on the map canvas.
- auto precision() const -> double
- The resolution of the grid in map units.
- void setCrs(const QgsCoordinateReferenceSystem& crs)
- The CRS in which the grid should be calculated.
- void setEnabled(bool enabled)
- Enable this item.
- void setPoint(const QgsPointXY& point)
- A point that will be highlighted on the map canvas.
- void setPrecision(double precision)
- The resolution of the grid in map units.
Function documentation
QgsCoordinateReferenceSystem QgsSnapToGridCanvasItem:: crs() const
The CRS in which the grid should be calculated.
By default will be an invalid QgsCoordinateReferenceSystem and as such equal to the CRS of the map canvas.
QgsPointXY QgsSnapToGridCanvasItem:: point() const
A point that will be highlighted on the map canvas.
The point needs to be in map coordinates. The closest point on the grid will be highlighted.
double QgsSnapToGridCanvasItem:: precision() const
The resolution of the grid in map units.
If a crs has been specified it will be in CRS units.
void QgsSnapToGridCanvasItem:: setCrs(const QgsCoordinateReferenceSystem& crs)
The CRS in which the grid should be calculated.
By default will be an invalid QgsCoordinateReferenceSystem and as such equal to the CRS of the map canvas.
void QgsSnapToGridCanvasItem:: setEnabled(bool enabled)
Enable this item.
It will be hidden if disabled.
void QgsSnapToGridCanvasItem:: setPoint(const QgsPointXY& point)
A point that will be highlighted on the map canvas.
The point needs to be in map coordinates. The closest point on the grid will be highlighted.
void QgsSnapToGridCanvasItem:: setPrecision(double precision)
The resolution of the grid in map units.
If a crs has been specified it will be in CRS units.