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
maptoolmeshselectvertex.h
Go to the documentation of this file.
1
24#ifndef OPENSWMMVIS_MAP_TOOLS_MAPTOOLMESHSELECTVERTEX_H
25#define OPENSWMMVIS_MAP_TOOLS_MAPTOOLMESHSELECTVERTEX_H
26
27#include "map/tools/maptool.h"
28#include "plot/plotattribute.h"
29
30#include <QPoint>
31#include <QPointer>
32#include <QVector>
33
35class SWMM2DMeshLayer;
36
38{
39 Q_OBJECT
40public:
42 SelectionManager *selection,
43 QObject *parent = nullptr);
44
45 void activate() override;
46 void deactivate() override;
47
48 void mousePressEvent(QMouseEvent *event) override;
49 void mouseMoveEvent(QMouseEvent *event) override;
50 void mouseReleaseEvent(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:
63 void plotVertexSeriesRequested(SWMM2DMeshLayer *mesh, const QVector<int> &vertexIdxList,
64 const QVector<openswmmvis::plot::PlotAttribute> &attrs);
65
66private:
67 SWMM2DMeshLayer *findActiveMeshLayer_() const;
68 QPointF pixelToScene_(int px, int py) const;
69
70 QPointer<SelectionManager> m_selection;
71 QPointer<SWMM2DMeshLayer> m_target;
72
73 bool m_dragging = false;
74 QPoint m_startPixel;
75 QPoint m_currentPixel;
76 static constexpr int kDragThreshPx = 6;
77 static constexpr double kPickTolPx = 12.0;
78};
79
80#endif // OPENSWMMVIS_MAP_TOOLS_MAPTOOLMESHSELECTVERTEX_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
Definition maptoolmeshselectvertex.h:38
void mousePressEvent(QMouseEvent *event) override
Definition maptoolmeshselectvertex.cpp:73
void deactivate() override
Called by the canvas when another tool replaces this one.
Definition maptoolmeshselectvertex.cpp:42
void activate() override
Called by the canvas when this tool becomes the active tool.
Definition maptoolmeshselectvertex.cpp:35
void mouseReleaseEvent(QMouseEvent *event) override
Definition maptoolmeshselectvertex.cpp:162
void plotVertexSeriesRequested(SWMM2DMeshLayer *mesh, const QVector< int > &vertexIdxList, const QVector< openswmmvis::plot::PlotAttribute > &attrs)
Emitted when the user right-clicks and picks an entry from the "Plot Time Series" submenu....
void keyPressEvent(QKeyEvent *event) override
Definition maptoolmeshselectvertex.cpp:220
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 maptoolmeshselectvertex.cpp:231
void mouseMoveEvent(QMouseEvent *event) override
Definition maptoolmeshselectvertex.cpp:146
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
Definition swmm2dmeshlayer.h:64
Owner of the canonical selection set for one SWMM project.
Definition selectionmanager.h:112
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.
Definition meshcommands.h:302
Slice BL — canonical enumeration of plottable result attributes.
QVector< int > parent
union-find
Definition pslgminsize.cpp:176