-
-
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
Implementation of labeling engine rules #58580
Implementation of labeling engine rules #58580
Conversation
@nyalldawson A documentation ticket will be opened at https://github.com/qgis/QGIS-Documentation when this PR is merged. Please update the description (not the comments) with helpful description and screenshot to help the work from documentors. Thank you! |
This pull request has been tagged for the changelog.
You can edit the description. Format available for credits
Thank you! |
Now with GUI, this is ready for review... |
Nice @nyalldawson! What about showing involved layers next to the rule in the "Labeling rules" list? It might help to quickly identify the rule you want to update... |
@DelazJ you can set your own name for rules, which is used in that list. I was thinking that could be better for rule identification. Maybe we could show a summary including involved layers in a tooltip for the list item? |
Ah, great! I only watched the screencast which didn't showcase that.
+1 from me. When you are out of inspiration for rules naming, this could be handful 😄 |
@DelazJ Peek.2024-09-09.11-11.mp4 |
* | ||
* The default implementation returns FALSE. | ||
*/ | ||
virtual bool candidateIsIllegal( const pal::LabelPosition *candidate, QgsLabelingEngineContext &context ) const SIP_SKIP; |
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'm not sure why but I don't like the word 'illegal' here. What about candidateIsForbidden, candiateIsProhibited, candidateIsDisallowed, candidateIsBanned ? We're breaching rules not laws 😉
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... we have QgsAbstractDatabaseProviderConnection::illegalFieldNames
, but nothing in current api with forbidden/prohibited/disallowed/banned. Is one other method enough to set the precedent?
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.
@nyalldawson , ideally we'd change illegalFieldNames to prohibited/forbiddenFileNames but that API is exposed to bindings so it's frozen right?
Seems like settling for what preexisting keyword is a good argument enough then.
See qgis/QGIS-Enhancement-Proposals#299 Implements the API framework for setting advanced labeling engine rules for a project, and implements 4 initial rule types: - QgsLabelingEngineRuleMinimumDistanceLabelToFeature: prevents labels being placed too *close* to features from a different layer - QgsLabelingEngineRuleMaximumDistanceLabelToFeature: prevents labels being placed too *far* from features from a different layer - QgsLabelingEngineRuleMinimumDistanceLabelToLabel: prevents labels being placed too close to labels from a different layer - QgsLabelingEngineRuleAvoidLabelOverlapWithFeature: prevents labels being placed overlapping features from a different layer (note that the first 3 rules require a build based on GEOS >= 3.10, they are not available for older GEOS builds) Also implements a registry for storing available rule classes, and serialization of rules and configuration in QGIS projects
Adds the necessary hooks into the pal classes to give engine rules a chance to implement their logic
- grey out the rule in the rules list - show an explanatory tooltip - don't allow users to create copies of that rule
b93e9de
to
9a909a0
Compare
@nyalldawson |
See qgis/QGIS-Enhancement-Proposals#299
Implements the API framework for setting advanced labeling engine rules for a project, and implements 4 initial rule types:
(note that the first 3 rules require a build based on GEOS >= 3.10, they are not available for older GEOS builds)
Also implements a registry for storing available rule classes, and serialization of rules and configuration in QGIS projects
Now with GUI:
Peek.2024-09-06.13-06.mp4
Sponsored by Rubicon Concierge Real Estate