-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add API for "Annotation layers" #38021
Conversation
😭🙇♂️🙏 This is so important! Thanks Nyall & SUG! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very cool stuff !!!!!
* | ||
* \see crs() | ||
*/ | ||
void setCrs( const QgsCoordinateReferenceSystem &crs ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reason for items having individual crs (rather than all being in layer crs)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question! I had my slyr hat on here, and annotations in ESRI world are stored using a referenced geometry + crs pair. So approaching it like this makes it easier to translate between the two. I don't see any problem in particular with this approach, expect a bit of extra code complexity. But I'm not set on it if you think it's a mistake...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was wondering what we gain (not sure if ESRI compatibility alone is convincing). I was a bit afraid of complexity: project crs vs layer crs vs item crs seems a lot of reprojection and possible room for missing one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah - but an annotation layer itself has no CRS. So it's just map CRS vs item CRS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, every layer has a QgsMapLayer::crs()
by design.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...But since a while we've supported returning invalid crs objects from this as a reflection of "no crs" 😁
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How are you going to work with this UI wise? Add it with the current project CRS? Will the CRS change if an item is moved?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I'm convinced. I'll rework this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great stuff.
3aa31d5
to
a40eb30
Compare
Based on a port from the downstream Kadas application's item layer type Kudos to @manisandro
2ab4065
to
73ea839
Compare
Unrelated test failure |
This PR adds the underlying API for a new QgsMapLayer subclass: "QgsAnnotationLayer".
An annotation layer is designed for freeform drawing of georeferenced objects, which don't have any of the constraints of adding objects to a standard vector layer. They don't have fields, and can contain many different types of drawing objects in a single layer (e.g. markers, lines, text objects, etc). The annotation items are all spatially referenced, so are attached to particular geographic geometries (potentially allowing for them to be converted to real vector layers in future).
Use cases for annotation layers include:
An annotation layer consists of a set of items which are subclasses of QgsAnnotationItem. Included in this PR are three annotation item types:
(future PRs will add various text item subclasses too)
This work is loosely based off the redlining tools support from Sourcepole's Kadas fork, but with many changes:
No GUI is exposed for working with annotation layers -- funding is sought for adding this (I'll be launching a crowdfund for this shortly). For now, it's the underlying API only.
Sponsored by the QGIS Swiss user group.