26 , mCadDockWidget( cadDockWidget )
46 if ( mSnapToLayerGridEnabled && layer )
58 if ( e->button() == Qt::RightButton )
86 if ( mSnapToGridCanvasItem && mSnapToLayerGridEnabled && layer )
111 if ( mSnapToGridCanvasItem && mSnapToLayerGridEnabled && layer )
132 mSnapToGridCanvasItem->
setEnabled( mSnapToLayerGridEnabled );
140 delete mSnapToGridCanvasItem;
141 mSnapToGridCanvasItem =
nullptr;
144 void QgsMapToolAdvancedDigitizing::cadPointChanged(
const QgsPointXY &point )
147 QMouseEvent *ev =
new QMouseEvent( QEvent::MouseMove,
mCanvas->
mouseLastXY(), Qt::NoButton, Qt::NoButton, Qt::NoModifier );
148 qApp->postEvent(
mCanvas->viewport(), ev );
151 void QgsMapToolAdvancedDigitizing::onCurrentLayerChanged()
153 if ( mSnapToGridCanvasItem )
156 if ( layer && mSnapToLayerGridEnabled )
159 mSnapToGridCanvasItem->
setCrs( layer->
crs() );
165 mSnapToGridCanvasItem->
setEnabled( mSnapToLayerGridEnabled );
171 return mSnapToLayerGridEnabled;
176 mSnapToLayerGridEnabled = snapToGridEnabled;
178 if ( mSnapToGridCanvasItem )
180 mSnapToGridCanvasItem->
setEnabled( snapToGridEnabled );
double geometryPrecision() const
The precision in which geometries on this layer should be saved.
void setCrs(const QgsCoordinateReferenceSystem &crs)
The CRS in which the grid should be calculated.
A class to represent a 2D point.
A QgsMapMouseEvent is the result of a user interaction with the mouse on a QgsMapCanvas.
const QgsCoordinateReferenceSystem & crs
Map canvas is a class for displaying all GIS data types on a canvas.
void setPrecision(double precision)
The resolution of the grid in map units.
Shows a grid on the map canvas given a spatial resolution.
void setEnabled(bool enabled)
Enable this item.
QgsPointXY mapPoint() const
mapPoint returns the point in coordinates
void currentLayerChanged(QgsMapLayer *layer)
Emitted when the current layer is changed.
QPoint mouseLastXY()
returns last position of mouse cursor
QgsGeometryOptions * geometryOptions() const
Configuration and logic to apply automatically on any edit happening on this layer.
void setPoint(const QgsPointXY &point)
A point that will be highlighted on the map canvas.
void snapToGrid(double precision, const QgsCoordinateReferenceSystem &crs)
Snaps the mapPoint to a grid with the given precision.
QgsPointXY snapPoint()
snapPoint will snap the points using the map canvas snapping utils configuration
Represents a vector layer which manages a vector based data sets.
QgsCoordinateReferenceSystem crs