File: qgsmapcanvas.sip.in

package info (click to toggle)
qgis 3.40.10%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,183,672 kB
  • sloc: cpp: 1,595,771; python: 372,544; xml: 23,474; sh: 3,761; perl: 3,664; ansic: 2,257; sql: 2,137; yacc: 1,068; lex: 577; javascript: 540; lisp: 411; makefile: 161
file content (1365 lines) | stat: -rw-r--r-- 36,693 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
/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/gui/qgsmapcanvas.h                                               *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 ************************************************************************/


















class QgsMapCanvas : QGraphicsView, QgsExpressionContextGenerator
{
%Docstring(signature="appended")
Map canvas is a class for displaying all GIS data types on a canvas.
%End

%TypeHeaderCode
#include "qgsmapcanvas.h"
%End
%ConvertToSubClassCode
    if ( qobject_cast<QgsMapCanvas *>( sipCpp ) != nullptr )
      sipType = sipType_QgsMapCanvas;
    else
      sipType = nullptr;
%End
  public:
    QgsMapCanvas( QWidget *parent /TransferThis/ = 0 );
%Docstring
Constructor
%End

    ~QgsMapCanvas();

    void addOverlayWidget( QWidget *widget /Transfer/, Qt::Edge edge );
%Docstring
Adds an overlay ``widget`` to the layout, which will be bound to the
specified ``edge``.

The widget will always float above the map canvas.

.. note::

   Widgets on the left and right edges will always be positioned first, with
   top and bottom edge widgets expanding to take the remaining horizontal space.

.. versionadded:: 3.38
%End

    double magnificationFactor() const;
%Docstring
Returns the magnification factor
%End

    void setLayers( const QList<QgsMapLayer *> &layers );
%Docstring
Sets the list of ``layers`` that should be shown in the canvas.

If the map canvas has been associated with a map theme via a call to
:py:func:`~QgsMapCanvas.setTheme`, then any calls to
:py:func:`~QgsMapCanvas.setLayers` are ignored. It is necessary to first
clear the theme association by calling :py:func:`~QgsMapCanvas.setTheme`
with an empty string before :py:func:`~QgsMapCanvas.setLayers` calls can
be made.

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

    void setFlags( Qgis::MapCanvasFlags flags );
%Docstring
Sets ``flags`` which control how the map canvas behaves.

.. seealso:: :py:func:`flags`

.. versionadded:: 3.40
%End

    Qgis::MapCanvasFlags flags() const;
%Docstring
Returns flags which control how the map canvas behaves.

.. seealso:: :py:func:`setFlags`

.. versionadded:: 3.40
%End

    void setCurrentLayer( QgsMapLayer *layer );

    const QgsMapSettings &mapSettings() const /KeepReference/;
%Docstring
Gets access to properties used for map rendering
%End


    void setTemporalController( QgsTemporalController *controller );
%Docstring
Sets the temporal ``controller`` for this canvas.

The controller will be used to update the canvas' temporal range.

.. versionadded:: 3.14
%End

    const QgsTemporalController *temporalController() const;
%Docstring
Gets access to the temporal controller that will be used to update the
canvas temporal range.

.. versionadded:: 3.14
%End

    void setDestinationCrs( const QgsCoordinateReferenceSystem &crs );
%Docstring
Sets destination coordinate reference system
%End

    void setMapSettingsFlags( Qgis::MapSettingsFlags flags );
%Docstring
Resets the ``flags`` for the canvas' map settings.
%End

    const QgsLabelingResults *labelingResults( bool allowOutdatedResults = true ) const;
%Docstring
Gets access to the labeling results (may be ``None``).

Since QGIS 3.20, if the ``allowOutdatedResults`` flag is ``False`` then
outdated labeling results (e.g. as a result of an ongoing canvas render)
will not be returned, and instead ``None`` will be returned.
%End

    const QgsRenderedItemResults *renderedItemResults( bool allowOutdatedResults = true ) const;
%Docstring
Gets access to the rendered item results (may be ``None``), which
includes the results of rendering annotation items in the canvas map.

If the ``allowOutdatedResults`` flag is ``False`` then outdated rendered
item results (e.g. as a result of an ongoing canvas render) will not be
returned, and instead ``None`` will be returned.

.. versionadded:: 3.22
%End

    void setCachingEnabled( bool enabled );
%Docstring
Set whether to cache images of rendered layers

.. seealso:: :py:func:`isCachingEnabled`

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

    bool isCachingEnabled() const;
%Docstring
Check whether images of rendered layers are curerently being cached

.. seealso:: :py:func:`setCachingEnabled`

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

    void clearCache();
%Docstring
Make sure to remove any rendered images from cache (does nothing if
cache is not enabled)
%End

    QgsMapRendererCache *cache();
%Docstring
Returns the map renderer cache, if caching is enabled.

.. seealso:: :py:func:`isCachingEnabled`

.. seealso:: :py:func:`setCachingEnabled`

.. versionadded:: 3.32
%End


    void waitWhileRendering();
%Docstring
Blocks until the rendering job has finished.

In almost all cases you do NOT want to call this, as it will hang the UI
until the rendering job is complete. It's included in API solely for
unit testing and standalone Python scripts.
%End

    void setParallelRenderingEnabled( bool enabled );
%Docstring
Set whether the layers are rendered in parallel or sequentially
%End

    bool isParallelRenderingEnabled() const;
%Docstring
Check whether the layers are rendered in parallel or sequentially
%End

    void setMapUpdateInterval( int timeMilliseconds );
%Docstring
Set how often map preview should be updated while it is being rendered
(in milliseconds)
%End

    int mapUpdateInterval() const;
%Docstring
Find out how often map preview should be updated while it is being
rendered (in milliseconds)
%End

    double scale() const;
%Docstring
Returns the last reported scale of the canvas. The ``scale`` value
indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.
%End

    double mapUnitsPerPixel() const;
%Docstring
Returns the mapUnitsPerPixel (map units per pixel) for the canvas
%End

    QgsRectangle extent() const;
%Docstring
Returns the current zoom extent of the map canvas
%End

    QgsRectangle fullExtent() const;
%Docstring
Returns the combined extent for all layers on the map canvas.

This method returns the combined extent for all layers which are
currently visible in the map canvas. The returned extent will be in the
same CRS as the map canvas.

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

    QgsRectangle projectExtent() const;
%Docstring
Returns the associated project's full extent, in the canvas' CRS.

This method returns the full extent for the project associated with this
canvas. Unlike :py:func:`~QgsMapCanvas.fullExtent`, this method does NOT
consider which layers are actually visible in the map canvas.

.. seealso:: :py:func:`fullExtent`

.. versionadded:: 3.20
%End

    void setExtent( const QgsRectangle &r, bool magnified = false );
%Docstring
Sets the extent of the map canvas to the specified rectangle.

The ``magnified`` argument dictates whether existing canvas constraints
such as a scale lock should be respected or not during the operation. If
``magnified`` is ``True`` then an existing scale lock constraint will be
applied. This means that the final visible canvas extent may not match
the specified extent.

If ``magnified`` is ``False`` then scale lock settings will be ignored,
and the specified rectangle will ALWAYS be visible in the canvas.
%End

    bool setReferencedExtent( const QgsReferencedRectangle &extent ) throw( QgsCsException );
%Docstring
Sets the canvas to the specified ``extent``.

:return: ``True`` if the zoom was successful.

:raises QgsCsException: if a transformation error occurred.

.. versionadded:: 3.10
%End

    double rotation() const;
%Docstring
Gets the current map canvas rotation in clockwise degrees
%End

    void setRotation( double degrees );
%Docstring
Set the rotation of the map canvas in clockwise degrees
%End

    void setCenter( const QgsPointXY &center );
%Docstring
Set the center of the map canvas, in geographical coordinates
%End

    QgsPointXY center() const;
%Docstring
Gets map center, in geographical coordinates
%End

    void zoomToFullExtent();
%Docstring
Zoom to the full extent of all layers currently visible in the canvas.

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

    void zoomToProjectExtent();
%Docstring
Zoom to the full extent the project associated with this canvas.

This method zooms to the full extent for the project associated with
this canvas. Unlike :py:func:`~QgsMapCanvas.zoomToFullExtent`, this
method does NOT consider which layers are actually visible in the map
canvas.

.. versionadded:: 3.20
%End

    void zoomToPreviousExtent();
%Docstring
Zoom to the previous extent (view)
%End

    void zoomToNextExtent();
%Docstring
Zoom to the next extent (view)
%End

    void clearExtentHistory();
%Docstring
Clears the list of extents and sets current extent as first item
%End


    void zoomToFeatureIds( QgsVectorLayer *layer, const QgsFeatureIds &ids );
%Docstring
Set canvas extent to the bounding box of a set of features

:param layer: the vector layer
:param ids: the feature ids
%End

    void panToFeatureIds( QgsVectorLayer *layer, const QgsFeatureIds &ids, bool alwaysRecenter = true );
%Docstring
Centers canvas extent to feature ids

:param layer: the vector layer
:param ids: the feature ids
:param alwaysRecenter: if ``False``, the canvas is recentered only if
                       the bounding box is not contained within the
                       current extent
%End

    void panToSelected( QgsMapLayer *layer = 0 );
%Docstring
Pan to the selected features of current ayer keeping same extent.
%End

    void panToSelected( const QList<QgsMapLayer *> &layers );
%Docstring
Pan to the combined extent of the selected features of all provided
(vector) layers.

:param layers: A list of layers

.. versionadded:: 3.18
%End

    void flashFeatureIds( QgsVectorLayer *layer, const QgsFeatureIds &ids, const QColor &startColor = QColor( 255, 0, 0, 255 ), const QColor &endColor = QColor( 255, 0, 0, 0 ), int flashes = 3, int duration = 500 );
%Docstring
Causes a set of features with matching ``ids`` from a vector ``layer``
to flash within the canvas.

The ``startColor`` and ``endColor`` can be specified, along with the
number of ``flashes`` and ``duration`` of each flash (in milliseconds).

.. note::

   If the features or geometries are already available, :py:func:`~QgsMapCanvas.flashGeometries` is much more efficient.

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

    void flashGeometries( const QList<QgsGeometry> &geometries, const QgsCoordinateReferenceSystem &crs = QgsCoordinateReferenceSystem(), const QColor &startColor = QColor( 255, 0, 0, 255 ), const QColor &endColor = QColor( 255, 0, 0, 0 ), int flashes = 3, int duration = 500 );
%Docstring
Causes a set of ``geometries`` to flash within the canvas.

If ``crs`` is a valid coordinate reference system, the geometries will
be automatically transformed from this CRS to the canvas CRS.

The ``startColor`` and ``endColor`` can be specified, along with the
number of ``flashes`` and ``duration`` of each flash (in milliseconds).

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

    void setMapTool( QgsMapTool *mapTool, bool clean = false );
%Docstring
Sets the map tool currently being used on the canvas
%End

    void unsetMapTool( QgsMapTool *mapTool );
%Docstring
Unset the current map tool or last non zoom tool

This is called from destructor of map tools to make sure that this map
tool won't be used any more. You don't have to call it manually,
:py:class:`QgsMapTool` takes care of it.
%End

    QgsMapTool *mapTool() const;
%Docstring
Returns the currently active tool
%End

    void setProject( QgsProject *project );
%Docstring
Sets the ``project`` linked to this canvas.

.. versionadded:: 3.14
%End

    QgsProject *project();
%Docstring
Returns the project linked to this canvas. The returned value may be
``None``.

.. versionadded:: 3.14
%End

    void setCanvasColor( const QColor &_newVal );
%Docstring
Write property of QColor bgColor.
%End
    QColor canvasColor() const;
%Docstring
Read property of QColor bgColor.
%End

    void setSelectionColor( const QColor &color );
%Docstring
Set color of selected vector features
%End

    QColor selectionColor() const;
%Docstring
Returns color for selected features
%End

    void updateScale();
%Docstring
Emits signal scaleChanged to update scale in main window
%End

    QgsMapLayer *layer( int index );
%Docstring
Returns the map layer at position index in the layer stack
%End

    QgsMapLayer *layer( const QString &id );
%Docstring
Returns the map layer with the matching ID, or ``None`` if no layers
could be found.

This method searches both layers associated with the map canvas (see
:py:func:`~QgsMapCanvas.layers`) and layers from the
:py:class:`QgsProject` associated with the canvas (which is current the
:py:func:`QgsProject.instance()`). It can be used to resolve layer IDs
to layers which may be visible in the canvas, but not associated with a
:py:class:`QgsProject`.

.. versionadded:: 3.22
%End

    int layerCount() const;
%Docstring
Returns number of layers on the map.
%End

    QList<QgsMapLayer *> layers( bool expandGroupLayers = false ) const;
%Docstring
Returns the list of layers shown within the map canvas.

Since QGIS 3.24, if the ``expandGroupLayers`` option is ``True`` then
group layers will be converted to all their child layers.

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


    void freeze( bool frozen = true );
%Docstring
Freeze/thaw the map canvas. This is used to prevent the canvas from
responding to events while layers are being added/removed etc.

:param frozen: Boolean specifying if the canvas should be frozen
               (``True``) or thawed (``False``). Default is ``True``.

.. seealso:: :py:func:`isFrozen`

.. seealso:: :py:func:`setRenderFlag` freeze() should be used to programmatically halt map updates,
               while :py:func:`~QgsMapCanvas.setRenderFlag` should only be used when users disable rendering via GUI.
%End

    bool isFrozen() const;
%Docstring
Returns ``True`` if canvas is frozen.

.. seealso:: :py:func:`renderFlag` isFrozen() should be used to determine whether map updates
have been halted programmatically, while :py:func:`~QgsMapCanvas.renderFlag` should be used to
determine whether a user has disabled rendering via GUI.

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

    bool renderFlag() const;
%Docstring
Returns ``True`` if canvas render is disabled as a result of user
disabling renders via the GUI.

.. seealso:: :py:func:`setRenderFlag`

.. seealso:: :py:func:`isFrozen` isFrozen() should be used to determine whether map updates
have been halted programmatically, while :py:func:`~QgsMapCanvas.renderFlag` should be used to
determine whether a user has disabled rendering via GUI.
%End

    Qgis::DistanceUnit mapUnits() const;
%Docstring
Convenience function for returning the current canvas map units. The map
units are dictated by the canvas'
:py:func:`~QgsMapCanvas.destinationCrs` map units.
%End

    QMap<QString, QString> layerStyleOverrides() const;
%Docstring
Returns the stored overrides of styles for layers.

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

    void setLayerStyleOverrides( const QMap<QString, QString> &overrides );
%Docstring
Sets the stored overrides of styles for rendering layers.

If the map canvas has been associated with a map theme via a call to
:py:func:`~QgsMapCanvas.setTheme`, then any calls to
:py:func:`~QgsMapCanvas.setLayerStyleOverrides` are ignored. It is
necessary to first clear the theme association by calling
:py:func:`~QgsMapCanvas.setTheme` with an empty string before
:py:func:`~QgsMapCanvas.setLayerStyleOverrides` calls can be made.

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

    void setTheme( const QString &theme );
%Docstring
Sets a map ``theme`` to show in the canvas. The theme name must match a
theme present in the associated project's
:py:class:`QgsMapThemeCollection`.

When the canvas is associated to a map theme, it will automatically
follow the layer selection and layer styles from that theme. Calls to
:py:func:`~QgsMapCanvas.setLayers` or
:py:func:`~QgsMapCanvas.setLayerStyleOverrides` will have no effect, and
canvases associated with a :py:class:`QgsLayerTreeMapCanvasBridge` will
no longer synchronize their state with the layer tree. In these cases it
is necessary to call :py:func:`~QgsMapCanvas.setTheme` with an empty
string to clear the theme association and allow map updates with
:py:func:`~QgsMapCanvas.setLayers`,
:py:func:`~QgsMapCanvas.setLayerStyleOverrides`, or via
:py:class:`QgsLayerTreeMapCanvasBridge`.

If an empty string is passed then the current theme association will be
cleared.

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

    QString theme() const;
%Docstring
Returns the map's theme shown in the canvas, if set.

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

    const QgsMapToPixel *getCoordinateTransform();
%Docstring
Gets the current coordinate transform
%End

    bool isDrawing();
%Docstring
Find out whether rendering is in progress
%End

    QgsMapLayer *currentLayer();
%Docstring
returns current layer (set by legend widget)
%End

    void setWheelFactor( double factor );
%Docstring
Sets wheel zoom factor (should be greater than 1)
%End

    void zoomScale( double scale, bool ignoreScaleLock = false );
%Docstring
Zooms the canvas to a specific ``scale``. The scale value indicates the
scale denominator, e.g. 1000.0 for a 1:1000 map.

If ``ignoreScaleLock`` is set to ``True``, then any existing constraint
on the map scale of the canvas will be ignored during the zoom
operation.
%End

    void zoomByFactor( double scaleFactor, const QgsPointXY *center = 0, bool ignoreScaleLock = false );
%Docstring
Zoom with the factor supplied. Factor > 1 zooms out, interval (0,1)
zooms in If point is given, re-center on it.

If ``ignoreScaleLock`` is set to ``True``, then any existing constraint
on the map scale of the canvas will be ignored during the zoom
operation.
%End

