50 Commits

Author SHA1 Message Date
Nyall Dawson
183e86f5b3 [api] Add method to test if labeling as non-default blend modes 2025-05-21 07:19:45 +10:00
Nyall Dawson
169657a0fb Sipify 2025-05-04 17:55:25 +10:00
Nyall Dawson
f1b8682e36 Improve API for exporting to SLD
Deprecate old methods and make methods always take QgsSldExportContext.
Add capacity to QgsSldExportContext to collect export errors and
warnings.

The old API had no way to reliably report errors/warnings during
export to users.
2025-05-04 17:55:25 +10:00
Nyall Dawson
c0a3e90ecf Fix misc tests 2025-04-22 11:45:25 +10:00
Nyall Dawson
c2ee323793 [feature] Add labeling setting to prevent duplicate labels within xx mm
Improves the appearance of labels in situations like road networks,
where things like dual carriageways, service roads, etc can result
in many labels of the exact same text appearing close to each other.

When active, removes any labels with the exact same text (case
sensitive!) which are closer then this minimum distance.

The setting applies across layers, so duplicate text from ANY
layer will be considered.
2025-04-22 11:45:25 +10:00
Nyall Dawson
4d98f21d67 [feature] Add 'margin around labels' setting for labeling
Allows setting a margin around a layer's labels, which prevents
other labels from being placed closer than this margin distance
to the layer's labels.
2025-04-22 11:45:25 +10:00
Nyall Dawson
3f6b490218 Sipify 2025-04-02 11:11:10 +10:00
Nyall Dawson
4a10066b69 Fix grammar errors in class docstrings 2025-04-01 09:44:00 +10:00
Nyall Dawson
afd2e4f42d Fix doxygen class briefs which aren't full sentences 2025-04-01 09:44:00 +10:00
Nyall Dawson
6d122f0038 Sipify 2025-03-30 20:48:07 +10:00
Nyall Dawson
bdba8d6366 Refactor too long doxygen brief comments
These break the table of contents for the PyQGIS documentation
2025-03-30 20:48:07 +10:00
Nyall Dawson
29050007d7 Fix class documentation which starts with "this is..."/"a class..." etc 2025-03-30 20:48:07 +10:00
Julien Cabieces
c5dee65d0f fix(RuleBasedRendering): keep rule key while cloning when needed
rule key is used by other object as reference (masking for instance)

Fixes #46402
2025-02-07 12:25:19 +10:00
PatrikSylve
12a2079225
Ensure consistent label positioning by sorting rule based label providers 2025-02-04 11:04:57 +10:00
Harrissou Sant-anna
53e777fd97 Typo fix 2024-12-18 06:17:52 +10:00
Julien Cabieces
ed64834106 api(deprecated): add message to deprecated SIP annotation 2024-12-17 09:06:42 +01:00
Nyall Dawson
7670fbe362
Move class, method out of QgsPalLabeling to central location 2024-12-02 12:46:23 +10:00
Nyall Dawson
cf1e6fd9bc Make "archive" copy of QgsPalLayerSettings::calculateLabelSize
For stable API use only, and then cleanup the private version
of this to remove all the consideration of 3.0 API compatibility.

Mark the archive copy as deprecated and remove in 4.0

This method has become completely unweildy because of all the
compatibility code. By making this private only we can rip
out all this old code and make the method much simpler and
easy to understand.
2024-10-21 13:41:51 +10:00
Nyall Dawson
569da98cd8 If a rule is not available on the system (eg geos too old):
- grey out the rule in the rules list
- show an explanatory tooltip
- don't allow users to create copies of that rule
2024-09-11 02:06:41 +10:00
Nyall Dawson
6c2055fc1e Generate user-friendly tooltips 2024-09-11 02:06:41 +10:00
Nyall Dawson
2d3e6aac43 Allow labeling rules to be de-activated 2024-09-11 02:06:41 +10:00
Nyall Dawson
3ec7665fec Add gui for configuring project advanced labeling rules 2024-09-11 02:06:41 +10:00
Nyall Dawson
98bd60e4ba Add __repr__ 2024-09-11 02:06:41 +10:00
Nyall Dawson
940949cbf9 Rules can have user-configurable names 2024-09-11 02:06:41 +10:00
Nyall Dawson
538cec5970 Fix seealso 2024-09-11 02:06:41 +10:00
Nyall Dawson
15a7079a39 [api] Implementation of labeling engine rules
See https://github.com/qgis/QGIS-Enhancement-Proposals/issues/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
2024-09-11 02:06:41 +10:00
Nyall Dawson
ef0289f3ec Fix formatting of Python ..deprecated annotations in docstrings
Fixes https://github.com/qgis/pyqgis-api-docs-builder/issues/174
2024-09-02 11:42:12 +10:00
Nyall Dawson
765cbb32db Standardise some deprecated annotations 2024-09-02 11:42:12 +10:00
Nyall Dawson
3a578d6712 Header update 2024-08-13 20:28:55 +10:00
Nyall Dawson
6f652d251b Drop no-value copy constructor dox 2024-07-25 04:02:55 +10:00
Nyall Dawson
28943f9c1b Remove a bunch of useless default constructor doxygen 2024-07-23 02:08:28 +10:00
Nyall Dawson
f5853a7212 Add tab stop distance to QgsTextFormat 2024-05-25 06:10:28 +10:00
Nyall Dawson
fe74b300be [feature] Add maximum distance setting for point labels
For the "Around point" and "Cartographic" placement modes, this
adds a new optional setting for the maximum distance of the labels from
the feature. It's used together with the existing distance setting
to define a range of distances at which labels may be placed
from their corresponding point features.

