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

Holds all configurable appearance properties for the map scale bar. More...

#include <scalebarsettings.h>

Inheritance diagram for ScaleBarSettings:
Collaboration diagram for ScaleBarSettings:

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
 

Detailed Description

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.

Member Enumeration Documentation

◆ Position

Enumerator
BottomLeft 
BottomRight 
TopLeft 
TopRight 

◆ Units

Enumerator
Auto 
Meters 
Feet 
Kilometers 
Miles 

Constructor & Destructor Documentation

◆ ScaleBarSettings()

ScaleBarSettings::ScaleBarSettings ( QObject *  parent = nullptr)
explicit

Member Function Documentation

◆ changed

void ScaleBarSettings::changed ( )
signal
Here is the caller graph for this function:

◆ compactNotation()

bool ScaleBarSettings::compactNotation ( ) const
inline

◆ font()

QFont ScaleBarSettings::font ( ) const
inline

◆ formatLabel()

QString ScaleBarSettings::formatLabel ( double  metres,
bool  rawUnits = false 
) const

Format a distance (in metres) as a string using the current units setting.

Parameters
metresDistance in metres.
rawUnitsWhen true, ignores the Units setting and appends "units" (used for local / undefined CRS where no real-world unit is known).
Here is the caller graph for this function:

◆ labelDecimals()

int ScaleBarSettings::labelDecimals ( ) const
inline

◆ maxBarLength()

int ScaleBarSettings::maxBarLength ( ) const
inline

◆ pen()

QPen ScaleBarSettings::pen ( ) const
inline

◆ position()

Position ScaleBarSettings::position ( ) const
inline

◆ roundedMetres()

double ScaleBarSettings::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.

Here is the caller graph for this function:

◆ setCompactNotation()

void ScaleBarSettings::setCompactNotation ( bool  compact)
Here is the call graph for this function:

◆ setFont()

void ScaleBarSettings::setFont ( const QFont &  font)
Here is the call graph for this function:

◆ setLabelDecimals()

void ScaleBarSettings::setLabelDecimals ( int  decimals)
Here is the call graph for this function:

◆ setMaxBarLength()

void ScaleBarSettings::setMaxBarLength ( int  length)
Here is the call graph for this function:

◆ setPen()

void ScaleBarSettings::setPen ( const QPen &  pen)
Here is the call graph for this function:

◆ setPosition()

void ScaleBarSettings::setPosition ( Position  position)
Here is the call graph for this function:

◆ setUnits()

void ScaleBarSettings::setUnits ( Units  units)
Here is the call graph for this function:

◆ units()

Units ScaleBarSettings::units ( ) const
inline

Property Documentation

◆ compactNotation

bool ScaleBarSettings::compactNotation
readwrite

◆ font

QFont ScaleBarSettings::font
readwrite

◆ labelDecimals

int ScaleBarSettings::labelDecimals
readwrite

◆ maxBarLength

int ScaleBarSettings::maxBarLength
readwrite

◆ pen

QPen ScaleBarSettings::pen
readwrite

◆ position

Position ScaleBarSettings::position
readwrite

◆ units

Units ScaleBarSettings::units
readwrite

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