    void zoomWithCenter( int x, int y, bool zoomIn );
%Docstring
Zooms in/out with a given center
%End

    void zoomToFeatureExtent( QgsRectangle &rect );
%Docstring
Zooms to feature extent. Adds a small margin around the extent and does
a pan if rect is empty (point extent)
%End

    bool scaleLocked() const;
%Docstring
Returns whether the scale is locked, so zooming can be performed using
magnication.

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

    void enableAntiAliasing( bool flag );
%Docstring
used to determine if anti-aliasing is enabled or not
%End

    bool antiAliasingEnabled() const;
%Docstring
``True`` if antialiasing is enabled
%End

    void enableMapTileRendering( bool flag );
%Docstring
sets map tile rendering flag
%End

    void panActionEnd( QPoint releasePoint );
%Docstring
Ends pan action and redraws the canvas.
%End


    void panAction( QMouseEvent *event );
%Docstring
Called when mouse is moving and pan is activated
%End

    QPoint mouseLastXY();
%Docstring
returns last position of mouse cursor
%End

    void setPreviewModeEnabled( bool previewEnabled );
%Docstring
Enables a preview mode for the map canvas

:param previewEnabled: set to ``True`` to enable a preview mode

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

    bool previewModeEnabled() const;
%Docstring
Returns whether a preview mode is enabled for the map canvas

:return: ``True`` if a preview mode is currently enabled

.. seealso:: :py:func:`setPreviewModeEnabled`

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

    void setPreviewMode( QgsPreviewEffect::PreviewMode mode );
%Docstring
Sets a preview mode for the map canvas. This setting only has an effect
if previewModeEnabled is ``True``.

:param mode: preview mode for the canvas

.. seealso:: :py:func:`previewMode`

.. seealso:: :py:func:`setPreviewModeEnabled`

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

    QgsPreviewEffect::PreviewMode previewMode() const;
%Docstring
Returns the current preview mode for the map canvas. This setting only
has an effect if previewModeEnabled is ``True``.

:return: preview mode for map canvas

.. seealso:: :py:func:`setPreviewMode`

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

    QgsSnappingUtils *snappingUtils() const;
%Docstring
Returns snapping utility class that is associated with map canvas. If no
snapping utils instance has been associated previously, an internal will
be created for convenience (so map tools do not need to test for
existence of the instance).

Main canvas in QGIS returns an instance which is always up-to-date with
the project's snapping configuration.
%End

