31 return QStringLiteral(
"distance" );
34 return QStringLiteral(
"area" );
37 return QStringLiteral(
"volume" );
40 return QStringLiteral(
"temporal" );
43 return QStringLiteral(
"<unknown>" );
51 const QString normalized =
string.trimmed().toLower();
129 return QStringLiteral(
"meters" );
132 return QStringLiteral(
"km" );
135 return QStringLiteral(
"feet" );
138 return QStringLiteral(
"yd" );
141 return QStringLiteral(
"mi" );
144 return QStringLiteral(
"degrees" );
147 return QStringLiteral(
"<unknown>" );
150 return QStringLiteral(
"nautical miles" );
153 return QStringLiteral(
"cm" );
156 return QStringLiteral(
"mm" );
159 return QStringLiteral(
"in" );
172 const QString normalized =
string.trimmed().toLower();
211 return QObject::tr(
"meters",
"distance" );
214 return QObject::tr(
"kilometers",
"distance" );
217 return QObject::tr(
"feet",
"distance" );
220 return QObject::tr(
"yards",
"distance" );
223 return QObject::tr(
"miles",
"distance" );
226 return QObject::tr(
"degrees",
"distance" );
229 return QObject::tr(
"centimeters",
"distance" );
232 return QObject::tr(
"millimeters",
"distance" );
235 return QObject::tr(
"inches",
"distance" );
238 return QObject::tr(
"<unknown>",
"distance" );
241 return QObject::tr(
"nautical miles",
"distance" );
251 return QObject::tr(
"mm",
"render" );
254 return QObject::tr(
"map units",
"render" );
257 return QObject::tr(
"px",
"render" );
260 return QObject::tr(
"%",
"render" );
263 return QObject::tr(
"pt",
"render" );
266 return QObject::tr(
"in",
"render" );
269 return QObject::tr(
"unknown",
"render" );
272 return QObject::tr(
"m",
"render" );
284 return QObject::tr(
"m",
"distance" );
287 return QObject::tr(
"km",
"distance" );
290 return QObject::tr(
"ft",
"distance" );
293 return QObject::tr(
"yd",
"distance" );
296 return QObject::tr(
"mi",
"distance" );
299 return QObject::tr(
"deg",
"distance" );
302 return QObject::tr(
"cm",
"distance" );
305 return QObject::tr(
"mm",
"distance" );
308 return QObject::tr(
"in",
"distance" );
314 return QObject::tr(
"NM",
"distance" );
327 const QString normalized =
string.trimmed().toLower();
369#define DEGREE_TO_METER 111319.49079327358
370#define FEET_TO_METER 0.3048
371#define NMILE_TO_METER 1852.0
372#define KILOMETERS_TO_METER 1000.0
373#define CENTIMETERS_TO_METER 0.01
374#define MILLIMETERS_TO_METER 0.001
375#define INCHES_TO_METER 0.0254
376#define FEET_TO_INCHES 12
377#define YARDS_TO_METER 0.9144
378#define YARDS_TO_FEET 3.0
379#define MILES_TO_METER 1609.344
696 return QStringLiteral(
"m2" );
698 return QStringLiteral(
"km2" );
700 return QStringLiteral(
"ft2" );
702 return QStringLiteral(
"y2" );
704 return QStringLiteral(
"mi2" );
706 return QStringLiteral(
"ha" );
708 return QStringLiteral(
"ac" );
710 return QStringLiteral(
"nm2" );
712 return QStringLiteral(
"deg2" );
714 return QStringLiteral(
"cm2" );
716 return QStringLiteral(
"mm2" );
718 return QStringLiteral(
"in2" );
720 return QStringLiteral(
"<unknown>" );
727 const QString normalized =
string.trimmed().toLower();
770 return QObject::tr(
"square meters",
"area" );
772 return QObject::tr(
"square kilometers",
"area" );
774 return QObject::tr(
"square feet",
"area" );
776 return QObject::tr(
"square yards",
"area" );
778 return QObject::tr(
"square miles",
"area" );
780 return QObject::tr(
"hectares",
"area" );
782 return QObject::tr(
"acres",
"area" );
784 return QObject::tr(
"square nautical miles",
"area" );
786 return QObject::tr(
"square degrees",
"area" );
788 return QObject::tr(
"square millimeters",
"area" );
790 return QObject::tr(
"square centimeters",
"area" );
792 return QObject::tr(
"square inches",
"area" );
794 return QObject::tr(
"<unknown>",
"area" );
804 return QObject::tr(
"m²",
"area" );
806 return QObject::tr(
"km²",
"area" );
808 return QObject::tr(
"ft²",
"area" );
810 return QObject::tr(
"yd²",
"area" );
812 return QObject::tr(
"mi²",
"area" );
814 return QObject::tr(
"ha",
"area" );
816 return QObject::tr(
"ac",
"area" );
818 return QObject::tr(
"NM²",
"area" );
820 return QObject::tr(
"deg²",
"area" );
822 return QObject::tr(
"cm²",
"area" );
824 return QObject::tr(
"mm²",
"area" );
826 return QObject::tr(
"in²",
"area" );
835 const QString normalized =
string.trimmed().toLower();
874#define KM2_TO_M2 1000000.0
875#define CM2_TO_M2 0.0001
876#define MM2_TO_M2 0.000001
877#define FT2_TO_M2 0.09290304
878#define IN2_TO_M2 0.00064516
879#define YD2_TO_M2 0.83612736
880#define MI2_TO_M2 2589988.110336
881#define HA_TO_M2 10000.0
882#define AC_TO_FT2 43560.0
883#define DEG2_TO_M2 12392029030.5
884#define NM2_TO_M2 3429904.0
1311 switch ( distanceUnit )
1398 return QStringLiteral(
"s" );
1400 return QStringLiteral(
"ms" );
1402 return QStringLiteral(
"min" );
1404 return QStringLiteral(
"h" );
1406 return QStringLiteral(
"d" );
1408 return QStringLiteral(
"wk" );
1410 return QStringLiteral(
"mon" );
1412 return QStringLiteral(
"y" );
1414 return QStringLiteral(
"dec" );
1416 return QStringLiteral(
"c" );
1418 return QStringLiteral(
"xxx" );
1420 return QStringLiteral(
"<unknown>" );
1427 const QString normalized =
string.trimmed().toLower();
1468 return QObject::tr(
"seconds",
"temporal" );
1470 return QObject::tr(
"milliseconds",
"temporal" );
1472 return QObject::tr(
"minutes",
"temporal" );
1474 return QObject::tr(
"hours",
"temporal" );
1476 return QObject::tr(
"days",
"temporal" );
1478 return QObject::tr(
"weeks",
"temporal" );
1480 return QObject::tr(
"months",
"temporal" );
1482 return QObject::tr(
"years",
"temporal" );
1484 return QObject::tr(
"decades",
"temporal" );
1486 return QObject::tr(
"centuries",
"temporal" );
1488 return QObject::tr(
"steps",
"temporal" );
1490 return QObject::tr(
"<unknown>",
"temporal" );
1500 return QObject::tr(
"s",
"temporal" );
1502 return QObject::tr(
"ms",
"temporal" );
1504 return QObject::tr(
"min",
"temporal" );
1506 return QObject::tr(
"h",
"temporal" );
1508 return QObject::tr(
"d",
"temporal" );
1510 return QObject::tr(
"wk",
"temporal" );
1512 return QObject::tr(
"mon",
"temporal" );
1514 return QObject::tr(
"y",
"temporal" );
1516 return QObject::tr(
"dec",
"temporal" );
1518 return QObject::tr(
"cen",
"temporal" );
1520 return QObject::tr(
"steps",
"temporal" );
1522 return QObject::tr(
"<unknown>",
"temporal" );
1529 const QString normalized =
string.trimmed().toLower();
1584 return 1 / 604800.0;
1586 return 1 / 2592000.0;
1588 return 1 / 31557600.0;
1590 return 1 / 315576000.0;
1592 return 1 / 3155760000.0;
1610 return 1 / 3600000.0;
1612 return 1 / 86400000.0;
1614 return 1 / 604800000.0;
1616 return 1 / 2592000000.0;
1618 return 1 / 31557600000.0;
1620 return 1 / 315576000000.0;
1622 return 1 / 3155760000000.0;
1648 return 1 / 525960.0;
1650 return 1 / 5259600.0;
1652 return 1 / 52596000.0;
1682 return 1 / 876600.0;
1756 return 2592000000.0;
1772 return 30 / 36525.0;
1786 return 31557600000.0;
1794 return 365.25 / 7.0;
1796 return 365.25 / 30.0;
1816 return 315576000000.0;
1824 return 3652.5 / 7.0;
1826 return 3652.5 / 30.0;
1845 return 3155760000.0;
1847 return 3155760000000.0;
1857 return 36525 / 30.0;
1882 const QString normalized =
string.trimmed().toLower();
1921 return QObject::tr(
"cubic meters",
"volume" );
1923 return QObject::tr(
"cubic feet",
"volume" );
1925 return QObject::tr(
"cubic yards",
"volume" );
1927 return QObject::tr(
"barrels",
"volume" );
1929 return QObject::tr(
"cubic decimeters",
"volume" );
1931 return QObject::tr(
"liters",
"volume" );
1933 return QObject::tr(
"gallons",
"volume" );
1935 return QObject::tr(
"cubic inches",
"volume" );
1937 return QObject::tr(
"cubic centimeters",
"volume" );
1939 return QObject::tr(
"cubic degrees",
"volume" );
1941 return QObject::tr(
"<unknown>",
"volume" );
1951 return QObject::tr(
"m³",
"volume" );
1953 return QObject::tr(
"ft³",
"volume" );
1955 return QObject::tr(
"yds³",
"volume" );
1957 return QObject::tr(
"bbl",
"volume" );
1959 return QObject::tr(
"dm³",
"volume" );
1961 return QObject::tr(
"l",
"volume" );
1963 return QObject::tr(
"gal",
"volume" );
1965 return QObject::tr(
"in³",
"volume" );
1967 return QObject::tr(
"cm³",
"volume" );
1969 return QObject::tr(
"deg³",
"volume" );
1971 return QObject::tr(
"<unknown>",
"volume" );
1979 const QString normalized =
string.trimmed().toLower();
2013#define DEG2_TO_M3 1379474361572186.2
2025 return 35.314666572222;
2027 return 1.307950613786;
2029 return 6.2898107438466;
2035 return 264.17205124156;
2037 return 61023.7438368;
2052 return 0.028316846592;
2066 return 1728.000629765;
2083 return 26.999998234;
2093 return 201.974025549;
2095 return 46656.013952472;
2122 return 41.999998943;
2124 return 9702.002677722;
2153 return 61.023758990;
2181 return 231.000069567;
2211 return 16.387060000;
2235 return 0.000264172 ;
2263 switch ( distanceUnit )
2304 switch ( volumeUnit )
2359 return QStringLiteral(
"m3" );
2361 return QStringLiteral(
"ft3" );
2363 return QStringLiteral(
"yd3" );
2365 return QStringLiteral(
"bbl" );
2367 return QStringLiteral(
"dm3" );
2369 return QStringLiteral(
"l" );
2371 return QStringLiteral(
"gal" );
2373 return QStringLiteral(
"in3" );
2375 return QStringLiteral(
"cm3" );
2377 return QStringLiteral(
"deg3" );
2379 return QStringLiteral(
"<unknown>" );
2389 return QStringLiteral(
"degrees" );
2391 return QStringLiteral(
"radians" );
2393 return QStringLiteral(
"gon" );
2395 return QStringLiteral(
"moa" );
2397 return QStringLiteral(
"soa" );
2399 return QStringLiteral(
"tr" );
2401 return QStringLiteral(
"milliradians" );
2403 return QStringLiteral(
"mil" );
2405 return QStringLiteral(
"<unknown>" );
2412 const QString normalized =
string.trimmed().toLower();
2446 return QObject::tr(
"degrees",
"angle" );
2448 return QObject::tr(
"radians",
"angle" );
2450 return QObject::tr(
"gon",
"angle" );
2452 return QObject::tr(
"minutes of arc",
"angle" );
2454 return QObject::tr(
"seconds of arc",
"angle" );
2456 return QObject::tr(
"turns",
"angle" );
2458 return QObject::tr(
"milliradians",
"angle" );
2460 return QObject::tr(
"mil",
"angle" );
2462 return QObject::tr(
"<unknown>",
"angle" );
2479 return M_PI / 180.0;
2481 return 400.0 / 360.0;
2489 return M_PI / 180.0 * 1000;
2491 return 3200.0 / 180;
2502 return 180.0 / M_PI;
2506 return 200.0 / M_PI;
2508 return 60 * 180.0 / M_PI;
2510 return 3600 * 180.0 / M_PI;
2516 return 3200.0 / M_PI;
2527 return 360.0 / 400.0;
2529 return M_PI / 200.0;
2533 return 60 * 360.0 / 400.0;
2535 return 3600 * 360.0 / 400.0;
2539 return M_PI / 200.0 * 1000;
2541 return 3200.0 / 200.0;
2554 return M_PI / 180.0 / 60.0;
2556 return 400.0 / 360.0 / 60.0;
2562 return 1.0 / 360.0 / 60.0;
2564 return M_PI / 180.0 / 60.0 * 1000;
2566 return 3200.0 / 180.0 / 60.0;
2579 return M_PI / 180.0 / 3600.0;
2581 return 400.0 / 360.0 / 3600.0;
2587 return 1.0 / 360.0 / 3600.0;
2589 return M_PI / 180.0 / 3600.0 * 1000;
2591 return 3200.0 / 180.0 / 3600.0;
2608 return 360.0 * 60.0;
2610 return 360.0 * 3600.0;
2614 return 2 * M_PI * 1000;
2627 return 180.0 / M_PI / 1000;
2631 return 200.0 / M_PI / 1000;
2633 return 180.0 * 60.0 / M_PI / 1000;
2635 return 180.0 * 3600.0 / M_PI / 1000;
2637 return M_PI / 2 / 1000;
2641 return 3200.0 / 1000.0 / M_PI;
2653 return 180.0 / 3200;
2657 return 200.0 / 3200;
2659 return 60 * 180.0 / 3200;
2661 return 3600.0 * 180 / 3200;
2663 return 1.0 / ( 2 * 32000 );
2665 return 1000.0 * M_PI / 3200.0;
2683 int decimalPlaces = 2;
2688 unitLabel = QObject::tr(
"°",
"angle" );
2692 unitLabel = QObject::tr(
" rad",
"angle" );
2696 unitLabel = QObject::tr(
" gon",
"angle" );
2700 unitLabel = QObject::tr(
"′",
"angle minutes" );
2704 unitLabel = QObject::tr(
"″",
"angle seconds" );
2708 unitLabel = QObject::tr(
" tr",
"angle turn" );
2712 unitLabel = QObject::tr(
" millirad",
"angular mil SI" );
2716 unitLabel = QObject::tr(
" mil",
"angular mil NATO" );
2723 if ( decimals >= 0 )
2724 decimalPlaces = decimals;
2726 return QStringLiteral(
"%L1%2" ).arg( angle, 0,
'f', decimalPlaces ).arg( unitLabel );
2741 else if ( std::fabs( distance ) > 1000.0 )
2746 else if ( std::fabs( distance ) < 0.01 )
2751 else if ( std::fabs( distance ) < 0.1 )
2765 if ( keepBaseUnit || std::fabs( distance ) >= 1.0 )
2778 if ( std::fabs( distance ) <= 5280.0 || keepBaseUnit )
2791 if ( std::fabs( distance ) <= 1760.0 || keepBaseUnit )
2804 if ( std::fabs( distance ) >= 1.0 || keepBaseUnit )
2843 result.
value = -1.0;
3045 return QStringLiteral(
"%L1%2" ).arg( distance, 0,
'e', decimals ).arg( unitText );
3049 return QStringLiteral(
"%L1%2" ).arg( dist.
value, 0,
'f', decimals ).arg( unitText );
3065 return QStringLiteral(
"%L1%2" ).arg( area, 0,
'e', decimals ).arg( unitText );
3069 return QStringLiteral(
"%L1%2" ).arg( areaValue.
value, 0,
'f', decimals ).arg( unitText );
3078 return QStringLiteral(
"MM" );
3080 return QStringLiteral(
"RenderMetersInMapUnits" );
3082 return QStringLiteral(
"MapUnit" );
3084 return QStringLiteral(
"Pixel" );
3086 return QStringLiteral(
"Percentage" );
3088 return QStringLiteral(
"Point" );
3090 return QStringLiteral(
"Inch" );
3099 const QString normalized =
string.trimmed().toLower();
3108 if ( normalized == QLatin1String(
"meters" ) )
3112 if ( normalized == QLatin1String(
"mapunits" ) )
3118 if ( normalized == QLatin1String(
"percent" ) )
3122 if ( normalized == QLatin1String(
"points" ) )
3139 return QObject::tr(
"millimeters",
"render" );
3142 return QObject::tr(
"meters at scale",
"render" );
3145 return QObject::tr(
"map units",
"render" );
3148 return QObject::tr(
"pixels",
"render" );
3151 return QObject::tr(
"percent",
"render" );
3154 return QObject::tr(
"points",
"render" );
3157 return QObject::tr(
"inches",
"render" );
3160 return QObject::tr(
"<unknown>",
"render" );
3173 return QStringLiteral(
"cm" );
3175 return QStringLiteral(
"m" );
3177 return QStringLiteral(
"in" );
3179 return QStringLiteral(
"ft" );
3181 return QStringLiteral(
"pt" );
3183 return QStringLiteral(
"pi" );
3185 return QStringLiteral(
"px" );
3187 return QStringLiteral(
"mm" );
3194 const QString normalized =
string.trimmed().toLower();
3248 return QObject::tr(
"px" );
3250 return QObject::tr(
"mm" );
3252 return QObject::tr(
"cm" );
3254 return QObject::tr(
"m" );
3256 return QObject::tr(
"in",
"unit inch" );
3258 return QObject::tr(
"ft" );
3260 return QObject::tr(
"pt" );
3262 return QObject::tr(
"pica" );
3272 return QObject::tr(
"pixels" );
3274 return QObject::tr(
"millimeters" );
3276 return QObject::tr(
"centimeters" );
3278 return QObject::tr(
"meters" );
3280 return QObject::tr(
"inches" );
3282 return QObject::tr(
"feet" );
3284 return QObject::tr(
"points" );
3286 return QObject::tr(
"picas" );
DistanceUnitType
Types of distance units.
@ Geographic
Unit is a geographic (e.g., degree based) unit.
@ Unknown
Unknown unit type.
@ Standard
Unit is a standard measurement unit.
@ Unknown
Unknown unit type.
LayoutUnit
Layout measurement units.
@ Centimeters
Centimeters.
@ Millimeters
Millimeters.
@ Points
Typographic points.
@ Picas
Typographic picas.
AngleUnit
Units of angles.
@ SecondsOfArc
Seconds of arc.
@ Radians
Square kilometers.
@ MinutesOfArc
Minutes of arc.
@ Unknown
Unknown angle unit.
@ MilliradiansSI
Angular milliradians (SI definition, 1/1000 of radian)
@ MilNATO
Angular mil (NATO definition, 6400 mil = 2PI radians)
DistanceUnit
Units of distance.
@ Centimeters
Centimeters.
@ Millimeters
Millimeters.
@ Miles
Terrestrial miles.
@ Unknown
Unknown distance unit.
@ Degrees
Degrees, for planar geographic CRS distance measurements.
@ Inches
Inches (since QGIS 3.32)
@ NauticalMiles
Nautical miles.
@ SquareCentimeters
Square centimeters.
@ SquareInches
Square inches (since QGIS 3.32)
@ SquareNauticalMiles
Square nautical miles.
@ SquareMillimeters
Square millimeters.
@ SquareYards
Square yards.
@ SquareKilometers
Square kilometers.
@ SquareMeters
Square meters.
@ Unknown
Unknown areal unit.
@ SquareDegrees
Square degrees, for planar geographic CRS area measurements.
@ SquareMiles
Square miles.
TemporalUnit
Temporal units.
@ IrregularStep
Special 'irregular step' time unit, used for temporal data which uses irregular, non-real-world unit ...
@ Milliseconds
Milliseconds.
@ Unknown
Unknown time unit.
RenderUnit
Rendering size units.
@ Percentage
Percentage of another measurement (e.g., canvas size, feature size)
@ Millimeters
Millimeters.
@ Points
Points (e.g., for font sizes)
@ Unknown
Mixed or unknown units.
@ MetersInMapUnits
Meters value as Map units.
LayoutUnitType
Types of layout units.
@ PaperUnits
Unit is a paper based measurement unit.
@ ScreenUnits
Unit is a screen based measurement unit.
VolumeUnit
Units of volume.
@ CubicMeters
Cubic meters.
@ CubicDegrees
Cubic degrees, for planar geographic CRS volume measurements.
@ CubicDecimeter
Cubic decimeters.
@ Unknown
Unknown volume unit.
@ CubicCentimeter
Cubic Centimeters.
static Q_INVOKABLE Qgis::VolumeUnit decodeVolumeUnit(const QString &string, bool *ok=nullptr)
Decodes a volume unit from a string.
static Q_INVOKABLE Qgis::DistanceUnit stringToDistanceUnit(const QString &string, bool *ok=nullptr)
Converts a translated string to a distance unit.
static Q_INVOKABLE QgsUnitTypes::AreaValue scaledArea(double area, Qgis::AreaUnit unit, int decimals, bool keepBaseUnit=false)
Will convert an area with a given unit to an area value which is nice to display.
static Q_INVOKABLE QgsUnitTypes::DistanceValue scaledDistance(double distance, Qgis::DistanceUnit unit, int decimals, bool keepBaseUnit=false)
Will convert a distance with a given unit to a distance value which is nice to display.
static Q_INVOKABLE QString toString(Qgis::DistanceUnit unit)
Returns a translated string representing a distance unit.
static Q_INVOKABLE QString formatArea(double area, int decimals, Qgis::AreaUnit unit, bool keepBaseUnit=false)
Returns an area formatted as a friendly string.
static Q_INVOKABLE double fromUnitToUnitFactor(Qgis::DistanceUnit fromUnit, Qgis::DistanceUnit toUnit)
Returns the conversion factor between the specified distance units.
static Q_INVOKABLE Qgis::VolumeUnit stringToVolumeUnit(const QString &string, bool *ok=nullptr)
Converts a translated string to a volume unit.
static Q_INVOKABLE QString formatDistance(double distance, int decimals, Qgis::DistanceUnit unit, bool keepBaseUnit=false)
Returns an distance formatted as a friendly string.
static Q_INVOKABLE QString toAbbreviatedString(Qgis::DistanceUnit unit)
Returns a translated abbreviation representing a distance unit.
static Q_INVOKABLE Qgis::DistanceUnitType unitType(Qgis::DistanceUnit unit)
Returns the type for a distance unit.
static Q_INVOKABLE Qgis::UnitType decodeUnitType(const QString &string, bool *ok=nullptr)
Decodes a unit type from a string.
static Q_INVOKABLE Qgis::AreaUnit decodeAreaUnit(const QString &string, bool *ok=nullptr)
Decodes an areal unit from a string.
static Q_INVOKABLE Qgis::RenderUnit decodeRenderUnit(const QString &string, bool *ok=nullptr)
Decodes a render unit from a string.
static Q_INVOKABLE Qgis::TemporalUnit stringToTemporalUnit(const QString &string, bool *ok=nullptr)
Converts a translated string to a temporal unit.
static Q_INVOKABLE Qgis::LayoutUnit decodeLayoutUnit(const QString &string, bool *ok=nullptr)
Decodes a layout unit from a string.
static Q_INVOKABLE Qgis::AreaUnit stringToAreaUnit(const QString &string, bool *ok=nullptr)
Converts a translated string to an areal unit.
static Q_INVOKABLE Qgis::AreaUnit distanceToAreaUnit(Qgis::DistanceUnit distanceUnit)
Converts a distance unit to its corresponding area unit, e.g., meters to square meters.
static Q_INVOKABLE Qgis::TemporalUnit decodeTemporalUnit(const QString &string, bool *ok=nullptr)
Decodes a temporal unit from a string.
static Q_INVOKABLE Qgis::AngleUnit decodeAngleUnit(const QString &string, bool *ok=nullptr)
Decodes an angular unit from a string.
static Q_INVOKABLE Qgis::DistanceUnit areaToDistanceUnit(Qgis::AreaUnit areaUnit)
Converts an area unit to its corresponding distance unit, e.g., square meters to meters.
static Q_INVOKABLE Qgis::DistanceUnit volumeToDistanceUnit(Qgis::VolumeUnit volumeUnit)
Converts a volume unit to its corresponding distance unit, e.g., cubic meters to meters.
static Q_INVOKABLE QString encodeUnit(Qgis::DistanceUnit unit)
Encodes a distance unit to a string.
static Q_INVOKABLE QString encodeUnitType(Qgis::UnitType type)
Encodes a unit type to a string.
static Q_INVOKABLE QString formatAngle(double angle, int decimals, Qgis::AngleUnit unit)
Returns an angle formatted as a friendly string.
static Q_INVOKABLE Qgis::VolumeUnit distanceToVolumeUnit(Qgis::DistanceUnit distanceUnit)
Converts a distance unit to its corresponding volume unit, e.g., meters to cubic meters.
static Q_INVOKABLE Qgis::DistanceUnit decodeDistanceUnit(const QString &string, bool *ok=nullptr)
Decodes a distance unit from a string.
double qgsRound(double number, int places)
Returns a double number, rounded (as close as possible) to the specified number of places.
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
#define MILLIMETERS_TO_METER
#define CENTIMETERS_TO_METER
#define KILOMETERS_TO_METER
A combination of area value and unit.
double value
The value part of the distance.
Qgis::AreaUnit unit
The value part of the distance.
A combination of distance value and unit.
double value
The value part of the distance.
Qgis::DistanceUnit unit
The value part of the distance.