File: qgsvectorlayer.sip.in

package info (click to toggle)
qgis 3.40.13%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 1,185,160 kB
  • sloc: cpp: 1,615,781; python: 372,865; xml: 23,474; sh: 3,761; perl: 3,664; ansic: 2,829; sql: 2,137; yacc: 1,068; lex: 577; javascript: 540; lisp: 411; makefile: 155
file content (3089 lines) | stat: -rw-r--r-- 103,224 bytes parent folder | download | duplicates (12)
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
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/core/vector/qgsvectorlayer.h                                     *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 ************************************************************************/










typedef QList<int> QgsAttributeList;
typedef QSet<int> QgsAttributeIds;


class QgsVectorLayer : QgsMapLayer, QgsExpressionContextGenerator, QgsExpressionContextScopeGenerator, QgsFeatureSink, QgsFeatureSource, QgsAbstractProfileSource
{
%Docstring(signature="appended")
Represents a vector layer which manages a vector based data sets.

The :py:class:`QgsVectorLayer` is instantiated by specifying the name of
a data provider, such as postgres or wfs, and url defining the specific
data set to connect to. The vector layer constructor in turn
instantiates a :py:class:`QgsVectorDataProvider` subclass corresponding
to the provider type, and passes it the url. The data provider connects
to the data source.

The :py:class:`QgsVectorLayer` provides a common interface to the
different data types. It also manages editing transactions by buffering
layer edits until they are written to the underlying
:py:class:`QgsVectorDataProvider`. Before edits can be made a call to
:py:func:`~startEditing` is required. Any edits made to a
:py:class:`QgsVectorLayer` are then held in memory only, and are not
written to the underlying :py:class:`QgsVectorDataProvider` until a call
to :py:func:`~commitChanges` is made. Buffered edits can be rolled back
and discarded without altering the underlying provider by calling
:py:func:`~rollBack`.

Sample usage of the :py:class:`QgsVectorLayer` class:

.. code-block:: python

         uri = "point?crs=epsg:4326&field=id:integer"
         scratchLayer = QgsVectorLayer(uri, "Scratch point layer",  "memory")

The main data providers supported by QGIS are listed below.

Vector data providers
---------------------

Memory data providerType (memory)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The memory data provider is used to construct in memory data, for
example scratch data or data generated from spatial operations such as
contouring. There is no inherent persistent storage of the data. The
data source uri is constructed. The url specifies the geometry type
("point", "linestring", "polygon",
"multipoint","multilinestring","multipolygon"), optionally followed by
url parameters as follows:

- crs=definition Defines the coordinate reference system to use for the
  layer. definition is any string accepted by
  :py:func:`QgsCoordinateReferenceSystem.createFromString()`
- index=yes Specifies that the layer will be constructed with a spatial
  index
- field=name:type(length,precision) Defines an attribute of the layer.
  Multiple field parameters can be added to the data provider
  definition. type is one of "integer", "double", "string".

An example url is
"Point?crs=epsg:4326&field=id:integer&field=name:string(20)&index=yes"

Since QGIS 3.4 when closing a project, the application shows a warning
about potential data loss if there are any non-empty memory layers
present. If your memory layer should not trigger such warning, it is
possible to suppress that by setting the following custom variable:

.. code-block:: python

