![]() |
SWMMVis
6.0.0-alpha.4
Qt6/C++ GIS-based graphical user interface for the SWMMVis engine (6.0.0-alpha.4)
|
Holds all configurable appearance properties for the map scale bar. More...
#include <scalebarsettings.h>
Public Types | |
| enum | Units { Auto , Meters , Feet , Kilometers , Miles } |
| enum | Position { BottomLeft , BottomRight , TopLeft , TopRight } |
Signals | |
| void | changed () |
Public Member Functions | |
| ScaleBarSettings (QObject *parent=nullptr) | |
| QPen | pen () const |
| QFont | font () const |
| Units | units () const |
| Position | position () const |
| int | maxBarLength () const |
| int | labelDecimals () const |
| bool | compactNotation () const |
| void | setPen (const QPen &pen) |
| void | setFont (const QFont &font) |
| void | setUnits (Units units) |
| void | setPosition (Position position) |
| void | setMaxBarLength (int length) |
| void | setLabelDecimals (int decimals) |
| void | setCompactNotation (bool compact) |
| QString | formatLabel (double metres, bool rawUnits=false) const |
| Format a distance (in metres) as a string using the current units setting. | |
| double | roundedMetres (double metres) const |
Returns the metres value that formatLabel() will actually display, i.e. the input rounded in the active unit. Use this to sync bar length to the label. | |
Properties | |
| QPen | pen |
| QFont | font |
| Units | units |
| Position | position |
| int | maxBarLength |
| int | labelDecimals |
| bool | compactNotation |
Holds all configurable appearance properties for the map scale bar.
Owned by MapCanvas as a child QObject and exposed via a CONSTANT Q_PROPERTY so it can be passed directly to QPropertyModel for live editing.
Connect the changed() signal to MapCanvas::update() so any property change immediately repaints the canvas.
|
explicit |
|
signal |
|
inline |
|
inline |
| QString ScaleBarSettings::formatLabel | ( | double | metres, |
| bool | rawUnits = false |
||
| ) | const |
Format a distance (in metres) as a string using the current units setting.
| metres | Distance in metres. |
| rawUnits | When true, ignores the Units setting and appends "units" (used for local / undefined CRS where no real-world unit is known). |
|
inline |
|
inline |
|
inline |
|
inline |
Returns the metres value that formatLabel() will actually display, i.e. the input rounded in the active unit. Use this to sync bar length to the label.
| void ScaleBarSettings::setCompactNotation | ( | bool | compact | ) |
| void ScaleBarSettings::setFont | ( | const QFont & | font | ) |
| void ScaleBarSettings::setLabelDecimals | ( | int | decimals | ) |
| void ScaleBarSettings::setMaxBarLength | ( | int | length | ) |
| void ScaleBarSettings::setPen | ( | const QPen & | pen | ) |
| void ScaleBarSettings::setPosition | ( | Position | position | ) |
| void ScaleBarSettings::setUnits | ( | Units | units | ) |
|
inline |
|
readwrite |
|
readwrite |
|
readwrite |
|
readwrite |
|
readwrite |
|
readwrite |
|
readwrite |