76 Commits

Author SHA1 Message Date
Juergen E. Fischer
c6008b7ee1 fix MSVC build: reverts fee62e4, dff05dd and e3a77b9484c effectivly
reverting 3fb0f66 (followup #45348)

Using --no-public-is-protected (default on Windows) also works on Linux
and fixes #45331 too
2021-10-21 23:03:48 +02:00
nirvn
ef84e48a09 Run sipify_all.sh 2021-10-12 16:34:05 +10:00
Denis Rouzaud
ec16736306 run sipify 2021-10-12 16:34:05 +10:00
Nyall Dawson
0ab6113e88 Promote QgsMapSettings and QgsRenderContext enums to enum class, move to Qgis 2021-09-26 11:24:51 +10:00
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
4cb06c0ae2 Add an annotation item edit operation for adding nodes 2021-09-10 15:01:26 +10:00
Nyall Dawson
a7d299df92 Use an edit operation for annotation item translation, instead of
transform

Will make it easier to add undo/redo support in future
2021-09-10 15:01:26 +10:00
Nyall Dawson
1228f59bff Make annotation item edit API a bit more flexible 2021-09-10 15:01:26 +10:00
Nyall Dawson
4b245f59e0 Add new annotation edit operation for deleting a vertex 2021-09-10 15:01:26 +10:00
Nyall Dawson
1537d393e3 Add framework for retrieving the temporary results of a in-progress
edit operation on an annotation item

This is used for the item to return a representative geometry
of what the item would look like if the operation were to be
applied. It's used to generate a rubber band showing a preview
of the modification during interactive editing operations on
an annotation item.
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
631343265d Allow QgsAnnotationItemEditOperationMoveNode operations to be
applied to annotation items to move nodes in the item
2021-09-10 15:01:26 +10:00
Nyall Dawson
a87206dbdf Create QgsAbstractAnnotationItemEditOperation as base class for
edit operations on annotation layers, with initial implementation
as QgsAnnotationItemEditOperationMoveNode

This class encapsulates edit operations which apply to annotation
layers/items
2021-09-10 15:01:26 +10:00
Nyall Dawson
5ed05fadca Add an id number to QgsAnnotationItemNode 2021-09-10 15:01:26 +10:00
Nyall Dawson
6d926d4ffe Add method to create rubber band geometry for an annotation item 2021-09-07 15:48:17 +10:00
Nyall Dawson
8d1f2bf7a6 Add a method to transform QgsAnnotationItems using a QTransform
transform
2021-09-07 15:48:17 +10:00
Nyall Dawson
46f1957cee [api] Annotation items can have their symbology reference scale set
This is especially important for annotation items, where users will
want to create text items with text which scales up and down with
the map.
2021-09-07 14:57:57 +10:00
Nyall Dawson
837dd24858 Make it easier for annotation item subclasses to correctly
copy/read/write common base class properties
2021-09-07 14:57:57 +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
40bef07264 Correctly handle rendered item results stored when map canvas redraw
partially uses cached layer results
2021-09-06 12:38:33 +10:00
Nyall Dawson
4ff1e55a21 [api] Add method to retrieve the nodes for an annotation item
For now all nodes just directly represent vertices in the item,
but the intention here is that they can represent any form of handle
which can be used to manipulate an item (e.g. a bezier curve point,
some "smart shape" handle for resizing or rotating an item, etc)
2021-09-03 08:06:48 +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
660433d9a9 [api] Add framework for collecting rendered item details during map
renderer operations

This follow a similar pattern as how labeling results could be collected
after a map render job, but generalises the API so that it can be
used for storing details of rendered items of any type.

It's currently used for storing details of rendered annotation items,
so that map tools can retrieve details of annotation items visible
in the canvas in an optimised way.
2021-08-31 11:04:29 +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
b4acffbb31 Add flag for scale dependent bounding boes 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
Marco Hugentobler
6cda8310d1 [Feature]: Allow setting html text directly in html annotation item (e.g. not from file) 2021-06-11 12:04:19 +02:00
Nyall Dawson
b5dfe8f155 Refactor enum handling
- Add enums to qgis.h instead of qgscoreenums, so that they belong to
a Qgis namespace
- Split up the various symbol headers into multiple files so that we
can fine-tune their inclusion and forward declare more readily, speeding
up recompilation
- Move QgsSymbol enums to qgis
2021-05-18 16:59:22 +10:00
Denis Rouzaud
ba8a445850 run sipify 2021-03-22 21:13:52 +01:00
Nyall Dawson
c6370c7f52
Speed up QGIS compilation by removing all Qt Module-wide includes
Refs https://www.kdab.com/beware-of-qt-module-wide-includes/
2021-03-05 11:23:15 +10: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
d1bc82ca7b Misc typo fixes 2020-08-31 11:38:02 +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
5a7cb166d0 [annotations] Refactor annotation item subclasses so that they
work correctly with curved geometry types, and tweak some API naming
accordingly

There's no need to be restrictive and only require linear geometries
for these items!
2020-08-19 14:33:55 +10:00
Nyall Dawson
25a78e1589 [api] Add QgsAnnotationPointTextItem annotation item class for
rendering text at a specified map point
2020-08-11 14:14:25 +10:00
Nyall Dawson
50d4bf0f10 Treat item crs as matching annotation layer CRS 2020-08-05 16:27:09 +10:00
Nyall Dawson
ca384b2452 Address review comments 2020-08-05 16:27:09 +10:00
Nyall Dawson
ea392ea17a Dox 2020-08-05 16:27:09 +10:00
Nyall Dawson
f2d172fcd3 Implement layer extent calculation 2020-08-05 16:27:09 +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