72 Commits

Author SHA1 Message Date
Nyall Dawson
8bb64a0683 Split existing "Show all labels (including colliding labels)" into
two separate new options

This setting was ambiguous in meaning -- it could be interpreted
as either:

"I don't care about overlapping labels, use them when
you have no other choice"

OR

"I want to see labels for EVERYTHING in this layer, and I don't
care what you have to do to show me those"

This leads to situations like those discussed in #41043, where some
users interpret the setting as the first meaning and get confused
when eg. a curved label line layer starts showing horizontal placements
for some features which couldn't otherwise be labeled (eg short
lines).

So, split the setting into two new options (checkboxes) with explicit, clear
distinction:

- "Allow overlapping labels if unavoidable": This setting means labels
can be overlapping, if there's no other option. It does NOT gaurantee
that all features in the layer will have labels, because other
constraints (such as lines too short to fit a label's text) will still
be respected and may prevent labels for the feature.

- "Allow inferior fallback placements": This mode permits features
to fallback to worse placement options when there's no other choice,
e.g. when a line is too short to fit a curved label text then the
label may be placed horizontally just over the feature's center
point.

The combination of checking BOTH options WILL gaurantee that
all features in the layer are labelled, albeit with both overlapping
labels and the degraded placements!

Fixes #41043
2022-06-03 18:20:03 +10:00
Alessandro Pasotti
f6b99b2b4a Address Nyall's comments 2022-04-06 11:47:21 +10:00
Alessandro Pasotti
66322f4c7f Curved offset first attempt 2022-04-06 11:47:21 +10:00
Alessandro Pasotti
a296a8bb84
Merge pull request #47782 from nyalldawson/highlight_all_curved
Highlight all characters in curved labels when hovering using a map label tool, instead of just one character
2022-03-17 13:29:49 +01:00
Nyall Dawson
94f198b36b Default to a "Follow placement" mode for the text anchor point, which
means when the line anchor is < 25% then it will be matched to the
start of the text, when the line anchor is > 75% it will be matched
to the end of the text, otherwise match to center of text
2022-03-15 16:31:45 +10:00
Nyall Dawson
3924437947 Use Q_ENUM for enums 2022-03-15 16:31:45 +10:00
Nyall Dawson
f2e338259a [feature][labeling] Expose control of what part of text (start,
middle or end) of line labels corresponds to the anchor position

Previously labels would always be centered over the anchor position
of lines (unless it was a curved label, in which case it was the
start of the lable!) This is limiting (and inconsistent) for some
placements, where it is preferable to e.g. line up the end
of the label text with a specific point on the line
2022-03-15 16:31:45 +10:00
Nyall Dawson
955cc8bf8c [labeling] Highlight all characters in curved labels when hovering
using a map label tool, instead of just one character
2022-03-15 15:08:22 +10:00
Nyall Dawson
237152e5ff [feature][labeling] Allow data-defined control over line anchor type
Allows data-defined control over whether the 'hint' or 'strict'
anchoring type is used
2022-02-20 06:47:15 +10:00
Damiano Lombardi
2f703f9c14 Simplified configuration gui 2022-01-10 08:35:14 +01:00
Damiano Lombardi
d7a58c6cc3 Removed ewkt conversion functions 2022-01-10 08:34:44 +01:00
Damiano Lombardi
ff04cbbe09 Add possibility do data define label position by point instead of X/Y 2022-01-10 08:18:03 +01:00
Damiano Lombardi
6d2c4245ce remove unneeded SIP_CONVERT_TO_SUBCLASS_CODE 2022-01-10 08:09:32 +01:00
Damiano Lombardi
9f7353b91c switch to XY coordinate types when using label move tool 2022-01-10 08:09:28 +01:00
Nyall Dawson
730cd7e23a [feature] Add "stretch" setting for labels and text formats
Allows text to be horizontally stretched or condensed by a %
factor. Handy for tweaking the widths of fonts to fit a bit
of extra text into labels (when used sparingly, that is...
you can certainly abuse font stretching with some horrendous
results!)

Requires Qt 6.3+ or KDE's 5.15 fork

Thanks for KDAB for fixing the upstream issues blocking this!
2021-11-09 14:58:14 +11:00
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
Damiano Lombardi
0874a6a4e3 QgsMapToolRotateLabel respect rotation unit 2021-09-01 07:54:10 +02:00
Damiano Lombardi
b19b39637e [labeling] test for rotation unit 2021-09-01 07:54:09 +02:00
Damiano Lombardi
44fb7d6714 [labeling] specify unit for data defined label rotation 2021-09-01 07:54:09 +02:00
Nyall Dawson
cf8b96ad44 Nicer memory handling when registering label features 2021-06-21 14:28:27 +10:00
Nyall Dawson
c95fed55f1 [api] Add labeling flag to collect unplaced labels without rendering them 2021-06-09 20:45:20 +10:00
Nyall Dawson
8e2fb49718 Add method to retrieve all labels from QgsLabelingResults, instead of just labels within a rect 2021-06-09 20:45:20 +10:00
Nyall Dawson
8bfb959e29 Add a __repr__ for QgsLabelPosition 2021-06-09 20:45:20 +10:00
Nyall Dawson
b190c8f06b [labeling] Default to cartographic placement mode for point layers
Results in much nicer label placement, so should be the default mode
2021-05-25 16:39:15 +10:00
Nyall Dawson
e7c4c84ae3 [labeling][api] Add api to supress unplaced label visibility for
a single layer

Not exposed anywhere, for PyQGIS use only
2021-05-25 16:11:53 +10:00
Marco Hugentobler
dce94dc656 mLegend string member with getter and setter 2021-05-13 22:40:13 +02:00
Marco Hugentobler
62d73373c1 Make legend/preview text configurable 2021-05-11 18:32:46 +02:00
nirvn
9989cffb3c [feature][callouts] Add blending mode settings 2021-04-26 19:34:16 +10:00
Nyall Dawson
7126faf27c [feature][labelling] Add an option to control how line features are
clipped before their anchor points are calculated

The previous behavior was to always use only the visible part
of the line when calculating the anchor point for labels. Now,
users have the option to choose "Use Entire Line" when setting
the label anchor point for lines, so that the entire line
feature is considered when calculating the point to place
the label instead of just the visible part of the line.

Sponsored by Stadt Zürich
2021-04-09 13:29:08 +10:00
Denis Rouzaud
ba8a445850 run sipify 2021-03-22 21:13:52 +01:00
Nyall Dawson
5d06c1d48d [FEATURE] When the "show pinned labels" option is enabled, also
highlight any pinned callout start or end points

This allows users to immediately see which callouts points have
been manually placed vs are automatically placed.
2021-03-18 12:15:40 +10:00
Nyall Dawson
b15be66472 Spelling 2021-02-23 15:49:23 +10:00
Nyall Dawson
d84da56dca Add rendered callout details to QgsLabelingResults for retrieval after a map render completes 2021-02-23 15:49:23 +10:00
Nyall Dawson
4f39cf6d6c Move QgsLabelingResults out to its own file 2021-02-23 15:49:23 +10:00
Nyall Dawson
a513f5a1e6 Move QgsLabelPosition out to own file 2021-02-23 15:49:23 +10:00
Nyall Dawson
7dfef3a0b1 Newer doxygen versions don't auto convert the first line in a class'
documentation to a brief note, so we have to do it explicitly...
2021-02-19 08:15:29 +10:00
Nyall Dawson
50b9beaad6 [sipify] Catch more class references and insert :py:class: annotations 2021-01-31 05:41:22 +10:00
Denis Rouzaud
2cc632ee5d follow up QVariant 2021-01-03 20:16:56 +01:00
Nyall Dawson
4ee9feb56b Sipify 2020-10-09 11:20:09 +10:00
Nyall Dawson
9f83b413a7 [vectortiles] Fix labels disappear randomly between map redraws
Fixes #37450
2020-09-01 14:23:31 +10:00
Nyall Dawson
f62c6d5d56 [feature][labeling] Expose option to allow users to control whether
anchor point for line labels is a hint or a strict requirement

Strict: Labels are placed exactly on the label anchor only, and no
other fallback placements are permitted.

Hint: The label anchor is treated as a hint for the preferred label
placement, but other placements close to the anchor point are permitted.
2020-08-21 09:48:47 +10:00
Nyall Dawson
b14bb32104 [labeling] Add api to set line anchor point for labels, which represents
the percentage along line features at which labels for that feature
should gravitate toward
2020-08-18 11:09:18 +10:00
Nyall Dawson
ff9f525893 Fix see also links 2020-08-17 11:12:33 +10:00
Nyall Dawson
844e9a3aac Move label overrun settings to QgsLabelLineSettings 2020-08-17 11:12:33 +10:00
Nyall Dawson
b31d315a52 Move another line label related setting and enum to QgsLabelLineSettings 2020-08-17 11:12:33 +10:00
Nyall Dawson
5dfbfaa89e Move some more line label related settings to QgsLabelLineSettings 2020-08-17 11:12:33 +10:00
Nyall Dawson
d93d881192 Move merge line settings to QgsLabelLineSettings 2020-08-17 11:12:33 +10:00