31 return QStringLiteral(
"distance" );
34 return QStringLiteral(
"area" );
37 return QStringLiteral(
"volume" );
40 return QStringLiteral(
"temporal" );
43 return QStringLiteral(
"<unknown>" );
51 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 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 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 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 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(
"<unknown>" );
1286 QString normalized =
string.trimmed().toLower();
1325 return QObject::tr(
"seconds",
"temporal" );
1327 return QObject::tr(
"milliseconds",
"temporal" );
1329 return QObject::tr(
"minutes",
"temporal" );
1331 return QObject::tr(
"hours",
"temporal" );
1333 return QObject::tr(
"days",
"temporal" );
1335 return QObject::tr(
"weeks",
"temporal" );
1337 return QObject::tr(
"months",
"temporal" );
1339 return QObject::tr(
"years",
"temporal" );
1341 return QObject::tr(
"decades",
"temporal" );
1343 return QObject::tr(
"centuries",
"temporal" );
1345 return QObject::tr(
"<unknown>",
"temporal" );
1355 return QObject::tr(
"s",
"temporal" );
1357 return QObject::tr(
"ms",
"temporal" );
1359 return QObject::tr(
"min",
"temporal" );
1361 return QObject::tr(
"h",
"temporal" );
1363 return QObject::tr(
"d",
"temporal" );
1365 return QObject::tr(
"wk",
"temporal" );
1367 return QObject::tr(
"mon",
"temporal" );
1369 return QObject::tr(
"y",
"temporal" );
1371 return QObject::tr(
"dec",
"temporal" );
1373 return QObject::tr(
"cen",
"temporal" );
1375 return QObject::tr(
"<unknown>",
"temporal" );
1382 QString normalized =
string.trimmed().toLower();
1435 return 1 / 604800.0;
1437 return 1 / 2592000.0;
1439 return 1 / 31557600.0;
1441 return 1 / 315576000.0;
1443 return 1 / 3155760000.0;
1460 return 1 / 3600000.0;
1462 return 1 / 86400000.0;
1464 return 1 / 60480000.0;
1466 return 1 / 259200000.0;
1468 return 1 / 3155760000.0;
1470 return 1 / 31557600000.0;
1472 return 1 / 315576000000.0;
1497 return 1 / 525960.0;
1499 return 1 / 5259600.0;
1501 return 1 / 52596000.0;
1530 return 1 / 876600.0;
1601 return 2592000000.0;
1617 return 30 / 36525.0;
1630 return 31557600000.0;
1638 return 365.25 / 7.0;
1640 return 365.25 / 30.0;
1659 return 315576000000.0;
1667 return 3652.5 / 7.0;
1669 return 3652.5 / 30.0;
1687 return 3155760000.0;
1689 return 3155760000000.0;
1699 return 36525 / 30.0;
1722 QString normalized =
string.trimmed().toLower();
1761 return QObject::tr(
"cubic meters",
"volume" );
1763 return QObject::tr(
"cubic feet",
"volume" );
1765 return QObject::tr(
"cubic yards",
"volume" );
1767 return QObject::tr(
"barrels",
"volume" );
1769 return QObject::tr(
"cubic decimeters",
"volume" );
1771 return QObject::tr(
"liters",
"volume" );
1773 return QObject::tr(
"gallons",
"volume" );
1775 return QObject::tr(
"cubic inches",
"volume" );
1777 return QObject::tr(
"cubic centimeters",
"volume" );
1779 return QObject::tr(
"cubic degrees",
"volume" );
1781 return QObject::tr(
"<unknown>",
"volume" );
1791 return QObject::tr(
"m³",
"volume" );
1793 return QObject::tr(
"ft³",
"volume" );
1795 return QObject::tr(
"yds³",
"volume" );
1797 return QObject::tr(
"bbl",
"volume" );
1799 return QObject::tr(
"dm³",
"volume" );
1801 return QObject::tr(
"l",
"volume" );
1803 return QObject::tr(
"gal",
"volume" );
1805 return QObject::tr(
"in³",
"volume" );
1807 return QObject::tr(
"cm³",
"volume" );
1809 return QObject::tr(
"deg³",
"volume" );
1811 return QObject::tr(
"<unknown>",
"volume" );
1819 QString normalized =
string.trimmed().toLower();
1853 #define DEG2_TO_M3 1379474361572186.2
1865 return 35.314666572222;
1867 return 1.307950613786;
1869 return 6.2898107438466;
1875 return 264.17205124156;
1877 return 61023.7438368;
1892 return 0.028316846592;
1906 return 1728.000629765;
1923 return 26.999998234;
1933 return 201.974025549;
1935 return 46656.013952472;
1962 return 41.999998943;
1964 return 9702.002677722;
1993 return 61.023758990;
2021 return 231.000069567;
2051 return 16.387060000;
2075 return 0.000264172 ;
2103 switch ( distanceUnit )
2141 switch ( volumeUnit )
2196 return QStringLiteral(
"m3" );
2198 return QStringLiteral(
"ft3" );
2200 return QStringLiteral(
"yd3" );
2202 return QStringLiteral(
"bbl" );
2204 return QStringLiteral(
"dm3" );
2206 return QStringLiteral(
"l" );
2208 return QStringLiteral(
"gal" );
2210 return QStringLiteral(
"in3" );
2212 return QStringLiteral(
"cm3" );
2214 return QStringLiteral(
"deg3" );
2216 return QStringLiteral(
"<unknown>" );
2226 return QStringLiteral(
"degrees" );
2228 return QStringLiteral(
"radians" );
2230 return QStringLiteral(
"gon" );
2232 return QStringLiteral(
"moa" );
2234 return QStringLiteral(
"soa" );
2236 return QStringLiteral(
"tr" );
2238 return QStringLiteral(
"milliradians" );
2240 return QStringLiteral(
"mil" );
2242 return QStringLiteral(
"<unknown>" );
2249 QString normalized =
string.trimmed().toLower();
2283 return QObject::tr(
"degrees",
"angle" );
2285 return QObject::tr(
"radians",
"angle" );
2287 return QObject::tr(
"gon",
"angle" );
2289 return QObject::tr(
"minutes of arc",
"angle" );
2291 return QObject::tr(
"seconds of arc",
"angle" );
2293 return QObject::tr(
"turns",
"angle" );
2295 return QObject::tr(
"milliradians",
"angle" );
2297 return QObject::tr(
"mil",
"angle" );
2299 return QObject::tr(
"<unknown>",
"angle" );
2316 return M_PI / 180.0;
2318 return 400.0 / 360.0;
2326 return M_PI / 180.0 * 1000;
2328 return 3200.0 / 180;
2339 return 180.0 / M_PI;
2343 return 200.0 / M_PI;
2345 return 60 * 180.0 / M_PI;
2347 return 3600 * 180.0 / M_PI;
2353 return 3200.0 / M_PI;
2364 return 360.0 / 400.0;
2366 return M_PI / 200.0;
2370 return 60 * 360.0 / 400.0;
2372 return 3600 * 360.0 / 400.0;
2376 return M_PI / 200.0 * 1000;
2378 return 3200.0 / 200.0;
2391 return M_PI / 180.0 / 60.0;
2393 return 400.0 / 360.0 / 60.0;
2399 return 1.0 / 360.0 / 60.0;
2401 return M_PI / 180.0 / 60.0 * 1000;
2403 return 3200.0 / 180.0 / 60.0;
2416 return M_PI / 180.0 / 3600.0;
2418 return 400.0 / 360.0 / 3600.0;
2424 return 1.0 / 360.0 / 3600.0;
2426 return M_PI / 180.0 / 3600.0 * 1000;
2428 return 3200.0 / 180.0 / 3600.0;
2445 return 360.0 * 60.0;
2447 return 360.0 * 3600.0;
2451 return 2 * M_PI * 1000;
2464 return 180.0 / M_PI / 1000;
2468 return 200.0 / M_PI / 1000;
2470 return 180.0 * 60.0 / M_PI / 1000;
2472 return 180.0 * 3600.0 / M_PI / 1000;
2474 return M_PI / 2 / 1000;
2478 return 3200.0 / 1000.0 / M_PI;
2490 return 180.0 / 3200;
2494 return 200.0 / 3200;
2496 return 60 * 180.0 / 3200;
2498 return 3600.0 * 180 / 3200;
2500 return 1.0 / ( 2 * 32000 );
2502 return 1000.0 * M_PI / 3200.0;
2524 unitLabel = QObject::tr(
"°",
"angle" );
2527 unitLabel = QObject::tr(
" rad",
"angle" );
2530 unitLabel = QObject::tr(
" gon",
"angle" );
2533 unitLabel = QObject::tr(
"′",
"angle minutes" );
2536 unitLabel = QObject::tr(
"″",
"angle seconds" );
2539 unitLabel = QObject::tr(
" tr",
"angle turn" );
2542 unitLabel = QObject::tr(
" millirad",
"angular mil SI" );
2545 unitLabel = QObject::tr(
" mil",
"angular mil NATO" );
2551 return QStringLiteral(
"%L1%2" ).arg(
angle, 0,
'f', decimals ).arg( unitLabel );
2567 else if ( std::fabs( distance ) > 1000.0 )
2572 else if ( std::fabs( distance ) < 0.01 )
2577 else if ( std::fabs( distance ) < 0.1 )
2591 if ( keepBaseUnit || std::fabs( distance ) >= 1.0 )
2604 if ( std::fabs( distance ) <= 5280.0 || keepBaseUnit )
2617 if ( std::fabs( distance ) <= 1760.0 || keepBaseUnit )
2630 if ( std::fabs( distance ) >= 1.0 || keepBaseUnit )
2669 result.
value = -1.0;
2861 return QStringLiteral(
"%L1%2" ).arg( dist.
value, 0,
'f', decimals ).arg( unitText );
2873 return QStringLiteral(
"%L1%2" ).arg( areaValue.
value, 0,
'f', decimals ).arg( unitText );
2881 return QStringLiteral(
"MM" );
2883 return QStringLiteral(
"RenderMetersInMapUnits" );
2885 return QStringLiteral(
"MapUnit" );
2887 return QStringLiteral(
"Pixel" );
2889 return QStringLiteral(
"Percentage" );
2891 return QStringLiteral(
"Point" );
2893 return QStringLiteral(
"Inch" );
2902 QString normalized =
string.trimmed().toLower();
2911 if ( normalized == QLatin1String(
"meters" ) )
2915 if ( normalized == QLatin1String(
"mapunits" ) )
2921 if ( normalized == QLatin1String(
"percent" ) )
2925 if ( normalized == QLatin1String(
"points" ) )
2942 return QObject::tr(
"millimeters",
"render" );
2945 return QObject::tr(
"meters at scale",
"render" );
2948 return QObject::tr(
"map units",
"render" );
2951 return QObject::tr(
"pixels",
"render" );
2954 return QObject::tr(
"percent",
"render" );
2957 return QObject::tr(
"points",
"render" );
2960 return QObject::tr(
"inches",
"render" );
2963 return QObject::tr(
"<unknown>",
"render" );
2976 return QStringLiteral(
"cm" );
2978 return QStringLiteral(
"m" );
2980 return QStringLiteral(
"in" );
2982 return QStringLiteral(
"ft" );
2984 return QStringLiteral(
"pt" );
2986 return QStringLiteral(
"pi" );
2988 return QStringLiteral(
"px" );
2990 return QStringLiteral(
"mm" );
2997 QString normalized =
string.trimmed().toLower();
3051 return QObject::tr(
"px" );
3053 return QObject::tr(
"mm" );
3055 return QObject::tr(
"cm" );
3057 return QObject::tr(
"m" );
3059 return QObject::tr(
"in",
"unit inch" );
3061 return QObject::tr(
"ft" );
3063 return QObject::tr(
"pt" );
3065 return QObject::tr(
"pica" );
3075 return QObject::tr(
"pixels" );
3077 return QObject::tr(
"millimeters" );
3079 return QObject::tr(
"centimeters" );
3081 return QObject::tr(
"meters" );
3083 return QObject::tr(
"inches" );
3085 return QObject::tr(
"feet" );
3087 return QObject::tr(
"points" );
3089 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.
@ 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.
#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.