1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551
|
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsmaplayer.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
class QgsMapLayer : QObject
{
%Docstring(signature="appended")
Base class for all map layer types. This is the base class for all map
layer types (vector, raster).
%End
%TypeHeaderCode
#include "qgsmaplayer.h"
%End
%ConvertToSubClassCode
QgsMapLayer *layer = qobject_cast<QgsMapLayer *>( sipCpp );
sipType = 0;
if ( layer )
{
switch ( layer->type() )
{
case Qgis::LayerType::Vector:
sipType = sipType_QgsVectorLayer;
break;
case Qgis::LayerType::Raster:
sipType = sipType_QgsRasterLayer;
break;
case Qgis::LayerType::Plugin:
sipType = sipType_QgsPluginLayer;
break;
case Qgis::LayerType::Mesh:
sipType = sipType_QgsMeshLayer;
break;
case Qgis::LayerType::VectorTile:
sipType = sipType_QgsVectorTileLayer;
break;
case Qgis::LayerType::Annotation:
sipType = sipType_QgsAnnotationLayer;
break;
case Qgis::LayerType::PointCloud:
sipType = sipType_QgsPointCloudLayer;
break;
case Qgis::LayerType::Group:
sipType = sipType_QgsGroupLayer;
break;
case Qgis::LayerType::TiledScene:
sipType = sipType_QgsTiledSceneLayer;
break;
default:
sipType = nullptr;
break;
}
}
%End
public:
enum PropertyType /BaseType=IntEnum/
{
Style,
Metadata,
};
enum LayerFlag /BaseType=IntEnum/
{
Identifiable,
Removable,
Searchable,
Private,
};
typedef QFlags<QgsMapLayer::LayerFlag> LayerFlags;
enum StyleCategory /BaseType=IntEnum/
{
LayerConfiguration,
Symbology,
Symbology3D,
Labeling,
Fields,
Forms,
Actions,
MapTips,
Diagrams,
AttributeTable,
Rendering,
CustomProperties,
GeometryOptions,
Relations,
Temporal,
Legend,
Elevation,
Notes,
AllStyleCategories
};
typedef QFlags<QgsMapLayer::StyleCategory> StyleCategories;
QgsMapLayer( Qgis::LayerType type = Qgis::LayerType::Vector, const QString &name = QString(), const QString &source = QString() );
%Docstring
Constructor for QgsMapLayer
:param type: layer type
:param name: display name for the layer
:param source: datasource of layer
%End
~QgsMapLayer();
virtual QgsMapLayer *clone() const = 0;
%Docstring
Returns a new instance equivalent to this one except for the id which is
still unique.
:return: a new layer instance
%End
Qgis::LayerType type() const;
%Docstring
Returns the type of the layer.
%End
QgsMapLayer::LayerFlags flags() const;
%Docstring
Returns the flags for this layer.
.. note::
Flags are options specified by the user used for the UI but are not preventing any API call.
For instance, even if the Removable flag is not set, the layer can still be removed with the API
but the action will not be listed in the legend menu.
.. seealso:: :py:func:`properties`
.. versionadded:: 3.4
%End
void setFlags( QgsMapLayer::LayerFlags flags );
%Docstring
Returns the flags for this layer.
.. note::
Flags are options specified by the user used for the UI but are not preventing any API call.
For instance, even if the Removable flag is not set, the layer can still be removed with the API
but the action will not be listed in the legend menu.
.. seealso:: :py:func:`properties`
.. versionadded:: 3.4
%End
virtual Qgis::MapLayerProperties properties() const;
%Docstring
Returns the map layer properties of this layer.
.. note::
:py:func:`~QgsMapLayer.properties` differ from :py:func:`~QgsMapLayer.flags` in that :py:func:`~QgsMapLayer.flags` are user settable, and reflect options that
users can enable for map layers. In contrast :py:func:`~QgsMapLayer.properties` are reflections of inherent capabilities
for the layer, which cannot be directly changed by users.
.. versionadded:: 3.22
%End
static QString extensionPropertyType( PropertyType type );
%Docstring
Returns the extension of a Property.
:return: The extension
%End
QString id() const;
%Docstring
Returns the layer's unique ID, which is used to access this layer from
:py:class:`QgsProject`.
.. seealso:: :py:func:`setId`
.. seealso:: :py:func:`idChanged`
%End
bool setId( const QString &id );
%Docstring
Sets the layer's ``id``.
Returns ``True`` if the layer ID was successfully changed, or ``False``
if it could not be changed (e.g. because the layer is owned by a
:py:class:`QgsProject` or :py:class:`QgsMapLayerStore`).
.. warning::
It is the caller's responsibility to ensure that the layer ID is unique in the desired context.
Generally this method should not be called, and the auto generated ID should be used instead.
.. warning::
This method should not be called on layers which already belong to a :py:class:`QgsProject` or :py:class:`QgsMapLayerStore`.
.. seealso:: :py:func:`id`
.. seealso:: :py:func:`idChanged`
.. versionadded:: 3.38
%End
void setName( const QString &name );
%Docstring
Set the display ``name`` of the layer.
.. seealso:: :py:func:`name`
%End
QString name() const;
%Docstring
Returns the display name of the layer.
.. seealso:: :py:func:`setName`
%End
virtual QgsDataProvider *dataProvider();
%Docstring
Returns the layer's data provider, it may be ``None``.
%End
QgsProviderMetadata *providerMetadata() const;
%Docstring
Returns the layer data provider's metadata, it may be ``None``.
.. versionadded:: 3.40
%End
void setShortName( const QString &shortName ) /Deprecated/;
%Docstring
Sets the short name of the layer used by QGIS Server to identify the
layer.
.. deprecated:: 3.38
Use :py:func:`~QgsMapLayer.serverProperties`->:py:func:`~QgsMapLayer.setShortName` instead.
%End
QString shortName() const /Deprecated/;
%Docstring
Returns the short name of the layer used by QGIS Server to identify the
layer.
.. deprecated:: 3.38
Use :py:func:`~QgsMapLayer.serverProperties`->:py:func:`~QgsMapLayer.shortName` instead.
%End
void setTitle( const QString &title ) /Deprecated/;
%Docstring
Sets the title of the layer used by QGIS Server in GetCapabilities
request.
.. deprecated:: 3.38
Use :py:func:`~QgsMapLayer.serverProperties`->:py:func:`~QgsMapLayer.setTitle` instead.
%End
QString title() const /Deprecated/;
%Docstring
Returns the title of the layer used by QGIS Server in GetCapabilities
request.
.. deprecated:: 3.38
Use :py:func:`~QgsMapLayer.serverProperties`->:py:func:`~QgsMapLayer.title` instead.
%End
void setAbstract( const QString &abstract ) /Deprecated/;
%Docstring
Sets the abstract of the layer used by QGIS Server in GetCapabilities
request.
.. deprecated:: 3.38
Use :py:func:`~QgsMapLayer.serverProperties`->:py:func:`~QgsMapLayer.setAbstract` instead.
%End
QString abstract() const /Deprecated/;
%Docstring
Returns the abstract of the layer used by QGIS Server in GetCapabilities
request.
.. deprecated:: 3.38
Use :py:func:`~QgsMapLayer.serverProperties`->:py:func:`~QgsMapLayer.abstract` instead.
%End
void setKeywordList( const QString &keywords ) /Deprecated/;
%Docstring
Sets the keyword list of the layerused by QGIS Server in GetCapabilities
request.
.. deprecated:: 3.38
Use :py:func:`~QgsMapLayer.serverProperties`->:py:func:`~QgsMapLayer.setKeywordList` instead.
%End
QString keywordList() const /Deprecated/;
%Docstring
Returns the keyword list of the layer used by QGIS Server in
GetCapabilities request.
.. deprecated:: 3.38
Use :py:func:`~QgsMapLayer.serverProperties`->:py:func:`~QgsMapLayer.keywordList` instead.
%End
void setDataUrl( const QString &dataUrl ) /Deprecated/;
%Docstring
Sets the DataUrl of the layer used by QGIS Server in GetCapabilities
request.
.. deprecated:: 3.38
Use :py:func:`~QgsMapLayer.serverProperties`->:py:func:`~QgsMapLayer.setDataUrl` instead.
%End
QString dataUrl() const /Deprecated/;
%Docstring
Returns the DataUrl of the layer used by QGIS Server in GetCapabilities
request.
.. deprecated:: 3.38
Use :py:func:`~QgsMapLayer.serverProperties`->:py:func:`~QgsMapLayer.dataUrl` instead.
%End
void setDataUrlFormat( const QString &dataUrlFormat ) /Deprecated/;
%Docstring
Sets the DataUrl format of the layer used by QGIS Server in
GetCapabilities request.
.. deprecated:: 3.38
Use :py:func:`~QgsMapLayer.serverProperties`->:py:func:`~QgsMapLayer.setDataUrlFormat` instead.
%End
QString dataUrlFormat() const /Deprecated/;
%Docstring
Returns the DataUrl format of the layer used by QGIS Server in
GetCapabilities request.
.. deprecated:: 3.38
Use :py:func:`~QgsMapLayer.serverProperties`->:py:func:`~QgsMapLayer.dataUrlFormat` instead.
%End
void setAttribution( const QString &attrib ) /Deprecated/;
%Docstring
Sets the attribution of the layerused by QGIS Server in GetCapabilities
request.
.. deprecated:: 3.38
Use :py:func:`~QgsMapLayer.serverProperties`->:py:func:`~QgsMapLayer.setAttribution` instead.
%End
QString attribution() const /Deprecated/;
%Docstring
Returns the attribution of the layer used by QGIS Server in
GetCapabilities request.
.. deprecated:: 3.38
Use :py:func:`~QgsMapLayer.serverProperties`->:py:func:`~QgsMapLayer.attribution` instead.
%End
void setAttributionUrl( const QString &attribUrl ) /Deprecated/;
%Docstring
Sets the attribution URL of the layer used by QGIS Server in
GetCapabilities request.
.. deprecated:: 3.38
Use :py:func:`~QgsMapLayer.serverProperties`->:py:func:`~QgsMapLayer.setAttributionUrl` instead.
%End
QString attributionUrl() const /Deprecated/;
%Docstring
Returns the attribution URL of the layer used by QGIS Server in
GetCapabilities request.
.. deprecated:: 3.38
Use :py:func:`~QgsMapLayer.serverProperties`->:py:func:`~QgsMapLayer.attributionUrl` instead.
%End
QgsMapLayerServerProperties *serverProperties();
%Docstring
Returns QGIS Server Properties for the map layer
.. versionadded:: 3.22
%End
void setMetadataUrl( const QString &metaUrl ) /Deprecated/;
%Docstring
Sets the metadata URL of the layer used by QGIS Server in
GetCapabilities request. MetadataUrl is a a link to the detailed,
standardized metadata about the data. Since QGIS 3.22, it edits the
first metadata URL link.
.. seealso:: :py:func:`serverProperties`
.. deprecated:: 3.22
%End
QString metadataUrl() const /Deprecated/;
%Docstring
Returns the metadata URL of the layer used by QGIS Server in
GetCapabilities request. MetadataUrl is a a link to the detailed,
standardized metadata about the data. Since QGIS 3.22, it returns the
first metadata URL link.
:return: the layer metadata URL
.. seealso:: :py:func:`serverProperties`
.. deprecated:: 3.22
%End
void setMetadataUrlType( const QString &metaUrlType ) /Deprecated/;
%Docstring
Set the metadata type of the layer used by QGIS Server in
GetCapabilities request MetadataUrlType indicates the standard to which
the metadata complies. Since QGIS 3.22, it edits the first metadata URL
type.
.. seealso:: :py:func:`serverProperties`
.. deprecated:: 3.22
%End
QString metadataUrlType() const /Deprecated/;
%Docstring
Returns the metadata type of the layer used by QGIS Server in
GetCapabilities request. MetadataUrlType indicates the standard to which
the metadata complies. Since QGIS 3.22, it returns the first metadata
URL type.
:return: the layer metadata type
.. seealso:: :py:func:`serverProperties`
.. deprecated:: 3.22
%End
void setMetadataUrlFormat( const QString &metaUrlFormat ) /Deprecated/;
%Docstring
Sets the metadata format of the layer used by QGIS Server in
GetCapabilities request. MetadataUrlType indicates how the metadata is
structured. Since QGIS 3.22, it edits the first metadata URL format.
.. seealso:: :py:func:`serverProperties`
.. deprecated:: 3.22
%End
QString metadataUrlFormat() const /Deprecated/;
%Docstring
Returns the metadata format of the layer used by QGIS Server in
GetCapabilities request. MetadataUrlType indicates how the metadata is
structured. Since QGIS 3.22, it returns the first metadata URL format.
:return: the layer metadata format
.. seealso:: :py:func:`serverProperties`
.. deprecated:: 3.22
%End
void setBlendMode( QPainter::CompositionMode blendMode );
%Docstring
Set the blending mode used for rendering a layer.
:param blendMode: new blending mode
.. seealso:: :py:func:`blendMode`
%End
QPainter::CompositionMode blendMode() const;
%Docstring
Returns the current blending mode for a layer.
.. seealso:: :py:func:`setBlendMode`
%End
virtual void setOpacity( double opacity );
%Docstring
Sets the ``opacity`` for the layer, where ``opacity`` is a value between
0 (totally transparent) and 1.0 (fully opaque).
.. seealso:: :py:func:`opacity`
.. seealso:: :py:func:`opacityChanged`
.. note::
Prior to QGIS 3.18, this method was available for vector layers only
.. versionadded:: 3.18
%End
virtual double opacity() const;
%Docstring
Returns the opacity for the layer, where opacity is a value between 0
(totally transparent) and 1.0 (fully opaque).
.. seealso:: :py:func:`setOpacity`
.. seealso:: :py:func:`opacityChanged`
.. note::
Prior to QGIS 3.18, this method was available for vector layers only
.. versionadded:: 3.18
%End
bool readOnly() const;
%Docstring
Returns if this layer is read only.
%End
virtual void reload();
%Docstring
Synchronises with changes in the datasource
%End
virtual QgsMapLayerRenderer *createMapRenderer( QgsRenderContext &rendererContext ) = 0 /Factory/;
%Docstring
Returns new instance of :py:class:`QgsMapLayerRenderer` that will be
used for rendering of given context
%End
virtual QgsRectangle extent() const;
%Docstring
Returns the extent of the layer.
%End
virtual QgsBox3D extent3D() const;
%Docstring
Returns the 3D extent of the layer.
.. versionadded:: 3.36
%End
QgsRectangle wgs84Extent( bool forceRecalculate = false ) const;
%Docstring
Returns the WGS84 extent (EPSG:4326) of the layer according to
ReadFlag.FlagTrustLayerMetadata. If that flag is activated, then the
WGS84 extent read in the qgs project is returned. Otherwise, the actual
WGS84 extent is returned.
:param forceRecalculate: True to return the current WGS84 extent
whatever the read flags
.. versionadded:: 3.20
%End
bool isValid() const;
%Docstring
Returns the status of the layer. An invalid layer is one which has a bad
datasource or other problem. Child classes set this flag when
initialized.
:return: ``True`` if the layer is valid and can be accessed
%End
QString publicSource( bool hidePassword = false ) const;
%Docstring
Gets a version of the internal layer definition that has sensitive bits
removed (for example, the password). This function should be used when
displaying the source name for general viewing.
:param hidePassword: ``True`` to replace the value of credentials with
'xxxxxxxx', ``False`` to completely remove
credentials (key and value). Since QGIS 3.34
.. seealso:: :py:func:`source`
%End
QString source() const;
%Docstring
Returns the source for the layer. This source may contain usernames,
passwords and other sensitive information.
.. seealso:: :py:func:`publicSource`
%End
virtual QStringList subLayers() const;
%Docstring
Returns the sublayers of this layer. (Useful for providers that manage
their own layers, such as WMS).
%End
virtual void setLayerOrder( const QStringList &layers );
%Docstring
Reorders the *previously selected* sublayers of this layer from bottom
to top. (Useful for providers that manage their own layers, such as
WMS).
%End
virtual void setSubLayerVisibility( const QString &name, bool visible );
%Docstring
Set the visibility of the given sublayer name.
:param name: sublayer name
:param visible: sublayer visibility
%End
virtual bool supportsEditing() const;
%Docstring
Returns whether the layer supports editing or not.
:return: ``False`` if the layer is read only or the data provider has no
editing capabilities.
.. note::
default implementation returns ``False``.
.. versionadded:: 3.22
%End
virtual bool isEditable() const;
%Docstring
Returns ``True`` if the layer can be edited.
%End
virtual bool isModified() const;
%Docstring
Returns ``True`` if the layer has been modified since last commit/save.
.. note::
default implementation returns ``False``.
.. versionadded:: 3.22
%End
virtual bool isSpatial() const;
%Docstring
Returns ``True`` if the layer is considered a spatial layer, ie it has
some form of geometry associated with it.
%End
virtual bool isTemporary() const;
%Docstring
Returns ``True`` if the layer is considered a temporary layer.
These include memory-only layers such as those created by the "memory"
data provider, layers stored inside a local temporary folder (such as
the "/tmp" folder on Linux) or layer with temporary data (as temporary
mesh layer dataset)
.. versionadded:: 3.10.1
%End
enum ReadFlag /BaseType=IntEnum/
{
FlagDontResolveLayers,
FlagTrustLayerMetadata,
FlagReadExtentFromXml,
FlagForceReadOnly,
};
typedef QFlags<QgsMapLayer::ReadFlag> ReadFlags;
bool readLayerXml( const QDomElement &layerElement, QgsReadWriteContext &context,
QgsMapLayer::ReadFlags flags = QgsMapLayer::ReadFlags(), QgsDataProvider *preloadedProvider /Transfer/ = 0 );
%Docstring
Sets state from DOM document
:param layerElement: The DOM element corresponding to ``maplayer`` tag
:param context: writing context (e.g. for conversion between relative
and absolute paths)
:param flags: optional argument which can be used to control layer
reading behavior.
:param preloadedProvider: optional preloaded data provider that will be
used as data provider for this layer, takes
ownership (since QGIS 3.32)
.. note::
The DOM node corresponds to a DOM document project file XML element read
by :py:class:`QgsProject`.
This, in turn, calls :py:func:`~QgsMapLayer.readXml` (and then
:py:func:`~QgsMapLayer.readSymbology`), which is overridable by
sub-classes so that they can read their own specific state from the
given DOM node.
Invoked by :py:func:`QgsProject.read()`.
:return: ``True`` if successful
%End
bool writeLayerXml( QDomElement &layerElement, QDomDocument &document, const QgsReadWriteContext &context ) const;
%Docstring
Stores state in DOM node
:param layerElement: is a DOM element corresponding to ``maplayer`` tag
:param document: is a the DOM document being written
:param context: reading context (e.g. for conversion between relative
and absolute paths)
.. note::
The DOM node corresponds to a DOM document project file XML element to be
written by :py:class:`QgsProject`.
This, in turn, calls :py:func:`~QgsMapLayer.writeXml` (and then
writeSymbology), which is over-rideable by sub-classes so that they can
write their own specific state to the given DOM node.
Invoked by :py:func:`QgsProject.write()`.
:return: ``True`` if successful
%End
virtual void resolveReferences( QgsProject *project );
%Docstring
Resolve references to other layers (kept as layer IDs after reading XML)
into layer objects.
%End
QStringList customPropertyKeys() const;
%Docstring
Returns list of all keys within custom properties. Properties are stored
in a map and saved in project file.
.. seealso:: :py:func:`customProperty`
%End
void setCustomProperty( const QString &key, const QVariant &value );
%Docstring
Set a custom property for layer. Properties are stored in a map and
saved in project file.
.. seealso:: :py:func:`customProperty`
.. seealso:: :py:func:`removeCustomProperty`
%End
QVariant customProperty( const QString &value, const QVariant &defaultValue = QVariant() ) const;
%Docstring
Read a custom property from layer. Properties are stored in a map and
saved in project file.
.. seealso:: :py:func:`setCustomProperty`
%End
void setCustomProperties( const QgsObjectCustomProperties &properties );
%Docstring
Set custom properties for layer. Current properties are dropped.
%End
const QgsObjectCustomProperties &customProperties() const;
%Docstring
Read all custom properties from layer. Properties are stored in a map
and saved in project file.
.. seealso:: :py:func:`setCustomProperties`
.. versionadded:: 3.14
%End
virtual int listStylesInDatabase( QStringList &ids /Out/, QStringList &names /Out/,
QStringList &descriptions /Out/, QString &msgError /Out/ );
%Docstring
Lists all the style in db split into related to the layer and not
related to
:return: - the number of styles related to current layer (-1 on not
implemented)
- ids: the list in which will be stored the style db ids
- names: the list in which will be stored the style names
- descriptions: the list in which will be stored the style
descriptions
- msgError: a descriptive error message if any occurs
.. note::
Since QGIS 3.2 Styles related to the layer are ordered with the default style first then by update time for Postgres, MySQL and Spatialite.
%End
virtual QString getStyleFromDatabase( const QString &styleId, QString &msgError /Out/ );
%Docstring
Returns the named style corresponding to style id provided
%End
virtual bool deleteStyleFromDatabase( const QString &styleId, QString &msgError /Out/ );
%Docstring
Deletes a style from the database
:param styleId: the provider's layer_styles table id of the style to
delete
:return: - ``True`` in case of success
- msgError: a descriptive error message if any occurs
%End
enum class SaveStyleResult
{
Success,
QmlGenerationFailed,
SldGenerationFailed,
DatabaseWriteFailed,
};
typedef QFlags<QgsMapLayer::SaveStyleResult> SaveStyleResults;
virtual void saveStyleToDatabase( const QString &name, const QString &description,
bool useAsDefault, const QString &uiFileContent,
QString &msgError /Out/,
QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories ) /Deprecated/;
%Docstring
Saves QML and SLD representations of the layer's style to a table in the
database.
:param name: Style name
:param description: A description of the style
:param useAsDefault: Set to ``True`` if style should be used as the
default style for the layer
:param uiFileContent:
:param categories: the style categories to be saved.
.. note::
Prior to QGIS 3.24, this method would show a message box warning when a
style with the same ``styleName`` already existed to confirm replacing the style with the user.
Since 3.24, calling this method will ALWAYS overwrite any existing style with the same name.
Use :py:func:`QgsProviderRegistry.styleExists()` to test in advance if a style already exists and handle this appropriately
in your client code.
:return: - msgError: a descriptive error message if any occurs
.. deprecated:: 4.0
Use :py:func:`~QgsMapLayer.saveStyleToDatabaseV2` instead.
%End
QgsMapLayer::SaveStyleResults saveStyleToDatabaseV2( const QString &name, const QString &description,
bool useAsDefault, const QString &uiFileContent,
QString &msgError /Out/,
QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories );
%Docstring
Saves QML and SLD representations of the layer's style to a table in the
database.
:param name: Style name
:param description: A description of the style
:param useAsDefault: Set to ``True`` if style should be used as the
default style for the layer
:param uiFileContent:
:param categories: the style categories to be saved.
:return: - flags representing whether QML or SLD storing was successful
- msgError: a descriptive error message if any occurs
.. versionadded:: 4.0
%End
virtual QString loadNamedStyle( const QString &theURI, bool &resultFlag /Out/, bool loadFromLocalDb,
QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories,
Qgis::LoadStyleFlags flags = Qgis::LoadStyleFlags() );
%Docstring
Loads a named style from file/local db/datasource db
:param theURI: the URI of the style or the URI of the layer
:param loadFromLocalDb: if ``True`` forces to load from local db instead
of datasource one
:param categories: the style categories to be loaded.
:param flags: flags controlling how the style should be loaded (since
QGIS 3.38)
:return: - status message, which may indicate success or contain an
error message
- resultFlag: ``True`` if a named style is correctly loaded
%End
void removeCustomProperty( const QString &key );
%Docstring
Remove a custom property from layer. Properties are stored in a map and
saved in project file.
.. seealso:: :py:func:`setCustomProperty`
%End
virtual QgsError error() const;
%Docstring
Gets current status error. This error describes some principal problem
for which layer cannot work and thus is not valid. It is not last error
after accessing data by :py:func:`~QgsMapLayer.draw` etc.
%End
QgsCoordinateReferenceSystem crs() const;
%Docstring
Returns the layer's spatial reference system.
.. warning::
Since QGIS 3.38, consider using :py:func:`~QgsMapLayer.crs3D` whenever transforming 3D data or whenever
z/elevation value handling is important.
.. seealso:: :py:func:`setCrs`
.. seealso:: :py:func:`crs3D`
.. seealso:: :py:func:`verticalCrs`
.. seealso:: :py:func:`crsChanged`
%End
QgsCoordinateReferenceSystem verticalCrs() const;
%Docstring
Returns the layer's vertical coordinate reference system.
If the layer :py:func:`~QgsMapLayer.crs` is a compound CRS, then the CRS
returned will be the vertical component of :py:func:`~QgsMapLayer.crs`.
Otherwise it will be the value explicitly set by a call to
:py:func:`~QgsMapLayer.setVerticalCrs`.
The returned CRS will be invalid if the layer has no vertical CRS.
.. note::
Consider also using :py:func:`~QgsMapLayer.crs3D`, which will return a CRS which takes into account
both :py:func:`~QgsMapLayer.crs` and :py:func:`~QgsMapLayer.verticalCrs`.
.. seealso:: :py:func:`crs`
.. seealso:: :py:func:`crs3D`
.. seealso:: :py:func:`setVerticalCrs`
.. versionadded:: 3.38
%End
QgsCoordinateReferenceSystem crs3D() const;
%Docstring
Returns the CRS to use for the layer when transforming 3D data, or when
z/elevation value handling is important.
The returned CRS will take into account
:py:func:`~QgsMapLayer.verticalCrs` when appropriate, e.g. it may return
a compound CRS consisting of :py:func:`~QgsMapLayer.crs` +
:py:func:`~QgsMapLayer.verticalCrs`. This method may still return a 2D
CRS, e.g in the case that :py:func:`~QgsMapLayer.crs` is a 2D CRS and no
:py:func:`~QgsMapLayer.verticalCrs` has been set for the layer. Check
:py:func:`QgsCoordinateReferenceSystem.type()` on the returned value to
determine the type of CRS returned by this method.
.. warning::
It is NOT guaranteed that the returned CRS will actually be a 3D CRS, but rather
it is guaranteed that the returned CRS is ALWAYS the most appropriate CRS to use when handling 3D data.
.. seealso:: :py:func:`crs`
.. seealso:: :py:func:`verticalCrs`
.. seealso:: :py:func:`crs3DChanged`
.. versionadded:: 3.38
%End
void setCrs( const QgsCoordinateReferenceSystem &srs, bool emitSignal = true );
%Docstring
Sets layer's spatial reference system.
If ``emitSignal`` is ``True``, changing the CRS will trigger a
:py:func:`~QgsMapLayer.crsChanged` signal. Additionally, if ``crs`` is a
compound CRS, then the :py:func:`~QgsMapLayer.verticalCrsChanged` signal
will also be emitted.
.. seealso:: :py:func:`crs`
.. seealso:: :py:func:`crsChanged`
.. seealso:: :py:func:`setVerticalCrs`
%End
bool setVerticalCrs( const QgsCoordinateReferenceSystem &crs, QString *errorMessage /Out/ = 0 );
%Docstring
Sets the layer's vertical coordinate reference system.
The :py:func:`~QgsMapLayer.verticalCrsChanged` signal will be raised if
the vertical CRS is changed.
.. note::
If the layer :py:func:`~QgsMapLayer.crs` is a compound CRS, then the CRS returned for
:py:func:`~QgsMapLayer.verticalCrs` will be the vertical component of :py:func:`~QgsMapLayer.crs`. Otherwise it will be the value
explicitly set by this call.
:param crs: the vertical CRS
:return: - ``True`` if vertical CRS was successfully set
- errorMessage: a descriptive message if the vertical CRS could
not be set
.. seealso:: :py:func:`verticalCrs`
.. seealso:: :py:func:`setCrs`
.. versionadded:: 3.38
%End
QgsCoordinateTransformContext transformContext( ) const;
%Docstring
Returns the layer data provider coordinate transform context or a
default transform context if the layer does not have a valid data
provider.
.. versionadded:: 3.8
%End
static QString formatLayerName( const QString &name );
%Docstring
A convenience function to capitalize and format a layer ``name``.
%End
virtual QString metadataUri() const;
%Docstring
Retrieve the metadata URI for this layer (either as a .qmd file on disk
or as a record in the users style table in their personal qgis.db)
:return: a QString with the metadata file name
%End
void exportNamedMetadata( QDomDocument &doc, QString &errorMsg ) const;
%Docstring
Export the current metadata of this layer as named metadata in a
QDomDocument
:param doc: the target QDomDocument
:param errorMsg: this QString will be initialized on error
%End
virtual QString saveDefaultMetadata( bool &resultFlag /Out/ );
%Docstring
Save the current metadata of this layer as the default metadata (either
as a .qmd file on disk or as a record in the users style table in their
personal qgis.db)
:return: - a QString with any status messages
- resultFlag: a reference to a flag that ``False`` if we did
not manage to save the default metadata.
%End
QString saveNamedMetadata( const QString &uri, bool &resultFlag );
%Docstring
Save the current metadata of this layer as a named metadata (either as a
.qmd file on disk or as a record in the users style table in their
personal qgis.db)
:param uri: the file name or other URI for the metadata file. First an
attempt will be made to see if this is a file and save to
that, if that fails the qgis.db metadata table will be used
to create a metadata entry who's key matches the URI.
:param resultFlag: a reference to a flag that will be set to ``False``
if we did not manage to save the default metadata.
:return: a QString with any status messages
%End
virtual QString loadNamedMetadata( const QString &uri, bool &resultFlag /Out/ );
%Docstring
Retrieve a named metadata for this layer if one exists (either as a .qmd
file on disk or as a record in the users style table in their personal
qgis.db)
:param uri: the file name or other URI for the metadata file. First an
attempt will be made to see if this is a file and load that,
if that fails the qgis.db metadata table will be consulted
to see if there is a metadata who's key matches the URI.
:return: - a QString with any status messages
- resultFlag: a reference to a flag that ``False`` if we did
not manage to load the default metadata.
%End
virtual QString loadDefaultMetadata( bool &resultFlag );
%Docstring
Retrieve the default metadata for this layer if one exists (either as a
.qmd file on disk or as a record in the users metadata table in their
personal qgis.db)
:param resultFlag: a reference to a flag that will be set to ``False``
if we did not manage to load the default metadata.
:return: a QString with any status messages
%End
bool loadNamedMetadataFromDatabase( const QString &db, const QString &uri, QString &qmd );
%Docstring
Retrieve a named metadata for this layer from a sqlite database.
:param db: path to sqlite database
:param uri: uri for table
:param qmd: will be set to QMD xml metadata content from database
:return: ``True`` if style was successfully loaded
%End
bool importNamedMetadata( QDomDocument &document, QString &errorMessage );
%Docstring
Import the metadata of this layer from a QDomDocument
:param document: source QDomDocument
:param errorMessage: this QString will be initialized on error
:return: ``True`` on success
%End
virtual QString styleURI() const;
%Docstring
Retrieve the style URI for this layer (either as a .qml file on disk or
as a record in the users style table in their personal qgis.db)
:return: a QString with the style file name
.. seealso:: :py:func:`loadNamedStyle`
.. seealso:: :py:func:`saveNamedStyle`
%End
virtual QString loadDefaultStyle( bool &resultFlag /Out/ );
%Docstring
Retrieve the default style for this layer if one exists (either as a
.qml file on disk or as a record in the users style table in their
personal qgis.db)
:return: - a QString with any status messages
- resultFlag: a reference to a flag that ``False`` if we did
not manage to load the default style.
.. seealso:: :py:func:`loadNamedStyle`
%End
virtual QString loadNamedStyle( const QString &uri, bool &resultFlag /Out/, QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories, Qgis::LoadStyleFlags flags = Qgis::LoadStyleFlags() );
%Docstring
Retrieve a named style for this layer if one exists (either as a .qml
file on disk or as a record in the users style table in their personal
qgis.db)
:param uri: the file name or other URI for the style file. First an
attempt will be made to see if this is a file and load that,
if that fails the qgis.db styles table will be consulted to
see if there is a style who's key matches the URI.
:param categories: the style categories to be loaded.
:param flags: flags controlling how the style should be loaded (since
QGIS 3.38)
:return: - a QString with any status messages
- resultFlag: a reference to a flag that ``False`` if we did
not manage to load the default style.
.. seealso:: :py:func:`loadDefaultStyle`
%End
virtual bool loadNamedStyleFromDatabase( const QString &db, const QString &uri, QString &qml /Out/ );
%Docstring
Retrieve a named style for this layer from a sqlite database.
:param db: path to sqlite database
:param uri: uri for table
:return: - ``True`` if style was successfully loaded
- qml: QML style content from database
%End
virtual bool importNamedStyle( QDomDocument &doc, QString &errorMsg /Out/,
QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories );
%Docstring
Import the properties of this layer from a QDomDocument
:param doc: source QDomDocument
:param categories: the style categories to import
:return: - ``True`` on success
- errorMsg: this QString will be initialized on error during
the execution of readSymbology
%End
virtual void exportNamedStyle( QDomDocument &doc, QString &errorMsg /Out/, const QgsReadWriteContext &context = QgsReadWriteContext(),
QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories ) const;
%Docstring
Export the properties of this layer as named style in a QDomDocument
:param doc: the target QDomDocument
:param context: read write context
:param categories: the style categories to export during the execution
of writeSymbology
:return: this QString will be initialized on error
%End
virtual void exportSldStyle( QDomDocument &doc, QString &errorMsg ) const;
%Docstring
Export the properties of this layer as SLD style in a QDomDocument
:param doc: the target QDomDocument
:param errorMsg: this QString will be initialized on error during the
execution of writeSymbology
.. seealso:: :py:func:`exportSldStyleV2`
%End
virtual void exportSldStyleV2( QDomDocument &doc, QString &errorMsg, const QgsSldExportContext &exportContext ) const;
%Docstring
Export the properties of this layer as SLD style in a QDomDocument
:param doc: the target QDomDocument
:param errorMsg: this QString will be initialized on error during the
execution of writeSymbology
:param exportContext: SLD export context
.. versionadded:: 3.30
%End
virtual QString saveDefaultStyle( bool &resultFlag /Out/, StyleCategories categories );
%Docstring
Save the properties of this layer as the default style (either as a .qml
file on disk or as a record in the users style table in their personal
qgis.db)
:param categories: the style categories to be saved (since QGIS 3.26)
:return: - a QString with any status messages
- resultFlag: a reference to a flag that ``False`` if we did
not manage to save the default style.
.. seealso:: :py:func:`loadNamedStyle`
.. seealso:: :py:func:`saveNamedStyle`
%End
virtual QString saveDefaultStyle( bool &resultFlag /Out/ ) /Deprecated/;
%Docstring
Save the properties of this layer as the default style (either as a .qml
file on disk or as a record in the users style table in their personal
qgis.db)
:return: - a QString with any status messages
- resultFlag: a reference to a flag that ``False`` if we did
not manage to save the default style.
.. seealso:: :py:func:`loadNamedStyle`
.. seealso:: :py:func:`saveNamedStyle`
.. deprecated:: 3.26
%End
virtual QString saveNamedStyle( const QString &uri, bool &resultFlag /Out/, StyleCategories categories = AllStyleCategories );
%Docstring
Save the properties of this layer as a named style (either as a .qml
file on disk or as a record in the users style table in their personal
qgis.db)
:param uri: the file name or other URI for the style file. First an
attempt will be made to see if this is a file and save to
that, if that fails the qgis.db styles table will be used to
create a style entry who's key matches the URI.
:param categories: the style categories to be saved.
:return: - a QString with any status messages
- resultFlag: a reference to a flag that ``False`` if we did
not manage to save the default style.
.. seealso:: :py:func:`saveDefaultStyle`
%End
virtual QString saveSldStyle( const QString &uri, bool &resultFlag ) const;
%Docstring
Saves the properties of this layer to an SLD format file.
:param uri: uri of destination for exported SLD file.
:param resultFlag: a reference to a flag that will be set to ``False``
if the SLD file could not be generated
:return: a string with any status or error messages
.. seealso:: :py:func:`loadSldStyle`
.. seealso:: :py:func:`saveSldStyleV2`
%End
virtual QString saveSldStyleV2( bool &resultFlag /Out/, const QgsSldExportContext &exportContext ) const;
%Docstring
Saves the properties of this layer to an SLD format file.
:param exportContext: SLD export context
:return: - a string with any status or error messages
- resultFlag: a reference to a flag that ``False`` if the SLD
file could not be generated
.. seealso:: :py:func:`loadSldStyle`
.. versionadded:: 3.30
%End
virtual QString loadSldStyle( const QString &uri, bool &resultFlag );
%Docstring
Attempts to style the layer using the formatting from an SLD type file.
:param uri: uri of source SLD file
:param resultFlag: a reference to a flag that will be set to ``False``
if the SLD file could not be loaded
:return: a string with any status or error messages
.. seealso:: :py:func:`saveSldStyle`
%End
virtual bool readSld( const QDomNode &node, QString &errorMessage );
virtual bool readSymbology( const QDomNode &node, QString &errorMessage,
QgsReadWriteContext &context, StyleCategories categories = AllStyleCategories ) = 0;
%Docstring
Read the symbology for the current layer from the DOM node supplied.
:param node: node that will contain the symbology definition for this
layer.
:param errorMessage: reference to string that will be updated with any
error messages
:param context: reading context (used for transform from relative to
absolute paths)
:param categories: the style categories to be read
:return: ``True`` in case of success.
%End
virtual bool readStyle( const QDomNode &node, QString &errorMessage,
QgsReadWriteContext &context, StyleCategories categories = AllStyleCategories );
%Docstring
Read the style for the current layer from the DOM node supplied.
:param node: node that will contain the style definition for this layer.
:param errorMessage: reference to string that will be updated with any
error messages
:param context: reading context (used for transform from relative to
absolute paths)
:param categories: the style categories to be read
:return: ``True`` in case of success.
.. note::
To be implemented in subclasses. Default implementation does nothing and returns ``False``.
%End
virtual bool writeSymbology( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsReadWriteContext &context,
StyleCategories categories = AllStyleCategories ) const = 0;
%Docstring
Write the style for the layer into the document provided.
:param node: the node that will have the style element added to it.
:param doc: the document that will have the QDomNode added.
:param errorMessage: reference to string that will be updated with any
error messages
:param context: writing context (used for transform from absolute to
relative paths)
:param categories: the style categories to be written
.. note::
There is a confusion of terms with the GUI. This method actually writes what is called a style in the application.
:return: ``True`` in case of success.
%End
virtual bool writeStyle( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsReadWriteContext &context,
StyleCategories categories = AllStyleCategories ) const;
%Docstring
Write just the symbology information for the layer into the document
:param node: the node that will have the style element added to it.
:param doc: the document that will have the QDomNode added.
:param errorMessage: reference to string that will be updated with any
error messages
:param context: writing context (used for transform from absolute to
relative paths)
:param categories: the style categories to be written
:return: ``True`` in case of success.
.. note::
To be implemented in subclasses. Default implementation does nothing and returns ``False``.
.. note::
There is a confusion of terms with the GUI. This method actually writes what is known as the symbology in the application.
%End
void setDataSource( const QString &dataSource, const QString &baseName = QString(), const QString &provider = QString(), bool loadDefaultStyleFlag = false );
%Docstring
Updates the data source of the layer.
The ``dataSource`` argument must specify the new data source string for
the layer. The format varies depending on the specified data
``provider`` in use. See :py:class:`QgsDataSourceUri` and the
documentation for the various :py:class:`QgsMapLayer` subclasses for
further details on data source strings.
The ``baseName`` argument specifies the user-visible name to use for the
layer. (See :py:func:`~QgsMapLayer.name` or
:py:func:`~QgsMapLayer.setName`). If not specified, then the current
name will be left unchanged (since QGIS 3.40).
The ``provider`` argument is used to specify the unique key of the data
provider to use for the layer. This must match one of the values
returned by
:py:func:`QgsProviderRegistry.instance()`->:py:func:`~QgsMapLayer.providerList`.
(See :py:func:`~QgsMapLayer.providerType`). If not specified, then the
current data provider will be used (since QGIS 3.40).
If ``loadDefaultStyleFlag`` is set to ``True`` then the layer's existing
style will be reset to the default for the data source.
.. note::
If ``loadDefaultStyleFlag`` is ``False`` then the layer's renderer and legend will be preserved only
if the geometry type of the new data source matches the current geometry type of the layer.
After setting a new data source callers can test
:py:func:`~QgsMapLayer.isValid` to determine whether the new source and
provider are valid and ready for use. If setting the new data source
fails and the layer returns ``False`` to
:py:func:`~QgsMapLayer.isValid`, then descriptive errors relating to
setting the data source can be retrieved by calling
:py:func:`~QgsMapLayer.error`.
This method was defined in :py:class:`QgsVectorLayer` since 2.10 and was
marked as deprecated since 3.2
.. seealso:: :py:func:`dataSourceChanged`
.. versionadded:: 3.20
%End
void setDataSource( const QString &dataSource, const QString &baseName, const QString &provider, const QgsDataProvider::ProviderOptions &options, bool loadDefaultStyleFlag = false );
%Docstring
Updates the data source of the layer.
The ``dataSource`` argument must specify the new data source string for
the layer. The format varies depending on the specified data
``provider`` in use. See :py:class:`QgsDataSourceUri` and the
documentation for the various :py:class:`QgsMapLayer` subclasses for
further details on data source strings.
The ``baseName`` argument specifies the user-visible name to use for the
layer. (See :py:func:`~QgsMapLayer.name` or
:py:func:`~QgsMapLayer.setName`).
The ``provider`` argument is used to specify the unique key of the data
provider to use for the layer. This must match one of the values
returned by
:py:func:`QgsProviderRegistry.instance()`->:py:func:`~QgsMapLayer.providerList`.
(See :py:func:`~QgsMapLayer.providerType`).
The ``options`` argument can be used to pass additional layer properties
to the new data provider.
If ``loadDefaultStyleFlag`` is set to ``True`` then the layer's existing
style will be reset to the default for the data source.
.. note::
If ``loadDefaultStyleFlag`` is ``False`` then the layer's renderer and legend will be preserved only
if the geometry type of the new data source matches the current geometry type of the layer.
After setting a new data source callers can test
:py:func:`~QgsMapLayer.isValid` to determine whether the new source and
provider are valid and ready for use. If setting the new data source
fails and the layer returns ``False`` to
:py:func:`~QgsMapLayer.isValid`, then descriptive errors relating to
setting the data source can be retrieved by calling
:py:func:`~QgsMapLayer.error`.
.. seealso:: :py:func:`dataSourceChanged`
.. versionadded:: 3.6
%End
void setDataSource( const QString &dataSource, const QString &baseName, const QString &provider, const QgsDataProvider::ProviderOptions &options, Qgis::DataProviderReadFlags flags );
%Docstring
Updates the data source of the layer.
The ``dataSource`` argument must specify the new data source string for
the layer. The format varies depending on the specified data
``provider`` in use. See :py:class:`QgsDataSourceUri` and the
documentation for the various :py:class:`QgsMapLayer` subclasses for
further details on data source strings.
The ``baseName`` argument specifies the user-visible name to use for the
layer. (See :py:func:`~QgsMapLayer.name` or
:py:func:`~QgsMapLayer.setName`).
The ``provider`` argument is used to specify the unique key of the data
provider to use for the layer. This must match one of the values
returned by
:py:func:`QgsProviderRegistry.instance()`->:py:func:`~QgsMapLayer.providerList`.
(See :py:func:`~QgsMapLayer.providerType`).
The ``options`` argument can be used to pass additional layer properties
to the new data provider.
The ``flags`` argument specifies provider read flags which control the
data provider construction, such as
:py:class:`QgsDataProvider`.ReadFlag.FlagTrustDataSource,
:py:class:`QgsDataProvider`.ReadFlag.FlagLoadDefaultStyle, etc.
.. note::
The layer's renderer and legend will be preserved only
if the geometry type of the new data source matches the current geometry type of the layer.
After setting a new data source callers can test
:py:func:`~QgsMapLayer.isValid` to determine whether the new source and
provider are valid and ready for use. If setting the new data source
fails and the layer returns ``False`` to
:py:func:`~QgsMapLayer.isValid`, then descriptive errors relating to
setting the data source can be retrieved by calling
:py:func:`~QgsMapLayer.error`.
.. seealso:: :py:func:`dataSourceChanged`
.. versionadded:: 3.20
%End
QString providerType() const;
%Docstring
Returns the provider type (provider key) for this layer
%End
QUndoStack *undoStack();
%Docstring
Returns pointer to layer's undo stack
%End
QUndoStack *undoStackStyles();
%Docstring
Returns pointer to layer's style undo stack
%End
void setLegendUrl( const QString &legendUrl );
%Docstring
Sets the URL for the layer's legend.
%End
QString legendUrl() const;
%Docstring
Returns the URL for the layer's legend.
%End
void setLegendUrlFormat( const QString &legendUrlFormat );
%Docstring
Sets the format for a URL based layer legend.
%End
QString legendUrlFormat() const;
%Docstring
Returns the format for a URL based layer legend.
%End
void setLegend( QgsMapLayerLegend *legend /Transfer/ );
%Docstring
Assign a legend controller to the map layer. The object will be
responsible for providing legend items.
:param legend: Takes ownership of the object. Can be ``None``.
%End
QgsMapLayerLegend *legend() const;
%Docstring
Can be ``None``.
%End
QgsMapLayerStyleManager *styleManager() const;
%Docstring
Gets access to the layer's style manager. Style manager allows switching
between multiple styles.
%End
void setRenderer3D( QgsAbstract3DRenderer *renderer /Transfer/ );
%Docstring
Sets 3D renderer for the layer. Takes ownership of the renderer.
%End
QgsAbstract3DRenderer *renderer3D() const;
%Docstring
Returns 3D renderer associated with the layer. May be ``None``.
%End
bool isInScaleRange( double scale ) const;
%Docstring
Tests whether the layer should be visible at the specified ``scale``.
The ``scale`` value indicates the scale denominator, e.g. 1000.0 for a
1:1000 map.
:return: ``True`` if the layer is visible at the given scale.
.. seealso:: :py:func:`minimumScale`
.. seealso:: :py:func:`maximumScale`
.. seealso:: :py:func:`hasScaleBasedVisibility`
%End
double minimumScale() const;
%Docstring
Returns the minimum map scale (i.e. most "zoomed out" scale) at which
the layer will be visible. The scale value indicates the scale
denominator, e.g. 1000.0 for a 1:1000 map. A scale of 0 indicates no
minimum scale visibility.
.. note::
Scale based visibility is only used if :py:func:`~QgsMapLayer.setScaleBasedVisibility` is set to ``True``.
.. seealso:: :py:func:`setMinimumScale`
.. seealso:: :py:func:`maximumScale`
.. seealso:: :py:func:`hasScaleBasedVisibility`
.. seealso:: :py:func:`isInScaleRange`
%End
double maximumScale() const;
%Docstring
Returns the maximum map scale (i.e. most "zoomed in" scale) at which the
layer will be visible. The scale value indicates the scale denominator,
e.g. 1000.0 for a 1:1000 map. A scale of 0 indicates no maximum scale
visibility.
.. note::
Scale based visibility is only used if :py:func:`~QgsMapLayer.setScaleBasedVisibility` is set to ``True``.
.. seealso:: :py:func:`setMaximumScale`
.. seealso:: :py:func:`minimumScale`
.. seealso:: :py:func:`hasScaleBasedVisibility`
.. seealso:: :py:func:`isInScaleRange`
%End
bool hasScaleBasedVisibility() const;
%Docstring
Returns whether scale based visibility is enabled for the layer.
:return: ``True`` if scale based visibility is enabled
.. seealso:: :py:func:`minimumScale`
.. seealso:: :py:func:`maximumScale`
.. seealso:: :py:func:`setScaleBasedVisibility`
.. seealso:: :py:func:`isInScaleRange`
%End
bool hasAutoRefreshEnabled() const /Deprecated/;
%Docstring
Returns ``True`` if auto refresh is enabled for the layer.
.. seealso:: :py:func:`autoRefreshInterval`
.. seealso:: :py:func:`setAutoRefreshEnabled`
.. deprecated:: 3.40
Use :py:func:`~QgsMapLayer.autoRefreshMode` instead.
%End
Qgis::AutoRefreshMode autoRefreshMode() const;
%Docstring
Returns the layer's automatic refresh mode.
.. seealso:: :py:func:`autoRefreshInterval`
.. seealso:: :py:func:`setAutoRefreshMode`
.. versionadded:: 3.34
%End
int autoRefreshInterval() const;
%Docstring
Returns the auto refresh interval (in milliseconds). Note that auto
refresh is only active when
:py:func:`~QgsMapLayer.hasAutoRefreshEnabled` is ``True``.
.. seealso:: :py:func:`hasAutoRefreshEnabled`
.. seealso:: :py:func:`setAutoRefreshInterval`
%End
void setAutoRefreshInterval( int interval );
%Docstring
Sets the auto refresh interval (in milliseconds) for the layer. This
will cause the layer to be automatically redrawn on a matching interval.
Note that auto refresh must be enabled by calling
:py:func:`~QgsMapLayer.setAutoRefreshMode`.
Note that auto refresh triggers deferred repaints of the layer. Any map
canvas must be refreshed separately in order to view the refreshed
layer.
.. seealso:: :py:func:`autoRefreshInterval`
.. seealso:: :py:func:`setAutoRefreshEnabled`
%End
void setAutoRefreshEnabled( bool enabled ) /Deprecated/;
%Docstring
Sets whether auto refresh is enabled for the layer.
.. seealso:: :py:func:`hasAutoRefreshEnabled`
.. seealso:: :py:func:`setAutoRefreshInterval`
.. deprecated:: 3.40
Use :py:func:`~QgsMapLayer.setAutoRefreshMode` instead.
%End
void setAutoRefreshMode( Qgis::AutoRefreshMode mode );
%Docstring
Sets the automatic refresh mode for the layer.
.. seealso:: :py:func:`autoRefreshMode`
.. seealso:: :py:func:`setAutoRefreshInterval`
.. versionadded:: 3.34
%End
virtual const QgsLayerMetadata &metadata() const;
%Docstring
Returns a reference to the layer's metadata store.
.. seealso:: :py:func:`setMetadata`
.. seealso:: :py:func:`metadataChanged`
%End
virtual void setMetadata( const QgsLayerMetadata &metadata );
%Docstring
Sets the layer's ``metadata`` store.
.. seealso:: :py:func:`metadata`
.. seealso:: :py:func:`metadataChanged`
%End
virtual QString htmlMetadata() const;
%Docstring
Obtain a formatted HTML string containing assorted metadata for this
layer.
%End
virtual QDateTime timestamp() const;
%Docstring
Time stamp of data source in the moment when data/metadata were loaded
by provider
%End
virtual QSet<QgsMapLayerDependency> dependencies() const;
%Docstring
Gets the list of dependencies. This includes data dependencies set by
the user (:py:func:`setDataDependencies`) as well as dependencies given
by the provider
:return: a set of :py:class:`QgsMapLayerDependency`
%End
QString refreshOnNotifyMessage() const;
%Docstring
Returns the message that should be notified by the provider to
triggerRepaint
%End
bool isRefreshOnNotifyEnabled() const;
%Docstring
Returns ``True`` if the refresh on provider nofification is enabled
%End
QString originalXmlProperties() const;
%Docstring
Returns the XML properties of the original layer as they were when the
layer was first read from the project file. In case of new layers this
is normally empty.
The storage format for the XML is qlr
.. versionadded:: 3.6
%End
void setOriginalXmlProperties( const QString &originalXmlProperties );
%Docstring
Sets the original XML properties for the layer to
``originalXmlProperties``
The storage format for the XML is qlr
.. versionadded:: 3.6
%End
static QString generateId( const QString &layerName );
%Docstring
Generates an unique identifier for this layer, the generate ID is
prefixed by ``layerName``
.. versionadded:: 3.8
%End
virtual bool accept( QgsStyleEntityVisitorInterface *visitor ) const;
%Docstring
Accepts the specified symbology ``visitor``, causing it to visit all
symbols associated with the layer.
Returns ``True`` if the visitor should continue visiting other objects,
or ``False`` if visiting should be canceled.
.. versionadded:: 3.10
%End
virtual QgsMapLayerSelectionProperties *selectionProperties();
%Docstring
Returns the layer's selection properties. This may be ``None``,
depending on the layer type.
.. versionadded:: 3.34
%End
virtual QgsMapLayerTemporalProperties *temporalProperties();
%Docstring
Returns the layer's temporal properties. This may be ``None``, depending
on the layer type.
.. versionadded:: 3.14
%End
virtual QgsMapLayerElevationProperties *elevationProperties();
%Docstring
Returns the layer's elevation properties. This may be ``None``,
depending on the layer type.
.. versionadded:: 3.18
%End
QString legendPlaceholderImage() const;
%Docstring
Returns path to the placeholder image or an empty string if a generated
legend is shown
:return: placeholder image path
.. versionadded:: 3.22
%End
void setLegendPlaceholderImage( const QString &imgPath );
%Docstring
Set placeholder image for legend. If the string is empty, a generated
legend will be shown.
:param imgPath: file path to the placeholder image
.. versionadded:: 3.22
%End
virtual bool hasMapTips() const;
%Docstring
Returns ``True`` if the layer contains map tips.
.. seealso:: :py:func:`mapTipTemplate`
.. seealso:: :py:func:`setMapTipTemplate`
%End
QString mapTipTemplate() const;
%Docstring
The mapTip is a pretty, html representation for feature information.
It may also contain embedded expressions.
.. versionadded:: 3.30
%End
void setMapTipTemplate( const QString &mapTipTemplate );
%Docstring
The mapTip is a pretty, html representation for feature information.
It may also contain embedded expressions.
.. versionadded:: 3.30
%End
void setMapTipsEnabled( bool enabled );
%Docstring
Enable or disable map tips for this layer
:param enabled: Whether map tips are enabled for this layer
.. versionadded:: 3.32
%End
bool mapTipsEnabled() const;
%Docstring
Returns true if map tips are enabled for this layer
.. versionadded:: 3.32
%End
static Qgis::DataProviderReadFlags providerReadFlags( const QDomNode &layerNode, QgsMapLayer::ReadFlags layerReadFlags );
%Docstring
Returns provider read flag deduced from layer read flags
``layerReadFlags`` and a dom node ``layerNode`` that describes a layer
(corresponding to ``maplayer`` tag in a DOM document project file read
by :py:class:`QgsProject`). This static method is used when loading a
project.
.. versionadded:: 3.32
%End
public slots:
void setMinimumScale( double scale );
%Docstring
Sets the minimum map ``scale`` (i.e. most "zoomed out" scale) at which
the layer will be visible. The ``scale`` value indicates the scale
denominator, e.g. 1000.0 for a 1:1000 map. A ``scale`` of 0 indicates no
minimum scale visibility.
.. note::
Scale based visibility is only used if :py:func:`~QgsMapLayer.setScaleBasedVisibility` is set to ``True``.
.. seealso:: :py:func:`minimumScale`
.. seealso:: :py:func:`setMaximumScale`
.. seealso:: :py:func:`setScaleBasedVisibility`
%End
void setMaximumScale( double scale );
%Docstring
Sets the maximum map ``scale`` (i.e. most "zoomed in" scale) at which
the layer will be visible. The ``scale`` value indicates the scale
denominator, e.g. 1000.0 for a 1:1000 map. A ``scale`` of 0 indicates no
maximum scale visibility.
.. note::
Scale based visibility is only used if :py:func:`~QgsMapLayer.setScaleBasedVisibility` is set to ``True``.
.. seealso:: :py:func:`maximumScale`
.. seealso:: :py:func:`setMinimumScale`
.. seealso:: :py:func:`setScaleBasedVisibility`
%End
void setScaleBasedVisibility( bool enabled );
%Docstring
Sets whether scale based visibility is enabled for the layer.
:param enabled: set to ``True`` to enable scale based visibility
.. seealso:: :py:func:`setMinimumScale`
.. seealso:: :py:func:`setMaximumScale`
.. seealso:: :py:func:`hasScaleBasedVisibility`
%End
void triggerRepaint( bool deferredUpdate = false );
%Docstring
Will advise the map canvas (and any other interested party) that this
layer requires to be repainted. Will emit a
:py:func:`~QgsMapLayer.repaintRequested` signal. If ``deferredUpdate``
is ``True`` then the layer will only be repainted when the canvas is
next re-rendered, and will not trigger any canvas redraws itself.
.. note::
in 2.6 function moved from vector/raster subclasses to QgsMapLayer
%End
void trigger3DUpdate();
%Docstring
Will advise any 3D maps that this layer requires to be updated in the
scene. Will emit a :py:func:`~QgsMapLayer.request3DUpdate` signal.
.. versionadded:: 3.18
%End
void emitStyleChanged();
%Docstring
Triggers an emission of the :py:func:`~QgsMapLayer.styleChanged` signal.
%End
virtual bool setDependencies( const QSet<QgsMapLayerDependency> &layers );
%Docstring
Sets the list of dependencies.
.. seealso:: :py:func:`dependencies`
:param layers: set of :py:class:`QgsMapLayerDependency`. Only
user-defined dependencies will be added
:return: ``False`` if a dependency cycle has been detected
%End
void setRefreshOnNotifyEnabled( bool enabled );
%Docstring
Set whether provider notification is connected to triggerRepaint
%End
void setRefreshOnNofifyMessage( const QString &message );
%Docstring
Set the notification message that triggers repaint If refresh on
notification is enabled, the notification will triggerRepaint only if
the notification message is equal to:param message:
%End
virtual void setTransformContext( const QgsCoordinateTransformContext &transformContext ) = 0;
%Docstring
Sets the coordinate transform context to ``transformContext``
.. versionadded:: 3.8
%End
SIP_PYOBJECT __repr__();
%MethodCode
QString str = QStringLiteral( "<QgsMapLayer: '%1' (%2)>" ).arg( sipCpp->name(), sipCpp->dataProvider() ? sipCpp->dataProvider()->name() : QStringLiteral( "Invalid" ) );
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
%End
QgsProject *project() const;
%Docstring
Returns the parent project if this map layer is added to a project.
Otherwise returns ``None``
.. versionadded:: 3.18
%End
signals:
void beforeResolveReferences( QgsProject *project );
%Docstring
Emitted when all layers are loaded and references can be resolved, just
before the references of this layer are resolved.
.. versionadded:: 3.10
%End
void statusChanged( const QString &status );
%Docstring
Emit a signal with status (e.g. to be caught by QgisApp and display a
msg on status bar)
%End
void idChanged( const QString &id );
%Docstring
Emitted when the layer's ID has been changed.
.. seealso:: :py:func:`id`
.. seealso:: :py:func:`setId`
.. versionadded:: 3.38
%End
void nameChanged();
%Docstring
Emitted when the name has been changed
%End
void crsChanged();
%Docstring
Emitted when the :py:func:`~QgsMapLayer.crs` of the layer has changed.
.. seealso:: :py:func:`crs`
.. seealso:: :py:func:`setCrs`
.. seealso:: :py:func:`verticalCrsChanged`
.. seealso:: :py:func:`crs3DChanged`
%End
void crs3DChanged();
%Docstring
Emitted when the :py:func:`~QgsMapLayer.crs3D` of the layer has changed.
.. seealso:: :py:func:`crs3D`
.. seealso:: :py:func:`crsChanged`
.. seealso:: :py:func:`verticalCrsChanged`
.. versionadded:: 3.38
%End
void verticalCrsChanged();
%Docstring
Emitted when the :py:func:`~QgsMapLayer.verticalCrs` of the layer has
changed.
This signal will be emitted whenever the vertical CRS of the layer is
changed, either as a direct result of a call to
:py:func:`~QgsMapLayer.setVerticalCrs` or when
:py:func:`~QgsMapLayer.setCrs` is called with a compound CRS.
.. seealso:: :py:func:`crsChanged`
.. seealso:: :py:func:`crs3DChanged`
.. seealso:: :py:func:`setCrs`
.. seealso:: :py:func:`setVerticalCrs`
.. seealso:: :py:func:`verticalCrs`
.. versionadded:: 3.38
%End
void repaintRequested( bool deferredUpdate = false );
%Docstring
By emitting this signal the layer tells that either appearance or
content have been changed and any view showing the rendered layer should
refresh itself. If ``deferredUpdate`` is ``True`` then the layer will
only be repainted when the canvas is next re-rendered, and will not
trigger any canvas redraws itself.
%End
void recalculateExtents() const;
%Docstring
This is used to send a request that any mapcanvas using this layer
update its extents
%End
void dataChanged();
%Docstring
Data of layer changed
%End
void blendModeChanged( QPainter::CompositionMode blendMode );
%Docstring
Signal emitted when the blend mode is changed, through
:py:func:`QgsMapLayer.setBlendMode()`
%End
void opacityChanged( double opacity );
%Docstring
Emitted when the layer's opacity is changed, where ``opacity`` is a
value between 0 (transparent) and 1 (opaque).
.. seealso:: :py:func:`setOpacity`
.. seealso:: :py:func:`opacity`
.. note::
Prior to QGIS 3.18, this signal was available for vector layers only
.. versionadded:: 3.18
%End
void rendererChanged();
%Docstring
Signal emitted when renderer is changed.
.. seealso:: :py:func:`styleChanged`
%End
void styleChanged();
%Docstring
Signal emitted whenever a change affects the layer's style. Ie this may
be triggered by renderer changes, label style changes, or other style
changes such as blend mode or layer opacity changes.
.. warning::
This signal should never be manually emitted. Instead call the :py:func:`~QgsMapLayer.emitStyleChanged` method
to ensure that the signal is only emitted when appropriate.
.. seealso:: :py:func:`rendererChanged`
%End
void legendChanged();
%Docstring
Signal emitted when legend of the layer has changed
%End
void renderer3DChanged();
%Docstring
Signal emitted when 3D renderer associated with the layer has changed.
%End
void request3DUpdate();
%Docstring
Signal emitted when a layer requires an update in any 3D maps.
.. versionadded:: 3.18
%End
void configChanged();
%Docstring
Emitted whenever the configuration is changed. The project listens to
this signal to be marked as dirty.
%End
void dependenciesChanged();
%Docstring
Emitted when dependencies are changed.
%End
void willBeDeleted();
%Docstring
Emitted in the destructor when the layer is about to be deleted, but it
is still in a perfectly valid state: the last chance for other pieces of
code for some cleanup if they use the layer.
%End
void autoRefreshIntervalChanged( int interval );
%Docstring
Emitted when the auto refresh interval changes.
.. seealso:: :py:func:`setAutoRefreshInterval`
%End
void metadataChanged();
%Docstring
Emitted when the layer's metadata is changed.
.. seealso:: :py:func:`setMetadata`
.. seealso:: :py:func:`metadata`
%End
void flagsChanged();
%Docstring
Emitted when layer's flags have been modified.
.. seealso:: :py:func:`setFlags`
.. seealso:: :py:func:`flags`
.. versionadded:: 3.4
%End
void dataSourceChanged();
%Docstring
Emitted whenever the layer's data source has been changed.
.. seealso:: :py:func:`setDataSource`
.. versionadded:: 3.5
%End
void styleLoaded( QgsMapLayer::StyleCategories categories );
%Docstring
Emitted when a style has been loaded
:param categories: style categories
.. versionadded:: 3.12
%End
void isValidChanged();
%Docstring
Emitted when the validity of this layer changed.
.. versionadded:: 3.16
%End
void customPropertyChanged( const QString &key );
%Docstring
Emitted when a custom property of the layer has been changed or removed.
.. versionadded:: 3.18
%End
void editingStarted();
%Docstring
Emitted when editing on this layer has started.
.. versionadded:: 3.22
%End
void editingStopped();
%Docstring
Emitted when edited changes have been successfully written to the data
provider.
.. versionadded:: 3.22
%End
void layerModified();
%Docstring
Emitted when modifications has been done on layer
.. versionadded:: 3.22
%End
void mapTipTemplateChanged();
%Docstring
Emitted when the map tip template changes
.. versionadded:: 3.30
%End
void mapTipsEnabledChanged();
%Docstring
Emitted when map tips are enabled or disabled for the layer.
.. seealso:: :py:func:`setMapTipsEnabled`
.. versionadded:: 3.32
%End
protected:
void clone( QgsMapLayer *layer ) const;
%Docstring
Copies attributes like name, short name, ... into another layer.
:param layer: The copy recipient
%End
virtual void setExtent( const QgsRectangle &rect );
%Docstring
Sets the extent
%End
virtual void setExtent3D( const QgsBox3D &box );
%Docstring
Sets the extent
.. versionadded:: 3.36
%End
void setValid( bool valid );
%Docstring
Sets whether layer is valid or not
%End
virtual bool readXml( const QDomNode &layer_node, QgsReadWriteContext &context );
%Docstring
Called by :py:func:`~QgsMapLayer.readLayerXML`, used by children to read
state specific to them from project files.
%End
virtual bool writeXml( QDomNode &layer_node, QDomDocument &document, const QgsReadWriteContext &context ) const;
%Docstring
Called by :py:func:`~QgsMapLayer.writeLayerXML`, used by children to
write state specific to them to project files.
%End
virtual QString encodedSource( const QString &source, const QgsReadWriteContext &context ) const;
%Docstring
Called by :py:func:`~QgsMapLayer.writeLayerXML`, used by derived classes
to encode provider's specific data source to project files. Typically
resolving absolute or relative paths, usernames and passwords or drivers
prefixes ("HDF5:")
:param source: data source to encode, typically
:py:func:`QgsMapLayer.source()`
:param context: writing context (e.g. for conversion between relative
and absolute paths)
:return: encoded source, typically to be written in the DOM element
"datasource"
.. versionadded:: 3.2
%End
virtual QString decodedSource( const QString &source, const QString &dataProvider, const QgsReadWriteContext &context ) const;
%Docstring
Called by :py:func:`~QgsMapLayer.readLayerXML`, used by derived classes
to decode provider's specific data source from project files. Typically
resolving absolute or relative paths, usernames and passwords or drivers
prefixes ("HDF5:")
:param source: data source to decode, typically read from layer's DOM
element "datasource"
:param dataProvider: string identification of data provider (e.g.
"ogr"), typically read from layer's DOM element
:param context: reading context (e.g. for conversion between relative
and absolute paths)
:return: decoded source, typically to be used as the layer's datasource
.. versionadded:: 3.2
%End
void readCustomProperties( const QDomNode &layerNode, const QString &keyStartsWith = QString() );
%Docstring
Read custom properties from project file.
:param layerNode: note to read from
:param keyStartsWith: reads only properties starting with the specified
string (or all if the string is empty)
%End
void writeCustomProperties( QDomNode &layerNode, QDomDocument &doc ) const;
%Docstring
Write custom properties to project file.
%End
void readStyleManager( const QDomNode &layerNode );
%Docstring
Read style manager's configuration (if any). To be called by subclasses.
%End
void writeStyleManager( QDomNode &layerNode, QDomDocument &doc ) const;
%Docstring
Write style manager's configuration (if exists). To be called by
subclasses.
%End
void writeCommonStyle( QDomElement &layerElement, QDomDocument &document,
const QgsReadWriteContext &context,
StyleCategories categories = AllStyleCategories ) const;
%Docstring
Write style data common to all layer types
%End
void readCommonStyle( const QDomElement &layerElement, const QgsReadWriteContext &context,
StyleCategories categories = AllStyleCategories );
%Docstring
Read style data common to all layer types
%End
void setProviderType( const QString &providerType );
%Docstring
Sets the ``providerType`` (provider key)
%End
void appendError( const QgsErrorMessage &error );
%Docstring
Add error message
%End
void setError( const QgsError &error );
%Docstring
Sets error message
%End
void invalidateWgs84Extent();
%Docstring
Invalidates the WGS84 extent. If FlagTrustLayerMetadata is enabled, the
extent is not invalidated because we want to trust metadata whatever
happens.
.. versionadded:: 3.20
%End
bool hasDependencyCycle( const QSet<QgsMapLayerDependency> & ) const;
%Docstring
Checks whether a new set of dependencies will introduce a cycle this
method is now deprecated and always return ``False``, because circular
dependencies are now correctly managed.
.. deprecated:: 3.10
%End
};
QFlags<QgsMapLayer::LayerFlag> operator|(QgsMapLayer::LayerFlag f1, QFlags<QgsMapLayer::LayerFlag> f2);
QFlags<QgsMapLayer::StyleCategory> operator|(QgsMapLayer::StyleCategory f1, QFlags<QgsMapLayer::StyleCategory> f2);
QFlags<QgsMapLayer::ReadFlag> operator|(QgsMapLayer::ReadFlag f1, QFlags<QgsMapLayer::ReadFlag> f2);
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsmaplayer.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
|