QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
|
Go to the documentation of this file.
29 , mPreferredWidth( 300 )
30 , mWidth( mPreferredWidth )
46 disconnect( mMapSettings,
nullptr,
this,
nullptr );
97 int digits = int( floor( log10( ( dist ) ) ) );
98 double base = pow( 10, digits );
99 double first_digit = dist / base;
101 if ( first_digit < 2 )
103 else if ( first_digit < 5 )
108 mDistance = int( round_digit * base );
109 mWidth = int( mPreferredWidth * mDistance / dist );
void mapSettingsChanged()
Associated map settings.
QgsQuickMapSettings * mapSettings
Associated map settings.
int width
Calculated width of scalebar in pixels representing distance + units.
void extentChanged()
Geographical coordinates of the rectangle that should be rendered.
void destinationCrsChanged()
CRS of destination coordinate reference system.
static Q_INVOKABLE QString toAbbreviatedString(QgsUnitTypes::DistanceUnit unit)
Returns a translated abbreviation representing a distance unit.
QString units
Units of distance (e.g.
QgsQuickScaleBarKit(QObject *parent=nullptr)
create new scale bar kit
DistanceUnit
Units of distance.
The QgsQuickMapSettings class encapsulates QgsMapSettings class to offer settings of configuration of...
void outputDpiChanged()
Output DPI used for conversion between real world units (e.g.
void preferredWidthChanged()
Preferred width of scalebar in pixels.
void updateScaleBar()
recalculate width, distance and units.
void setMapSettings(QgsQuickMapSettings *mapSettings)
Associated map settings.
void mapUnitsPerPixelChanged()
Returns the distance in geographical coordinates that equals to one pixel in the map.
void scaleBarChanged()
width, distance and/or units changed
void outputSizeChanged()
The size of the resulting map image.
Encapsulating the common utilities for QgsQuick library.
static Q_INVOKABLE double screenUnitsToMeters(QgsQuickMapSettings *mapSettings, int baseLengthPixels)
Calculates the distance in meter representing baseLengthPixels pixels on the screen based on the curr...
void visibleExtentChanged()
Returns the actual extent derived from requested extent that takes takes output image size into accou...
static void humanReadableDistance(double srcDistance, QgsUnitTypes::DistanceUnit srcUnits, QgsUnitTypes::SystemOfMeasurement destSystem, double &destDistance, QgsUnitTypes::DistanceUnit &destUnits)
Converts distance to human readable distance in destination system of measurement.
int distance
Distance rounded to "nice" number (e.g.