    void setSnappingUtils( QgsSnappingUtils *utils );
%Docstring
Assign an instance of snapping utils to the map canvas. The instance is
not owned by the canvas, so it is possible to use one instance in
multiple canvases.

For main canvas in QGIS, do not associate a different instance from the
existing one (it is updated from the project's snapping configuration).
%End

    void setExpressionContextScope( const QgsExpressionContextScope &scope );
%Docstring
Sets an expression context scope for the map canvas. This scope is
injected into the expression context used for rendering the map, and can
be used to apply specific variable overrides for expression evaluation
for the map canvas render. This method will overwrite the existing
expression context scope for the canvas.

:param scope: new expression context scope

.. seealso:: :py:func:`expressionContextScope`

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

    QgsExpressionContextScope &expressionContextScope();
%Docstring
Returns a reference to the expression context scope for the map canvas.
This scope is injected into the expression context used for rendering
the map, and can be used to apply specific variable overrides for
expression evaluation for the map canvas render.

.. seealso:: :py:func:`setExpressionContextScope`

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


    QgsExpressionContextScope *defaultExpressionContextScope() const /Factory/;
%Docstring
Creates a new scope which contains default variables and functions
relating to the map canvas.

.. seealso:: :py:func:`expressionContextScope`

.. seealso:: :py:func:`setExpressionContextScope`

.. versionadded:: 3.4
%End

    virtual QgsExpressionContext createExpressionContext() const;


    void setSegmentationTolerance( double tolerance );
%Docstring
Sets the segmentation tolerance applied when rendering curved geometries

:param tolerance: the segmentation tolerance
%End

    void setSegmentationToleranceType( QgsAbstractGeometry::SegmentationToleranceType type );
%Docstring
Sets segmentation tolerance type (maximum angle or maximum difference
between curve and approximation)

:param type: the segmentation tolerance typename
%End

    QList<QgsMapCanvasAnnotationItem *> annotationItems() const;
%Docstring
Returns a list of all annotation items in the canvas.
%End

    bool annotationsVisible() const;
%Docstring
Returns ``True`` if annotations are visible within the map canvas.

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

    void setAnnotationsVisible( bool visible );
%Docstring
Sets whether annotations are ``visible`` in the canvas.

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

    void setLabelingEngineSettings( const QgsLabelingEngineSettings &settings );
%Docstring
Sets global labeling engine settings in the internal map settings
%End

    const QgsLabelingEngineSettings &labelingEngineSettings() const;
%Docstring
Returns global labeling engine settings from the internal map settings
%End

    bool previewJobsEnabled() const;
%Docstring
Returns ``True`` if canvas map preview jobs (low priority render jobs
which render portions of the view just outside of the canvas extent, to
allow preview of these out-of-canvas areas when panning or zooming out
the map) are enabled for the canvas.

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

    void setPreviewJobsEnabled( bool enabled );
%Docstring
Sets whether canvas map preview jobs (low priority render jobs which
render portions of the view just outside of the canvas extent, to allow
preview of these out-of-canvas areas when panning or zooming out the
map) are ``enabled`` for the canvas.

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


    void setTemporalRange( const QgsDateTimeRange &range );
%Docstring
Set datetime ``range`` for the map canvas.

The :py:func:`~QgsMapCanvas.temporalRangeChanged` signal will be emitted
if the temporal range has been changed.

.. note::

   Calling :py:func:`~QgsMapCanvas.setTemporalRange` does not automatically trigger a map refresh.

.. seealso:: :py:func:`temporalRange`

.. versionadded:: 3.14
%End

    const QgsDateTimeRange &temporalRange() const;
%Docstring
Returns map canvas datetime range.

.. seealso:: :py:func:`setTemporalRange`

.. versionadded:: 3.14
%End

    void installInteractionBlocker( QgsMapCanvasInteractionBlocker *blocker );
%Docstring
Installs an interaction ``blocker`` onto the canvas, which may prevent
certain map canvas interactions from occurring.

The caller retains ownership of ``blocker``, and must correctly call
:py:func:`~QgsMapCanvas.removeInteractionBlocker` before deleting the
object.

.. seealso:: :py:func:`allowInteraction`

.. seealso:: :py:func:`removeInteractionBlocker`

.. versionadded:: 3.14
%End

    void removeInteractionBlocker( QgsMapCanvasInteractionBlocker *blocker );
%Docstring
Removes an interaction ``blocker`` from the canvas.

.. seealso:: :py:func:`allowInteraction`

.. seealso:: :py:func:`installInteractionBlocker`

.. versionadded:: 3.14
%End

    bool allowInteraction( QgsMapCanvasInteractionBlocker::Interaction interaction ) const;
%Docstring
Returns ``True`` if the specified ``interaction`` is currently permitted
on the canvas.

.. versionadded:: 3.14
%End

    void setMapController( QgsAbstract2DMapController *controller /Transfer/ );
%Docstring
Sets the input controller device to use for controlling the canvas.

Ownership of ``controller`` is transferred to the canvas.

.. versionadded:: 3.34
%End

  public slots:

    void refresh();
%Docstring
Repaints the canvas map
%End

    void refreshAllLayers();
%Docstring
Reload all layers (including refreshing layer properties from their data
sources), clears the cache and refreshes the canvas.

.. note::

   Consider using the less expensive :py:func:`~QgsMapCanvas.redrawAllLayers` method if a layer reload
   from the data provider is not required.
%End

    void redrawAllLayers();
%Docstring
Clears all cached images and redraws all layers.

.. note::

   Unlike :py:func:`~QgsMapCanvas.refreshAllLayers`, this does NOT reload layers themselves, and accordingly
   is more "lightweight". Use this method when only an update of the layer's renderers is required.

.. versionadded:: 3.10
%End

    void selectionChangedSlot();
%Docstring
Receives signal about selection change, and pass it on with layer info
%End

    void saveAsImage( const QString &fileName, QPixmap *QPixmap = 0, const QString & = "PNG" );
%Docstring
Save the contents of the map canvas to disk as an image
%End

    void layerStateChange();
%Docstring
This slot is connected to the visibility change of one or more layers
%End

    void setRenderFlag( bool flag );
%Docstring
Sets whether a user has disabled canvas renders via the GUI.

:param flag: set to ``False`` to indicate that user has disabled renders

.. seealso:: :py:func:`renderFlag`

.. seealso:: :py:func:`freeze` freeze() should be used to programmatically halt map updates,
             while :py:func:`~QgsMapCanvas.setRenderFlag` should only be used when users disable rendering via GUI.
%End

    void stopRendering();
%Docstring
stop rendering (if there is any right now)
%End

    void readProject( const QDomDocument & );
%Docstring
called to read map canvas settings from project
%End

    void writeProject( QDomDocument & );
%Docstring
called to write map canvas settings to project
%End

    void setMagnificationFactor( double factor, const QgsPointXY *center = 0 );
%Docstring
Sets the factor of magnification to apply to the map canvas. Indeed, we
increase/decrease the DPI of the map settings according to this factor
in order to render marker point, labels, ... bigger.

:param factor: The factor of magnification
:param center: Optional point to re-center the map
%End

    void setScaleLocked( bool isLocked );
%Docstring
Lock the scale, so zooming can be performed using magnication

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

    void zoomIn();
%Docstring
Zoom in with fixed factor
%End

    void zoomOut();
%Docstring
Zoom out with fixed factor
%End

    void zoomToSelected( QgsMapLayer *layer = 0 );
%Docstring
Zoom to the extent of the selected features of provided map layer.

:param layer: optionally specify different than current layer
%End

    void zoomToSelected( const QList<QgsMapLayer *> &layers );
%Docstring
Zoom to the combined extent of the selected features of all provided
(vector) layers.

:param layers: A list of layers

.. versionadded:: 3.18
%End

    void setZoomResolutions( const QList<double> &resolutions );
%Docstring
Set a list of resolutions (map units per pixel) to which to "snap to"
when zooming the map

:param resolutions: A list of resolutions

.. versionadded:: 3.12
%End

    double zoomInFactor() const;
%Docstring
Returns the zoom in factor.
%End

    double zoomOutFactor() const;
%Docstring
Returns the zoom in factor.
%End

    const QList<double> &zoomResolutions() const;
%Docstring
:return: List of resolutions to which to "snap to" when zooming the map

.. seealso:: :py:func:`setZoomResolutions`

.. versionadded:: 3.12
%End

    QgsDoubleRange zRange() const;
%Docstring
Returns the range of z-values which will be visible in the map.

.. seealso:: :py:func:`setZRange`

.. seealso:: :py:func:`zRangeChanged`

.. versionadded:: 3.18
%End

    void setZRange( const QgsDoubleRange &range );
%Docstring
Sets the ``range`` of z-values which will be visible in the map.

.. seealso:: :py:func:`zRange`

.. seealso:: :py:func:`zRangeChanged`

.. versionadded:: 3.18
%End

  signals:

    void xyCoordinates( const QgsPointXY &p );
%Docstring
Emits current mouse position

.. note::

   changed in 1.3
%End

    void scaleChanged( double scale );
%Docstring
Emitted when the scale of the map changes
%End

    void scaleLockChanged( bool locked );
%Docstring
Emitted when the scale locked state of the map changes

:param locked: true if the scale is locked

.. seealso:: :py:func:`setScaleLocked`

.. versionadded:: 3.18
%End


    void extentsChanged();
%Docstring
Emitted when the extents of the map change
%End

    void rotationChanged( double rotation );
%Docstring
Emitted when the rotation of the map changes
%End

    void magnificationChanged( double magnification );
%Docstring
Emitted when the scale of the map changes
%End

    void canvasColorChanged();
%Docstring
Emitted when canvas background color changes
%End


    void renderComplete( QPainter *painter );
%Docstring
Emitted when the canvas has rendered. Passes a pointer to the painter on
which the map was drawn. This is useful for plugins that wish to draw on
the map after it has been rendered. Passing the painter allows plugins
to work when the map is being rendered onto a pixmap other than the
mapCanvas own pixmap member.

- anything related to rendering progress is not visible outside of map canvas
- additional drawing shall be done directly within the renderer job or independently as a map canvas item
%End

    void mapCanvasRefreshed();
%Docstring
Emitted when canvas finished a refresh request.
%End

    void renderStarting();
%Docstring
Emitted when the canvas is about to be rendered.
%End

    void mapRefreshCanceled();
%Docstring
Emitted when the pending map refresh has been canceled

.. versionadded:: 3.18
%End

    void layersChanged();
%Docstring
Emitted when a new set of layers has been received
%End

    void keyPressed( QKeyEvent *e );
%Docstring
Emit key press event
%End

    void keyReleased( QKeyEvent *e );
%Docstring
Emit key release event
%End

    void mapToolSet( QgsMapTool *newTool, QgsMapTool *oldTool );
%Docstring
Emit map tool changed with the old tool
%End

    void selectionChanged( QgsMapLayer *layer );
%Docstring
Emitted when selection in any ``layer`` gets changed.

.. note::

   Since QGIS 3.28 this signal is emitted for multiple layer types, including :py:class:`QgsVectorLayer` and :py:class:`QgsVectorTileLayer`
%End

    void zoomLastStatusChanged( bool available );
%Docstring
Emitted when zoom last status changed
%End

    void zoomNextStatusChanged( bool available );
%Docstring
Emitted when zoom next status changed
%End

    void destinationCrsChanged();
%Docstring
Emitted when map CRS has changed
%End

    void transformContextChanged();
%Docstring
Emitted when the canvas transform context is changed.
%End

    void currentLayerChanged( QgsMapLayer *layer );
%Docstring
Emitted when the current layer is changed
%End

    void layerStyleOverridesChanged();
%Docstring
Emitted when the configuration of overridden layer styles changes
%End

    void themeChanged( const QString &theme );
%Docstring
Emitted when the canvas has been assigned a different map theme.

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

    void messageEmitted( const QString &title, const QString &message, Qgis::MessageLevel level = Qgis::MessageLevel::Info );
%Docstring
emit a message (usually to be displayed in a message bar)
%End

    void renderErrorOccurred( const QString &error, QgsMapLayer *layer );
%Docstring
Emitted whenever an error is encountered during a map render operation.

The ``layer`` argument indicates the associated map layer, if available.

.. versionadded:: 3.10.0
%End

    void panDistanceBearingChanged( double distance, Qgis::DistanceUnit unit, double bearing );
%Docstring
Emitted whenever the distance or bearing of an in-progress panning
operation is changed.

This signal will be emitted during a pan operation as the user moves the
map, giving the total distance and bearing between the map position at
the start of the pan and the current pan position.

.. versionadded:: 3.12
%End

    void tapAndHoldGestureOccurred( const QgsPointXY &mapPoint, QTapAndHoldGesture *gesture );
%Docstring
Emitted whenever a tap and hold ``gesture`` occurs at the specified map
point.

.. versionadded:: 3.12
%End

    void temporalRangeChanged();
%Docstring
Emitted when the map canvas temporal range changes.

.. versionadded:: 3.14
%End

    void zRangeChanged();
%Docstring
Emitted when the map canvas z (elevation) range changes.

.. seealso:: :py:func:`zRange`

.. seealso:: :py:func:`setZRange`

.. versionadded:: 3.18
%End

    void contextMenuAboutToShow( QMenu *menu, QgsMapMouseEvent *event );
%Docstring
Emitted before the map canvas context menu will be shown. Can be used to
extend the context menu.

.. versionadded:: 3.16
%End

  protected:
    virtual bool event( QEvent *e );

    virtual void keyPressEvent( QKeyEvent *e );

    virtual void keyReleaseEvent( QKeyEvent *e );

    virtual void mouseDoubleClickEvent( QMouseEvent *e );

    virtual void mouseMoveEvent( QMouseEvent *e );

    virtual void mousePressEvent( QMouseEvent *e );

    virtual void mouseReleaseEvent( QMouseEvent *e );

    virtual void wheelEvent( QWheelEvent *e );

    virtual void resizeEvent( QResizeEvent *e );

    virtual void paintEvent( QPaintEvent *e );

    virtual void dragEnterEvent( QDragEnterEvent *e );

    virtual bool viewportEvent( QEvent *event );


    void moveCanvasContents( bool reset = false );
%Docstring
called when panning is in action, reset indicates end of panning
%End

    virtual void dropEvent( QDropEvent *event );


    virtual void showEvent( QShowEvent *event );


    void emitExtentsChanged();
%Docstring
Emits the extentsChanged signal when appropriate.

.. versionadded:: 3.30
%End




  protected slots:
    void updateCanvasItemPositions();
%Docstring
called on resize or changed extent to notify canvas items to change
their rectangle
%End

      public:
}; // class QgsMapCanvas


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