QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Go to the documentation of this file.
30 #include <QGlobalStatic>
37 , mMessageBar( messageBar )
40 sTracers()->insert( canvas,
this );
49 connect( canvas, &QObject::destroyed,
this, [
this]() { mCanvas =
nullptr; } );
58 sTracers->remove( mCanvas );
63 return sTracers->value( canvas,
nullptr );
68 Q_UNUSED( addingVertex )
75 mLastMessage =
nullptr;
81 message = tr(
"Disabled - there are too many features displayed. Try zooming in or disable some layers." );
90 message = tr(
"Tracing may not work correctly. Please check topology of the input layers." );
93 if ( message.isEmpty() )
97 mMessageBar->
pushItem( mLastMessage );
107 QList<QgsVectorLayer *>
layers;
108 const QList<QgsMapLayer *> visibleLayers = mCanvas->
mapSettings().
layers(
true );
116 if ( vl && visibleLayers.contains( vl ) )
122 const auto constVisibleLayers = visibleLayers;
136 if ( visibleLayers.contains( cfg.layer ) )
146 void QgsMapCanvasTracer::onCurrentLayerChanged()
void currentLayerChanged(QgsMapLayer *layer)
Emitted when the current layer is changed.
@ AdvancedConfiguration
On a per layer configuration basis.
void transformContextChanged()
Emitted when the canvas transform context is changed.
QgsRectangle extent() const
Returns the current zoom extent of the map canvas.
void destinationCrsChanged()
Emitted when map CRS has changed.
static QgsRenderContext fromMapSettings(const QgsMapSettings &mapSettings)
create initialized QgsRenderContext instance from given QgsMapSettings
const QgsMapSettings & mapSettings() const
Gets access to properties used for map rendering.
Map canvas is a class for displaying all GIS data types on a canvas.
Contains information about the context of a rendering operation.
QList< QgsVectorLayer * > layers() const
Gets layers used for tracing.
bool popWidget(QgsMessageBarItem *item)
Remove the specified item from the bar, and display the next most recent one in the stack.
Q_GLOBAL_STATIC(TracerCanvasHash, sTracers)
QgsSnappingUtils * snappingUtils() const
Returns snapping utility class that is associated with map canvas.
void invalidateGraph()
Destroy the existing graph structure if any (de-initialize)
void setRenderContext(const QgsRenderContext *renderContext)
Sets the renderContext used for tracing only on visible features.
void setDestinationCrs(const QgsCoordinateReferenceSystem &crs, const QgsCoordinateTransformContext &context)
Sets the crs and transform context used for tracing.
QgsCoordinateTransformContext transformContext() const
Returns the coordinate transform context, which stores various information regarding which datum tran...
void configChanged(const QgsSnappingConfig &snappingConfig)
Emitted when the snapping settings object changes.
Represents an item shown within a QgsMessageBar widget.
Extension of QgsTracer that provides extra functionality:
void layersChanged()
Emitted when a new set of layers has been received.
~QgsMapCanvasTracer() override
void pushItem(QgsMessageBarItem *item)
Display a message item on the bar, after hiding the currently visible one and putting it in a stack.
@ ErrTooManyFeatures
Max feature count threshold was reached while reading features.
void extentsChanged()
Emitted when the extents of the map change.
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.
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.
@ AllLayers
On all vector layers.
static int defaultMessageTimeout(Qgis::MessageLevel level=Qgis::MessageLevel::NoLevel)
Returns the default timeout in seconds for timed messages of the specified level.
bool hasTopologyProblem() const
Whether there was an error during graph creation due to noding exception, indicating some input data ...
static QgsMapCanvasTracer * tracerForCanvas(QgsMapCanvas *canvas)
Retrieve instance of this class associated with given canvas (if any).
QgsCoordinateReferenceSystem destinationCrs() const
Returns the destination coordinate reference system for the map render.
QList< QgsSnappingUtils::LayerConfig > layers() const
Query layers used for snapping.
Represents a vector layer which manages a vector based data sets.
Base class for all map layer types. This is the base class for all map layer types (vector,...
Qgis::SnappingMode mode() const
Returns the mode (all layers, active layer, per layer settings)
QHash< QgsMapCanvas *, QgsMapCanvasTracer * > TracerCanvasHash
void reportError(PathError err, bool addingVertex)
Report a path finding error to the user.
static const QgsSettingsEntryInteger settingsDigitizingTracingMaxFeatureCount
Settings entry digitizing tracing max feature count.
QgsMapLayer * currentLayer()
returns current layer (set by legend widget)
@ ActiveLayer
On the active layer.
PathError
Possible errors that may happen when calling findShortestPath()
Configures how a certain layer should be handled in a snapping operation.
void setLayers(const QList< QgsVectorLayer * > &layers)
Sets layers used for tracing.
QList< QgsMapLayer * > layers(bool expandGroupLayers=false) const
Returns the list of layers which will be rendered in the map.
QgsMapCanvasTracer(QgsMapCanvas *canvas, QgsMessageBar *messageBar=nullptr)
Create tracer associated with a particular map canvas, optionally message bar for reporting.