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
maptoolselectpolygon.h
Go to the documentation of this file.
1
9#ifndef MAPTOOLSELECTPOLYGON_H
10#define MAPTOOLSELECTPOLYGON_H
11
12#include "map/tools/maptool.h"
13
14#include <QColor>
15#include <QPoint>
16#include <QVector>
17
19
35{
36 Q_OBJECT
37
38public:
40 QObject *parent = nullptr);
41
42 [[nodiscard]] QCursor cursor() const override;
43
44 void activate() override;
45 void deactivate() override;
46
47 void mousePressEvent(QMouseEvent *event) override;
48 void mouseMoveEvent(QMouseEvent *event) override;
49 void mouseReleaseEvent(QMouseEvent *event) override;
50 void mouseDoubleClickEvent(QMouseEvent *event) override;
51 void keyPressEvent(QKeyEvent *event) override;
52
53 void paint(QPainter *painter,
54 const MapExtent &canvasExtent,
55 const SpatialReferenceSystem *canvasSRS) override;
56
57signals:
60
61private:
63 void finalizeSelection(Qt::KeyboardModifiers mods);
65 void cancel();
67 void requestRepaint();
68
69 QVector<QPoint> m_vertices; // committed vertices (widget pixels)
70 QPoint m_cursorPx; // live cursor position (widget pixels)
71 bool m_haveCursor = false;
72 QColor m_lineColor = QColor(0, 120, 255);
73 QColor m_fillColor = QColor(0, 120, 255, 40);
74};
75
76#endif // MAPTOOLSELECTPOLYGON_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 all layers displayed in the MapCanvas.
Definition openswmmvislayer.h:116
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
Selects SWMM model features enclosed by a user-drawn polygon.
Definition maptoolselectpolygon.h:35
void mouseDoubleClickEvent(QMouseEvent *event) override
Definition maptoolselectpolygon.cpp:89
void keyPressEvent(QKeyEvent *event) override
Definition maptoolselectpolygon.cpp:96
void mouseReleaseEvent(QMouseEvent *event) override
Definition maptoolselectpolygon.cpp:84
void deactivate() override
Called by the canvas when another tool replaces this one.
Definition maptoolselectpolygon.cpp:37
void selectionChanged(OpenSWMMVisLayer *layer)
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 maptoolselectpolygon.cpp:112
void mousePressEvent(QMouseEvent *event) override
Definition maptoolselectpolygon.cpp:59
void activate() override
Called by the canvas when this tool becomes the active tool.
Definition maptoolselectpolygon.cpp:30
void mouseMoveEvent(QMouseEvent *event) override
Definition maptoolselectpolygon.cpp:75
QCursor cursor() const override
Returns the mouse cursor to display while this tool is active.
Definition maptoolselectpolygon.cpp:25
Represents a coordinate reference system backed by a GDAL OGRSpatialReference.
Definition spatialreferencesystem.h:28
Abstract base class for all interactive tools attached to a MapCanvas.
QVector< int > parent
union-find
Definition pslgminsize.cpp:176