SWMMVis  6.0.0-alpha.4
Qt6/C++ GIS-based graphical user interface for the SWMMVis engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
maptoolidentify.h
Go to the documentation of this file.
1
11#ifndef MAPTOOLIDENTIFY_H
12#define MAPTOOLIDENTIFY_H
13
14#include "map/tools/maptool.h"
15
16#include <QList>
17#include <QVariantMap>
18
24{
25 QString layerName;
26 QList<QVariantMap> features;
27};
28
39{
40 Q_OBJECT
41
42 Q_PROPERTY(double mapTolerance READ mapTolerance WRITE setMapTolerance
46
47public:
48
49 explicit OpenSWMMVisMapToolIdentify(MapCanvas *canvas, QObject *parent = nullptr);
50
51 [[nodiscard]] QCursor cursor() const override;
52
53 // ----- Configuration -------------------------------------------------
54
58 [[nodiscard]] double mapTolerance() const;
59 void setMapTolerance(double tolerance);
60
64 [[nodiscard]] bool queryAllLayers() const;
65 void setQueryAllLayers(bool all);
66
67 // ----- Tool interface ------------------------------------------------
68
69 void activate() override;
70 void deactivate() override;
71
72 void mousePressEvent(QMouseEvent *event) override;
73
74 void paint(QPainter *painter,
75 const MapExtent &canvasExtent,
76 const SpatialReferenceSystem *canvasSRS) override;
77
78signals:
79 void mapToleranceChanged(double tolerance);
80 void queryAllLayersChanged(bool all);
81
85 void identifyResult(const QList<IdentifyResult> &results);
86
87private:
88 double m_tolerance = 1e-6;
89 bool m_queryAll = true;
90 double m_lastX = 0.0;
91 double m_lastY = 0.0;
92 bool m_hasResult = false;
93};
94
95#endif // MAPTOOLIDENTIFY_H
The central map display widget — QGIS-style hybrid rendering.
Definition mapcanvas.h:63
An axis-aligned bounding box in the coordinate space of a given CRS.
Definition mapextent.h:26
Abstract base class for interactive map tools used in the MapCanvas.
Definition maptool.h:43
MapCanvas * canvas() const
Returns the MapCanvas this tool is attached to.
Definition maptool.cpp:29
Tool that queries all visible layers at a clicked point and reports attributes.
Definition maptoolidentify.h:39
void paint(QPainter *painter, const MapExtent &canvasExtent, const SpatialReferenceSystem *canvasSRS) override
Called by the canvas in drawForeground() so the tool can draw transient overlay graphics (rubber-band...
Definition maptoolidentify.cpp:108
void deactivate() override
Called by the canvas when another tool replaces this one.
Definition maptoolidentify.cpp:55
void setMapTolerance(double tolerance)
Definition maptoolidentify.cpp:29
void mapToleranceChanged(double tolerance)
double mapTolerance
Definition maptoolidentify.h:43
void mousePressEvent(QMouseEvent *event) override
Definition maptoolidentify.cpp:61
bool queryAllLayers
Definition maptoolidentify.h:45
void identifyResult(const QList< IdentifyResult > &results)
Emitted after a click with the list of identify results (one per layer).
QCursor cursor() const override
Returns the mouse cursor to display while this tool is active.
Definition maptoolidentify.cpp:22
void setQueryAllLayers(bool all)
Definition maptoolidentify.cpp:40
void activate() override
Called by the canvas when this tool becomes the active tool.
Definition maptoolidentify.cpp:49
void queryAllLayersChanged(bool all)
Represents a coordinate reference system backed by a GDAL OGRSpatialReference.
Definition spatialreferencesystem.h:28
int e
Definition inpmeshreader.cpp:41
Abstract base class for all interactive tools attached to a MapCanvas.
QVector< int > parent
union-find
Definition pslgminsize.cpp:176
Holds identify results from a single layer.
Definition maptoolidentify.h:24
QList< QVariantMap > features
Definition maptoolidentify.h:26
QString layerName
Definition maptoolidentify.h:25