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

Two-click polyline tool that creates a SWMM link between two nodes. More...

#include <maptooladdlink.h>

Inheritance diagram for OpenSWMMVisMapToolAddLink:
Collaboration diagram for OpenSWMMVisMapToolAddLink:

Signals

void linkAdded (const QString &name, int linkType, const QString &fromNode, const QString &toNode)
 
- Signals inherited from OpenSWMMVisMapTool
void cursorChanged (const QCursor &cursor)
 
void activeChanged (bool active)
 
void repaintRequested ()
 Emitted to instruct the canvas to repaint its overlay.
 

Public Member Functions

 OpenSWMMVisMapToolAddLink (MapCanvas *canvas, int linkType, const QString &elementKind, QObject *parent=nullptr)
 
QCursor cursor () const override
 Returns the mouse cursor to display while this tool is active.
 
void activate () override
 Called by the canvas when this tool becomes the active tool.
 
void deactivate () override
 Called by the canvas when another tool replaces this one.
 
void mousePressEvent (QMouseEvent *event) override
 
void mouseMoveEvent (QMouseEvent *event) override
 
void mouseDoubleClickEvent (QMouseEvent *event) override
 
void keyPressEvent (QKeyEvent *event) override
 
void paint (QPainter *painter, const MapExtent &extent, const SpatialReferenceSystem *srs) override
 Called by the canvas in drawForeground() so the tool can draw transient overlay graphics (rubber-band, measure segments, etc.).
 
void setTerrain (GISRasterLayer *layer, double offset, double factor=1.0)
 Sets the active terrain layer and link offset used to estimate upstream and downstream invert elevations when a link is committed.
 
- Public Member Functions inherited from OpenSWMMVisMapTool
 OpenSWMMVisMapTool (const QString &toolName, MapCanvas *canvas, QObject *parent=nullptr)
 
virtual ~OpenSWMMVisMapTool ()=default
 
QString toolName () const
 Returns the human-readable name of this tool.
 
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 mouseReleaseEvent (QMouseEvent *event)
 
virtual void wheelEvent (QWheelEvent *event)
 
virtual void keyReleaseEvent (QKeyEvent *event)
 
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.
 

Additional Inherited Members

- Protected Attributes inherited from OpenSWMMVisMapTool
QString m_toolName
 
MapCanvasm_canvas = nullptr
 
- Properties inherited from OpenSWMMVisMapTool
QString toolName
 
QCursor cursor
 
bool active
 

Detailed Description

Two-click polyline tool that creates a SWMM link between two nodes.

Interaction:

  • Click on (or near) an existing node → anchors the from-node.
  • Subsequent left-clicks add intermediate polyline vertices.
  • Click on a second node → commits the link.
  • Right-click → removes the last intermediate vertex (or cancels if none).
  • Escape → cancels without creating anything.

Node snapping activates within m_snapPx pixels of a node centre. The nearest node within that tolerance is highlighted with a snap indicator ring painted on the overlay channel.

Constructor & Destructor Documentation

◆ OpenSWMMVisMapToolAddLink()

OpenSWMMVisMapToolAddLink::OpenSWMMVisMapToolAddLink ( MapCanvas canvas,
int  linkType,
const QString &  elementKind,
QObject *  parent = nullptr 
)
Parameters
canvasTarget canvas.
linkTypeSWMM_LinkType (0=Conduit, 1=Pump, 2=Orifice, 3=Weir, 4=Outlet).
namePrefixAuto-name prefix ("C", "P", "Or", "W", "Ou").
elementKindNaming-preference key: "conduit", "pump", "orifice", "weir", or "outlet".

Member Function Documentation

◆ activate()

void OpenSWMMVisMapToolAddLink::activate ( )
overridevirtual

Called by the canvas when this tool becomes the active tool.

Reimplemented from OpenSWMMVisMapTool.

Here is the call graph for this function:

◆ cursor()

QCursor OpenSWMMVisMapToolAddLink::cursor ( ) const
overridevirtual

Returns the mouse cursor to display while this tool is active.

Reimplemented from OpenSWMMVisMapTool.

◆ deactivate()

void OpenSWMMVisMapToolAddLink::deactivate ( )
overridevirtual

Called by the canvas when another tool replaces this one.

Reimplemented from OpenSWMMVisMapTool.

Here is the call graph for this function:

◆ keyPressEvent()

void OpenSWMMVisMapToolAddLink::keyPressEvent ( QKeyEvent *  event)
overridevirtual

Reimplemented from OpenSWMMVisMapTool.

◆ linkAdded

void OpenSWMMVisMapToolAddLink::linkAdded ( const QString &  name,
int  linkType,
const QString &  fromNode,
const QString &  toNode 
)
signal

◆ mouseDoubleClickEvent()

void OpenSWMMVisMapToolAddLink::mouseDoubleClickEvent ( QMouseEvent *  event)
overridevirtual

Reimplemented from OpenSWMMVisMapTool.

◆ mouseMoveEvent()

void OpenSWMMVisMapToolAddLink::mouseMoveEvent ( QMouseEvent *  event)
overridevirtual

Reimplemented from OpenSWMMVisMapTool.

Here is the call graph for this function:

◆ mousePressEvent()

void OpenSWMMVisMapToolAddLink::mousePressEvent ( QMouseEvent *  event)
overridevirtual

Reimplemented from OpenSWMMVisMapTool.

Here is the call graph for this function:

◆ paint()

void OpenSWMMVisMapToolAddLink::paint ( QPainter *  painter,
const MapExtent canvasExtent,
const SpatialReferenceSystem canvasSRS 
)
overridevirtual

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 from OpenSWMMVisMapTool.

Here is the call graph for this function:

◆ setTerrain()

void OpenSWMMVisMapToolAddLink::setTerrain ( GISRasterLayer layer,
double  offset,
double  factor = 1.0 
)

Sets the active terrain layer and link offset used to estimate upstream and downstream invert elevations when a link is committed.

Parameters
layerRaster to sample; nullptr disables terrain assistance.
offsetSigned value added to terrain Z at each endpoint.
Here is the caller graph for this function:

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