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
OpenSWMMVisMapTool Class Reference

Abstract base class for interactive map tools used in the MapCanvas. More...

#include <maptool.h>

Inheritance diagram for OpenSWMMVisMapTool:
Collaboration diagram for OpenSWMMVisMapTool:

Signals

void cursorChanged (const QCursor &cursor)
 
void activeChanged (bool active)
 
void repaintRequested ()
 Emitted to instruct the canvas to repaint its overlay.
 

Public Member Functions

 OpenSWMMVisMapTool (const QString &toolName, MapCanvas *canvas, QObject *parent=nullptr)
 
virtual ~OpenSWMMVisMapTool ()=default
 
QString toolName () const
 Returns the human-readable name of this tool.
 
virtual QCursor cursor () const
 Returns the mouse cursor to display while this tool is active.
 
bool isActive () const
 Returns true when this tool is the active tool on its canvas.
 
MapCanvascanvas () const
 Returns the MapCanvas this tool is attached to.
 
virtual void activate ()
 Called by the canvas when this tool becomes the active tool.
 
virtual void deactivate ()
 Called by the canvas when another tool replaces this one.
 
virtual void mousePressEvent (QMouseEvent *event)
 
virtual void mouseMoveEvent (QMouseEvent *event)
 
virtual void mouseReleaseEvent (QMouseEvent *event)
 
virtual void mouseDoubleClickEvent (QMouseEvent *event)
 
virtual void wheelEvent (QWheelEvent *event)
 
virtual void keyPressEvent (QKeyEvent *event)
 
virtual void keyReleaseEvent (QKeyEvent *event)
 
virtual void paint (QPainter *painter, const MapExtent &canvasExtent, const SpatialReferenceSystem *canvasSRS)
 Called by the canvas in drawForeground() so the tool can draw transient overlay graphics (rubber-band, measure segments, etc.).
 
QGraphicsScene * scene () const
 Returns the scene this tool's canvas is using.
 
void toMapCoords (int px, int py, double &mapX, double &mapY) const
 Converts a widget pixel position to map coordinates.
 
void toPixelCoords (double mapX, double mapY, int &px, int &py) const
 Converts map coordinates to widget pixel position.
 

Protected Attributes

QString m_toolName
 
MapCanvasm_canvas = nullptr
 

Properties

QString toolName
 
QCursor cursor
 
bool active
 

Friends

class MapCanvas
 

Detailed Description

Abstract base class for interactive map tools used in the MapCanvas.

A map tool handles mouse, wheel, and keyboard events on behalf of the MapCanvas. Exactly one tool is active at a time. The canvas calls activate() / deactivate() when switching tools.

Tools can also draw their own transient graphics on top of the map by overriding paint().

Concrete tool subclasses:

Constructor & Destructor Documentation

◆ OpenSWMMVisMapTool()

OpenSWMMVisMapTool::OpenSWMMVisMapTool ( const QString &  toolName,
MapCanvas canvas,
QObject *  parent = nullptr 
)
explicit

◆ ~OpenSWMMVisMapTool()

virtual OpenSWMMVisMapTool::~OpenSWMMVisMapTool ( )
virtualdefault

Member Function Documentation

◆ activate()

◆ activeChanged

void OpenSWMMVisMapTool::activeChanged ( bool  active)
signal

◆ canvas()

MapCanvas * OpenSWMMVisMapTool::canvas ( ) const

Returns the MapCanvas this tool is attached to.

Here is the caller graph for this function:

◆ cursor()

◆ cursorChanged

void OpenSWMMVisMapTool::cursorChanged ( const QCursor &  cursor)
signal
Here is the caller graph for this function:

◆ deactivate()

◆ isActive()

bool OpenSWMMVisMapTool::isActive ( ) const

Returns true when this tool is the active tool on its canvas.

◆ keyPressEvent()

◆ keyReleaseEvent()

void OpenSWMMVisMapTool::keyReleaseEvent ( QKeyEvent *  event)
virtual
Here is the caller graph for this function:

◆ mouseDoubleClickEvent()

void OpenSWMMVisMapTool::mouseDoubleClickEvent ( QMouseEvent *  event)
virtual

Reimplemented in OpenSWMMVisMapToolAddLink, OpenSWMMVisMapToolAddSubcatchment, OpenSWMMVisMapToolEditVertex, OpenSWMMVisMapToolFeatureDrawBase, OpenSWMMVisMapToolMeasure, MapToolMeshProfile, MapToolPick2DCells, OpenSWMMVisMapToolSelect, and OpenSWMMVisMapToolSelectPolygon.

Here is the caller graph for this function:

◆ mouseMoveEvent()

◆ mousePressEvent()

◆ mouseReleaseEvent()

◆ paint()

void OpenSWMMVisMapTool::paint ( QPainter *  painter,
const MapExtent canvasExtent,
const SpatialReferenceSystem canvasSRS 
)
virtual

Called by the canvas in drawForeground() so the tool can draw transient overlay graphics (rubber-band, measure segments, etc.).

Override this to paint tool overlays directly via QPainter in view coordinates.

Reimplemented in OpenSWMMVisMapToolEditVertex, OpenSWMMVisMapToolFeatureDrawBase, OpenSWMMVisMapToolEditFeatureVertex, OpenSWMMVisMapToolIdentify, OpenSWMMVisMapToolMeasure, MapToolMeshProfile, MapToolMeshSelectEdge, MapToolMeshSelectVertex, MapToolPick2DCells, MapToolProfileMarker, OpenSWMMVisMapToolSelect, OpenSWMMVisMapToolSelectPolygon, OpenSWMMVisMapToolZoom, OpenSWMMVisMapToolAddInletNode, OpenSWMMVisMapToolAddLink, OpenSWMMVisMapToolAddNode, OpenSWMMVisMapToolAddSubcatchment, OpenSWMMVisMapToolAddVirtualNode, and OpenSWMMVisMapToolPickNode.

Here is the caller graph for this function:

◆ repaintRequested

void OpenSWMMVisMapTool::repaintRequested ( )
signal

Emitted to instruct the canvas to repaint its overlay.

◆ scene()

QGraphicsScene * OpenSWMMVisMapTool::scene ( ) const

Returns the scene this tool's canvas is using.

Here is the call graph for this function:

◆ toMapCoords()

void OpenSWMMVisMapTool::toMapCoords ( int  px,
int  py,
double mapX,
double mapY 
) const

Converts a widget pixel position to map coordinates.

Parameters
pxPixel X in widget space.
pyPixel Y in widget space.
mapXOutput map X.
mapYOutput map Y.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ toolName()

QString OpenSWMMVisMapTool::toolName ( ) const

Returns the human-readable name of this tool.

◆ toPixelCoords()

void OpenSWMMVisMapTool::toPixelCoords ( double  mapX,
double  mapY,
int &  px,
int &  py 
) const

Converts map coordinates to widget pixel position.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ wheelEvent()

void OpenSWMMVisMapTool::wheelEvent ( QWheelEvent *  event)
virtual

Reimplemented in OpenSWMMVisMapToolZoom.

Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ MapCanvas

friend class MapCanvas
friend

Member Data Documentation

◆ m_canvas

MapCanvas* OpenSWMMVisMapTool::m_canvas = nullptr
protected

◆ m_toolName

QString OpenSWMMVisMapTool::m_toolName
protected

Property Documentation

◆ active

bool OpenSWMMVisMapTool::active
read

◆ cursor

QCursor OpenSWMMVisMapTool::cursor
read

◆ toolName

QString OpenSWMMVisMapTool::toolName
read

The documentation for this class was generated from the following files: