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

#include <profileplotwidget.h>

Inheritance diagram for ProfilePlotWidget:
Collaboration diagram for ProfilePlotWidget:

Classes

struct  LayerToggles
 Label / terrain / orientation switches and per-output user preferences (currentHglLine, currentHglFill, maxHglBand, etc.). More...
 
struct  SeriesBinding
 One elevation-axis curve to render: a (results-layer × output kind) pair with resolved style and pre-computed data. More...
 
struct  Surface2DSample
 One station of the 2D inundation overlay: the active 2D results layer's water surface sampled where the path crosses the mesh. chainage is REAL path chainage (converted to virtual x when painting, like terrain samples). bed is the mesh bed elevation at the station; wse is bed + interpolated depth, or NaN when the station is dry / off-mesh / has no data (a gap). More...
 

Public Types

enum class  Mode {
  Identify = 0 ,
  Pan ,
  ZoomIn ,
  ZoomOut
}
 
enum class  AxisEdge {
  None = 0 ,
  XMinimum ,
  XMaximum ,
  YMinimum ,
  YMaximum
}
 

Signals

void visibleXRangeChanged (double vxMin, double vxMax)
 Emitted whenever the visible x-range (virtual chainage) changes — fit, zoom, pan, wheel, axis-edge edit, or a new path/series recomputing the extent. Emitted at most once per change (values are compared against the last emission). Consumed by the attribute-tracks pane to stay column-aligned.
 
void nodeRightClicked (int pathNodeIdx, const QPoint &globalPos)
 Emitted on right-click over a node glyph; consumed by Stage 6 to pop an edit-in-place context menu.
 
void linkRightClicked (int pathLinkIdx, const QPoint &globalPos)
 Emitted on right-click over a link glyph.
 
void backgroundRightClicked (const QPoint &globalPos)
 Emitted on right-click that hits neither a node nor a link. Hosts use this to show a context menu whose element-specific items (e.g. "Zoom to on map") are disabled but other items (e.g. "Properties…") remain available.
 
void nodeClicked (int pathNodeIdx)
 Emitted on left-click over a node glyph. Consumed by ProfilePlotDialog to drive the main-map selection.
 
void linkClicked (int pathLinkIdx)
 Emitted on left-click over a conduit / non-conduit glyph.
 
void nodeDoubleClicked (int pathNodeIdx)
 Emitted on left double-click over a node glyph. Hosts use this to zoom the main map to the element.
 
void linkDoubleClicked (int pathLinkIdx)
 Emitted on left double-click over a link glyph.
 
void backgroundClicked ()
 Emitted on left-click in Identify mode when the click misses every node and link glyph. Hosts use this to clear the selection so blank-area clicks act as a deselect.
 

Public Member Functions

 ProfilePlotWidget (QWidget *parent=nullptr)
 
void setPath (const ProfileBuilder::PathStatic &path)
 Sets the static path + chainage to render. Triggers a repaint.
 
void setSeries (const QVector< SeriesBinding > &series)
 Replaces all rendered series at once. Order matters only for z-order between equal-kind series (e.g. when overlaying HGL from two models, the later series paints on top).
 
const QVector< SeriesBinding > & series () const
 
void setCurrentPeriod (int seriesIdx, int period)
 Selects the time-step shown by current-time series (HGL / EGL / WaterSurface). seriesIdx is the source-of-truth for the animation cursor; other current-time series advance in lock- step. Pass -1 for period to hide the animation lines.
 
void setCurrentDateTime (const QDateTime &dt)
 Sets the wall-clock datetime corresponding to the current period. Used by the on-plot timestamp overlay. Passing an invalid QDateTime hides the overlay.
 
void setCurrentPeriod (int period)
 Convenience overload: applies period to the primary (series index 0). Per-source time-mapping is the dialog's responsibility — the widget doesn't translate dates.
 
void setLayerToggles (const LayerToggles &toggles)
 
LayerToggles layerToggles () const
 
