18#include "moc_qgsunittypes.cpp"
32 return QStringLiteral(
"distance" );
35 return QStringLiteral(
"area" );
38 return QStringLiteral(
"volume" );
41 return QStringLiteral(
"temporal" );
44 return QStringLiteral(
"<unknown>" );
52 const QString normalized =
string.trimmed().toLower();
169 return QStringLiteral(
"meters" );
172 return QStringLiteral(
"km" );
175 return QStringLiteral(
"feet" );
178 return QStringLiteral(
"yd" );
181 return QStringLiteral(
"mi" );
184 return QStringLiteral(
"degrees" );
187 return QStringLiteral(
"<unknown>" );
190 return QStringLiteral(
"nautical miles" );
193 return QStringLiteral(
"cm" );
196 return QStringLiteral(
"mm" );
199 return QStringLiteral(
"in" );
202 return QStringLiteral(
"chain" );
205 return QStringLiteral(
"chain british benoit b1895a" );
208 return QStringLiteral(
"chain british benoit b1895b" );
211 return QStringLiteral(
"chain british sears 1922 truncated" );
214 return QStringLiteral(
"chain british sears 1922" );
217 return QStringLiteral(
"chain clarkes" );
220 return QStringLiteral(
"chain us survey" );
223 return QStringLiteral(
"feet british 1865" );
226 return QStringLiteral(
"feet british 1936" );
229 return QStringLiteral(
"feet british benoit 1895a" );
232 return QStringLiteral(
"feet british benoit 1895b" );
235 return QStringLiteral(
"feet british sears 1922 truncated" );
238 return QStringLiteral(
"feet british sears 1922" );
241 return QStringLiteral(
"feet clarkes" );
244 return QStringLiteral(
"feet gold coast" );
247 return QStringLiteral(
"feet indian" );
249 return QStringLiteral(
"feet indian 1937" );
252 return QStringLiteral(
"feet indian 1962" );
255 return QStringLiteral(
"feet indian 1975" );
258 return QStringLiteral(
"feet us survey" );
261 return QStringLiteral(
"links" );
264 return QStringLiteral(
"links british benoit 1895a" );
267 return QStringLiteral(
"links british benoit 1895b" );
270 return QStringLiteral(
"links british sears 1922 truncated" );
273 return QStringLiteral(
"links british sears 1922" );
276 return QStringLiteral(
"links clarkes" );
279 return QStringLiteral(
"links us survey" );
282 return QStringLiteral(
"yards british benoit 1895a" );
285 return QStringLiteral(
"yards british benoit 1895b" );
288 return QStringLiteral(
"yards british sears 1922 truncated" );
291 return QStringLiteral(
"yards british sears 1922" );
294 return QStringLiteral(
"yards clarkes" );
297 return QStringLiteral(
"yards indian" );
300 return QStringLiteral(
"yards indian 1937" );
303 return QStringLiteral(
"yards indian 1962" );
306 return QStringLiteral(
"yards indian 1975" );
309 return QStringLiteral(
"miles us survey" );
312 return QStringLiteral(
"yards fathom" );
315 return QStringLiteral(
"german legal meters" );
328 const QString normalized =
string.trimmed().toLower();
402 return QObject::tr(
"meters",
"distance" );
405 return QObject::tr(
"kilometers",
"distance" );
408 return QObject::tr(
"feet",
"distance" );
411 return QObject::tr(
"yards",
"distance" );
414 return QObject::tr(
"miles",
"distance" );
417 return QObject::tr(
"degrees",
"distance" );
420 return QObject::tr(
"centimeters",
"distance" );
423 return QObject::tr(
"millimeters",
"distance" );
426 return QObject::tr(
"inches",
"distance" );
429 return QObject::tr(
"<unknown>",
"distance" );
432 return QObject::tr(
"nautical miles",
"distance" );
435 return QObject::tr(
"chains (international)",
"distance" );
438 return QObject::tr(
"chains (British, Benoit 1895 A)",
"distance" );
441 return QObject::tr(
"chains (British, Benoit 1895 B)",
"distance" );
444 return QObject::tr(
"chains (British, Sears 1922 truncated)",
"distance" );
447 return QObject::tr(
"chains (British, Sears 1922)",
"distance" );
450 return QObject::tr(
"chains (Clarke's)",
"distance" );
453 return QObject::tr(
"chains (US survey)",
"distance" );
456 return QObject::tr(
"feet (British, 1865)",
"distance" );
459 return QObject::tr(
"feet (British, 1936)",
"distance" );
462 return QObject::tr(
"feet (British, Benoit 1895 A)",
"distance" );
465 return QObject::tr(
"feet (British, Benoit 1895 B)",
"distance" );
468 return QObject::tr(
"feet (British, Sears 1922 truncated)",
"distance" );
471 return QObject::tr(
"feet (British, Sears 1922)",
"distance" );
474 return QObject::tr(
"feet (Clarke's)",
"distance" );
477 return QObject::tr(
"feet (Gold Coast)",
"distance" );
480 return QObject::tr(
"feet (Indian)",
"distance" );
483 return QObject::tr(
"feet (Indian 1937)",
"distance" );
486 return QObject::tr(
"feet (Indian 1962)",
"distance" );
489 return QObject::tr(
"feet (Indian 1975)",
"distance" );
492 return QObject::tr(
"feet (US survey)",
"distance" );
495 return QObject::tr(
"links",
"distance" );
498 return QObject::tr(
"links (British, Benoit 1895 A)",
"distance" );
501 return QObject::tr(
"links (British, Benoit 1895 B)",
"distance" );
504 return QObject::tr(
"links (British, Sears 1922 truncated)",
"distance" );
507 return QObject::tr(
"links (British, Sears 1922)",
"distance" );
510 return QObject::tr(
"links (Clarke's)",
"distance" );
513 return QObject::tr(
"links (US survey)",
"distance" );
516 return QObject::tr(
"yards (British, Benoit 1895 A)",
"distance" );
519 return QObject::tr(
"yards (British, Benoit 1895 B)",
"distance" );
522 return QObject::tr(
"yards (British, Sears 1922 truncated)",
"distance" );
525 return QObject::tr(
"yards (British, Sears 1922)",
"distance" );
528 return QObject::tr(
"yards (Clarke's)",
"distance" );
531 return QObject::tr(
"yards (Indian)",
"distance" );
534 return QObject::tr(
"yards (Indian 1937)",
"distance" );
537 return QObject::tr(
"yards (Indian 1962)",
"distance" );
540 return QObject::tr(
"yards (Indian 1975)",
"distance" );
543 return QObject::tr(
"miles (US survey)",
"distance" );
546 return QObject::tr(
"fathoms",
"distance" );
549 return QObject::tr(
"meters (German legal)",
"distance" );
559 return QObject::tr(
"mm",
"render" );
562 return QObject::tr(
"map units",
"render" );
565 return QObject::tr(
"px",
"render" );
568 return QObject::tr(
"%",
"render" );
571 return QObject::tr(
"pt",
"render" );
574 return QObject::tr(
"in",
"render" );
577 return QObject::tr(
"unknown",
"render" );
580 return QObject::tr(
"m",
"render" );
592 return QObject::tr(
"m",
"distance" );
595 return QObject::tr(
"km",
"distance" );
611 return QObject::tr(
"ft",
"distance" );
623 return QObject::tr(
"yd",
"distance" );
627 return QObject::tr(
"mi",
"distance" );
630 return QObject::tr(
"deg",
"distance" );
633 return QObject::tr(
"cm",
"distance" );
636 return QObject::tr(
"mm",
"distance" );
639 return QObject::tr(
"in",
"distance" );
645 return QObject::tr(
"NM",
"distance" );
654 return QObject::tr(
"ch",
"distance" );
663 return QObject::tr(
"lk",
"distance" );
666 return QObject::tr(
"f",
"distance" );
669 return QObject::tr(
"glm",
"distance" );
683 const QString normalized =
string.trimmed().toLower();
742 if ( normalized.compare(
toString( unit ), Qt::CaseInsensitive ) == 0 )
776 return 111319.49079327358;
788 return 20.116782494376;
792 return 20.116765121553;
794 return 20.1166195164;
796 return 20.11684023368;
798 return 0.30480083333333;
802 return 0.30479973333333;
804 return 0.30479973476327;
806 return 0.30479933333333;
808 return 0.30479947153868;
812 return 0.30479971018151;
814 return 0.30479951024815;
822 return 0.30480060960122;
828 return 0.20116782494376;
832 return 0.20116765121553;
834 return 0.201166195164;
836 return 0.2011684023368;
840 return 0.91439920428981;
844 return 0.91439841461603;
848 return 0.91439853074444;
856 return 1609.3472186944;
872 constexpr double FEET_TO_INCHES = 12;
873 constexpr double YARDS_TO_FEET = 3.0;
885 return FEET_TO_INCHES;
887 return 1.0 / YARDS_TO_FEET;
899 return YARDS_TO_FEET;
901 return YARDS_TO_FEET * FEET_TO_INCHES;
914 return 1.0 / FEET_TO_INCHES;
916 return 1.0 / ( YARDS_TO_FEET * FEET_TO_INCHES );
936 return QStringLiteral(
"m2" );
938 return QStringLiteral(
"km2" );
940 return QStringLiteral(
"ft2" );
942 return QStringLiteral(
"y2" );
944 return QStringLiteral(
"mi2" );
946 return QStringLiteral(
"ha" );
948 return QStringLiteral(
"ac" );
950 return QStringLiteral(
"nm2" );
952 return QStringLiteral(
"deg2" );
954 return QStringLiteral(
"cm2" );
956 return QStringLiteral(
"mm2" );
958 return QStringLiteral(
"in2" );
960 return QStringLiteral(
"<unknown>" );
967 const QString normalized =
string.trimmed().toLower();
1010 return QObject::tr(
"square meters",
"area" );
1012 return QObject::tr(
"square kilometers",
"area" );
1014 return QObject::tr(
"square feet",
"area" );
1016 return QObject::tr(
"square yards",
"area" );
1018 return QObject::tr(
"square miles",
"area" );
1020 return QObject::tr(
"hectares",
"area" );
1022 return QObject::tr(
"acres",
"area" );
1024 return QObject::tr(
"square nautical miles",
"area" );
1026 return QObject::tr(
"square degrees",
"area" );
1028 return QObject::tr(
"square millimeters",
"area" );
1030 return QObject::tr(
"square centimeters",
"area" );
1032 return QObject::tr(
"square inches",
"area" );
1034 return QObject::tr(
"<unknown>",
"area" );
1044 return QObject::tr(
"m²",
"area" );
1046 return QObject::tr(
"km²",
"area" );
1048 return QObject::tr(
"ft²",
"area" );
1050 return QObject::tr(
"yd²",
"area" );
1052 return QObject::tr(
"mi²",
"area" );
1054 return QObject::tr(
"ha",
"area" );
1056 return QObject::tr(
"ac",
"area" );
1058 return QObject::tr(
"NM²",
"area" );
1060 return QObject::tr(
"deg²",
"area" );
1062 return QObject::tr(
"cm²",
"area" );
1064 return QObject::tr(
"mm²",
"area" );
1066 return QObject::tr(
"in²",
"area" );
1075 const QString normalized =
string.trimmed().toLower();
1114#define KM2_TO_M2 1000000.0
1115#define CM2_TO_M2 0.0001
1116#define MM2_TO_M2 0.000001
1117#define FT2_TO_M2 0.09290304
1118#define IN2_TO_M2 0.00064516
1119#define YD2_TO_M2 0.83612736
1120#define MI2_TO_M2 2589988.110336
1121#define HA_TO_M2 10000.0
1122#define AC_TO_FT2 43560.0
1123#define DEG2_TO_M2 12392029030.5
1124#define NM2_TO_M2 3429904.0
1551 switch ( distanceUnit )
1677 return QStringLiteral(
"s" );
1679 return QStringLiteral(
"ms" );
1681 return QStringLiteral(
"min" );
1683 return QStringLiteral(
"h" );
1685 return QStringLiteral(
"d" );
1687 return QStringLiteral(
"wk" );
1689 return QStringLiteral(
"mon" );
1691 return QStringLiteral(
"y" );
1693 return QStringLiteral(
"dec" );
1695 return QStringLiteral(
"c" );
1697 return QStringLiteral(
"xxx" );
1699 return QStringLiteral(
"<unknown>" );
1706 const QString normalized =
string.trimmed().toLower();
1747 return QObject::tr(
"seconds",
"temporal" );
1749 return QObject::tr(
"milliseconds",
"temporal" );
1751 return QObject::tr(
"minutes",
"temporal" );
1753 return QObject::tr(
"hours",
"temporal" );
1755 return QObject::tr(
"days",
"temporal" );
1757 return QObject::tr(
"weeks",
"temporal" );
1759 return QObject::tr(
"months",
"temporal" );
1761 return QObject::tr(
"years",
"temporal" );
1763 return QObject::tr(
"decades",
"temporal" );
1765 return QObject::tr(
"centuries",
"temporal" );
1767 return QObject::tr(
"steps",
"temporal" );
1769 return QObject::tr(
"<unknown>",
"temporal" );
1779 return QObject::tr(
"s",
"temporal" );
1781 return QObject::tr(
"ms",
"temporal" );
1783 return QObject::tr(
"min",
"temporal" );
1785 return QObject::tr(
"h",
"temporal" );
1787 return QObject::tr(
"d",
"temporal" );
1789 return QObject::tr(
"wk",
"temporal" );
1791 return QObject::tr(
"mon",
"temporal" );
1793 return QObject::tr(
"y",
"temporal" );
1795 return QObject::tr(
"dec",
"temporal" );
1797 return QObject::tr(
"cen",
"temporal" );
1799 return QObject::tr(
"steps",
"temporal" );
1801 return QObject::tr(
"<unknown>",
"temporal" );
1808 const QString normalized =
string.trimmed().toLower();
1863 return 1 / 604800.0;
1865 return 1 / 2592000.0;
1867 return 1 / 31557600.0;
1869 return 1 / 315576000.0;
1871 return 1 / 3155760000.0;
1889 return 1 / 3600000.0;
1891 return 1 / 86400000.0;
1893 return 1 / 604800000.0;
1895 return 1 / 2592000000.0;
1897 return 1 / 31557600000.0;
1899 return 1 / 315576000000.0;
1901 return 1 / 3155760000000.0;
1927 return 1 / 525960.0;
1929 return 1 / 5259600.0;
1931 return 1 / 52596000.0;
1961 return 1 / 876600.0;
2035 return 2592000000.0;
2051 return 30 / 36525.0;
2065 return 31557600000.0;
2073 return 365.25 / 7.0;
2075 return 365.25 / 30.0;
2095 return 315576000000.0;
2103 return 3652.5 / 7.0;
2105 return 3652.5 / 30.0;
2124 return 3155760000.0;
2126 return 3155760000000.0;
2136 return 36525 / 30.0;
2161 const QString normalized =
string.trimmed().toLower();
2200 return QObject::tr(
"cubic meters",
"volume" );
2202 return QObject::tr(
"cubic feet",
"volume" );
2204 return QObject::tr(
"cubic yards",
"volume" );
2206 return QObject::tr(
"barrels",
"volume" );
2208 return QObject::tr(
"cubic decimeters",
"volume" );
2210 return QObject::tr(
"liters",
"volume" );
2212 return QObject::tr(
"gallons",
"volume" );
2214 return QObject::tr(
"cubic inches",
"volume" );
2216 return QObject::tr(
"cubic centimeters",
"volume" );
2218 return QObject::tr(
"cubic degrees",
"volume" );
2220 return QObject::tr(
"<unknown>",
"volume" );
2230 return QObject::tr(
"m³",
"volume" );
2232 return QObject::tr(
"ft³",
"volume" );
2234 return QObject::tr(
"yds³",
"volume" );
2236 return QObject::tr(
"bbl",
"volume" );
2238 return QObject::tr(
"dm³",
"volume" );
2240 return QObject::tr(
"l",
"volume" );
2242 return QObject::tr(
"gal",
"volume" );
2244 return QObject::tr(
"in³",
"volume" );
2246 return QObject::tr(
"cm³",
"volume" );
2248 return QObject::tr(
"deg³",
"volume" );
2250 return QObject::tr(
"<unknown>",
"volume" );
2258 const QString normalized =
string.trimmed().toLower();
2292#define DEG2_TO_M3 1379474361572186.2
2306 return 35.314666572222;
2308 return 1.307950613786;
2310 return 6.2898107438466;
2316 return 264.17205124156;
2318 return 61023.7438368;
2333 return 0.028316846592;
2347 return 1728.000629765;
2364 return 26.999998234;
2374 return 201.974025549;
2376 return 46656.013952472;
2403 return 41.999998943;
2405 return 9702.002677722;
2434 return 61.023758990;
2462 return 231.000069567;
2492 return 16.387060000;
2516 return 0.000264172 ;
2547 switch ( distanceUnit )
2628 switch ( volumeUnit )
2683 return QStringLiteral(
"m3" );
2685 return QStringLiteral(
"ft3" );
2687 return QStringLiteral(
"yd3" );
2689 return QStringLiteral(
"bbl" );
2691 return QStringLiteral(
"dm3" );
2693 return QStringLiteral(
"l" );
2695 return QStringLiteral(
"gal" );
2697 return QStringLiteral(
"in3" );
2699 return QStringLiteral(
"cm3" );
2701 return QStringLiteral(
"deg3" );
2703 return QStringLiteral(
"<unknown>" );
2713 return QStringLiteral(
"degrees" );
2715 return QStringLiteral(
"radians" );
2717 return QStringLiteral(
"gon" );
2719 return QStringLiteral(
"moa" );
2721 return QStringLiteral(
"soa" );
2723 return QStringLiteral(
"tr" );
2725 return QStringLiteral(
"milliradians" );
2727 return QStringLiteral(
"mil" );
2729 return QStringLiteral(
"<unknown>" );
2736 const QString normalized =
string.trimmed().toLower();
2770 return QObject::tr(
"degrees",
"angle" );
2772 return QObject::tr(
"radians",
"angle" );
2774 return QObject::tr(
"gon",
"angle" );
2776 return QObject::tr(
"minutes of arc",
"angle" );
2778 return QObject::tr(
"seconds of arc",
"angle" );
2780 return QObject::tr(
"turns",
"angle" );
2782 return QObject::tr(
"milliradians",
"angle" );
2784 return QObject::tr(
"mil",
"angle" );
2786 return QObject::tr(
"<unknown>",
"angle" );
2803 return M_PI / 180.0;
2805 return 400.0 / 360.0;
2813 return M_PI / 180.0 * 1000;
2815 return 3200.0 / 180;
2826 return 180.0 / M_PI;
2830 return 200.0 / M_PI;
2832 return 60 * 180.0 / M_PI;
2834 return 3600 * 180.0 / M_PI;
2840 return 3200.0 / M_PI;
2851 return 360.0 / 400.0;
2853 return M_PI / 200.0;
2857 return 60 * 360.0 / 400.0;
2859 return 3600 * 360.0 / 400.0;
2863 return M_PI / 200.0 * 1000;
2865 return 3200.0 / 200.0;
2878 return M_PI / 180.0 / 60.0;
2880 return 400.0 / 360.0 / 60.0;
2886 return 1.0 / 360.0 / 60.0;
2888 return M_PI / 180.0 / 60.0 * 1000;
2890 return 3200.0 / 180.0 / 60.0;
2903 return M_PI / 180.0 / 3600.0;
2905 return 400.0 / 360.0 / 3600.0;
2911 return 1.0 / 360.0 / 3600.0;
2913 return M_PI / 180.0 / 3600.0 * 1000;
2915 return 3200.0 / 180.0 / 3600.0;
2932 return 360.0 * 60.0;
2934 return 360.0 * 3600.0;
2938 return 2 * M_PI * 1000;
2951 return 180.0 / M_PI / 1000;
2955 return 200.0 / M_PI / 1000;
2957 return 180.0 * 60.0 / M_PI / 1000;
2959 return 180.0 * 3600.0 / M_PI / 1000;
2961 return M_PI / 2 / 1000;
2965 return 3200.0 / 1000.0 / M_PI;
2977 return 180.0 / 3200;
2981 return 200.0 / 3200;
2983 return 60 * 180.0 / 3200;
2985 return 3600.0 * 180 / 3200;
2987 return 1.0 / ( 2 * 32000 );
2989 return 1000.0 * M_PI / 3200.0;
3007 int decimalPlaces = 2;
3012 unitLabel = QObject::tr(
"°",
"angle" );
3016 unitLabel = QObject::tr(
" rad",
"angle" );
3020 unitLabel = QObject::tr(
" gon",
"angle" );
3024 unitLabel = QObject::tr(
"′",
"angle minutes" );
3028 unitLabel = QObject::tr(
"″",
"angle seconds" );
3032 unitLabel = QObject::tr(
" tr",
"angle turn" );
3036 unitLabel = QObject::tr(
" millirad",
"angular mil SI" );
3040 unitLabel = QObject::tr(
" mil",
"angular mil NATO" );
3047 if ( decimals >= 0 )
3048 decimalPlaces = decimals;
3050 return QStringLiteral(
"%L1%2" ).arg( angle, 0,
'f', decimalPlaces ).arg( unitLabel );
3067 else if ( std::fabs( distance ) > 1000.0 )
3072 else if ( std::fabs( distance ) < 0.01 )
3077 else if ( std::fabs( distance ) < 0.1 )
3091 if ( keepBaseUnit || std::fabs( distance ) >= 1.0 )
3104 if ( std::fabs( distance ) <= 5280.0 || keepBaseUnit )
3117 if ( std::fabs( distance ) <= 1760.0 || keepBaseUnit )
3130 if ( std::fabs( distance ) >= 1.0 || keepBaseUnit )
3170 result.
value = -1.0;
3375 return QStringLiteral(
"%L1%2" ).arg( distance, 0,
'e', decimals ).arg( unitText );
3379 return QStringLiteral(
"%L1%2" ).arg( dist.
value, 0,
'f', decimals ).arg( unitText );
3395 return QStringLiteral(
"%L1%2" ).arg( area, 0,
'e', decimals ).arg( unitText );
3399 return QStringLiteral(
"%L1%2" ).arg( areaValue.
value, 0,
'f', decimals ).arg( unitText );
3408 return QStringLiteral(
"MM" );
3410 return QStringLiteral(
"RenderMetersInMapUnits" );
3412 return QStringLiteral(
"MapUnit" );
3414 return QStringLiteral(
"Pixel" );
3416 return QStringLiteral(
"Percentage" );
3418 return QStringLiteral(
"Point" );
3420 return QStringLiteral(
"Inch" );
3429 const QString normalized =
string.trimmed().toLower();
3438 if ( normalized == QLatin1String(
"meters" ) )
3442 if ( normalized == QLatin1String(
"mapunits" ) )
3448 if ( normalized == QLatin1String(
"percent" ) )
3452 if ( normalized == QLatin1String(
"points" ) )
3469 return QObject::tr(
"millimeters",
"render" );
3472 return QObject::tr(
"meters at scale",
"render" );
3475 return QObject::tr(
"map units",
"render" );
3478 return QObject::tr(
"pixels",
"render" );
3481 return QObject::tr(
"percent",
"render" );
3484 return QObject::tr(
"points",
"render" );
3487 return QObject::tr(
"inches",
"render" );
3490 return QObject::tr(
"<unknown>",
"render" );
3503 return QStringLiteral(
"cm" );
3505 return QStringLiteral(
"m" );
3507 return QStringLiteral(
"in" );
3509 return QStringLiteral(
"ft" );
3511 return QStringLiteral(
"pt" );
3513 return QStringLiteral(
"pi" );
3515 return QStringLiteral(
"px" );
3517 return QStringLiteral(
"mm" );
3524 const QString normalized =
string.trimmed().toLower();
3578 return QObject::tr(
"px" );
3580 return QObject::tr(
"mm" );
3582 return QObject::tr(
"cm" );
3584 return QObject::tr(
"m" );
3586 return QObject::tr(
"in",
"unit inch" );
3588 return QObject::tr(
"ft" );
3590 return QObject::tr(
"pt" );
3592 return QObject::tr(
"pica" );
3602 return QObject::tr(
"pixels" );
3604 return QObject::tr(
"millimeters" );
3606 return QObject::tr(
"centimeters" );
3608 return QObject::tr(
"meters" );
3610 return QObject::tr(
"inches" );
3612 return QObject::tr(
"feet" );
3614 return QObject::tr(
"points" );
3616 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.
@ YardsBritishSears1922Truncated
British yards (Sears 1922 truncated)
@ MilesUSSurvey
US Survey miles.
@ LinksBritishSears1922
British links (Sears 1922)
@ YardsBritishBenoit1895A
British yards (Benoit 1895 A)
@ LinksBritishBenoit1895A
British links (Benoit 1895 A)
@ Centimeters
Centimeters.
@ YardsIndian1975
Indian yards (1975)
@ FeetUSSurvey
US Survey feet.
@ Millimeters
Millimeters.
@ FeetBritishSears1922
British feet (Sears 1922)
@ YardsClarkes
Clarke's yards.
@ YardsIndian
Indian yards.
@ FeetBritishBenoit1895B
British feet (Benoit 1895 B)
@ Miles
Terrestrial miles.
@ LinksUSSurvey
US Survey links.
@ ChainsUSSurvey
US Survey chains.
@ FeetClarkes
Clarke's feet.
@ Unknown
Unknown distance unit.
@ FeetBritish1936
British feet (1936)
@ FeetIndian1962
Indian feet (1962)
@ YardsBritishSears1922
British yards (Sears 1922)
@ FeetIndian1937
Indian feet (1937)
@ YardsIndian1937
Indian yards (1937)
@ Degrees
Degrees, for planar geographic CRS distance measurements.
@ ChainsBritishBenoit1895B
British chains (Benoit 1895 B)
@ LinksBritishSears1922Truncated
British links (Sears 1922 truncated)
@ ChainsBritishBenoit1895A
British chains (Benoit 1895 A)
@ YardsBritishBenoit1895B
British yards (Benoit 1895 B)
@ FeetBritish1865
British feet (1865)
@ YardsIndian1962
Indian yards (1962)
@ FeetBritishSears1922Truncated
British feet (Sears 1922 truncated)
@ MetersGermanLegal
German legal meter.
@ LinksBritishBenoit1895B
British links (Benoit 1895 B)
@ ChainsInternational
International chains.
@ LinksInternational
International links.
@ ChainsBritishSears1922Truncated
British chains (Sears 1922 truncated)
@ FeetIndian
Indian (geodetic) feet.
@ NauticalMiles
Nautical miles.
@ ChainsClarkes
Clarke's chains.
@ LinksClarkes
Clarke's links.
@ ChainsBritishSears1922
British chains (Sears 1922)
@ FeetIndian1975
Indian feet (1975)
@ FeetGoldCoast
Gold Coast feet.
@ FeetBritishBenoit1895A
British feet (Benoit 1895 A)
@ SquareCentimeters
Square centimeters.
@ SquareInches
Square inches.
@ 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)
constexpr double distanceUnitToMeter(Qgis::DistanceUnit unit)
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.