30 QHash<QgsMapCanvas *, QgsMapCanvasTracer *> QgsMapCanvasTracer::sTracers;
35 , mMessageBar( messageBar )
38 sTracers.insert( canvas,
this );
55 sTracers.remove( mCanvas );
60 return sTracers.value( canvas,
nullptr );
65 Q_UNUSED( addingVertex );
72 mLastMessage =
nullptr;
78 message = tr(
"Disabled - there are too many features displayed. Try zooming in or disable some layers." );
87 message = tr(
"Tracing may not work correctly. Please check topology of the input layers." );
90 if ( message.isEmpty() )
94 QgsSettings().value( QStringLiteral(
"/qgis/messageTimeout" ), 5 ).toInt() );
95 mMessageBar->
pushItem( mLastMessage );
105 QList<QgsVectorLayer *>
layers;
114 if ( vl && visibleLayers.contains( vl ) )
129 if ( visibleLayers.contains( cfg.
layer ) )
138 void QgsMapCanvasTracer::onCurrentLayerChanged()
QList< QgsVectorLayer * > layers() const
Gets layers used for tracing.
Base class for all map layer types.
QgsCoordinateTransformContext transformContext() const
Returns the coordinate transform context, which stores various information regarding which datum tran...
SnappingMode mode() const
Returns the mode (all layers, active layer, per layer settings)
This class is a composition of two QSettings instances:
void setRenderContext(const QgsRenderContext *renderContext)
Sets the renderContext used for tracing only on visible features.
void setExtent(const QgsRectangle &extent)
Sets extent to which graph's features will be limited (empty extent means no limit) ...
A bar for displaying non-blocking messages to the user.
QList< QgsMapLayer * > layers() const
Gets list of layers for map rendering The layers are stored in the reverse order of how they are rend...
Map canvas is a class for displaying all GIS data types on a canvas.
bool hasTopologyProblem() const
Whether there was an error during graph creation due to noding exception, indicating some input data ...
QgsCoordinateReferenceSystem destinationCrs() const
returns CRS of destination coordinate reference system
~QgsMapCanvasTracer() override
Extension of QgsTracer that provides extra functionality:
static QgsMapCanvasTracer * tracerForCanvas(QgsMapCanvas *canvas)
Retrieve instance of this class associated with given canvas (if any).
void setDestinationCrs(const QgsCoordinateReferenceSystem &crs, const QgsCoordinateTransformContext &context)
Sets the crs and transform context used for tracing.
bool popWidget(QgsMessageBarItem *item)
Remove the passed widget from the bar (if previously added), then display the next one in the stack i...
Max feature count threshold was reached while reading features.
QList< QgsSnappingUtils::LayerConfig > layers() const
Query layers used for snapping.
QgsRectangle extent() const
Returns the current zoom extent of the map canvas.
PathError
Possible errors that may happen when calling findShortestPath()
void destinationCrsChanged()
Emitted when map CRS has changed.
On a per layer configuration basis.
void transformContextChanged()
Emitted when the canvas transform context is changed.
void currentLayerChanged(QgsMapLayer *layer)
Emitted when the current layer is changed.
void configChanged(const QgsSnappingConfig &snappingConfig)
Emitted when the snapping settings object changes.
QgsMapLayer * currentLayer()
returns current layer (set by legend widget)
const QgsMapSettings & mapSettings() const
Gets access to properties used for map rendering.
void reportError(PathError err, bool addingVertex)
Report a path finding error to the user.
Contains information about the context of a rendering operation.
void pushItem(QgsMessageBarItem *item)
Display a message item on the bar after hiding the currently visible one and putting it in a stack...
void setMaxFeatureCount(int count)
Gets maximum possible number of features in graph. If the number is exceeded, graph is not created...
void configure() override
Sets configuration from current snapping settings and canvas settings.
QgsVectorLayer * layer
The layer to configure.
Configures how a certain layer should be handled in a snapping operation.
static QgsRenderContext fromMapSettings(const QgsMapSettings &mapSettings)
create initialized QgsRenderContext instance from given QgsMapSettings
void invalidateGraph()
Destroy the existing graph structure if any (de-initialize)
QgsMapCanvasTracer(QgsMapCanvas *canvas, QgsMessageBar *messageBar=nullptr)
Create tracer associated with a particular map canvas, optionally message bar for reporting...
QgsSnappingUtils * snappingUtils() const
Returns snapping utility class that is associated with map canvas.
Represents a vector layer which manages a vector based data sets.
void extentsChanged()
Emitted when the extents of the map change.
void setLayers(const QList< QgsVectorLayer *> &layers)
Sets layers used for tracing.
void layersChanged()
Emitted when a new set of layers has been received.