void setSurface2DSamples (const QVector< Surface2DSample > &samples)
 Replaces the 2D inundation overlay stations (static geometry + the current frame's WSE). Pass an empty vector to clear. The host re-sends the vector with fresh wse values on every animation tick; ProfilePlotOptions::show2DInundation gates drawing. Widens the y-extent to the wettest station.
 
const QVector< Surface2DSample > & surface2DSamples () const
 
void setOptions (ProfilePlotOptions *options)
 Binds a ProfilePlotOptions object — the widget's theming (per-type fills/outlines, soil colours, line widths, legend position/font/opacity) is read from it. Pass nullptr to fall back to the hardcoded defaults. The widget connects to changed() and repaints automatically.
 
ProfilePlotOptionsoptions () const
 
void setAxisLabels (const QString &xLabel, const QString &yLabel)
 Sets axis labels for the plot frame. Defaults to "Chainage" / "Elevation" if not set.
 
int nodeIndexAt (const QPoint &widgetPos) const
 Hit-test: returns the path-node index whose manhole glyph is nearest widgetPos within a reasonable tolerance, or -1. Virtual junctions count — their dashed rectangle shares the manhole footprint. Used by Stage 6's edit-in-place context menu.
 
int linkIndexAt (const QPoint &widgetPos) const
 Hit-test: returns the path-link index whose conduit / glyph passes through widgetPos within a reasonable tolerance, or -1.
 
void setMode (Mode m)
 
Mode mode () const
 
AxisEdge axisEdgeAt (const QPoint &widgetPos) const
 
bool setAxisEdgeValue (AxisEdge edge, double value)
 
QRectF visibleDataRange () const
 
void setVisibleXRange (double vxMin, double vxMax)
 
const QVector< double > & virtualChainageTable () const
 
double virtualToRealChainage (double vx) const
 
void zoomBy (double factor)
 
void fitToExtent ()
 
void setSelectedElementNames (const QStringList &names)
 Marks a set of element names (nodes or links) as selected so the matching glyphs render with a highlight outline. Names not on the path are silently ignored. Pass an empty list to clear all highlights.
 

Static Public Member Functions

static int chartLeftMarginPx ()
 
static int chartRightMarginPx ()
 

Protected Member Functions

void paintEvent (QPaintEvent *event) override
 
void resizeEvent (QResizeEvent *event) override
 
void mousePressEvent (QMouseEvent *event) override
 
void mouseMoveEvent (QMouseEvent *event) override
 
void mouseReleaseEvent (QMouseEvent *event) override
 
void mouseDoubleClickEvent (QMouseEvent *event) override
 
void wheelEvent (QWheelEvent *event) override
 

Member Enumeration Documentation

◆ AxisEdge

enum class ProfilePlotWidget::AxisEdge
strong
Enumerator
None 
XMinimum 
XMaximum 
YMinimum 
YMaximum 

◆ Mode

enum class ProfilePlotWidget::Mode
strong

Modal interaction state — mutually exclusive. Default is Identify (clicks select / right-click context-menu).

Enumerator
Identify 
Pan 
ZoomIn 
ZoomOut 

Constructor & Destructor Documentation

◆ ProfilePlotWidget()

ProfilePlotWidget::ProfilePlotWidget ( QWidget *  parent = nullptr)
explicit
Here is the call graph for this function:

Member Function Documentation

◆ axisEdgeAt()

ProfilePlotWidget::AxisEdge ProfilePlotWidget::axisEdgeAt ( const QPoint &  widgetPos) const
Here is the caller graph for this function:

◆ backgroundClicked

void ProfilePlotWidget::backgroundClicked ( )
signal

Emitted on left-click in Identify mode when the click misses every node and link glyph. Hosts use this to clear the selection so blank-area clicks act as a deselect.

Here is the caller graph for this function:

◆ backgroundRightClicked

void ProfilePlotWidget::backgroundRightClicked ( const QPoint &  globalPos)
signal

Emitted on right-click that hits neither a node nor a link. Hosts use this to show a context menu whose element-specific items (e.g. "Zoom to on map") are disabled but other items (e.g. "Properties…") remain available.

Here is the caller graph for this function:

◆ chartLeftMarginPx()

int ProfilePlotWidget::chartLeftMarginPx ( )
static

The fixed horizontal gutters of the plot area, in pixels. The tracks pane adopts the same values so data columns line up.

◆ chartRightMarginPx()

int ProfilePlotWidget::chartRightMarginPx ( )
static

◆ fitToExtent()

void ProfilePlotWidget::fitToExtent ( )

Reset the view rect to the auto-computed data extent (Fit).

◆ layerToggles()

ProfilePlotWidget::LayerToggles ProfilePlotWidget::layerToggles ( ) const

◆ linkClicked

void ProfilePlotWidget::linkClicked ( int  pathLinkIdx)
signal

Emitted on left-click over a conduit / non-conduit glyph.

Here is the caller graph for this function:

◆ linkDoubleClicked

void ProfilePlotWidget::linkDoubleClicked ( int  pathLinkIdx)
signal

Emitted on left double-click over a link glyph.

Here is the caller graph for this function:

◆ linkIndexAt()

int ProfilePlotWidget::linkIndexAt ( const QPoint &  widgetPos) const

Hit-test: returns the path-link index whose conduit / glyph passes through widgetPos within a reasonable tolerance, or -1.

Here is the caller graph for this function:

◆ linkRightClicked

void ProfilePlotWidget::linkRightClicked ( int  pathLinkIdx,
const QPoint &  globalPos 
)
signal

Emitted on right-click over a link glyph.

Here is the caller graph for this function:

◆ mode()

Mode ProfilePlotWidget::mode ( ) const
inline

◆ mouseDoubleClickEvent()

void ProfilePlotWidget::mouseDoubleClickEvent ( QMouseEvent *  event)
overrideprotected
Here is the call graph for this function:

◆ mouseMoveEvent()

void ProfilePlotWidget::mouseMoveEvent ( QMouseEvent *  event)
overrideprotected

◆ mousePressEvent()

void ProfilePlotWidget::mousePressEvent ( QMouseEvent *  event)
overrideprotected
Here is the call graph for this function:

◆ mouseReleaseEvent()

void ProfilePlotWidget::mouseReleaseEvent ( QMouseEvent *  event)
overrideprotected
Here is the call graph for this function:

◆ nodeClicked

void ProfilePlotWidget::nodeClicked ( int  pathNodeIdx)
signal

Emitted on left-click over a node glyph. Consumed by ProfilePlotDialog to drive the main-map selection.

Here is the caller graph for this function:

◆ nodeDoubleClicked

void ProfilePlotWidget::nodeDoubleClicked ( int  pathNodeIdx)
signal

Emitted on left double-click over a node glyph. Hosts use this to zoom the main map to the element.

Here is the caller graph for this function:

◆ nodeIndexAt()

int ProfilePlotWidget::nodeIndexAt ( const QPoint &  widgetPos) const

Hit-test: returns the path-node index whose manhole glyph is nearest widgetPos within a reasonable tolerance, or -1. Virtual junctions count — their dashed rectangle shares the manhole footprint. Used by Stage 6's edit-in-place context menu.

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

◆ nodeRightClicked

void ProfilePlotWidget::nodeRightClicked ( int  pathNodeIdx,
const QPoint &  globalPos 
)
signal

Emitted on right-click over a node glyph; consumed by Stage 6 to pop an edit-in-place context menu.

Here is the caller graph for this function:

◆ options()

ProfilePlotOptions * ProfilePlotWidget::options ( ) const
inline
Here is the caller graph for this function:

◆ paintEvent()

void ProfilePlotWidget::paintEvent ( QPaintEvent *  event)
overrideprotected

◆ resizeEvent()

void ProfilePlotWidget::resizeEvent ( QResizeEvent *  event)
overrideprotected

◆ series()

const QVector< SeriesBinding > & ProfilePlotWidget::series ( ) const
inline
Here is the caller graph for this function:

◆ setAxisEdgeValue()

bool ProfilePlotWidget::setAxisEdgeValue ( AxisEdge  edge,
double  value 
)

◆ setAxisLabels()

void ProfilePlotWidget::setAxisLabels ( const QString &  xLabel,
const QString &  yLabel 
)

Sets axis labels for the plot frame. Defaults to "Chainage" / "Elevation" if not set.

◆ setCurrentDateTime()

void ProfilePlotWidget::setCurrentDateTime ( const QDateTime &  dt)

Sets the wall-clock datetime corresponding to the current period. Used by the on-plot timestamp overlay. Passing an invalid QDateTime hides the overlay.

◆ setCurrentPeriod() [1/2]

void ProfilePlotWidget::setCurrentPeriod ( int  period)

Convenience overload: applies period to the primary (series index 0). Per-source time-mapping is the dialog's responsibility — the widget doesn't translate dates.

◆ setCurrentPeriod() [2/2]

void ProfilePlotWidget::setCurrentPeriod ( int  seriesIdx,
int  period 
)

Selects the time-step shown by current-time series (HGL / EGL / WaterSurface). seriesIdx is the source-of-truth for the animation cursor; other current-time series advance in lock- step. Pass -1 for period to hide the animation lines.

◆ setLayerToggles()

void ProfilePlotWidget::setLayerToggles ( const LayerToggles toggles)

◆ setMode()

void ProfilePlotWidget::setMode ( Mode  m)

◆ setOptions()

void ProfilePlotWidget::setOptions ( ProfilePlotOptions options)

Binds a ProfilePlotOptions object — the widget's theming (per-type fills/outlines, soil colours, line widths, legend position/font/opacity) is read from it. Pass nullptr to fall back to the hardcoded defaults. The widget connects to changed() and repaints automatically.

Here is the call graph for this function:

◆ setPath()

void ProfilePlotWidget::setPath ( const ProfileBuilder::PathStatic path)

Sets the static path + chainage to render. Triggers a repaint.

◆ setSelectedElementNames()

void ProfilePlotWidget::setSelectedElementNames ( const QStringList &  names)

Marks a set of element names (nodes or links) as selected so the matching glyphs render with a highlight outline. Names not on the path are silently ignored. Pass an empty list to clear all highlights.

◆ setSeries()

void ProfilePlotWidget::setSeries ( const QVector< SeriesBinding > &  series)

Replaces all rendered series at once. Order matters only for z-order between equal-kind series (e.g. when overlaying HGL from two models, the later series paints on top).

Here is the call graph for this function:

◆ setSurface2DSamples()

void ProfilePlotWidget::setSurface2DSamples ( const QVector< Surface2DSample > &  samples)

Replaces the 2D inundation overlay stations (static geometry + the current frame's WSE). Pass an empty vector to clear. The host re-sends the vector with fresh wse values on every animation tick; ProfilePlotOptions::show2DInundation gates drawing. Widens the y-extent to the wettest station.

◆ setVisibleXRange()

void ProfilePlotWidget::setVisibleXRange ( double  vxMin,
double  vxMax 
)

Sets the visible x-range (virtual chainage). Y is untouched. Used by the synced attribute-tracks pane to push its own pan/zoom back up. Emits visibleXRangeChanged() (once) when the range actually moves.

◆ surface2DSamples()

const QVector< Surface2DSample > & ProfilePlotWidget::surface2DSamples ( ) const
inline

◆ virtualChainageTable()

const QVector< double > & ProfilePlotWidget::virtualChainageTable ( ) const
inline

Per-node virtual chainage, rebuilt by recomputeBounds() on every setPath()/setSeries(). Size matches the path's node count; empty before the first setPath().

◆ virtualToRealChainage()

double ProfilePlotWidget::virtualToRealChainage ( double  vx) const

Maps a virtual x back to real chainage — public so the tracks pane can label its shared x-axis with real stations, exactly like this widget's own bottom ticks.

◆ visibleDataRange()

QRectF ProfilePlotWidget::visibleDataRange ( ) const

◆ visibleXRangeChanged

void ProfilePlotWidget::visibleXRangeChanged ( double  vxMin,
double  vxMax 
)
signal

Emitted whenever the visible x-range (virtual chainage) changes — fit, zoom, pan, wheel, axis-edge edit, or a new path/series recomputing the extent. Emitted at most once per change (values are compared against the last emission). Consumed by the attribute-tracks pane to stay column-aligned.

◆ wheelEvent()

void ProfilePlotWidget::wheelEvent ( QWheelEvent *  event)
overrideprotected

◆ zoomBy()

void ProfilePlotWidget::zoomBy ( double  factor)

Zoom the view rect by factor around its centre. < 1 zooms in.


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