31 Commits

Author SHA1 Message Date
Nyall Dawson
5e150f9262 Allow paint effects to be applied to an annotation layer 2021-09-10 18:26:39 +10:00
Nyall Dawson
fbce5ad864 Implement html metadata for annotation layers 2021-09-10 18:26:39 +10:00
Nyall Dawson
1228f59bff Make annotation item edit API a bit more flexible 2021-09-10 15:01:26 +10:00
Nyall Dawson
1fe874315a Add method to apply a annotation item edit operation directly
onto a QgsAnnotationLayer
2021-09-10 15:01:26 +10:00
Nyall Dawson
38b8b82674 Add method to replace an existing item in an annotation layer 2021-09-07 10:35:02 +10:00
Nyall Dawson
f5bd9ccaee
[annotations] Implement scale dependent bounding box calculation for marker items 2021-09-02 14:45:18 +10:00
Nyall Dawson
b09994abcc Add a minimal data provider for annotation layers
Required for some nice things, like avoiding rendering slower
annotation layers in canvas preview jobs
2021-08-31 11:04:29 +10:00
Nyall Dawson
47bcf09af6 Rework annotation layer index handling
Because some annotation items have scale dependent bounding boxes,
we can only index items which have a fixed bounding box. Other
item bounds need to be dynamically determined based on a specific
render context. So rework the annotation layer index handling
to only index appropriate items and store other items in a non-indexed
item set.

This isn't ideal, because it means we need to clone ALL non-indexed
items upfront whenever we render an annotation layer (it's too expensive
to calculate their actual bounding box and selectively clone them,
as it's a process which blocks the main thread).

Hopefully we can think of an alternative approach to this down
the line so that we DO have some form of spatial index for scale
dependent items, unlocking better performance for annotation layers
with 10,000s of items. But we'll ignore that situation for now ;)
2021-08-31 11:04:29 +10:00
Nyall Dawson
aeb7d89a24 Use a spatial index to optimise annotation layer item retrieval 2021-08-19 13:26:36 +10:00
Nyall Dawson
e3b10ff5b1 Add method to retrieve a specific item from an annotation layer by id 2021-08-19 13:26:36 +10:00
Nyall Dawson
3b2e640cee Add a new enum for inherent map layer properties, and add property
to annotation layers to reflect that while these are editable
users are not able to toggle edits on them (they are ALWAYS
editable!)

Note that we can't use the existing QgsMapLayer::LayerFlag enum here,
as that has a different meaning (flags which are set by users
at runtime)
2021-08-18 12:32:41 +10:00
Nyall Dawson
3f7fc069ae Annotation layers should return true to isEditable, supportsEditing 2021-08-18 12:32:41 +10:00
Denis Rouzaud
ba8a445850 run sipify 2021-03-22 21:13:52 +01:00
Nyall Dawson
50b9beaad6 [sipify] Catch more class references and insert :py:class: annotations 2021-01-31 05:41:22 +10:00
Nyall Dawson
f3648ba3f6 Move getters and setters for layer opacity from QgsVectorLayer to QgsMapLayer
All the logic for rendering non-opaque layers is handled in a layer
type agnostic way already, so this just allows the existing handling
to be used for mesh/point cloud/vector tile/etc layers also
2020-11-13 21:27:06 +10:00
Nyall Dawson
819fc50b0e Don't use generic "QgsMapLayer" class name in map layer Python repr
strings

Rather use actual layer subclass type, e.g. QgsVectorLayer
2020-11-12 16:05:52 +10:00
Nyall Dawson
b9cd453674 Add method to determine whether an annotation layer is empty 2020-09-01 15:29:32 +10:00
Nyall Dawson
69665cd534 Add method to reset QgsAnnotationLayer back to default state 2020-08-27 13:08:51 +10:00
Nyall Dawson
199cd7e8d2 Add clear method to QgsAnnotationLayer 2020-08-27 13:08:51 +10:00
Nyall Dawson
f0d2f3d21d Allow removing items from annotation layers 2020-08-05 16:27:09 +10:00
Nyall Dawson
5e9264dfb7 Add unit tests for annotation layer 2020-08-05 16:27:09 +10:00
Nyall Dawson
c31ee84b46 Don't return reference 2020-08-05 16:27:09 +10:00
Nyall Dawson
a90555bf95 Remove data provider from annotation layer -- this is no longer required 2020-08-05 16:27:09 +10:00
Nyall Dawson
6f90139fe9 Dox, build fixes 2020-08-05 16:27:09 +10:00
Nyall Dawson
96cf240b39 Dox cleanup 2020-08-05 16:27:09 +10:00
Nyall Dawson
c523063401 Basic storage and restore of annotation layers in projects 2020-08-05 16:27:09 +10:00
Nyall Dawson
bc745a14e1 Create minimal data provider for annotation layers 2020-08-05 16:27:09 +10:00
Nyall Dawson
83e48c0254 Add missing Transfer annotation 2020-08-05 16:27:09 +10:00
Nyall Dawson
c8e86aefc7 Move QgsAnnotationItem to its own file 2020-08-05 16:27:09 +10:00
Nyall Dawson
21a2599d0d Move annotation layer renderer to own file 2020-08-05 16:27:09 +10:00
Nyall Dawson
9f943f72a8 First steps towards free-form graphics item layer
Based on a port from the downstream Kadas application's item layer
type

Kudos to @manisandro
2020-08-05 16:27:09 +10:00