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
openswmmvis::plot::NumberFormat Struct Reference

A mode + count describing how to render a double. More...

#include <numberformat.h>

Collaboration diagram for openswmmvis::plot::NumberFormat:

Public Member Functions

int effectiveCount () const noexcept
 Effective, clamped digit count for the current mode.
 
char fmtChar () const noexcept
 printf conversion the mode maps onto: 'f' (Decimals, Thousands), 'g' (SignificantFigures), 'e' (Scientific, Engineering).
 
bool hasValidCustom () const
 True when custom is a single, safe floating-point printf conversion (specifier in eEfFgGaA, no '*' width/precision, no other conversions). Only then is custom honoured.
 
QString printfSpec () const
 printf spec for QValueAxis::setLabelFormatcustom when valid, else e.g. "%.2f" / "%.3g".
 
QString format (double v) const
 Format v for hand-drawn ticks, labels, tooltips, stats.
 

Public Attributes

NumberFormatMode mode = NumberFormatMode::Decimals
 
int count = 2
 Decimals (>=0) or sig figs (>=1).
 
QString custom
 Optional user-supplied printf spec (e.g. "%.2f", "%.1f m"). When it holds a single valid floating-point conversion (see hasValidCustom()) it overrides mode/count; otherwise it is ignored and mode/count apply. Empty by default.
 

Detailed Description

A mode + count describing how to render a double.

Member Function Documentation

◆ effectiveCount()

int openswmmvis::plot::NumberFormat::effectiveCount ( ) const
noexcept

Effective, clamped digit count for the current mode.

Here is the caller graph for this function:

◆ fmtChar()

char openswmmvis::plot::NumberFormat::fmtChar ( ) const
noexcept

printf conversion the mode maps onto: 'f' (Decimals, Thousands), 'g' (SignificantFigures), 'e' (Scientific, Engineering).

Here is the caller graph for this function:

◆ format()

QString openswmmvis::plot::NumberFormat::format ( double  v) const

Format v for hand-drawn ticks, labels, tooltips, stats.

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

◆ hasValidCustom()

bool openswmmvis::plot::NumberFormat::hasValidCustom ( ) const

True when custom is a single, safe floating-point printf conversion (specifier in eEfFgGaA, no '*' width/precision, no other conversions). Only then is custom honoured.

Here is the caller graph for this function:

◆ printfSpec()

QString openswmmvis::plot::NumberFormat::printfSpec ( ) const

printf spec for QValueAxis::setLabelFormatcustom when valid, else e.g. "%.2f" / "%.3g".

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

Member Data Documentation

◆ count

int openswmmvis::plot::NumberFormat::count = 2

Decimals (>=0) or sig figs (>=1).

◆ custom

QString openswmmvis::plot::NumberFormat::custom

Optional user-supplied printf spec (e.g. "%.2f", "%.1f m"). When it holds a single valid floating-point conversion (see hasValidCustom()) it overrides mode/count; otherwise it is ignored and mode/count apply. Empty by default.

◆ mode

NumberFormatMode openswmmvis::plot::NumberFormat::mode = NumberFormatMode::Decimals

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