QGIS API Documentation
3.2.0-Bonn (bc43194)
|
The class QgsQuickScaleBarKit encapsulates the utilies to calculate scale bar properties. More...
#include <qgsquickscalebarkit.h>
Public Slots | |
void | updateScaleBar () |
recalculate width, distance and units. More... | |
Signals | |
void | mapSettingsChanged () |
Associated map settings. More... | |
void | preferredWidthChanged () |
Preferred width of scalebar in pixels. More... | |
void | scaleBarChanged () |
width, distance and/or units changed More... | |
Public Member Functions | |
QgsQuickScaleBarKit (QObject *parent=nullptr) | |
create new scale bar kit More... | |
~QgsQuickScaleBarKit ()=default | |
int | distance () const |
Units of distance (e.g. More... | |
void | setMapSettings (QgsQuickMapSettings *mapSettings) |
Associated map settings. More... | |
QString | units () const |
Units of distance (e.g. More... | |
int | width () const |
Calculated width of scalebar in pixels representing distance + units. More... | |
Properties | |
int | distance |
Distance rounded to "nice" number (e.g. More... | |
QgsQuickMapSettings | mapSettings |
Associated map settings. More... | |
int | preferredWidth |
Preferred width of scalebar in pixels. More... | |
QString | units |
Units of distance (e.g. More... | |
int | width |
Calculated width of scalebar in pixels representing distance + units. More... | |
The class QgsQuickScaleBarKit encapsulates the utilies to calculate scale bar properties.
It requires connection to mapSettings of the active canvas to automatically update text and width
From preferred width in pixel, it calculates the width (pixel) of scalebar distance in meters or kilometers (int) rounded to "nice" number (e.g. 72.4 to 100) and units text (e.g. km)
Definition at line 44 of file qgsquickscalebarkit.h.
|
explicit |
create new scale bar kit
Definition at line 27 of file qgsquickscalebarkit.cpp.
|
default |
int QgsQuickScaleBarKit::distance | ( | ) | const |
|
signal |
Associated map settings.
Should be initialized before the first use from mapcanvas map settings.
|
signal |
Preferred width of scalebar in pixels.
Default set to 300.
|
signal |
width, distance and/or units changed
void QgsQuickScaleBarKit::setMapSettings | ( | QgsQuickMapSettings * | mapSettings | ) |
Associated map settings.
Should be initialized before the first use from mapcanvas map settings.
Definition at line 38 of file qgsquickscalebarkit.cpp.
QString QgsQuickScaleBarKit::units | ( | ) | const |
|
slot |
recalculate width, distance and units.
Definition at line 80 of file qgsquickscalebarkit.cpp.
int QgsQuickScaleBarKit::width | ( | ) | const |
Calculated width of scalebar in pixels representing distance + units.
Differs minimum possible from preferredWidth to Gets "nice" distance number.
|
read |
Distance rounded to "nice" number (e.g.
100, 20) corresponding to width. To be used with units property for labels. Read-only (result).
Definition at line 66 of file qgsquickscalebarkit.h.
|
write |
Associated map settings.
Should be initialized before the first use from mapcanvas map settings.
Definition at line 51 of file qgsquickscalebarkit.h.
int QgsQuickScaleBarKit::preferredWidth |
Preferred width of scalebar in pixels.
Default set to 300.
Definition at line 56 of file qgsquickscalebarkit.h.
|
read |
Units of distance (e.g.
km or m) Read-only (result).
Definition at line 61 of file qgsquickscalebarkit.h.
|
read |
Calculated width of scalebar in pixels representing distance + units.
Differs minimum possible from preferredWidth to Gets "nice" distance number.
Definition at line 72 of file qgsquickscalebarkit.h.