         layer.setCustomProperty("skipMemoryLayersCheck", 1)

OGR data provider (ogr)
^^^^^^^^^^^^^^^^^^^^^^^

Accesses data using the OGR drivers
(https://gdal.org/drivers/vector/index.html). The url is the OGR
connection string. A wide variety of data formats can be accessed using
this driver, including file based formats used by many GIS systems,
database formats, and web services. Some of these formats are also
supported by custom data providers listed below.

SpatiaLite data provider (spatialite)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Access data in a SpatiaLite database. The url defines the connection
parameters, table, geometry column, and other attributes. The url can be
constructed using the :py:class:`QgsDataSourceUri` class.

PostgreSQL data provider (postgres)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Connects to a PostgreSQL database. The url defines the connection
parameters, table, geometry column, and other attributes. The url can be
constructed using the :py:class:`QgsDataSourceUri` class.

Microsoft SQL server data provider (mssql)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Connects to a Microsoft SQL server database. The url defines the
connection parameters, table, geometry column, and other attributes. The
url can be constructed using the :py:class:`QgsDataSourceUri` class.

WFS (web feature service) data provider (wfs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Used to access data provided by a web feature service.

The url can be a HTTP url to a WFS server (legacy, e.g.
http://foobar/wfs?TYPENAME=xxx&SRSNAME=yyy[&FILTER=zzz]), or a URI
constructed using the :py:class:`QgsDataSourceUri` class with the
following parameters (note that parameter keys are case sensitive):

- url=string (mandatory): HTTP url to a WFS server endpoint. e.g
  http://foobar/wfs
- typename=string (mandatory): WFS typename
- srsname=string (recommended): SRS like 'EPSG:XXXX'
- username=string
- password=string
- authcfg=string
- version=auto/1.0.0/1.1.0/2.0.0
- sql=string: full SELECT SQL statement with optional WHERE, ORDER BY
  and possibly with JOIN if supported on server
- filter=string: QGIS expression or OGC/FES filter
- restrictToRequestBBOX=1: to download only features in the view extent
  (or more generally in the bounding box of the feature iterator)
- pageSize=number: number of features to retrieve in a single request
  (WFS 2)
- maxNumFeatures=number: maximum number of features to retrieve
  (possibly across several multiple paging requests)
- IgnoreAxisOrientation=1: to ignore EPSG axis order for WFS 1.1 or 2.0
- InvertAxisOrientation=1: to invert axis order
- hideDownloadProgressDialog=1: to hide the download progress dialog
- featureMode=default/simpleFeatures/complexFeatures (QGIS >= 3.44)

The ‘filter’ key value can either be a QGIS expression or an OGC XML
filter. If the value is set to a QGIS expression the driver will turn it
into OGC XML filter before passing it to the WFS server. Beware the QGIS
expression filter only supports” =, !=, <, >, <=, >=, AND, OR, NOT,
LIKE, IS NULL” attribute operators, “BBOX, Disjoint, Intersects,
Touches, Crosses, Contains, Overlaps, Within” spatial binary operators
and the QGIS local “geomFromWKT, geomFromGML” geometry constructor
functions.

Also note:

- You can use various functions available in the QGIS Expression list,
  however the function must exist server side and have the same name and
  arguments to work.
- Use the special ``@geometry`` parameter to provide the layer geometry
  column as input into the spatial binary operators e.g
  ``intersects(@geometry, geomFromWKT('POINT (5 6)'))``

OGC API Features data provider (oapif)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Used to access data provided by a OGC API - Features server.

The URI should be constructed using the :py:class:`QgsDataSourceUri`
class with the following parameters:

- url=string (mandatory): HTTP url to a OGC API - Features landing page.
- typename=string (mandatory): Collection id
- username=string
- password=string
- authcfg=string
- filter=string: QGIS expression (only datetime filtering is forwarded
  to the server)
- restrictToRequestBBOX=1: to download only features in the view extent
  (or more generally in the bounding box of the feature iterator)
- pageSize=number: number of features to retrieve in a single request
- maxNumFeatures=number: maximum number of features to retrieve
  (possibly across several multiple paging requests)
- hideDownloadProgressDialog=1: to hide the download progress dialog.

Delimited text file data provider (delimitedtext)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Accesses data in a delimited text file, for example CSV files generated
by spreadsheets. The contents of the file are split into columns based
on specified delimiter characters. Each record may be represented
spatially either by an X and Y coordinate column, or by a WKT (well
known text) formatted columns.

The url defines the filename, the formatting options (how the text in
the file is divided into data fields, and which fields contain the X,Y
coordinates or WKT text definition. The options are specified as url
query items.

At its simplest the url can just be the filename, in which case it will
be loaded as a CSV formatted file.

The url may include the following items:

- encoding=UTF-8

Defines the character encoding in the file. The default is UTF-8. To use
the default encoding for the operating system use "System".

- type=(csv|regexp|whitespace|plain)

Defines the algorithm used to split records into columns. Records are
defined by new lines, except for csv format files for which quoted
fields may span multiple records. The default type is csv.

- "csv" splits the file based on three sets of characters: delimiter
  characters, quote characters, and escape characters. Delimiter
  characters mark the end of a field. Quote characters enclose a field
  which can contain delimiter characters, and newlines. Escape
  characters cause the following character to be treated literally
  (including delimiter, quote, and newline characters). Escape and quote
  characters must be different from delimiter characters. Escape
  characters that are also quote characters are treated specially - they
  can only escape themselves within quotes. Elsewhere they are treated
  as quote characters. The defaults for delimiter, quote, and escape are
  ',', '"', '"'.
- "regexp" splits each record using a regular expression (see
  QRegularExpression documentation for details).
- "whitespace" splits each record based on whitespace (on or more
  whitespace characters. Leading whitespace in the record is ignored.
- "plain" is provided for backwards compatibility. It is equivalent to
  CSV except that the default quote characters are single and double
  quotes, and there is no escape characters.
- delimiter=characters

Defines the delimiter characters used for csv and plain type files, or
the regular expression for regexp type files. It is a literal string of
characters except that "\t" may be used to represent a tab character.

- quote=characters

Defines the characters that are used as quote characters for csv and
plain type files.

- escape=characters

Defines the characters used to escape delimiter, quote, and newline
characters.

- skipLines=n

Defines the number of lines to ignore at the beginning of the file
(default 0)

- useHeader=(yes|no)

Defines whether the first record in the file (after skipped lines)
contains column names (default yes)

- trimFields=(yes|no)

If yes then leading and trailing whitespace will be removed from fields

- skipEmptyFields=(yes|no)

If yes then empty fields will be discarded (equivalent to concatenating
consecutive delimiters)

- maxFields=#

Specifies the maximum number of fields to load for each record.
Additional fields will be discarded. Default is 0 - load all fields.

- decimalPoint=c

Defines a character that is used as a decimal point in the numeric
columns The default is '.'.

- xField=column yField=column

Defines the name of the columns holding the x and y coordinates for XY
point geometries. If the useHeader is no (ie there are no column names),
then this is the column number (with the first column as 1).

- xyDms=(yes|no)

If yes then the X and Y coordinates are interpreted as
degrees/minutes/seconds format (fairly permissively), or degree/minutes
format.

- wktField=column

Defines the name of the columns holding the WKT geometry definition for
WKT geometries. If the useHeader is no (ie there are no column names),
then this is the column number (with the first column as 1).

- geomType=(point|line|polygon|none)

Defines the geometry type for WKT type geometries. QGIS will only
display one type of geometry for the layer - any others will be ignored
when the file is loaded. By default the provider uses the type of the
first geometry in the file. Use geomType to override this type.

geomType can also be set to none, in which case the layer is loaded
without geometries.

- subset=expression

Defines an expression that will identify a subset of records to display

- crs=crsstring

Defines the coordinate reference system used for the layer. This can be
any string accepted by
:py:func:`QgsCoordinateReferenceSystem.createFromString()`

- subsetIndex=(yes|no)

Determines whether the provider generates an index to improve the
efficiency of subsets. The default is yes

- spatialIndex=(yes|no)

Determines whether the provider generates a spatial index. The default
is no.

- watchFile=(yes|no)

Defines whether the file will be monitored for changes. The default is
to monitor for changes.

- quiet

Errors encountered loading the file will not be reported in a user
dialog if quiet is included (They will still be shown in the output
log).

GPX data provider (gpx)
^^^^^^^^^^^^^^^^^^^^^^^

Provider reads tracks, routes, and waypoints from a GPX file. The url
defines the name of the file, and the type of data to retrieve from it
("track", "route", or "waypoint").

An example url is "/home/user/data/holiday.gpx?type=route"

Grass data provider (grass)
^^^^^^^^^^^^^^^^^^^^^^^^^^^

Provider to display vector data in a GRASS GIS layer.

.. seealso:: :py:class:`QgsVectorLayerUtils`
%End

%TypeHeaderCode
#include "qgsvectorlayer.h"
%End
  public:



    struct LayerOptions
    {

      explicit LayerOptions( bool loadDefaultStyle = true,
                             bool readExtentFromXml = false );
%Docstring
Constructor for LayerOptions.
%End

      explicit LayerOptions( const QgsCoordinateTransformContext &transformContext,
                             bool loadDefaultStyle = true,
                             bool readExtentFromXml = false
                           );
%Docstring
Constructor for LayerOptions.

.. versionadded:: 3.8
%End

      bool loadDefaultStyle;

      bool readExtentFromXml;

      QgsCoordinateTransformContext transformContext;

      Qgis::WkbType fallbackWkbType;

      QgsCoordinateReferenceSystem fallbackCrs;

      bool skipCrsValidation;

      bool forceReadOnly;

      bool loadAllStoredStyles;
    };

    struct DeleteContext
    {

      explicit DeleteContext( bool cascade = false, QgsProject *project = 0 );
%Docstring
Constructor for DeleteContext.
%End

      QList<QgsVectorLayer *> handledLayers( bool includeAuxiliaryLayers = true ) const;
%Docstring
Returns a list of all layers affected by the delete operation.

If ``includeAuxiliaryLayers`` is ``False`` then auxiliary layers will
not be included in the returned list.
%End

      QgsFeatureIds handledFeatures( QgsVectorLayer *layer ) const;
%Docstring
Returns a list of feature IDs from the specified ``layer`` affected by
the delete operation.
%End

      bool cascade;
      QgsProject *project;
    };

    explicit QgsVectorLayer( const QString &path = QString(), const QString &baseName = QString(),
                             const QString &providerLib = "ogr", const QgsVectorLayer::LayerOptions &options = QgsVectorLayer::LayerOptions() );
%Docstring
Constructor - creates a vector layer

The QgsVectorLayer is constructed by instantiating a data provider. The
provider interprets the supplied path (url) of the data source to
connect to and access the data.

:param path: The path or url of the parameter. Typically this encodes
             parameters used by the data provider as url query items.
:param baseName: The name used to represent the layer in the legend
:param providerLib: The name of the data provider, e.g., "memory",
                    "postgres"
:param options: layer load options
%End

    ~QgsVectorLayer();


    SIP_PYOBJECT __repr__();
%MethodCode
    QString str = QStringLiteral( "<QgsVectorLayer: '%1' (%2)>" ).arg( sipCpp->name(), sipCpp->dataProvider() ? sipCpp->dataProvider()->name() : QStringLiteral( "Invalid" ) );
    sipRes = PyUnicode_FromString( str.toUtf8().constData() );
%End

    virtual QgsVectorLayer *clone() const /Factory/;

%Docstring
Returns a new instance equivalent to this one. A new provider is created
for the same data source and renderers for features and diagrams are
cloned too. Moreover, each attributes (transparency, extent, selected
features and so on) are identical.

:return: a new layer instance
%End

    QString storageType() const;
%Docstring
Returns the permanent storage type for this layer as a friendly name.
This is obtained from the data provider and does not follow any
standard.
%End

    QString capabilitiesString() const;
%Docstring
Capabilities for this layer, comma separated and translated.
%End


    bool isSqlQuery() const;
%Docstring
Returns ``True`` if the layer is a query (SQL) layer.

.. note::

   this is simply a shortcut to check if the SqlQuery flag
   is set.

.. seealso:: :py:func:`vectorLayerTypeFlags`

.. versionadded:: 3.24
%End

    Qgis::VectorLayerTypeFlags vectorLayerTypeFlags() const;
%Docstring
Returns the vector layer type flags.

.. seealso:: :py:func:`isSqlQuery`

.. versionadded:: 3.24
%End


    QString dataComment() const;
%Docstring
Returns a description for this layer as defined in the data provider.
%End

    QString displayField() const;
%Docstring
This is a shorthand for accessing the displayExpression if it is a
simple field. If the displayExpression is more complex than a simple
field, a null string will be returned.

.. seealso:: :py:func:`displayExpression`
%End

    void setDisplayExpression( const QString &displayExpression );
%Docstring
Set the preview expression, used to create a human readable preview
string. Used e.g. in the attribute table feature list. Uses
:py:class:`QgsExpression`.

:param displayExpression: The expression which will be used to preview
                          features for this layer
%End

    QString displayExpression() const;
%Docstring
Returns the preview expression, used to create a human readable preview
string. Uses :py:class:`QgsExpression`

:return: The expression which will be used to preview features for this
         layer
%End

    virtual bool hasMapTips() const ${SIP_FINAL};


    virtual QgsVectorDataProvider *dataProvider() ${SIP_FINAL};

    virtual QgsMapLayerSelectionProperties *selectionProperties();

    virtual QgsMapLayerTemporalProperties *temporalProperties();

    virtual QgsMapLayerElevationProperties *elevationProperties();

    virtual QgsAbstractProfileGenerator *createProfileGenerator( const QgsProfileRequest &request ) /Factory/;


    void setProviderEncoding( const QString &encoding );
%Docstring
Sets the text ``encoding`` of the data provider.

An empty ``encoding`` string indicates that the provider should
automatically select the most appropriate encoding.

.. warning::

   Support for setting the provider encoding depends on the underlying data
   provider. Check :py:func:`~QgsVectorLayer.dataProvider`.capabilities() for the :py:class:`QgsVectorDataProvider`.SelectEncoding
   capability in order to determine if the provider supports this ability.
%End

    void setCoordinateSystem();
%Docstring
Setup the coordinate system transformation for the layer
%End

    bool addJoin( const QgsVectorLayerJoinInfo &joinInfo );
%Docstring
Joins another vector layer to this layer

:param joinInfo: join object containing join layer id, target and source
                 field

.. note::

   since 2.6 returns bool indicating whether the join can be added
%End

    bool removeJoin( const QString &joinLayerId );
%Docstring
Removes a vector layer join

:return: ``True`` if join was found and successfully removed
%End

    QgsVectorLayerJoinBuffer *joinBuffer();
%Docstring
Returns the join buffer object.
%End

    const QList<QgsVectorLayerJoinInfo> vectorJoins() const;

    virtual bool setDependencies( const QSet<QgsMapLayerDependency> &layers ) ${SIP_FINAL};

%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

    virtual QSet<QgsMapLayerDependency> dependencies() const ${SIP_FINAL};

%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

    int addExpressionField( const QString &exp, const QgsField &fld );
%Docstring
Add a new field which is calculated by the expression specified

:param exp: The expression which calculates the field
:param fld: The field to calculate

:return: The index of the new field
%End

    void removeExpressionField( int index );
%Docstring
Removes an expression field

:param index: The index of the field
%End

    QString expressionField( int index ) const;
%Docstring
Returns the expression used for a given expression field

:param index: An index of an epxression based (virtual) field

:return: The expression for the field at index
%End

    void updateExpressionField( int index, const QString &exp );
%Docstring
Changes the expression used to define an expression based (virtual)
field

:param index: The index of the expression to change

:param exp: The new expression to set
%End

    QgsActionManager *actions();
%Docstring
Returns all layer actions defined on this layer.

The pointer which is returned directly points to the actions object
which is used by the layer, so any changes are immediately applied.
%End


    int selectedFeatureCount() const;
%Docstring
Returns the number of features that are selected in this layer.

.. seealso:: :py:func:`selectedFeatureIds`
%End

    void selectByRect( QgsRectangle &rect, Qgis::SelectBehavior behavior = Qgis::SelectBehavior::SetSelection );
%Docstring
Selects features found within the search rectangle (in layer's
coordinates)

:param rect: search rectangle
:param behavior: selection type, allows adding to current selection,
                 removing from selection, etc.

.. seealso:: :py:func:`invertSelectionInRectangle`

.. seealso:: :py:func:`selectByExpression`

.. seealso:: :py:func:`selectByIds`
%End

    void selectByExpression( const QString &expression, Qgis::SelectBehavior behavior = Qgis::SelectBehavior::SetSelection, QgsExpressionContext *context = 0 );
%Docstring
Selects matching features using an expression.

:param expression: expression to evaluate to select features
:param behavior: selection type, allows adding to current selection,
                 removing from selection, etc.
:param context: since QGIS 3.26, specifies an optional expression
                context to use when selecting features. If not specified
                a default one will be built.

.. seealso:: :py:func:`selectByRect`

.. seealso:: :py:func:`selectByIds`
%End

    void selectByIds( const QgsFeatureIds &ids, Qgis::SelectBehavior behavior = Qgis::SelectBehavior::SetSelection );
%Docstring
Selects matching features using a list of feature IDs. Will emit the
:py:func:`~QgsVectorLayer.selectionChanged` signal with the
clearAndSelect flag set.

:param ids: feature IDs to select
:param behavior: selection type, allows adding to current selection,
                 removing from selection, etc.

.. seealso:: :py:func:`selectByRect`

.. seealso:: :py:func:`selectByExpression`
%End

    void modifySelection( const QgsFeatureIds &selectIds, const QgsFeatureIds &deselectIds );
%Docstring
Modifies the current selection on this layer

:param selectIds: Select these ids
:param deselectIds: Deselect these ids

.. seealso:: :py:func:`selectByIds`

.. seealso:: :py:func:`deselect`

.. seealso:: :py:func:`deselect`

.. seealso:: :py:func:`selectByExpression`
%End

    void invertSelection();
%Docstring
Selects not selected features and deselects selected ones
%End

    void selectAll();
%Docstring
Select all the features
%End

    void invertSelectionInRectangle( QgsRectangle &rect );
%Docstring
Inverts selection of features found within the search rectangle (in
layer's coordinates)

:param rect: The rectangle in which the selection of features will be
             inverted

.. seealso:: :py:func:`invertSelection`
%End

    QgsFeatureList selectedFeatures() const;
%Docstring
Returns a copy of the user-selected features.

.. warning::

   Calling this method triggers a request for all attributes and geometry for the selected features.
   Consider using the much more efficient :py:func:`~QgsVectorLayer.selectedFeatureIds` or :py:func:`~QgsVectorLayer.selectedFeatureCount` if you do not
   require access to the feature attributes or geometry.

:return: A list of :py:class:`QgsFeature`

.. seealso:: :py:func:`selectedFeatureIds`

.. seealso:: :py:func:`getSelectedFeatures` which is more memory friendly when handling large selections
%End

    QgsFeatureIterator getSelectedFeatures( QgsFeatureRequest request = QgsFeatureRequest() ) const;
%Docstring
Returns an iterator of the selected features.

:param request: You may specify a request, e.g. to limit the set of
                requested attributes. Any filter on the request will be
                discarded.

:return: Iterator over the selected features

.. warning::

   Calling this method returns an iterator for all attributes and geometry for the selected features.
   Consider using the much more efficient :py:func:`~QgsVectorLayer.selectedFeatureIds` or :py:func:`~QgsVectorLayer.selectedFeatureCount` if you do not
   require access to the feature attributes or geometry.

.. seealso:: :py:func:`selectedFeatureIds`

.. seealso:: :py:func:`selectedFeatures`
%End

    const QgsFeatureIds &selectedFeatureIds() const;
%Docstring
Returns a list of the selected features IDs in this layer.

.. seealso:: :py:func:`selectedFeatures`

.. seealso:: :py:func:`selectedFeatureCount`

.. seealso:: :py:func:`selectByIds`
%End

    QgsRectangle boundingBoxOfSelected() const;
%Docstring
Returns the bounding box of the selected features. If there is no
selection, QgsRectangle(0,0,0,0) is returned
%End

    bool labelsEnabled() const;
%Docstring
Returns whether the layer contains labels which are enabled and should
be drawn.

:return: ``True`` if layer contains enabled labels

.. seealso:: :py:func:`setLabelsEnabled`
%End

    void setLabelsEnabled( bool enabled );
%Docstring
Sets whether labels should be ``enabled`` for the layer.

.. note::

   Labels will only be rendered if :py:func:`~QgsVectorLayer.labelsEnabled` is ``True`` and a labeling
   object is returned by :py:func:`~QgsVectorLayer.labeling`.

.. seealso:: :py:func:`labelsEnabled`

.. seealso:: :py:func:`labeling`
%End

    bool diagramsEnabled() const;
%Docstring
Returns whether the layer contains diagrams which are enabled and should
be drawn.

:return: ``True`` if layer contains enabled diagrams
%End

    void setDiagramRenderer( QgsDiagramRenderer *r /Transfer/ );
%Docstring
Sets diagram rendering object (takes ownership)
%End
    const QgsDiagramRenderer *diagramRenderer() const;

    void setDiagramLayerSettings( const QgsDiagramLayerSettings &s );
    const QgsDiagramLayerSettings *diagramLayerSettings() const;

    QgsFeatureRenderer *renderer();
%Docstring
Returns the feature renderer used for rendering the features in the
layer in 2D map views.

.. seealso:: :py:func:`setRenderer`
%End


    void setRenderer( QgsFeatureRenderer *r /Transfer/ );
%Docstring
Sets the feature renderer which will be invoked to represent this layer
in 2D map views. Ownership is transferred.

.. seealso:: :py:func:`renderer`
%End

    void addFeatureRendererGenerator( QgsFeatureRendererGenerator *generator /Transfer/ );
%Docstring
Adds a new feature renderer ``generator`` to the layer.

Ownership of ``generator`` is transferred to the layer.

.. seealso:: :py:func:`removeFeatureRendererGenerator`

.. seealso:: :py:func:`featureRendererGenerators`

.. versionadded:: 3.18
%End

    void removeFeatureRendererGenerator( const QString &id );
%Docstring
Removes the feature renderer with matching ``id`` from the layer.

The corresponding generator will be deleted.

.. seealso:: :py:func:`addFeatureRendererGenerator`

.. seealso:: :py:func:`featureRendererGenerators`

.. versionadded:: 3.18
%End

    QList< const QgsFeatureRendererGenerator * > featureRendererGenerators() const;
%Docstring
Returns a list of the feature renderer generators owned by the layer.

.. seealso:: :py:func:`addFeatureRendererGenerator`

.. seealso:: :py:func:`removeFeatureRendererGenerator`

.. versionadded:: 3.18
%End

    Qgis::GeometryType geometryType() const;
%Docstring
Returns point, line or polygon
%End

    virtual Qgis::WkbType wkbType() const ${SIP_FINAL};

%Docstring
Returns the WKBType or WKBUnknown in case of error
%End

    virtual QgsCoordinateReferenceSystem sourceCrs() const ${SIP_FINAL};

    virtual QString sourceName() const ${SIP_FINAL};


    virtual bool readXml( const QDomNode &layer_node, QgsReadWriteContext &context ) ${SIP_FINAL};

%Docstring
Reads vector layer specific state from project file Dom node.

.. note::

   Called by :py:func:`QgsMapLayer.readXml()`.
%End

    virtual bool writeXml( QDomNode &layer_node, QDomDocument &doc, const QgsReadWriteContext &context ) const ${SIP_FINAL};

%Docstring
Writes vector layer specific state to project file Dom node.

.. note::

   Called by :py:func:`QgsMapLayer.writeXml()`.
%End

    virtual QString encodedSource( const QString &source, const QgsReadWriteContext &context ) const ${SIP_FINAL};

    virtual QString decodedSource( const QString &source, const QString &provider, const QgsReadWriteContext &context ) const ${SIP_FINAL};


    virtual void resolveReferences( QgsProject *project ) ${SIP_FINAL};

%Docstring
Resolves references to other layers (kept as layer IDs after reading
XML) into layer objects.
%End

    bool loadAuxiliaryLayer( const QgsAuxiliaryStorage &storage, const QString &key = QString() );
%Docstring
Loads the auxiliary layer for this vector layer. If there's no
corresponding table in the database, then nothing happens and ``False``
is returned. The key is optional because if this layer has been read
from a XML document, then the key read in this document is used by
default.

:param storage: The auxiliary storage where to look for the table
:param key: The key to use for joining.

:return: ``True`` if the auxiliary layer is well loaded, ``False``
         otherwise
%End

    void setAuxiliaryLayer( QgsAuxiliaryLayer *layer /Transfer/ = 0 );
%Docstring
Sets the current auxiliary layer. The auxiliary layer is automatically
put in editable mode and fields are updated. Moreover, a join is created
between the current layer and the auxiliary layer. Ownership is
transferred.
%End

    QgsAuxiliaryLayer *auxiliaryLayer();
%Docstring
Returns the current auxiliary layer.
%End


     virtual bool readSymbology( const QDomNode &layerNode, QString &errorMessage,
                        QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories ) ${SIP_FINAL};
     virtual bool readStyle( const QDomNode &node, QString &errorMessage,
                    QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories ) ${SIP_FINAL};
     virtual bool writeSymbology( QDomNode &node, QDomDocument &doc, QString &errorMessage,
                         const QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories ) const ${SIP_FINAL};
     virtual bool writeStyle( QDomNode &node, QDomDocument &doc, QString &errorMessage,
                     const QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories ) const ${SIP_FINAL};

    bool writeSld( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QVariantMap &props = QVariantMap() ) const;
%Docstring
Writes the symbology of the layer into the document provided in SLD 1.1
format

: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 props: a open ended set of properties that can drive/inform the
              SLD encoding

:return: ``True`` in case of success
%End

    virtual bool readSld( const QDomNode &node, QString &errorMessage ) ${SIP_FINAL};


    long long featureCount( const QString &legendKey ) const;
%Docstring
Number of features rendered with specified legend key. Features must be
first calculated by :py:func:`~QgsVectorLayer.countSymbolFeatures`

:return: number of features rendered by symbol or -1 if failed or counts
         are not available
%End

    QgsFeatureIds symbolFeatureIds( const QString &legendKey ) const;
%Docstring
Ids of features rendered with specified legend key. Features must be
first calculated by :py:func:`~QgsVectorLayer.countSymbolFeatures`

:return: Ids of features rendered by symbol or -1 if failed or Ids are
         not available

.. versionadded:: 3.10
%End

    virtual Qgis::FeatureAvailability hasFeatures() const ${SIP_FINAL};

%Docstring
Determines if this vector layer has features.

.. warning::

   when a layer is editable and some features
   have been deleted, this will return
   :py:class:`QgsFeatureSource`.FeatureAvailability.FeaturesMayBeAvailable
   to avoid a potentially expensive call to the dataprovider.

.. versionadded:: 3.4
%End

    virtual QString loadDefaultStyle( bool &resultFlag /Out/ ) ${SIP_FINAL};


    QgsVectorLayerFeatureCounter *countSymbolFeatures( bool storeSymbolFids = false );
%Docstring
Count features for symbols. The method will return the feature counter
task. You will need to connect to the
:py:func:`~QgsVectorLayer.symbolFeatureCountMapChanged` signal to be
notified when the freshly updated feature counts are ready.

:param storeSymbolFids: If ``True`` will gather the feature ids (fids)
                        per symbol, otherwise only the count. Default
                        ``False``.

.. note::

   If the count features for symbols has been already done a
   ``None`` is returned. If you need to wait for the results,
   you can call :py:func:`~QgsVectorLayer.waitForFinished` on the feature counter.
%End

    virtual bool setSubsetString( const QString &subset );
%Docstring
Sets the string (typically sql) used to define a subset of the layer

:param subset: The subset string. This may be the where clause of a sql
               statement or other definition string specific to the
               underlying dataprovider and data store.

:return: ``True``, when setting the subset string was successful,
         ``False`` otherwise
%End

    virtual QString subsetString() const;
%Docstring
Returns the string (typically sql) used to define a subset of the layer.

:return: The subset string or null QString if not implemented by the
         provider
%End

    virtual QgsFeatureIterator getFeatures( const QgsFeatureRequest &request = QgsFeatureRequest() ) const ${SIP_FINAL};

%Docstring
Queries the layer for features specified in request.

:param request: feature request describing parameters of features to
                return

:return: iterator for matching features from provider
%End

    QgsFeatureIterator getFeatures( const QString &expression );
%Docstring
Queries the layer for features matching a given expression.
%End

    QgsFeature getFeature( QgsFeatureId fid ) const;
%Docstring
Queries the layer for the feature with the given id. If there is no such
feature, the returned feature will be invalid.
%End

    QgsGeometry getGeometry( QgsFeatureId fid ) const;
%Docstring
Queries the layer for the geometry at the given id. If there is no such
feature, the returned geometry will be invalid.
%End

    QgsFeatureIterator getFeatures( const QgsFeatureIds &fids );
%Docstring
Queries the layer for the features with the given ids.
%End

    QgsFeatureIterator getFeatures( const QgsRectangle &rectangle );
%Docstring
Queries the layer for the features which intersect the specified
rectangle.
%End

    virtual bool addFeature( QgsFeature &feature, QgsFeatureSink::Flags flags = QgsFeatureSink::Flags() ) ${SIP_FINAL};


    bool updateFeature( QgsFeature &feature, bool skipDefaultValues = false );
%Docstring
Updates an existing ``feature`` in the layer, replacing the attributes
and geometry for the feature with matching :py:func:`QgsFeature.id()`
with the attributes and geometry from ``feature``. Changes are not
immediately committed to the layer.

If ``skipDefaultValue`` is set to ``True``, default field values will
not be updated. This can be used to override default field value
expressions.

Returns ``True`` if the feature's attribute was successfully changed.

.. note::

   Calls to :py:func:`~QgsVectorLayer.updateFeature` are only valid for layers in which edits have been enabled
   by a call to :py:func:`~QgsVectorLayer.startEditing`. Changes made to features using this method are not committed
   to the underlying data provider until a :py:func:`~QgsVectorLayer.commitChanges` call is made. Any uncommitted
   changes can be discarded by calling :py:func:`~QgsVectorLayer.rollBack`.

.. warning::

   This method needs to query the underlying data provider to fetch the feature
   with matching :py:func:`QgsFeature.id()` on every call. Depending on the underlying data source this
   can be slow to execute. Consider using the more efficient :py:func:`~QgsVectorLayer.changeAttributeValue` or
   :py:func:`~QgsVectorLayer.changeGeometry` methods instead.

.. seealso:: :py:func:`startEditing`

.. seealso:: :py:func:`commitChanges`

.. seealso:: :py:func:`changeGeometry`

.. seealso:: :py:func:`changeAttributeValue`
%End

    bool insertVertex( double x, double y, QgsFeatureId atFeatureId, int beforeVertex );
%Docstring
Inserts a new vertex before the given vertex number, in the given ring,
item (first number is index 0), and feature.

Not meaningful for Point geometries

.. note::

   Calls to :py:func:`~QgsVectorLayer.insertVertex` are only valid for layers in which edits have been enabled
   by a call to :py:func:`~QgsVectorLayer.startEditing`. Changes made to features using this method are not committed
   to the underlying data provider until a :py:func:`~QgsVectorLayer.commitChanges` call is made. Any uncommitted
   changes can be discarded by calling :py:func:`~QgsVectorLayer.rollBack`.
%End

    bool insertVertex( const QgsPoint &point, QgsFeatureId atFeatureId, int beforeVertex );
%Docstring
Inserts a new vertex before the given vertex number, in the given ring,
item (first number is index 0), and feature.

Not meaningful for Point geometries

.. note::

   Calls to :py:func:`~QgsVectorLayer.insertVertex` are only valid for layers in which edits have been enabled
   by a call to :py:func:`~QgsVectorLayer.startEditing`. Changes made to features using this method are not committed
   to the underlying data provider until a :py:func:`~QgsVectorLayer.commitChanges` call is made. Any uncommitted
   changes can be discarded by calling :py:func:`~QgsVectorLayer.rollBack`.
%End

    bool moveVertex( double x, double y, QgsFeatureId atFeatureId, int atVertex );
%Docstring
Moves the vertex at the given position number, ring and item (first
number is index 0), and feature to the given coordinates.

.. note::

   Calls to :py:func:`~QgsVectorLayer.moveVertex` are only valid for layers in which edits have been enabled
   by a call to :py:func:`~QgsVectorLayer.startEditing`. Changes made to features using this method are not committed
   to the underlying data provider until a :py:func:`~QgsVectorLayer.commitChanges` call is made. Any uncommitted
   changes can be discarded by calling :py:func:`~QgsVectorLayer.rollBack`.
%End

    bool moveVertex( const QgsPoint &p, QgsFeatureId atFeatureId, int atVertex ) /PyName=moveVertexV2/;
%Docstring
Moves the vertex at the given position number, ring and item (first
number is index 0), and feature to the given coordinates.



.. note::

   Calls to :py:func:`~QgsVectorLayer.moveVertex` are only valid for layers in which edits have been enabled
   by a call to :py:func:`~QgsVectorLayer.startEditing`. Changes made to features using this method are not committed
   to the underlying data provider until a :py:func:`~QgsVectorLayer.commitChanges` call is made. Any uncommitted
   changes can be discarded by calling :py:func:`~QgsVectorLayer.rollBack`.
%End

    Qgis::VectorEditResult deleteVertex( QgsFeatureId featureId, int vertex );
%Docstring
Deletes a vertex from a feature.

:param featureId: ID of feature to remove vertex from
:param vertex: index of vertex to delete

.. note::

   Calls to :py:func:`~QgsVectorLayer.deleteVertex` are only valid for layers in which edits have been enabled
   by a call to :py:func:`~QgsVectorLayer.startEditing`. Changes made to features using this method are not committed
   to the underlying data provider until a :py:func:`~QgsVectorLayer.commitChanges` call is made. Any uncommitted
   changes can be discarded by calling :py:func:`~QgsVectorLayer.rollBack`.
%End

    bool deleteSelectedFeatures( int *deletedCount = 0, QgsVectorLayer::DeleteContext *context = 0 );
%Docstring
Deletes the selected features

:param deletedCount: The number of successfully deleted features
:param context: The chain of features who will be deleted for feedback
                and to avoid endless recursions

:return: ``True`` in case of success and ``False`` otherwise
%End

 Qgis::GeometryOperationResult addRing( const QVector<QgsPointXY> &ring, QgsFeatureId *featureId = 0 ) /Deprecated/;
%Docstring
Adds a ring to polygon/multipolygon features

:param ring: ring to add
:param featureId: if specified, feature ID for feature ring was added to
                  will be stored in this parameter

:return: :py:class:`Qgis`.GeometryOperationResult

         - Success
         - LayerNotEditable
         - AddRingNotInExistingFeature
         - InvalidInputGeometryType
         - AddRingNotClosed
         - AddRingNotValid
         - AddRingCrossesExistingRings

.. note::

   Calls to :py:func:`~QgsVectorLayer.addRing` are only valid for layers in which edits have been enabled
   by a call to :py:func:`~QgsVectorLayer.startEditing`. Changes made to features using this method are not committed
   to the underlying data provider until a :py:func:`~QgsVectorLayer.commitChanges` call is made. Any uncommitted
   changes can be discarded by calling :py:func:`~QgsVectorLayer.rollBack`.

.. deprecated:: 3.12

   Will be removed in QGIS 4.0. Use the variant which accepts :py:class:`QgsPoint` objects instead of :py:class:`QgsPointXY`.
%End


    Qgis::GeometryOperationResult addRing( const QgsPointSequence &ring, QgsFeatureId *featureId = 0 );
%Docstring
Adds a ring to polygon/multipolygon features

:param ring: ring to add
:param featureId: if specified, feature ID for feature ring was added to
                  will be stored in this parameter

:return: :py:class:`Qgis`.GeometryOperationResult

         - Success
         - LayerNotEditable
         - AddRingNotInExistingFeature
         - InvalidInputGeometryType
         - AddRingNotClosed
         - AddRingNotValid
         - AddRingCrossesExistingRings

.. note::

   Calls to :py:func:`~QgsVectorLayer.addRing` are only valid for layers in which edits have been enabled
   by a call to :py:func:`~QgsVectorLayer.startEditing`. Changes made to features using this method are not committed
   to the underlying data provider until a :py:func:`~QgsVectorLayer.commitChanges` call is made. Any uncommitted
   changes can be discarded by calling :py:func:`~QgsVectorLayer.rollBack`.
%End

    Qgis::GeometryOperationResult addRing( QgsCurve *ring /Transfer/, QgsFeatureId *featureId = 0 ) /PyName=addCurvedRing/;
%Docstring
Adds a ring to polygon/multipolygon features (takes ownership)

:param ring: ring to add
:param featureId: if specified, feature ID for feature ring was added to
                  will be stored in this parameter

:return: :py:class:`Qgis`.GeometryOperationResult

         - Success
         - LayerNotEditable
         - AddRingNotInExistingFeature
         - InvalidInputGeometryType
         - AddRingNotClosed
         - AddRingNotValid
         - AddRingCrossesExistingRings



.. note::

   Calls to :py:func:`~QgsVectorLayer.addRing` are only valid for layers in which edits have been enabled
   by a call to :py:func:`~QgsVectorLayer.startEditing`. Changes made to features using this method are not committed
   to the underlying data provider until a :py:func:`~QgsVectorLayer.commitChanges` call is made. Any uncommitted
   changes can be discarded by calling :py:func:`~QgsVectorLayer.rollBack`.
%End

 Qgis::GeometryOperationResult addPart( const QList<QgsPointXY> &ring ) /Deprecated/;
%Docstring
Adds a new part polygon to a multipart feature

:return: :py:class:`Qgis`.GeometryOperationResult

         - Success
         - LayerNotEditable
         - SelectionIsEmpty
         - SelectionIsGreaterThanOne
         - AddPartSelectedGeometryNotFound
         - AddPartNotMultiGeometry
         - InvalidBaseGeometry
         - InvalidInputGeometryType

.. note::

   Calls to :py:func:`~QgsVectorLayer.addPart` are only valid for layers in which edits have been enabled
   by a call to :py:func:`~QgsVectorLayer.startEditing`. Changes made to features using this method are not committed
   to the underlying data provider until a :py:func:`~QgsVectorLayer.commitChanges` call is made. Any uncommitted
   changes can be discarded by calling :py:func:`~QgsVectorLayer.rollBack`.

.. deprecated:: 3.12

   Will be removed in QGIS 4.0. Use the variant which accepts :py:class:`QgsPoint` objects instead of :py:class:`QgsPointXY`.
%End


 Qgis::GeometryOperationResult addPart( const QVector<QgsPointXY> &ring ) /PyName=addPartV2,Deprecated/;
%Docstring
Adds a new part polygon to a multipart feature

:return: :py:class:`Qgis`.GeometryOperationResult

         - Success
         - LayerNotEditable
         - SelectionIsEmpty
         - SelectionIsGreaterThanOne
         - AddPartSelectedGeometryNotFound
         - AddPartNotMultiGeometry
         - InvalidBaseGeometry
         - InvalidInputGeometryType

.. note::

   available in Python bindings as addPartV2

.. note::

   Calls to :py:func:`~QgsVectorLayer.addPart` are only valid for layers in which edits have been enabled
   by a call to :py:func:`~QgsVectorLayer.startEditing`. Changes made to features using this method are not committed
   to the underlying data provider until a :py:func:`~QgsVectorLayer.commitChanges` call is made. Any uncommitted
   changes can be discarded by calling :py:func:`~QgsVectorLayer.rollBack`.

.. deprecated:: 3.12

   Will be removed in QGIS 4.0. Use the variant which accepts :py:class:`QgsPoint` objects instead of :py:class:`QgsPointXY`.
%End

    Qgis::GeometryOperationResult addPart( const QgsPointSequence &ring ) /PyName=addPartV2/;
%Docstring
Adds a new part polygon to a multipart feature

:return: :py:class:`Qgis`.GeometryOperationResult

         - Success
         - LayerNotEditable
         - SelectionIsEmpty
         - SelectionIsGreaterThanOne
         - AddPartSelectedGeometryNotFound
         - AddPartNotMultiGeometry
         - InvalidBaseGeometry
         - InvalidInputGeometryType



.. note::

   Calls to :py:func:`~QgsVectorLayer.addPart` are only valid for layers in which edits have been enabled
   by a call to :py:func:`~QgsVectorLayer.startEditing`. Changes made to features using this method are not committed
   to the underlying data provider until a :py:func:`~QgsVectorLayer.commitChanges` call is made. Any uncommitted
   changes can be discarded by calling :py:func:`~QgsVectorLayer.rollBack`.
%End

    Qgis::GeometryOperationResult addPart( QgsCurve *ring /Transfer/ ) /PyName=addCurvedPart/;
%Docstring
.. note::

   Calls to :py:func:`~QgsVectorLayer.addPart` are only valid for layers in which edits have been enabled
   by a call to :py:func:`~QgsVectorLayer.startEditing`. Changes made to features using this method are not committed
   to the underlying data provider until a :py:func:`~QgsVectorLayer.commitChanges` call is made. Any uncommitted
   changes can be discarded by calling :py:func:`~QgsVectorLayer.rollBack`.
%End

    int translateFeature( QgsFeatureId featureId, double dx, double dy );
%Docstring
Translates feature by dx, dy

:param featureId: id of the feature to translate
:param dx: translation of x-coordinate
:param dy: translation of y-coordinate

:return: 0 in case of success

.. note::

   Calls to :py:func:`~QgsVectorLayer.translateFeature` are only valid for layers in which edits have been enabled
   by a call to :py:func:`~QgsVectorLayer.startEditing`. Changes made to features using this method are not committed
   to the underlying data provider until a :py:func:`~QgsVectorLayer.commitChanges` call is made. Any uncommitted
   changes can be discarded by calling :py:func:`~QgsVectorLayer.rollBack`.
%End

 Qgis::GeometryOperationResult splitParts( const QVector<QgsPointXY> &splitLine, bool topologicalEditing = false ) /Deprecated/;
%Docstring
Splits parts cut by the given line

:param splitLine: line that splits the layer features
:param topologicalEditing: ``True`` if topological editing is enabled

:return: :py:class:`Qgis`.GeometryOperationResult

         - Success
         - NothingHappened
         - LayerNotEditable
         - InvalidInputGeometryType
         - InvalidBaseGeometry
         - GeometryEngineError
         - SplitCannotSplitPoint

.. note::

   Calls to :py:func:`~QgsVectorLayer.splitParts` are only valid for layers in which edits have been enabled
   by a call to :py:func:`~QgsVectorLayer.startEditing`. Changes made to features using this method are not committed
   to the underlying data provider until a :py:func:`~QgsVectorLayer.commitChanges` call is made. Any uncommitted
   changes can be discarded by calling :py:func:`~QgsVectorLayer.rollBack`.

.. deprecated:: 3.12

   Will be removed in QGIS 4.0. Use the variant which accepts :py:class:`QgsPoint` objects instead of :py:class:`QgsPointXY`.
%End

    Qgis::GeometryOperationResult splitParts( const QgsPointSequence &splitLine, bool topologicalEditing = false );
%Docstring
Splits parts cut by the given line

:param splitLine: line that splits the layer features
:param topologicalEditing: ``True`` if topological editing is enabled

:return: :py:class:`Qgis`.GeometryOperationResult

         - Success
         - NothingHappened
         - LayerNotEditable
         - InvalidInputGeometryType
         - InvalidBaseGeometry
         - GeometryEngineError
         - SplitCannotSplitPoint

.. note::

   Calls to :py:func:`~QgsVectorLayer.splitParts` are only valid for layers in which edits have been enabled
   by a call to :py:func:`~QgsVectorLayer.startEditing`. Changes made to features using this method are not committed
   to the underlying data provider until a :py:func:`~QgsVectorLayer.commitChanges` call is made. Any uncommitted
   changes can be discarded by calling :py:func:`~QgsVectorLayer.rollBack`.
%End

 Qgis::GeometryOperationResult splitFeatures( const QVector<QgsPointXY> &splitLine, bool topologicalEditing = false ) /Deprecated/;
%Docstring
Splits features cut by the given line

:param splitLine: line that splits the layer features
:param topologicalEditing: ``True`` if topological editing is enabled

:return: :py:class:`Qgis`.GeometryOperationResult

         - Success
         - NothingHappened
         - LayerNotEditable
         - InvalidInputGeometryType
         - InvalidBaseGeometry
         - GeometryEngineError
         - SplitCannotSplitPoint

.. note::

   Calls to :py:func:`~QgsVectorLayer.splitFeatures` are only valid for layers in which edits have been enabled
   by a call to :py:func:`~QgsVectorLayer.startEditing`. Changes made to features using this method are not committed
   to the underlying data provider until a :py:func:`~QgsVectorLayer.commitChanges` call is made. Any uncommitted
   changes can be discarded by calling :py:func:`~QgsVectorLayer.rollBack`.

.. deprecated:: 3.12

   Will be removed in QGIS 4.0. Use the variant which accepts :py:class:`QgsPoint` objects instead of :py:class:`QgsPointXY`.
%End

    Qgis::GeometryOperationResult splitFeatures( const QgsPointSequence &splitLine, bool topologicalEditing = false );
%Docstring
Splits features cut by the given line

:param splitLine: line that splits the layer features
:param topologicalEditing: ``True`` if topological editing is enabled

:return: :py:class:`Qgis`.GeometryOperationResult

         - Success
         - NothingHappened
         - LayerNotEditable
         - InvalidInputGeometryType
         - InvalidBaseGeometry
         - GeometryEngineError
         - SplitCannotSplitPoint

.. note::

   Calls to :py:func:`~QgsVectorLayer.splitFeatures` are only valid for layers in which edits have been enabled
   by a call to :py:func:`~QgsVectorLayer.startEditing`. Changes made to features using this method are not committed
   to the underlying data provider until a :py:func:`~QgsVectorLayer.commitChanges` call is made. Any uncommitted
   changes can be discarded by calling :py:func:`~QgsVectorLayer.rollBack`.
%End

    Qgis::GeometryOperationResult splitFeatures( const QgsCurve *curve, QgsPointSequence &topologyTestPoints /Out/, bool preserveCircular = false, bool topologicalEditing = false );
%Docstring
Splits features cut by the given curve

:param curve: curve that splits the layer features
:param preserveCircular: whether circular strings are preserved after
                         splitting
:param topologicalEditing: ``True`` if topological editing is enabled

:return: - :py:class:`Qgis`.GeometryOperationResult

           - Success
           - NothingHappened
           - LayerNotEditable
           - InvalidInputGeometryType
           - InvalidBaseGeometry
           - GeometryEngineError
           - SplitCannotSplitPoint

         - topologyTestPoints: topological points to be tested against other layers

.. note::

   Calls to :py:func:`~QgsVectorLayer.splitFeatures` are only valid for layers in which edits have been enabled
   by a call to :py:func:`~QgsVectorLayer.startEditing`. Changes made to features using this method are not committed
   to the underlying data provider until a :py:func:`~QgsVectorLayer.commitChanges` call is made. Any uncommitted
   changes can be discarded by calling :py:func:`~QgsVectorLayer.rollBack`.

.. versionadded:: 3.16
%End

    int addTopologicalPoints( const QgsGeometry &geom );
%Docstring
Adds topological points for every vertex of the geometry.

:param geom: the geometry where each vertex is added to segments of
             other features

:return: - 1 in case of layer error (invalid or non editable)

:return: 0 in case of success

:return: 1 in case of geometry error (non spatial or null geometry)

:return: 2 in case no vertices needed to be added

.. note::

   geom is not going to be modified by the function

.. note::

   Calls to :py:func:`~QgsVectorLayer.addTopologicalPoints` are only valid for layers in which edits have been enabled
   by a call to :py:func:`~QgsVectorLayer.startEditing`. Changes made to features using this method are not committed
   to the underlying data provider until a :py:func:`~QgsVectorLayer.commitChanges` call is made. Any uncommitted
   changes can be discarded by calling :py:func:`~QgsVectorLayer.rollBack`.
%End

 int addTopologicalPoints( const QgsPointXY &p )  /Deprecated/;
%Docstring
Adds a vertex to segments which intersect point ``p`` but don't already
have a vertex there. If a feature already has a vertex at position
``p``, no additional vertex is inserted. This method is useful for
topological editing.

:param p: position of the vertex

:return: - 1 in case of layer error (invalid or non editable)

:return: 0 in case of success

:return: 1 in case of geometry error (non spatial or null geometry)

:return: 2 in case no vertices needed to be added

.. note::

   Calls to :py:func:`~QgsVectorLayer.addTopologicalPoints` are only valid for layers in which edits have been enabled
   by a call to :py:func:`~QgsVectorLayer.startEditing`. Changes made to features using this method are not committed
   to the underlying data provider until a :py:func:`~QgsVectorLayer.commitChanges` call is made. Any uncommitted
   changes can be discarded by calling :py:func:`~QgsVectorLayer.rollBack`.

.. deprecated:: 3.12

   Will be removed in QGIS 4.0. Use the variant which accepts :py:class:`QgsPoint` objects instead of :py:class:`QgsPointXY`.
%End

    int addTopologicalPoints( const QgsPoint &p );
%Docstring
Adds a vertex to segments which intersect point ``p`` but don't already
have a vertex there. If a feature already has a vertex at position
``p``, no additional vertex is inserted. This method is useful for
topological editing.

:param p: position of the vertex

:return: - 1 in case of layer error (invalid or non editable)

:return: 0 in case of success

:return: 1 in case of geometry error (non spatial or null geometry)

:return: 2 in case no vertices needed to be added

.. note::

   Calls to :py:func:`~QgsVectorLayer.addTopologicalPoints` are only valid for layers in which edits have been enabled
   by a call to :py:func:`~QgsVectorLayer.startEditing`. Changes made to features using this method are not committed
   to the underlying data provider until a :py:func:`~QgsVectorLayer.commitChanges` call is made. Any uncommitted
   changes can be discarded by calling :py:func:`~QgsVectorLayer.rollBack`.

.. versionadded:: 3.10
%End

    int addTopologicalPoints( const QgsPointSequence &ps );
%Docstring
Adds a vertex to segments which intersect any of the points ``p`` but
don't already have a vertex there. If a feature already has a vertex at
position ``p``, no additional vertex is inserted. This method is useful
for topological editing.

:param ps: point sequence of the vertices

:return: - 1 in case of layer error (invalid or non editable)

:return: 0 in case of success

:return: 1 in case of geometry error (non spatial or null geometry)

:return: 2 in case no vertices needed to be added

.. note::

   Calls to :py:func:`~QgsVectorLayer.addTopologicalPoints` are only valid for layers in which edits have been enabled
   by a call to :py:func:`~QgsVectorLayer.startEditing`. Changes made to features using this method are not committed
   to the underlying data provider until a :py:func:`~QgsVectorLayer.commitChanges` call is made. Any uncommitted
   changes can be discarded by calling :py:func:`~QgsVectorLayer.rollBack`.

.. versionadded:: 3.16
%End


    QgsAbstractVectorLayerLabeling *labeling();
%Docstring
Access to labeling configuration. May be ``None`` if labeling is not
used.

.. note::

   Labels will only be rendered if :py:func:`~QgsVectorLayer.labelsEnabled` returns ``True``.

.. seealso:: :py:func:`labelsEnabled`
%End

    void setLabeling( QgsAbstractVectorLayerLabeling *labeling /Transfer/ );
%Docstring
Sets labeling configuration. Takes ownership of the object.
%End

    virtual bool isEditable() const ${SIP_FINAL};

%Docstring
Returns ``True`` if the provider is in editing mode
%End

    virtual bool isSpatial() const ${SIP_FINAL};

%Docstring
Returns ``True`` if this is a geometry layer and ``False`` in case of
NoGeometry (table only) or UnknownGeometry
%End

    virtual bool isModified() const;

%Docstring
Returns ``True`` if the provider has been modified since the last commit
%End

    bool isAuxiliaryField( int index, int &srcIndex ) const;
%Docstring
Returns ``True`` if the field comes from the auxiliary layer, ``False``
otherwise.
%End

    virtual void reload() ${SIP_FINAL};

%Docstring
Synchronises with changes in the datasource
%End

    virtual QgsMapLayerRenderer *createMapRenderer( QgsRenderContext &rendererContext ) ${SIP_FINAL} /Factory/;

%Docstring
Returns new instance of :py:class:`QgsMapLayerRenderer` that will be
used for rendering of given context
%End

    virtual QgsRectangle extent() const ${SIP_FINAL};

    virtual QgsRectangle sourceExtent() const ${SIP_FINAL};


    virtual QgsBox3D extent3D() const ${SIP_FINAL};

    virtual QgsBox3D sourceExtent3D() const ${SIP_FINAL};


    virtual QgsFields fields() const ${SIP_FINAL};

%Docstring
Returns the list of fields of this layer. This also includes fields
which have not yet been saved to the provider.

:return: A list of fields
%End

    QgsAttributeList attributeList() const;
%Docstring
Returns list of attribute indexes. i.e. a list from 0 ...
:py:func:`~QgsVectorLayer.fieldCount`
%End

    QgsAttributeList primaryKeyAttributes() const;
%Docstring
Returns the list of attributes which make up the layer's primary keys.
%End

    virtual long long featureCount() const ${SIP_FINAL};

%Docstring
Returns feature count including changes which have not yet been
committed If you need only the count of committed features call this
method on this layer's provider.

:return: the number of features on this layer or -1 if unknown.
%End

    bool setReadOnly( bool readonly = true );
%Docstring
Makes layer read-only (editing disabled) or not

:return: ``False`` if the layer is in editing yet or if the data source
         is in read-only mode

.. seealso:: :py:func:`readOnlyChanged`
%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

.. versionadded:: 3.18
%End

    bool changeGeometry( QgsFeatureId fid, QgsGeometry &geometry, bool skipDefaultValue = false );
%Docstring
Changes a feature's ``geometry`` within the layer's edit buffer (but
does not immediately commit the changes). The ``fid`` argument specifies
the ID of the feature to be changed.

If ``skipDefaultValue`` is set to ``True``, default field values will
not be updated. This can be used to override default field value
expressions.

:return: ``True`` if the feature's geometry was successfully changed.

.. note::

   Calls to :py:func:`~QgsVectorLayer.changeGeometry` are only valid for layers in which edits have been enabled
   by a call to :py:func:`~QgsVectorLayer.startEditing`. Changes made to features using this method are not committed
   to the underlying data provider until a :py:func:`~QgsVectorLayer.commitChanges` call is made. Any uncommitted
   changes can be discarded by calling :py:func:`~QgsVectorLayer.rollBack`.

.. seealso:: :py:func:`startEditing`

.. seealso:: :py:func:`commitChanges`

.. seealso:: :py:func:`changeAttributeValue`

.. seealso:: :py:func:`updateFeature`
%End

    bool changeAttributeValue( QgsFeatureId fid, int field, const QVariant &newValue, const QVariant &oldValue = QVariant(), bool skipDefaultValues = false,  QgsVectorLayerToolsContext *context = 0 );
%Docstring
Changes an attribute value for a feature (but does not immediately
commit the changes). The ``fid`` argument specifies the ID of the
feature to be changed.

The ``field`` argument must specify a valid field index for the layer
(where an index of 0 corresponds to the first field).

The new value to be assigned to the field is given by ``newValue``.

If a valid QVariant is specified for ``oldValue``, it will be used as
the field value in the case of an undo operation corresponding to this
attribute value change. If an invalid QVariant is used (the default
behavior), then the feature's current value will be automatically
retrieved and used. Note that this involves a feature request to the
underlying data provider, so it is more efficient to explicitly pass an
``oldValue`` if it is already available.

If ``skipDefaultValues`` is set to ``True``, default field values will
not be updated. This can be used to override default field value
expressions.

If ``context`` is provided, it will be used when updating default values
(since QGIS 3.38).

:return: ``True`` if the feature's attribute was successfully changed.

.. note::

   Calls to :py:func:`~QgsVectorLayer.changeAttributeValue` are only valid for layers in which edits have been enabled
   by a call to :py:func:`~QgsVectorLayer.startEditing`. Changes made to features using this method are not committed
   to the underlying data provider until a :py:func:`~QgsVectorLayer.commitChanges` call is made. Any uncommitted
   changes can be discarded by calling :py:func:`~QgsVectorLayer.rollBack`.

.. seealso:: :py:func:`startEditing`

.. seealso:: :py:func:`commitChanges`

.. seealso:: :py:func:`changeGeometry`

.. seealso:: :py:func:`updateFeature`
%End

    bool changeAttributeValues( QgsFeatureId fid, const QgsAttributeMap &newValues, const QgsAttributeMap &oldValues = QgsAttributeMap(), bool skipDefaultValues = false, QgsVectorLayerToolsContext *context = 0 );
%Docstring
Changes attributes' values for a feature (but does not immediately
commit the changes). The ``fid`` argument specifies the ID of the
feature to be changed.

The new values to be assigned to the fields are given by ``newValues``.

If a valid QVariant is specified for a field in ``oldValues``, it will
be used as the field value in the case of an undo operation
corresponding to this attribute value change. If an invalid QVariant is
used (the default behavior), then the feature's current value will be
automatically retrieved and used. Note that this involves a feature
request to the underlying data provider, so it is more efficient to
explicitly pass an oldValue if it is already available.

If ``skipDefaultValues`` is set to ``True``, default field values will
not be updated. This can be used to override default field value
expressions.

If ``context`` is provided, it will be used when updating default values
(since QGIS 3.38).

:return: ``True`` if feature's attributes was successfully changed.

.. note::

   Calls to :py:func:`~QgsVectorLayer.changeAttributeValues` are only valid for layers in
   which edits have been enabled by a call to :py:func:`~QgsVectorLayer.startEditing`. Changes made
   to features using this method are not committed to the underlying data
   provider until a :py:func:`~QgsVectorLayer.commitChanges` call is made. Any uncommitted changes
   can be discarded by calling :py:func:`~QgsVectorLayer.rollBack`.

.. seealso:: :py:func:`startEditing`

.. seealso:: :py:func:`commitChanges`

.. seealso:: :py:func:`changeGeometry`

.. seealso:: :py:func:`updateFeature`

.. seealso:: :py:func:`changeAttributeValue`
%End

    bool addAttribute( const QgsField &field );
%Docstring
Add an attribute field (but does not commit it) returns ``True`` if the
field was added

.. note::

   Calls to :py:func:`~QgsVectorLayer.addAttribute` are only valid for layers in which edits have been enabled
   by a call to :py:func:`~QgsVectorLayer.startEditing`. Changes made to features using this method are not committed
   to the underlying data provider until a :py:func:`~QgsVectorLayer.commitChanges` call is made. Any uncommitted
   changes can be discarded by calling :py:func:`~QgsVectorLayer.rollBack`.
%End

    void setFieldAlias( int index, const QString &aliasString );
%Docstring
Sets an alias (a display name) for attributes to display in dialogs
%End

    void removeFieldAlias( int index );
%Docstring
Removes an alias (a display name) for attributes to display in dialogs
%End

    bool renameAttribute( int index, const QString &newName );
%Docstring
Renames an attribute field (but does not commit it).

:param index: attribute index
:param newName: new name of field

.. note::

   Calls to :py:func:`~QgsVectorLayer.renameAttribute` are only valid for layers in which edits have been enabled
   by a call to :py:func:`~QgsVectorLayer.startEditing`. Changes made to features using this method are not committed
   to the underlying data provider until a :py:func:`~QgsVectorLayer.commitChanges` call is made. Any uncommitted
   changes can be discarded by calling :py:func:`~QgsVectorLayer.rollBack`.
%End

    QString attributeAlias( int index ) const;
%Docstring
Returns the alias of an attribute name or a null string if there is no
alias.

\see {attributeDisplayName( int attributeIndex )} which returns the
field name if no alias is defined.
%End

    QString attributeDisplayName( int index ) const;
%Docstring
Convenience function that returns the attribute alias if defined or the
field name else
%End

    QgsStringMap attributeAliases() const;
%Docstring
Returns a map of field name to attribute alias
%End


    void setFieldSplitPolicy( int index, Qgis::FieldDomainSplitPolicy policy );
%Docstring
Sets a split ``policy`` for the field with the specified index.

:raises KeyError: if no field with the specified index exists

.. versionadded:: 3.30
%End

%MethodCode
    if ( a0 < 0 || a0 >= sipCpp->fields().count() )
    {
      PyErr_SetString( PyExc_KeyError, QByteArray::number( a0 ) );
      sipIsErr = 1;
    }
    else
    {
      sipCpp->setFieldSplitPolicy( a0, a1 );
    }
%End

    void setFieldDuplicatePolicy( int index, Qgis::FieldDuplicatePolicy policy );
%Docstring
Sets a duplicate ``policy`` for the field with the specified index.

:raises KeyError: if no field with the specified index exists

.. versionadded:: 3.38
%End

%MethodCode
    if ( a0 < 0 || a0 >= sipCpp->fields().count() )
    {
      PyErr_SetString( PyExc_KeyError, QByteArray::number( a0 ) );
      sipIsErr = 1;
    }
    else
    {
      sipCpp->setFieldDuplicatePolicy( a0, a1 );
    }
%End

 QSet<QString> excludeAttributesWms() const /Deprecated/;
%Docstring
A set of attributes that are not advertised in WMS requests with QGIS
server.

.. deprecated:: 3.16

   Use :py:func:`~QgsVectorLayer.fields`.configurationFlags() instead.
%End

 void setExcludeAttributesWms( const QSet<QString> &att ) /Deprecated/;
%Docstring
A set of attributes that are not advertised in WMS requests with QGIS
server.

.. deprecated:: 3.16

   Use setFieldConfigurationFlag instead.
%End

 QSet<QString> excludeAttributesWfs() const /Deprecated/;
%Docstring
A set of attributes that are not advertised in WFS requests with QGIS
server.

.. deprecated:: 3.16

   Use :py:func:`~QgsVectorLayer.fields`.configurationFlags() instead.
%End

 void setExcludeAttributesWfs( const QSet<QString> &att ) /Deprecated/;
%Docstring
A set of attributes that are not advertised in WFS requests with QGIS
server.

.. deprecated:: 3.16

   Use setFieldConfigurationFlag instead.
%End

    virtual bool deleteAttribute( int attr );
%Docstring
Deletes an attribute field (but does not commit it).

.. note::

   Calls to :py:func:`~QgsVectorLayer.deleteAttribute` are only valid for layers in which edits have been enabled
   by a call to :py:func:`~QgsVectorLayer.startEditing`. Changes made to features using this method are not committed
   to the underlying data provider until a :py:func:`~QgsVectorLayer.commitChanges` call is made. Any uncommitted
   changes can be discarded by calling :py:func:`~QgsVectorLayer.rollBack`.
%End

    bool deleteAttributes( const QList<int> &attrs );
%Docstring
Deletes a list of attribute fields (but does not commit it)

:param attrs: the indices of the attributes to delete

:return: ``True`` if at least one attribute has been deleted
%End

    virtual bool addFeatures( QgsFeatureList &features, QgsFeatureSink::Flags flags = QgsFeatureSink::Flags() ) ${SIP_FINAL};


    bool deleteFeature( QgsFeatureId fid, QgsVectorLayer::DeleteContext *context = 0 );
%Docstring
Deletes a feature from the layer (but does not commit it).

:param fid: The feature id to delete
:param context: The chain of features who will be deleted for feedback
                and to avoid endless recursions

.. note::

   Calls to :py:func:`~QgsVectorLayer.deleteFeature` are only valid for layers in which edits have been enabled
   by a call to :py:func:`~QgsVectorLayer.startEditing`. Changes made to features using this method are not committed
   to the underlying data provider until a :py:func:`~QgsVectorLayer.commitChanges` call is made. Any uncommitted
   changes can be discarded by calling :py:func:`~QgsVectorLayer.rollBack`.
%End

    bool deleteFeatures( const QgsFeatureIds &fids, QgsVectorLayer::DeleteContext *context = 0 );
%Docstring
Deletes a set of features from the layer (but does not commit it)

:param fids: The feature ids to delete
:param context: The chain of features who will be deleted for feedback
                and to avoid endless recursions

:return: ``False`` if the layer is not in edit mode or does not support
         deleting in case of an active transaction depends on the
         provider implementation

.. note::

   Calls to :py:func:`~QgsVectorLayer.deleteFeatures` are only valid for layers in which edits have been enabled
   by a call to :py:func:`~QgsVectorLayer.startEditing`. Changes made to features using this method are not committed
   to the underlying data provider until a :py:func:`~QgsVectorLayer.commitChanges` call is made. Any uncommitted
   changes can be discarded by calling :py:func:`~QgsVectorLayer.rollBack`.
%End

    bool commitChanges( bool stopEditing = true );
%Docstring
Attempts to commit to the underlying data provider any buffered changes
made since the last to call to :py:func:`~QgsVectorLayer.startEditing`.

Returns the result of the attempt. If a commit fails (i.e. ``False`` is
returned), the in-memory changes are left untouched and are not
discarded. This allows editing to continue if the commit failed on e.g.
a disallowed value in a Postgres database - the user can re-edit and try
again.

The commits occur in distinct stages, (add attributes, add features,
change attribute values, change geometries, delete features, delete
attributes) so if a stage fails, it can be difficult to roll back
cleanly. Therefore any error message returned by
:py:func:`~QgsVectorLayer.commitErrors` also includes which stage failed
so that the user has some chance of repairing the damage cleanly.

By setting ``stopEditing`` to ``False``, the layer will stay in editing
mode. Otherwise the layer editing mode will be disabled if the commit is
successful.

.. seealso:: :py:func:`startEditing`

.. seealso:: :py:func:`commitErrors`

.. seealso:: :py:func:`rollBack`
%End

    QStringList commitErrors() const;
%Docstring
Returns a list containing any error messages generated when attempting
to commit changes to the layer.

.. seealso:: :py:func:`commitChanges`
%End

    bool rollBack( bool deleteBuffer = true );
%Docstring
Stops a current editing operation and discards any uncommitted edits.

If ``deleteBuffer`` is ``True`` the editing buffer will be completely
deleted (the default behavior).

.. seealso:: :py:func:`startEditing`

.. seealso:: :py:func:`commitChanges`
%End

    QList<QgsRelation> referencingRelations( int idx ) const;
%Docstring
Returns the layer's relations, where the foreign key is on this layer.

:param idx: Only get relations, where idx forms part of the foreign key

:return: A list of relations
%End



    QgsVectorLayerEditBuffer *editBuffer();
%Docstring
Buffer with uncommitted editing operations. Only valid after editing has
been turned on.
%End


    void beginEditCommand( const QString &text );
%Docstring
Create edit command for undo/redo operations

:param text: text which is to be displayed in undo window
%End

    void endEditCommand();
%Docstring
Finish edit command and add it to undo/redo stack
%End

    void destroyEditCommand();
%Docstring
Destroy active command and reverts all changes in it
%End

 static void drawVertexMarker( double x, double y, QPainter &p, Qgis::VertexMarkerType type, int vertexSize );
%Docstring
Draws a vertex symbol at (screen) coordinates x, y. (Useful to assist
vertex editing.)

.. deprecated:: 3.40

   Use the equivalent :py:class:`QgsSymbolLayerUtils`.drawVertexMarker function instead.
%End

    void updateFields();
%Docstring
Will regenerate the `fields` property of this layer by obtaining all
fields from the dataProvider, joined fields and virtual fields. It will
also take any changes made to default values into consideration.

.. note::

   Unless the fields on the provider have directly been modified, there is
   no reason to call this method.
%End

    QVariant defaultValue( int index, const QgsFeature &feature = QgsFeature(),
                           QgsExpressionContext *context = 0 ) const;
%Docstring
Returns the calculated default value for the specified field index. The
default value may be taken from a client side default value expression
(see :py:func:`~QgsVectorLayer.setDefaultValueDefinition`) or taken from
the underlying data provider.

:param index: field index
:param feature: optional feature to use for default value evaluation. If
                passed, then properties from the feature (such as
                geometry) can be used when calculating the default
                value.
:param context: optional expression context to evaluate expressions
                again. If not specified, a default context will be
                created

:return: calculated default value

.. seealso:: :py:func:`setDefaultValueDefinition`
%End

    void setDefaultValueDefinition( int index, const QgsDefaultValue &definition );
%Docstring
Sets the definition of the expression to use when calculating the
default value for a field.

:param index: field index
:param definition: default value definition to use and evaluate when
                   calculating default values for field. Pass an empty
                   expression to clear the default.

.. seealso:: :py:func:`defaultValue`

.. seealso:: :py:func:`defaultValueDefinition`
%End

    QgsDefaultValue defaultValueDefinition( int index ) const;
%Docstring
Returns the definition of the expression used when calculating the
default value for a field.

:param index: field index

:return: definition of the default value with the expression evaluated
         when calculating default values for field, or definition with
         an empty string if no default is set

.. seealso:: :py:func:`defaultValue`

.. seealso:: :py:func:`setDefaultValueDefinition`
%End

    QgsFieldConstraints::Constraints fieldConstraints( int fieldIndex ) const;
%Docstring
Returns any constraints which are present for a specified field index.
These constraints may be inherited from the layer's data provider or may
be set manually on the vector layer from within QGIS.

.. seealso:: :py:func:`setFieldConstraint`
%End

    QMap< QgsFieldConstraints::Constraint, QgsFieldConstraints::ConstraintStrength> fieldConstraintsAndStrength( int fieldIndex ) const;
%Docstring
Returns a map of constraint with their strength for a specific field of
the layer.

:param fieldIndex: field index
%End

    void setFieldConstraint( int index, QgsFieldConstraints::Constraint constraint, QgsFieldConstraints::ConstraintStrength strength = QgsFieldConstraints::ConstraintStrengthHard );
%Docstring
Sets a constraint for a specified field index. Any constraints inherited
from the layer's data provider will be kept intact and cannot be
modified. Ie, calling this method only allows for new constraints to be
added on top of the existing provider constraints.

.. seealso:: :py:func:`fieldConstraints`

.. seealso:: :py:func:`removeFieldConstraint`
%End

    void removeFieldConstraint( int index, QgsFieldConstraints::Constraint constraint );
%Docstring
Removes a constraint for a specified field index. Any constraints
inherited from the layer's data provider will be kept intact and cannot
be removed.

.. seealso:: :py:func:`fieldConstraints`

.. seealso:: :py:func:`setFieldConstraint`
%End

    QString constraintExpression( int index ) const;
%Docstring
Returns the constraint expression for for a specified field index, if
set.

.. seealso:: :py:func:`fieldConstraints`

.. seealso:: :py:func:`constraintDescription`

.. seealso:: :py:func:`setConstraintExpression`
%End

    QString constraintDescription( int index ) const;
%Docstring
Returns the descriptive name for the constraint expression for a
specified field index.

.. seealso:: :py:func:`fieldConstraints`

.. seealso:: :py:func:`constraintExpression`

.. seealso:: :py:func:`setConstraintExpression`
%End

    void setConstraintExpression( int index, const QString &expression, const QString &description = QString() );
%Docstring
Sets the constraint expression for the specified field index. An
optional descriptive name for the constraint can also be set. Setting an
empty expression will clear any existing expression constraint.

.. seealso:: :py:func:`constraintExpression`

.. seealso:: :py:func:`constraintDescription`

.. seealso:: :py:func:`fieldConstraints`
%End

    void setFieldConfigurationFlags( int index, Qgis::FieldConfigurationFlags flags );
%Docstring
Sets the configuration flags of the field at given index

.. seealso:: :py:func:`QgsField.configurationFlags`

.. versionadded:: 3.34
%End

    void setFieldConfigurationFlag( int index, Qgis::FieldConfigurationFlag flag, bool active );
%Docstring
Sets the given configuration ``flag`` for the field at given ``index``
to be ``active`` or not.

.. versionadded:: 3.34
%End

    Qgis::FieldConfigurationFlags fieldConfigurationFlags( int index ) const;
%Docstring
Returns the configuration flags of the field at given index

.. seealso:: :py:func:`QgsField.setConfigurationFlags`

.. versionadded:: 3.34
%End

    void setEditorWidgetSetup( int index, const QgsEditorWidgetSetup &setup );
%Docstring
Sets the editor widget ``setup`` for the field at the specified
``index``.

The editor widget setup defines which :py:class:`QgsFieldFormatter` and
editor widget will be used for the field.

.. seealso:: :py:func:`editorWidgetSetup`
%End

    QgsEditorWidgetSetup editorWidgetSetup( int index ) const;
%Docstring
Returns the editor widget setup for the field at the specified
``index``.

The editor widget setup defines which :py:class:`QgsFieldFormatter` and
editor widget will be used for the field.

.. seealso:: :py:func:`setEditorWidgetSetup`
%End

    virtual QSet<QVariant> uniqueValues( int fieldIndex, int limit = -1 ) const ${SIP_FINAL};

%Docstring
Calculates a list of unique values contained within an attribute in the
layer. Note that in some circumstances when unsaved changes are present
for the layer then the returned list may contain outdated values (for
instance when the attribute value in a saved feature has been changed
inside the edit buffer then the previous saved value will be included in
the returned list).

:param fieldIndex: column index for attribute
:param limit: maximum number of values to return (or -1 if unlimited)

.. seealso:: :py:func:`minimumValue`

.. seealso:: :py:func:`maximumValue`
%End

    QStringList uniqueStringsMatching( int index, const QString &substring, int limit = -1,
                                       QgsFeedback *feedback = 0 ) const;
%Docstring
Returns unique string values of an attribute which contain a specified
subset string. Subset matching is done in a case-insensitive manner.
Note that in some circumstances when unsaved changes are present for the
layer then the returned list may contain outdated values (for instance
when the attribute value in a saved feature has been changed inside the
edit buffer then the previous saved value will be included in the
returned list).

:param index: column index for attribute
:param substring: substring to match (case insensitive)
:param limit: maxmum number of the values to return, or -1 to return all
              unique values
:param feedback: optional feedback object for canceling request

:return: list of unique strings containing substring
%End

    virtual QVariant minimumValue( int index ) const ${SIP_FINAL};

%Docstring
Returns the minimum value for an attribute column or an invalid variant
in case of error.

.. note::

   In some circumstances when unsaved changes are present for the layer then the
   returned value may be outdated (for instance when the attribute value in a saved feature has
   been changed inside the edit buffer then the previous saved value may be returned as the minimum).

.. note::

   If both the minimum and maximum value are required it is more efficient to call :py:func:`~QgsVectorLayer.minimumAndMaximumValue`
   instead of separate calls to :py:func:`~QgsVectorLayer.minimumValue` and :py:func:`~QgsVectorLayer.maximumValue`.

.. seealso:: :py:func:`maximumValue`

.. seealso:: :py:func:`minimumAndMaximumValue`

.. seealso:: :py:func:`uniqueValues`
%End

    virtual QVariant maximumValue( int index ) const ${SIP_FINAL};

%Docstring
Returns the maximum value for an attribute column or an invalid variant
in case of error.

.. note::

   In some circumstances when unsaved changes are present for the layer then the
   returned value may be outdated (for instance when the attribute value in a saved feature has
   been changed inside the edit buffer then the previous saved value may be returned as the maximum).

.. note::

   If both the minimum and maximum value are required it is more efficient to call :py:func:`~QgsVectorLayer.minimumAndMaximumValue`
   instead of separate calls to :py:func:`~QgsVectorLayer.minimumValue` and :py:func:`~QgsVectorLayer.maximumValue`.

.. seealso:: :py:func:`minimumValue`

.. seealso:: :py:func:`minimumAndMaximumValue`

.. seealso:: :py:func:`uniqueValues`
%End


    void minimumAndMaximumValue( int index, QVariant &minimum /Out/, QVariant &maximum /Out/ ) const;
%Docstring
Calculates both the minimum and maximum value for an attribute column.

This is more efficient then calling both
:py:func:`~QgsVectorLayer.minimumValue` and
:py:func:`~QgsVectorLayer.maximumValue` when both the minimum and
maximum values are required.

:param index: index of field to calculate minimum and maximum value for.

.. note::

   In some circumstances when unsaved changes are present for the layer then the
   calculated values may be outdated (for instance when the attribute value in a saved feature has
   been changed inside the edit buffer then the previous saved value may be returned as the maximum).

.. seealso:: :py:func:`minimumValue`

.. seealso:: :py:func:`maximumValue`

:return: - minimum: minimum attribute value or an invalid variant in
           case of error.
         - maximum: maximum attribute value or an invalid variant in
           case of error.

.. versionadded:: 3.20
%End

    QVariant aggregate( Qgis::Aggregate aggregate,
                        const QString &fieldOrExpression,
                        const QgsAggregateCalculator::AggregateParameters &parameters = QgsAggregateCalculator::AggregateParameters(),
                        QgsExpressionContext *context = 0,
                        bool *ok = 0,
                        QgsFeatureIds *fids = 0,
                        QgsFeedback *feedback = 0 ) const;
%Docstring
Calculates an aggregated value from the layer's features. Currently any
filtering expression provided will override filters in the
FeatureRequest.

:param aggregate: aggregate to calculate
:param fieldOrExpression: source field or expression to use as basis for
                          aggregated values.
:param parameters: parameters controlling aggregate calculation
:param context: expression context for expressions and filters
:param ok: if specified, will be set to ``True`` if aggregate
           calculation was successful
:param fids: list of fids to filter, otherwise will use all fids
:param feedback: optional feedback argument for early cancellation
                 (since QGIS 3.22)

:return: calculated aggregate value
%End

    void setFeatureBlendMode( QPainter::CompositionMode blendMode );
%Docstring
Sets the blending mode used for rendering each feature
%End
    QPainter::CompositionMode featureBlendMode() const;
%Docstring
Returns the current blending mode for features
%End

    virtual QString htmlMetadata() const ${SIP_FINAL};


    void setSimplifyMethod( const QgsVectorSimplifyMethod &simplifyMethod );
%Docstring
Sets the simplification settings for fast rendering of features
%End

    const QgsVectorSimplifyMethod &simplifyMethod() const;
%Docstring
Returns the simplification settings for fast rendering of features
%End

    bool simplifyDrawingCanbeApplied( const QgsRenderContext &renderContext, Qgis::VectorRenderingSimplificationFlag simplifyHint ) const;
%Docstring
Returns whether the VectorLayer can apply the specified simplification
hint

.. note::

   Do not use in 3rd party code - may be removed in future version!
%End

    QgsConditionalLayerStyles *conditionalStyles() const;
%Docstring
Returns the conditional styles that are set for this layer. Style
information is used to render conditional formatting in the attribute
table.

:return: Return a :py:class:`QgsConditionalLayerStyles` object holding
         the conditional attribute style information. Style information
         is generic and can be used for anything.
%End

    QgsAttributeTableConfig attributeTableConfig() const;
%Docstring
Returns the attribute table configuration object. This defines the
appearance of the attribute table.
%End

    void setAttributeTableConfig( const QgsAttributeTableConfig &attributeTableConfig );
%Docstring
Sets the attribute table configuration object. This defines the
appearance of the attribute table.
%End

    virtual QgsExpressionContext createExpressionContext() const ${SIP_FINAL};


    virtual QgsExpressionContextScope *createExpressionContextScope() const ${SIP_FINAL} /Factory/;


    QgsEditFormConfig editFormConfig() const;
%Docstring
Returns the configuration of the form used to represent this vector
layer.

:return: The configuration of this layers' form
%End

    void setEditFormConfig( const QgsEditFormConfig &editFormConfig );
%Docstring
Sets the ``editFormConfig`` (configuration) of the form used to
represent this vector layer.

.. seealso:: :py:func:`editFormConfig`
%End

    void setReadExtentFromXml( bool readExtentFromXml );
%Docstring
Flag allowing to indicate if the extent has to be read from the XML
document when data source has no metadata or if the data provider has to
determine it.
%End

    bool readExtentFromXml() const;
%Docstring
Returns ``True`` if the extent is read from the XML document when data
source has no metadata, ``False`` if it's the data provider which
determines it.
%End

    bool isEditCommandActive() const;
%Docstring
Tests if an edit command is active
%End

    QgsGeometryOptions *geometryOptions() const;
%Docstring
Configuration and logic to apply automatically on any edit happening on
this layer.

.. versionadded:: 3.4
%End



    QgsStoredExpressionManager *storedExpressionManager();
%Docstring
Returns the manager of the stored expressions for this layer.

.. versionadded:: 3.10
%End

  public slots:

    void select( QgsFeatureId featureId );
%Docstring
Selects feature by its ID

:param featureId: The id of the feature to select

.. seealso:: :py:func:`select`
%End

    void select( const QgsFeatureIds &featureIds );
%Docstring
Selects features by their ID

:param featureIds: The ids of the features to select

.. seealso:: :py:func:`select`
%End

    void deselect( QgsFeatureId featureId );
%Docstring
Deselects feature by its ID

:param featureId: The id of the feature to deselect

.. seealso:: :py:func:`deselect`
%End

    void deselect( const QgsFeatureIds &featureIds );
%Docstring
Deselects features by their ID

:param featureIds: The ids of the features to deselect

.. seealso:: :py:func:`deselect`
%End

    void removeSelection();
%Docstring
Clear selection

.. seealso:: :py:func:`selectByIds`

.. seealso:: :py:func:`reselect`
%End

    void reselect();
%Docstring
Reselects the previous set of selected features. This is only applicable
after a prior call to :py:func:`~QgsVectorLayer.removeSelection`.

Any other modifications to the selection following a call to
:py:func:`~QgsVectorLayer.removeSelection` clears memory of the previous
selection and consequently calling :py:func:`~QgsVectorLayer.reselect`
has no impact.

.. seealso:: :py:func:`removeSelection`

.. versionadded:: 3.10
%End

    virtual void updateExtents( bool force = false );
%Docstring
Update the extents for the layer. This is necessary if features are
added/deleted or the layer has been subsetted.

:param force: ``True`` to update layer extent even if it's read from xml
              by default, ``False`` otherwise
%End

    bool startEditing();
%Docstring
Makes the layer editable.

This starts an edit session on this layer. Changes made in this edit
session will not be made persistent until
:py:func:`~QgsVectorLayer.commitChanges` is called, and can be reverted
by calling :py:func:`~QgsVectorLayer.rollBack`.

:return: ``True`` if the layer was successfully made editable, or
         ``False`` if the operation failed (e.g. due to an underlying
         read-only data source, or lack of edit support by the backend
         data provider).

.. seealso:: :py:func:`commitChanges`

.. seealso:: :py:func:`rollBack`
%End

    virtual void setTransformContext( const QgsCoordinateTransformContext &transformContext );
%Docstring
Sets the coordinate transform context to ``transformContext``

.. versionadded:: 3.8
%End

    virtual Qgis::SpatialIndexPresence hasSpatialIndex() const;


    virtual bool accept( QgsStyleEntityVisitorInterface *visitor ) const;


  signals:

    void selectionChanged( const QgsFeatureIds &selected, const QgsFeatureIds &deselected, bool clearAndSelect );
%Docstring
Emitted when selection was changed

:param selected: Newly selected feature ids
:param deselected: Ids of all features which have previously been
                   selected but are not any more
:param clearAndSelect: In case this is set to ``True``, the old
                       selection was dismissed and the new selection
                       corresponds to selected
%End

    void allowCommitChanged();
%Docstring
Emitted whenever the :py:func:`~QgsVectorLayer.allowCommit` property of
this layer changes.

.. versionadded:: 3.4
%End

    void beforeModifiedCheck() const;
%Docstring
Emitted when the layer is checked for modifications. Use for last-minute
additions.
%End

    void beforeEditingStarted();
%Docstring
Emitted before editing on this layer is started.
%End

    void beforeCommitChanges( bool stopEditing );
%Docstring
Emitted before changes are committed to the data provider.

The ``stopEditing`` flag specifies if the editing mode shall be left
after this commit.
%End

    void beforeRollBack();
%Docstring
Emitted before changes are rolled back.
%End

    void afterCommitChanges();
%Docstring
Emitted after changes are committed to the data provider.

.. versionadded:: 3.16
%End

    void afterRollBack();
%Docstring
Emitted after changes are rolled back.

.. versionadded:: 3.4
%End

    void attributeAdded( int idx );
%Docstring
Will be emitted, when a new attribute has been added to this vector
layer. Applies only to types :py:class:`QgsFields`.OriginEdit,
:py:class:`QgsFields`.OriginProvider and
:py:class:`QgsFields`.OriginExpression

:param idx: The index of the new attribute

.. seealso:: :py:func:`updatedFields`
%End

    void beforeAddingExpressionField( const QString &fieldName );
%Docstring
Will be emitted, when an expression field is going to be added to this
vector layer. Applies only to types
:py:class:`QgsFields`.OriginExpression

:param fieldName: The name of the attribute to be added
%End

    void attributeDeleted( int idx );
%Docstring
Will be emitted, when an attribute has been deleted from this vector
layer. Applies only to types :py:class:`QgsFields`.OriginEdit,
:py:class:`QgsFields`.OriginProvider and
:py:class:`QgsFields`.OriginExpression

:param idx: The index of the deleted attribute

.. seealso:: :py:func:`updatedFields`
%End

    void beforeRemovingExpressionField( int idx );
%Docstring
Will be emitted, when an expression field is going to be deleted from
this vector layer. Applies only to types
:py:class:`QgsFields`.OriginExpression

:param idx: The index of the attribute to be deleted
%End

    void featureAdded( QgsFeatureId fid );
%Docstring
Emitted when a new feature has been added to the layer

:param fid: The id of the new feature
%End

    void featureDeleted( QgsFeatureId fid );
%Docstring
Emitted when a feature has been deleted.

If you do expensive operations in a slot connected to this, you should
prefer to use :py:func:`~QgsVectorLayer.featuresDeleted`.

:param fid: The id of the feature which has been deleted
%End

    void featuresDeleted( const QgsFeatureIds &fids );
%Docstring
Emitted when features have been deleted.

If features are deleted within an edit command, this will only be
emitted once at the end to allow connected slots to minimize the
overhead. If features are deleted outside of an edit command, this
signal will be emitted once per feature.

:param fids: The feature ids that have been deleted.
%End

    void updatedFields();
%Docstring
Emitted whenever the fields available from this layer have been changed.
This can be due to manually adding attributes or due to a join.
%End

    void subsetStringChanged();
%Docstring
Emitted when the layer's subset string has changed.

.. versionadded:: 3.2
%End

    void attributeValueChanged( QgsFeatureId fid, int idx, const QVariant &value );
%Docstring
Emitted whenever an attribute value change is done in the edit buffer.
Note that at this point the attribute change is not yet saved to the
provider.

:param fid: The id of the changed feature
:param idx: The attribute index of the changed attribute
:param value: The new value of the attribute
%End

    void geometryChanged( QgsFeatureId fid, const QgsGeometry &geometry );
%Docstring
Emitted whenever a geometry change is done in the edit buffer. Note that
at this point the geometry change is not yet saved to the provider.

:param fid: The id of the changed feature
:param geometry: The new geometry
%End

    void committedAttributesDeleted( const QString &layerId, const QgsAttributeList &deletedAttributes );
%Docstring
Emitted when attributes are deleted from the provider if not in
transaction mode.
%End
    void committedAttributesAdded( const QString &layerId, const QList<QgsField> &addedAttributes );
%Docstring
Emitted when attributes are added to the provider if not in transaction
mode.
%End
    void committedFeaturesAdded( const QString &layerId, const QgsFeatureList &addedFeatures );
%Docstring
Emitted when features are added to the provider if not in transaction
mode.
%End
    void committedFeaturesRemoved( const QString &layerId, const QgsFeatureIds &deletedFeatureIds );
%Docstring
Emitted when features are deleted from the provider if not in
transaction mode.
%End
    void committedAttributeValuesChanges( const QString &layerId, const QgsChangedAttributesMap &changedAttributesValues );
%Docstring
Emitted when attribute value changes are saved to the provider if not in
transaction mode.
%End
    void committedGeometriesChanges( const QString &layerId, const QgsGeometryMap &changedGeometries );
%Docstring
Emitted when geometry changes are saved to the provider if not in
transaction mode.
%End

    void labelingFontNotFound( QgsVectorLayer *layer, const QString &fontfamily );
%Docstring
Emitted when the font family defined for labeling layer is not found on
system
%End

    void featureBlendModeChanged( QPainter::CompositionMode blendMode );
%Docstring
Signal emitted when :py:func:`~QgsVectorLayer.setFeatureBlendMode` is
called
%End

    void editCommandStarted( const QString &text );
%Docstring
Signal emitted when a new edit command has been started

:param text: Description for this edit command
%End

    void editCommandEnded();
%Docstring
Signal emitted, when an edit command successfully ended

.. note::

   This does not mean it is also committed, only that it is written
   to the edit buffer. See :py:func:`~QgsVectorLayer.beforeCommitChanges`
%End

    void editCommandDestroyed();
%Docstring
Signal emitted, when an edit command is destroyed

.. note::

   This is not a rollback, it is only related to the current edit command.
   See :py:func:`~QgsVectorLayer.beforeRollBack`
%End

    void readCustomSymbology( const QDomElement &element, QString &errorMessage );
%Docstring
Signal emitted whenever the symbology (QML-file) for this layer is being
read. If there is custom style information saved in the file, you can
connect to this signal and update the layer style accordingly.

:param element: The XML layer style element.

:param errorMessage: Write error messages into this string.
%End

    void writeCustomSymbology( QDomElement &element, QDomDocument &doc, QString &errorMessage ) const;
%Docstring
Signal emitted whenever the symbology (QML-file) for this layer is being
written. If there is custom style information you want to save to the
file, you can connect to this signal and update the element accordingly.

:param element: The XML element where you can add additional style
                information to.
:param doc: The XML document that you can use to create new XML nodes.
:param errorMessage: Write error messages into this string.
%End

    void displayExpressionChanged();
%Docstring
Emitted when the display expression changes
%End

    void raiseError( const QString &msg );
%Docstring
Signals an error related to this vector layer.
%End

    void editFormConfigChanged();
%Docstring
Will be emitted whenever the edit form configuration of this layer
changes.
%End

    void readOnlyChanged();
%Docstring
Emitted when the read only state of this layer is changed. Only applies
to manually set readonly state, not to the edit mode.

.. seealso:: :py:func:`setReadOnly`
%End

    void supportsEditingChanged();
%Docstring
Emitted when the read only state or the data provider of this layer is
changed.

.. versionadded:: 3.18
%End

    void symbolFeatureCountMapChanged();
%Docstring
Emitted when the feature count for symbols on this layer has been
recalculated.
%End

  protected:
    virtual void setExtent( const QgsRectangle &rect ) ${SIP_FINAL};

%Docstring
Sets the extent
%End
    virtual void setExtent3D( const QgsBox3D &rect ) ${SIP_FINAL};

%Docstring
Sets the extent
%End

  private:
    QgsVectorLayer( const QgsVectorLayer &rhs );
};




/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/core/vector/qgsvectorlayer.h                                     *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 ************************************************************************/