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();
127 return QStringLiteral(
"meters" );
130 return QStringLiteral(
"km" );
133 return QStringLiteral(
"feet" );
136 return QStringLiteral(
"yd" );
139 return QStringLiteral(
"mi" );
142 return QStringLiteral(
"degrees" );
145 return QStringLiteral(
"<unknown>" );
148 return QStringLiteral(
"nautical miles" );
151 return QStringLiteral(
"cm" );
154 return QStringLiteral(
"mm" );
167 const QString normalized =
string.trimmed().toLower();
204 return QObject::tr(
"meters",
"distance" );
207 return QObject::tr(
"kilometers",
"distance" );
210 return QObject::tr(
"feet",
"distance" );
213 return QObject::tr(
"yards",
"distance" );
216 return QObject::tr(
"miles",
"distance" );
219 return QObject::tr(
"degrees",
"distance" );
222 return QObject::tr(
"centimeters",
"distance" );
225 return QObject::tr(
"millimeters",
"distance" );
228 return QObject::tr(
"<unknown>",
"distance" );
231 return QObject::tr(
"nautical miles",
"distance" );
241 return QObject::tr(
"mm",
"render" );
244 return QObject::tr(
"map units",
"render" );
247 return QObject::tr(
"px",
"render" );
250 return QObject::tr(
"%",
"render" );
253 return QObject::tr(
"pt",
"render" );
256 return QObject::tr(
"in",
"render" );
259 return QObject::tr(
"unknown",
"render" );
262 return QObject::tr(
"m",
"render" );
274 return QObject::tr(
"m",
"distance" );
277 return QObject::tr(
"km",
"distance" );
280 return QObject::tr(
"ft",
"distance" );
283 return QObject::tr(
"yd",
"distance" );
286 return QObject::tr(
"mi",
"distance" );
289 return QObject::tr(
"deg",
"distance" );
292 return QObject::tr(
"cm",
"distance" );
295 return QObject::tr(
"mm",
"distance" );
301 return QObject::tr(
"NM",
"distance" );
314 const QString normalized =
string.trimmed().toLower();
354#define DEGREE_TO_METER 111319.49079327358
355#define FEET_TO_METER 0.3048
356#define NMILE_TO_METER 1852.0
357#define KILOMETERS_TO_METER 1000.0
358#define CENTIMETERS_TO_METER 0.01
359#define MILLIMETERS_TO_METER 0.001
360#define YARDS_TO_METER 0.9144
361#define YARDS_TO_FEET 3.0
362#define MILES_TO_METER 1609.344
630 return QStringLiteral(
"m2" );
632 return QStringLiteral(
"km2" );
634 return QStringLiteral(
"ft2" );
636 return QStringLiteral(
"y2" );
638 return QStringLiteral(
"mi2" );
640 return QStringLiteral(
"ha" );
642 return QStringLiteral(
"ac" );
644 return QStringLiteral(
"nm2" );
646 return QStringLiteral(
"deg2" );
648 return QStringLiteral(
"cm2" );
650 return QStringLiteral(
"mm2" );
652 return QStringLiteral(
"<unknown>" );
659 const QString normalized =
string.trimmed().toLower();
700 return QObject::tr(
"square meters",
"area" );
702 return QObject::tr(
"square kilometers",
"area" );
704 return QObject::tr(
"square feet",
"area" );
706 return QObject::tr(
"square yards",
"area" );
708 return QObject::tr(
"square miles",
"area" );
710 return QObject::tr(
"hectares",
"area" );
712 return QObject::tr(
"acres",
"area" );
714 return QObject::tr(
"square nautical miles",
"area" );
716 return QObject::tr(
"square degrees",
"area" );
718 return QObject::tr(
"square millimeters",
"area" );
720 return QObject::tr(
"square centimeters",
"area" );
722 return QObject::tr(
"<unknown>",
"area" );
732 return QObject::tr(
"m²",
"area" );
734 return QObject::tr(
"km²",
"area" );
736 return QObject::tr(
"ft²",
"area" );
738 return QObject::tr(
"yd²",
"area" );
740 return QObject::tr(
"mi²",
"area" );
742 return QObject::tr(
"ha",
"area" );
744 return QObject::tr(
"ac",
"area" );
746 return QObject::tr(
"NM²",
"area" );
748 return QObject::tr(
"deg²",
"area" );
750 return QObject::tr(
"cm²",
"area" );
752 return QObject::tr(
"mm²",
"area" );
761 const QString normalized =
string.trimmed().toLower();
798#define KM2_TO_M2 1000000.0
799#define CM2_TO_M2 0.0001
800#define MM2_TO_M2 0.000001
801#define FT2_TO_M2 0.09290304
802#define YD2_TO_M2 0.83612736
803#define MI2_TO_M2 2589988.110336
804#define HA_TO_M2 10000.0
805#define AC_TO_FT2 43560.0
806#define DEG2_TO_M2 12392029030.5
807#define NM2_TO_M2 3429904.0
1178 switch ( distanceUnit )
1259 return QStringLiteral(
"s" );
1261 return QStringLiteral(
"ms" );
1263 return QStringLiteral(
"min" );
1265 return QStringLiteral(
"h" );
1267 return QStringLiteral(
"d" );
1269 return QStringLiteral(
"wk" );
1271 return QStringLiteral(
"mon" );
1273 return QStringLiteral(
"y" );
1275 return QStringLiteral(
"dec" );
1277 return QStringLiteral(
"c" );
1279 return QStringLiteral(
"xxx" );
1281 return QStringLiteral(
"<unknown>" );
1288 const QString normalized =
string.trimmed().toLower();
1329 return QObject::tr(
"seconds",
"temporal" );
1331 return QObject::tr(
"milliseconds",
"temporal" );
1333 return QObject::tr(
"minutes",
"temporal" );
1335 return QObject::tr(
"hours",
"temporal" );
1337 return QObject::tr(
"days",
"temporal" );
1339 return QObject::tr(
"weeks",
"temporal" );
1341 return QObject::tr(
"months",
"temporal" );
1343 return QObject::tr(
"years",
"temporal" );
1345 return QObject::tr(
"decades",
"temporal" );
1347 return QObject::tr(
"centuries",
"temporal" );
1349 return QObject::tr(
"steps",
"temporal" );
1351 return QObject::tr(
"<unknown>",
"temporal" );
1361 return QObject::tr(
"s",
"temporal" );
1363 return QObject::tr(
"ms",
"temporal" );
1365 return QObject::tr(
"min",
"temporal" );
1367 return QObject::tr(
"h",
"temporal" );
1369 return QObject::tr(
"d",
"temporal" );
1371 return QObject::tr(
"wk",
"temporal" );
1373 return QObject::tr(
"mon",
"temporal" );
1375 return QObject::tr(
"y",
"temporal" );
1377 return QObject::tr(
"dec",
"temporal" );
1379 return QObject::tr(
"cen",
"temporal" );
1381 return QObject::tr(
"steps",
"temporal" );
1383 return QObject::tr(
"<unknown>",
"temporal" );
1390 const QString normalized =
string.trimmed().toLower();
1445 return 1 / 604800.0;
1447 return 1 / 2592000.0;
1449 return 1 / 31557600.0;
1451 return 1 / 315576000.0;
1453 return 1 / 3155760000.0;
1471 return 1 / 3600000.0;
1473 return 1 / 86400000.0;
1475 return 1 / 60480000.0;
1477 return 1 / 259200000.0;
1479 return 1 / 3155760000.0;
1481 return 1 / 31557600000.0;
1483 return 1 / 315576000000.0;
1509 return 1 / 525960.0;
1511 return 1 / 5259600.0;
1513 return 1 / 52596000.0;
1543 return 1 / 876600.0;
1617 return 2592000000.0;
1633 return 30 / 36525.0;
1647 return 31557600000.0;
1655 return 365.25 / 7.0;
1657 return 365.25 / 30.0;
1677 return 315576000000.0;
1685 return 3652.5 / 7.0;
1687 return 3652.5 / 30.0;
1706 return 3155760000.0;
1708 return 3155760000000.0;
1718 return 36525 / 30.0;
1743 const QString normalized =
string.trimmed().toLower();
1782 return QObject::tr(
"cubic meters",
"volume" );
1784 return QObject::tr(
"cubic feet",
"volume" );
1786 return QObject::tr(
"cubic yards",
"volume" );
1788 return QObject::tr(
"barrels",
"volume" );
1790 return QObject::tr(
"cubic decimeters",
"volume" );
1792 return QObject::tr(
"liters",
"volume" );
1794 return QObject::tr(
"gallons",
"volume" );
1796 return QObject::tr(
"cubic inches",
"volume" );
1798 return QObject::tr(
"cubic centimeters",
"volume" );
1800 return QObject::tr(
"cubic degrees",
"volume" );
1802 return QObject::tr(
"<unknown>",
"volume" );
1812 return QObject::tr(
"m³",
"volume" );
1814 return QObject::tr(
"ft³",
"volume" );
1816 return QObject::tr(
"yds³",
"volume" );
1818 return QObject::tr(
"bbl",
"volume" );
1820 return QObject::tr(
"dm³",
"volume" );
1822 return QObject::tr(
"l",
"volume" );
1824 return QObject::tr(
"gal",
"volume" );
1826 return QObject::tr(
"in³",
"volume" );
1828 return QObject::tr(
"cm³",
"volume" );
1830 return QObject::tr(
"deg³",
"volume" );
1832 return QObject::tr(
"<unknown>",
"volume" );
1840 const QString normalized =
string.trimmed().toLower();
1874#define DEG2_TO_M3 1379474361572186.2
1886 return 35.314666572222;
1888 return 1.307950613786;
1890 return 6.2898107438466;
1896 return 264.17205124156;
1898 return 61023.7438368;
1913 return 0.028316846592;
1927 return 1728.000629765;
1944 return 26.999998234;
1954 return 201.974025549;
1956 return 46656.013952472;
1983 return 41.999998943;
1985 return 9702.002677722;
2014 return 61.023758990;
2042 return 231.000069567;
2072 return 16.387060000;
2096 return 0.000264172 ;
2124 switch ( distanceUnit )
2162 switch ( volumeUnit )
2217 return QStringLiteral(
"m3" );
2219 return QStringLiteral(
"ft3" );
2221 return QStringLiteral(
"yd3" );
2223 return QStringLiteral(
"bbl" );
2225 return QStringLiteral(
"dm3" );
2227 return QStringLiteral(
"l" );
2229 return QStringLiteral(
"gal" );
2231 return QStringLiteral(
"in3" );
2233 return QStringLiteral(
"cm3" );
2235 return QStringLiteral(
"deg3" );
2237 return QStringLiteral(
"<unknown>" );
2247 return QStringLiteral(
"degrees" );
2249 return QStringLiteral(
"radians" );
2251 return QStringLiteral(
"gon" );
2253 return QStringLiteral(
"moa" );
2255 return QStringLiteral(
"soa" );
2257 return QStringLiteral(
"tr" );
2259 return QStringLiteral(
"milliradians" );
2261 return QStringLiteral(
"mil" );
2263 return QStringLiteral(
"<unknown>" );
2270 const QString normalized =
string.trimmed().toLower();
2304 return QObject::tr(
"degrees",
"angle" );
2306 return QObject::tr(
"radians",
"angle" );
2308 return QObject::tr(
"gon",
"angle" );
2310 return QObject::tr(
"minutes of arc",
"angle" );
2312 return QObject::tr(
"seconds of arc",
"angle" );
2314 return QObject::tr(
"turns",
"angle" );
2316 return QObject::tr(
"milliradians",
"angle" );
2318 return QObject::tr(
"mil",
"angle" );
2320 return QObject::tr(
"<unknown>",
"angle" );
2337 return M_PI / 180.0;
2339 return 400.0 / 360.0;
2347 return M_PI / 180.0 * 1000;
2349 return 3200.0 / 180;
2360 return 180.0 / M_PI;
2364 return 200.0 / M_PI;
2366 return 60 * 180.0 / M_PI;
2368 return 3600 * 180.0 / M_PI;
2374 return 3200.0 / M_PI;
2385 return 360.0 / 400.0;
2387 return M_PI / 200.0;
2391 return 60 * 360.0 / 400.0;
2393 return 3600 * 360.0 / 400.0;
2397 return M_PI / 200.0 * 1000;
2399 return 3200.0 / 200.0;
2412 return M_PI / 180.0 / 60.0;
2414 return 400.0 / 360.0 / 60.0;
2420 return 1.0 / 360.0 / 60.0;
2422 return M_PI / 180.0 / 60.0 * 1000;
2424 return 3200.0 / 180.0 / 60.0;
2437 return M_PI / 180.0 / 3600.0;
2439 return 400.0 / 360.0 / 3600.0;
2445 return 1.0 / 360.0 / 3600.0;
2447 return M_PI / 180.0 / 3600.0 * 1000;
2449 return 3200.0 / 180.0 / 3600.0;
2466 return 360.0 * 60.0;
2468 return 360.0 * 3600.0;
2472 return 2 * M_PI * 1000;
2485 return 180.0 / M_PI / 1000;
2489 return 200.0 / M_PI / 1000;
2491 return 180.0 * 60.0 / M_PI / 1000;
2493 return 180.0 * 3600.0 / M_PI / 1000;
2495 return M_PI / 2 / 1000;
2499 return 3200.0 / 1000.0 / M_PI;
2511 return 180.0 / 3200;
2515 return 200.0 / 3200;
2517 return 60 * 180.0 / 3200;
2519 return 3600.0 * 180 / 3200;
2521 return 1.0 / ( 2 * 32000 );
2523 return 1000.0 * M_PI / 3200.0;
2541 int decimalPlaces = 2;
2546 unitLabel = QObject::tr(
"°",
"angle" );
2550 unitLabel = QObject::tr(
" rad",
"angle" );
2554 unitLabel = QObject::tr(
" gon",
"angle" );
2558 unitLabel = QObject::tr(
"′",
"angle minutes" );
2562 unitLabel = QObject::tr(
"″",
"angle seconds" );
2566 unitLabel = QObject::tr(
" tr",
"angle turn" );
2570 unitLabel = QObject::tr(
" millirad",
"angular mil SI" );
2574 unitLabel = QObject::tr(
" mil",
"angular mil NATO" );
2581 if ( decimals >= 0 )
2582 decimalPlaces = decimals;
2584 return QStringLiteral(
"%L1%2" ).arg(
angle, 0,
'f', decimalPlaces ).arg( unitLabel );
2599 else if ( std::fabs( distance ) > 1000.0 )
2604 else if ( std::fabs( distance ) < 0.01 )
2609 else if ( std::fabs( distance ) < 0.1 )
2623 if ( keepBaseUnit || std::fabs( distance ) >= 1.0 )
2636 if ( std::fabs( distance ) <= 5280.0 || keepBaseUnit )
2649 if ( std::fabs( distance ) <= 1760.0 || keepBaseUnit )
2662 if ( std::fabs( distance ) >= 1.0 || keepBaseUnit )
2701 result.
value = -1.0;
2896 return QStringLiteral(
"%L1%2" ).arg( distance, 0,
'e', decimals ).arg( unitText );
2900 return QStringLiteral(
"%L1%2" ).arg( dist.
value, 0,
'f', decimals ).arg( unitText );
2916 return QStringLiteral(
"%L1%2" ).arg( area, 0,
'e', decimals ).arg( unitText );
2920 return QStringLiteral(
"%L1%2" ).arg( areaValue.
value, 0,
'f', decimals ).arg( unitText );
2929 return QStringLiteral(
"MM" );
2931 return QStringLiteral(
"RenderMetersInMapUnits" );
2933 return QStringLiteral(
"MapUnit" );
2935 return QStringLiteral(
"Pixel" );
2937 return QStringLiteral(
"Percentage" );
2939 return QStringLiteral(
"Point" );
2941 return QStringLiteral(
"Inch" );
2950 const QString normalized =
string.trimmed().toLower();
2959 if ( normalized == QLatin1String(
"meters" ) )
2963 if ( normalized == QLatin1String(
"mapunits" ) )
2969 if ( normalized == QLatin1String(
"percent" ) )
2973 if ( normalized == QLatin1String(
"points" ) )
2990 return QObject::tr(
"millimeters",
"render" );
2993 return QObject::tr(
"meters at scale",
"render" );
2996 return QObject::tr(
"map units",
"render" );
2999 return QObject::tr(
"pixels",
"render" );
3002 return QObject::tr(
"percent",
"render" );
3005 return QObject::tr(
"points",
"render" );
3008 return QObject::tr(
"inches",
"render" );
3011 return QObject::tr(
"<unknown>",
"render" );
3024 return QStringLiteral(
"cm" );
3026 return QStringLiteral(
"m" );
3028 return QStringLiteral(
"in" );
3030 return QStringLiteral(
"ft" );
3032 return QStringLiteral(
"pt" );
3034 return QStringLiteral(
"pi" );
3036 return QStringLiteral(
"px" );
3038 return QStringLiteral(
"mm" );
3045 const QString normalized =
string.trimmed().toLower();
3099 return QObject::tr(
"px" );
3101 return QObject::tr(
"mm" );
3103 return QObject::tr(
"cm" );
3105 return QObject::tr(
"m" );
3107 return QObject::tr(
"in",
"unit inch" );
3109 return QObject::tr(
"ft" );
3111 return QObject::tr(
"pt" );
3113 return QObject::tr(
"pica" );
3123 return QObject::tr(
"pixels" );
3125 return QObject::tr(
"millimeters" );
3127 return QObject::tr(
"centimeters" );
3129 return QObject::tr(
"meters" );
3131 return QObject::tr(
"inches" );
3133 return QObject::tr(
"feet" );
3135 return QObject::tr(
"points" );
3137 return QObject::tr(
"picas" );
static Q_INVOKABLE QgsUnitTypes::VolumeUnit decodeVolumeUnit(const QString &string, bool *ok=nullptr)
Decodes a volume unit from a string.
DistanceUnit
Units of distance.
@ DistanceDegrees
Degrees, for planar geographic CRS distance measurements.
@ DistanceKilometers
Kilometers.
@ DistanceMiles
Terrestrial miles.
@ DistanceUnknownUnit
Unknown distance unit.
@ DistanceMillimeters
Millimeters.
@ DistanceYards
Imperial yards.
@ DistanceFeet
Imperial feet.
@ DistanceNauticalMiles
Nautical miles.
@ DistanceCentimeters
Centimeters.
LayoutUnit
Layout measurement units.
@ LayoutMillimeters
Millimeters.
@ LayoutCentimeters
Centimeters.
@ LayoutPicas
Typographic picas.
@ LayoutPoints
Typographic points.
static Q_INVOKABLE QgsUnitTypes::TemporalUnit stringToTemporalUnit(const QString &string, bool *ok=nullptr)
Converts a translated string to a temporal unit.
AngleUnit
Units of angles.
@ AngleRadians
Square kilometers.
@ AngleMilNATO
Angular mil (NATO definition, 6400 mil = 2PI radians)
@ AngleMilliradiansSI
Angular milliradians (SI definition, 1/1000 of radian)
@ AngleTurn
Turn/revolutions.
@ AngleUnknownUnit
Unknown angle unit.
@ AngleMinutesOfArc
Minutes of arc.
@ AngleSecondsOfArc
Seconds of arc.
static Q_INVOKABLE QString encodeUnit(QgsUnitTypes::DistanceUnit unit)
Encodes a distance unit to a string.
static Q_INVOKABLE QgsUnitTypes::AreaUnit distanceToAreaUnit(QgsUnitTypes::DistanceUnit distanceUnit)
Converts a distance unit to its corresponding area unit, e.g., meters to square meters.
static Q_INVOKABLE QgsUnitTypes::VolumeUnit stringToVolumeUnit(const QString &string, bool *ok=nullptr)
Converts a translated string to a volume unit.
static Q_INVOKABLE QgsUnitTypes::AngleUnit decodeAngleUnit(const QString &string, bool *ok=nullptr)
Decodes an angular unit from a string.
VolumeUnit
Units of volume.
@ VolumeCubicYards
Cubic yards.
@ VolumeCubicMeters
Cubic meters.
@ VolumeCubicDecimeter
Cubic decimeters.
@ VolumeCubicCentimeter
Cubic Centimeters.
@ VolumeCubicDegrees
Cubic degrees, for planar geographic CRS volume measurements.
@ VolumeCubicFeet
Cubic feet.
@ VolumeCubicInch
Cubic inches.
@ VolumeUnknownUnit
Unknown volume unit.
@ VolumeGallonUS
US Gallons.
static Q_INVOKABLE QgsUnitTypes::DistanceUnit decodeDistanceUnit(const QString &string, bool *ok=nullptr)
Decodes a distance unit from a string.
static Q_INVOKABLE QString toString(QgsUnitTypes::DistanceUnit unit)
Returns a translated string representing a distance unit.
static Q_INVOKABLE QgsUnitTypes::DistanceUnit areaToDistanceUnit(QgsUnitTypes::AreaUnit areaUnit)
Converts an area unit to its corresponding distance unit, e.g., square meters to meters.
static Q_INVOKABLE QgsUnitTypes::DistanceUnit stringToDistanceUnit(const QString &string, bool *ok=nullptr)
Converts a translated string to a distance unit.
static Q_INVOKABLE double fromUnitToUnitFactor(QgsUnitTypes::DistanceUnit fromUnit, QgsUnitTypes::DistanceUnit toUnit)
Returns the conversion factor between the specified distance units.
static Q_INVOKABLE QgsUnitTypes::AreaUnit stringToAreaUnit(const QString &string, bool *ok=nullptr)
Converts a translated string to an areal unit.
static Q_INVOKABLE QgsUnitTypes::DistanceUnit volumeToDistanceUnit(QgsUnitTypes::VolumeUnit volumeUnit)
Converts a volume unit to its corresponding distance unit, e.g., cubic meters to meters.
static Q_INVOKABLE QString toAbbreviatedString(QgsUnitTypes::DistanceUnit unit)
Returns a translated abbreviation representing a distance unit.
static Q_INVOKABLE QgsUnitTypes::DistanceUnitType unitType(QgsUnitTypes::DistanceUnit unit)
Returns the type for a distance unit.
static Q_INVOKABLE QgsUnitTypes::RenderUnit decodeRenderUnit(const QString &string, bool *ok=nullptr)
Decodes a render unit from a string.
static Q_INVOKABLE QgsUnitTypes::AreaValue scaledArea(double area, QgsUnitTypes::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 QString formatArea(double area, int decimals, QgsUnitTypes::AreaUnit unit, bool keepBaseUnit=false)
Returns an area formatted as a friendly string.
static Q_INVOKABLE QgsUnitTypes::LayoutUnit decodeLayoutUnit(const QString &string, bool *ok=nullptr)
Decodes a layout unit from a string.
static Q_INVOKABLE QgsUnitTypes::AreaUnit decodeAreaUnit(const QString &string, bool *ok=nullptr)
Decodes an areal unit from a string.
DistanceUnitType
Types of distance units.
@ Geographic
Unit is a geographic (e.g., degree based) unit.
@ Standard
Unit is a standard measurement unit.
@ UnknownType
Unknown unit type.
@ TypeDistance
Distance unit.
@ TypeTemporal
Temporal unit.
@ TypeUnknown
Unknown unit type.
static Q_INVOKABLE QgsUnitTypes::DistanceValue scaledDistance(double distance, QgsUnitTypes::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 QgsUnitTypes::VolumeUnit distanceToVolumeUnit(QgsUnitTypes::DistanceUnit distanceUnit)
Converts a distance unit to its corresponding volume unit, e.g., meters to cubic meters.
@ AreaSquareNauticalMiles
Square nautical miles.
@ AreaSquareYards
Square yards.
@ AreaSquareFeet
Square feet.
@ AreaUnknownUnit
Unknown areal unit.
@ AreaSquareMeters
Square meters.
@ AreaSquareMiles
Square miles.
@ AreaSquareCentimeters
Square centimeters.
@ AreaSquareKilometers
Square kilometers.
@ AreaSquareDegrees
Square degrees, for planar geographic CRS area measurements.
@ AreaSquareMillimeters
Square millimeters.
TemporalUnit
Temporal units.
@ TemporalUnknownUnit
Unknown time unit.
@ TemporalMilliseconds
Milliseconds.
@ TemporalIrregularStep
Special "irregular step" time unit, used for temporal data which uses irregular, non-real-world unit ...
@ TemporalDecades
Decades.
@ TemporalCenturies
Centuries.
@ TemporalSeconds
Seconds.
@ TemporalMinutes
Minutes.
static Q_INVOKABLE QgsUnitTypes::TemporalUnit decodeTemporalUnit(const QString &string, bool *ok=nullptr)
Decodes a temporal unit from a string.
static Q_INVOKABLE QString formatDistance(double distance, int decimals, QgsUnitTypes::DistanceUnit unit, bool keepBaseUnit=false)
Returns an distance formatted as a friendly string.
static Q_INVOKABLE QgsUnitTypes::UnitType decodeUnitType(const QString &string, bool *ok=nullptr)
Decodes a unit type from a string.
static Q_INVOKABLE QString encodeUnitType(QgsUnitTypes::UnitType type)
Encodes a unit type to a string.
RenderUnit
Rendering size units.
@ RenderUnknownUnit
Mixed or unknown units.
@ RenderMetersInMapUnits
Meters value as Map units.
@ RenderPercentage
Percentage of another measurement (e.g., canvas size, feature size)
@ RenderPoints
Points (e.g., for font sizes)
@ RenderMillimeters
Millimeters.
@ RenderMapUnits
Map units.
static Q_INVOKABLE QString formatAngle(double angle, int decimals, QgsUnitTypes::AngleUnit unit)
Returns an angle formatted as a friendly string.
LayoutUnitType
Types of layout units.
@ LayoutScreenUnits
Unit is a screen based measurement unit.
@ LayoutPaperUnits
Unit is a paper based measurement unit.
double ANALYSIS_EXPORT angle(QgsPoint *p1, QgsPoint *p2, QgsPoint *p3, QgsPoint *p4)
Calculates the angle between two segments (in 2 dimension, z-values are ignored)
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.
QgsUnitTypes::AreaUnit unit
The value part of the distance.
A combination of distance value and unit.
QgsUnitTypes::DistanceUnit unit
The value part of the distance.
double value
The value part of the distance.