74 Commits

Author SHA1 Message Date
Juergen E. Fischer
f19a35c34e dxf export: support rule based labeling (fixes #13757) 2016-04-13 14:51:55 +02:00
Juergen E. Fischer
a90be95f7b sip sync 2016-02-14 03:50:49 +01:00
Nyall Dawson
8779091225 Fix failing tests 2016-01-12 08:24:56 +11:00
Nyall Dawson
8b28c040d1 [FEATURE] Add mode to apply label distance from symbol bounds
(only works with Cartographic point label placement). When this
setting is active, the label distance applies from the bounds
of the rendered symbol for a point, instead of the point itself.
It's especially useful when the symbol size isn't fixed, eg if
it's set by a data defined size or when using different symbols
in a categorised renderer.

Sponsored by Andreas Neumann
2016-01-12 08:24:39 +11:00
Nyall Dawson
6499439cc5 Fix failing tests, add tests for ordered placement
Sponsored by Andreas Neumann
2016-01-12 08:24:38 +11:00
Nyall Dawson
5e4c14cd40 [FEATURE] Control over label rendering order
A new control for setting a label's "z-index" has been added to
the labeling properties dialog. This control (which also accepts
data-defined overrides for individual features) determines the order
in which label are rendered. Label layers with a higher z-index
are rendered on top of labels from a layer with lower z-index.

Additionally, the logic has been tweaks so that if 2 labels have
matching z-indexes, then:
- if they are from the same layer, a smaller label will be drawn
above a larger label
- if they are from different layers, the labels will be drawn in
the same order as the layers themselves (ie respecting the order
set in the legend)

Diagrams can also have their z-index set (but not data defined)
so that the order of labels and diagrams can be controlled.

Note that this does *NOT* allow labels to be drawn below the
features from other layers, it just controls the order in which
labels are drawn on top of all the layer's features.

Fix #13888, #13559
2016-01-05 22:27:22 +11:00
Nyall Dawson
881074b194 Boost coverage of SIP bindings
Now all classes and members are either exposed to bindings or marked
as "not available in Python bindings" in the docs.

Drop test thresholds to 0. Now it should be much easier to determine
what missing members have been added which are causing test
failures.
2016-01-05 11:16:15 +11:00
Nyall Dawson
4cc590c929 Cleanup labeling, avoid some duplicate enums, add docs 2016-01-04 07:23:58 +11:00
Nyall Dawson
f45f688f61 [labeling] Avoid placing labels over ANY part of point symbols 2015-11-25 17:00:20 +11:00
Nyall Dawson
55ead85382 Allow setting label obstacle geom in QgsPalLabeling::registerFeature
Sponsored by City of Uster
2015-11-21 22:52:22 +11:00
Nyall Dawson
cdf21b7c3e Return derived classes from clone() methods, avoids need to
dynamic_cast results
2015-11-12 20:29:06 +11:00
Nyall Dawson
fe221d54bf Don't return QStrings by reference, since they're implicitly shared
anyway
2015-10-28 09:47:44 +11:00
Nyall Dawson
c49b5b777f Change a lot of arguments to const references in core/gui
Rationale:
- there was a lot of large objects passed by value, so potentially
there's a speed bump from this
- even for implicitly shared classes like QString/QList there's still
a (small) cost for copying the objects when there's no reason to
- it's the right thing to do!
2015-10-07 12:02:04 +11:00
Nyall Dawson
1491d5636f Remove const from labeling QgsRenderContext usage 2015-10-01 15:42:02 +10:00
Martin Dobias
1c877f116c Fix another crash with rule-based labeling + data-defined properties (fixes #13453)
The writing of data-defined properties to XML was using invalid data.
Also fixes a possible memory leak in assignment operator.
Thanks Nyall for help tracking it down!

This code has been funded by Tuscany Region (Italy) - SITA (CIG: 63526840AE) and commissioned to Gis3W s.a.s.
2015-09-30 12:36:44 +08:00
Martin Dobias
a36567a47a Fix compilation error 2015-09-21 12:57:10 +08:00
Martin Dobias
d0fcc9557f More labeling engine refactoring
- QgsPalLabeling now internally uses new engine
- label/diagram providers can hook into rendering loop to avoid extra feature loops
- map rendering uses the new engine instead of QgsPalLabeling

This code has been funded by Tuscany Region (Italy) - SITA (CIG: 63526840AE) and commissioned to Gis3W s.a.s.
2015-09-21 12:57:09 +08:00
Nyall Dawson
87022a4efd Add mode for drawing just label rects for debugging
Sponsored by City of Uster
2015-08-28 11:01:46 +10:00
Nyall Dawson
c9c12bc7f9 Fix warnings 2015-08-22 19:01:41 +10:00
Nyall Dawson
1a7acb0d98 Port labelling to expression contexts 2015-08-22 19:01:40 +10:00
Juergen E. Fischer
9752c468c1 indentation update 2015-07-29 11:52:14 +02:00
Nyall Dawson
b4311877f7 [FEATURE][labeling] Add priority control for obstacles
Allows you to make labels prefer to overlap features from certain
layers rather than others. Can also be data defined, so that certain
features are more likely to be covered than others.
2015-07-23 15:00:53 +10:00
Nyall Dawson
c97733ea27 [FEATURE][labeling] Data defined control over whether a feature
acts as an obstacle for labels
2015-07-23 15:00:45 +10:00
Nyall Dawson
dc4049ddff [FEATURE][labeling] Add option to only draw labels which fit
completely within polygon features (fix #12136)
2015-07-20 13:48:49 +10:00
Nyall Dawson
3a44e294de [FEATURE][labeling] Add option to control how polygon layers
act as obstacles

Options are either avoid placing labels over polygon interior
or avoid placing over polygon boundaries. (Previous behaviour
was always avoid placing over interior).

Avoiding placing over boundaries is useful for regional boundary
layers, where the features cover an entire area. In this case
it's impossible to avoid placing labels within these features,
and it looks much better to avoid placing them over the boundaries
between features. End result is better cartographic placement of
labels in this situation.
2015-07-17 15:26:57 +10:00
Nyall Dawson
388e4047a7 [FEATURE][labeling] Add option for obstacle only layers
This allows users to set a layer as just an obstacle for other
layer's labels without rendering any labels of its own.

Ideas for UI improvements are welcome!
2015-07-15 16:08:24 +10:00
Nyall Dawson
ce2c402690 [FEATURE][labeling] Allow data defined control of label priority
Previously only the priority for the entire layer could be specified
(fix #4606)
2015-07-08 18:38:33 +10:00
Matthias Kuhn
385529ef7b PalLabelling: Reproject geometries before evaluating mininum size
Followup 2b096e09
2015-06-03 23:59:42 +02:00
Matthias Kuhn
2b096e09e2 Fix suppress labelling of short lines
And deduplicate code
Followup cfe397e
2015-06-03 18:53:36 +02:00
Juergen E. Fischer
2ab8a0bed9 include user.py in translations 2015-05-31 00:42:51 +02:00
Nyall Dawson
51bd0b2bc5 Followup 2dc5d95, add unit tests 2015-05-31 07:58:05 +10:00
Juergen E. Fischer
d40d481bd3 avoid warning about not created test difference image 2015-05-25 21:43:55 +02:00
Nyall Dawson
4b4075b5b9 [labeling] Fix setting a wrap character conflicts with newlines
in label text (fix #12750)
2015-05-19 06:18:07 +10:00
Nyall Dawson
2863f20d67 Add a const geometry getter to QgsFeature 2015-05-11 19:46:32 +10:00
Nyall Dawson
7314047698 Fix missing doc strings due to invalid doxygen tags 2015-04-30 17:26:58 +10:00
Juergen E. Fischer
d79268cbd7 indentation update 2015-04-17 09:51:24 +02:00
Nyall Dawson
cfe397e718 Better fix for ffd81f4, avoid unnecessary copies of geometry 2015-04-14 10:36:04 +10:00
Nyall Dawson
7c7ef6d8cd Fix diagrams not respecting canvas rotation
Also fixes diagrams not showing for invalid polygons (fix #11955)
2015-04-13 23:16:14 +10:00
Nyall Dawson
44f7930ecf [FEATURE] Add follow point alignment for multiline labels
When set to this mode, text alignment for labels will be dependant
on the final placement of the label relative to the point. Eg, if
the label is placed to the left of the point then the label will
be right aligned, and if it is placed to the right of the point
then the label will be left aligned.
(fix #11153)
2015-03-19 19:48:38 +11:00
Nyall Dawson
e4fb95fad1 [pal] Some const correctness and avoid passing large object by value 2015-02-05 18:34:14 +11:00
Juergen E. Fischer
9ceb5ceab6 sip sync 2014-11-21 01:17:21 +01:00
Juergen E. Fischer
67e077853e DXF export improvements:
* tree view and attribute selection for layer assigment in dialog
* support fill polygons/HATCH
* represent texts as MTEXT instead of TEXT (including font, slant and weight)
* support for RGB colors when there's no exact color match
* use AutoCAD 2000 DXF (R15) instead of R12
* remove R18 test methods

Funded-By: City of Uster
Funded-By: Ville de Morges
Funded-By: SIGE
2014-09-26 14:10:26 +02:00
Larry Shaffer
c1d80ed6a6 Initial fix for #3975, label engine vectorizing texts in SVG and PDF output
- Add labeling engine option to render text-as-text
- Default is still text-as-outlines (vectorized), due to differences between text (as text) and buffer (as outline) methods
- Good output with printing to PDF (searchable, selectable text and embedded fonts)
- OK output with SVG, but differences between text (as text) and buffer (as outline) methods

Does not yet include unit tests or auto-setting of text-as-text for SVG output
2014-06-13 10:20:55 -06:00
Martin Dobias
73358c3a7e [layertree] Add python bindings - part one (core) 2014-06-03 19:27:28 +07:00
Juergen E. Fischer
45c0be1059 sip: remove enum constants 2014-06-02 21:52:02 +02:00
Larry Shaffer
fe42b0048f Merge pull request #1238 from ahuarte47/Issue_9480
Fix bug #9480: Labels for polygon centroids should always originate inside a polygon
2014-05-29 14:45:22 -06:00
Juergen E. Fischer
c1f50db1ac fix warnings 2014-05-29 01:43:04 +02:00
Juergen E. Fischer
c4c131ef75 sip sync 2014-05-27 23:32:42 +02:00
ahuarte47
6cb4cbb1cc #9480: Add centroidInside to sip file 2014-05-27 13:39:31 +02:00
Martin Dobias
5a4f8d07a0 Change "added/deprecated in 2.1" notes to 2.4 for stuff related to threading 2014-02-21 17:33:09 +07:00