This adds more flexibility to the placement for these layers,
ultimately allowing for more labels to be placed in busy maps.

When the layer is set to the "around point" mode, then label
candidates which are closer to the point will always be prefered
over those which are further away.

When the layer is set to the "cartographic" mode, then the default
behavior is also to prioritize closer labels. A new combo box
allows users to control the priority, with an option for
prefering position ordering. If this option is set, then candidates
at the corresponding positions (eg top left) are preferred regardless
of how far they are from the point, with the labelling falling
back to alternate positions only when no labels can be placed
up to the maximum label distance.

Sponsored by Rubicon Concierge Real Estate Services
2024-05-23 17:20:30 +10:00
Nyall Dawson
587a80dcc2 Move label quadrant setting to QgsLabelPointSettings 2024-05-23 17:20:30 +10:00
Nyall Dawson
49cbe3bec3 Better documentation 2024-05-23 17:20:30 +10:00
Nyall Dawson
24cc226a64 Expose a useful method to python 2024-05-23 17:20:30 +10:00
Nyall Dawson
dda755d058 Move predefined position order member to QgsLabelPointSettings 2024-05-23 17:20:30 +10:00
Nyall Dawson
e81fcd0b09 Start on QgsLabelPointSettings class 2024-05-23 17:20:30 +10:00
Even Rouault
15ea5c46bc
Header files: remove all mentions of '\since QGIS 3.0' 2024-02-18 20:57:23 +01:00
Even Rouault
02caeb9db7
Header files: remove all mentions of '\since QGIS 2.' 2024-02-18 20:46:01 +01:00
Nyall Dawson
0096246afe Sipify 2024-02-13 20:51:03 +10:00
Nyall Dawson
814e6db3b4 Don't map non-list of QVariantMaps to QMap<QString,QVariant>
The original workaround was only supposed to apply to QList/
QVector of QVariantMaps. By replacing them all in sip we
break mapping of signals defined in c++ which are emitted
by Python code.

Fixes exceptions after running processing algorithms in Qt6
builds.
2024-02-12 12:16:14 +10:00
Nyall Dawson
3e07b06d87 Fix broken old API compatibility code on Qt 6 builds
The old sip based approach to handling property -> getter/setter
conversion is broken on sip6, so move the patching into Python.

Also fix incorrect checks in tests, and add additional test
for compatiblity code.
2024-02-04 05:54:31 +10:00
Nyall Dawson
f2c74f377d Sipify 2024-01-31 17:16:18 +10:00
Nyall Dawson
078fd4f2ea Make IntFlag enum type opt-in, rather than opt-out
And make sipify handle this nicely. This means that all our non-flag
style enums correctly map across to IntFlag python enums on Qt 6,
fixing issues with negative enum values for these and providing
a better match for the original c++ enum.
2024-01-31 17:16:18 +10:00
Nyall Dawson
f1e3ba9e2d Use correct sip method
And use INDENT-OFF annotations to avoid astyle messing up
formatting of enum with inline macros
2024-01-31 13:48:49 +10:00
Nyall Dawson
23f3af4290 Use enum classes for QgsProperty property keys
Should fix usage on Qt 6 builds
2024-01-31 13:48:49 +10:00
Nyall Dawson
4654ad3db5 Sipify 2024-01-23 08:32:38 +01:00
Julien Cabieces
7f586d8742 PyQt6 sip files 2023-12-13 05:36:44 +10:00
Julien Cabieces
bb3c36a69b Initialize sip bindings for PyQt6
use exactly the ones from PyQt5 so we can study the difference when
generating for PyQt6
2023-12-08 03:38:42 +10:00