103 Commits

Author SHA1 Message Date
Denis Rouzaud
93971d5ed3 [sip] align pointer and reference in blacklisted files
this will facilitate sip diff checking
2017-05-01 17:49:43 +02:00
Martin Dobias
25ed76b86e Move labeling engine config to a new class + QgsPalLabeling cleanup
Another bit to make core library independent from QgsProject::instance().
Until now labeling engine configuration was taken from project singleton.

Removed legacy methods from QgsPalLabeling - the class now does not have
any more member variables/methods, it is just a bunch of helper functions.

(PR #4384)
2017-04-21 18:04:09 +08:00
Nyall Dawson
47683fca4f [needs-docs] Rename Outline and Border -> Stroke
This change is being driven by:

- need for consistent terminology in the api. Currently there's
a confusing mix of border/outline used
- need for consistent terminology in the gui - we have a mix
of "border"/"outline"/"pen"
- bringing QGIS into line with the standard terminology used
in other graphic editing programs
2017-02-22 19:22:45 +10:00
Nyall Dawson
54089ff710 Follow up 4a3871, fix broken data defined properties
(definitions are often accessed before a QgsSymboLayer/etc
is constructed)
2017-02-05 14:27:26 +10:00
Martin Dobias
3a92b17418 Reading/saving labeling engine uses a particular QgsProject
... rather than using QgsProject::instance() internally

These are small cleanups to dig out some instance() uses and move them one level up...

At some point we should maybe make labeling engine configuration a part of QgsMapSettings
and have default project labeling engine config accessible from QgsProject
in a way similar to e.g. snapping configuration.
2017-01-26 10:56:50 +08:00
Nyall Dawson
39b89d1bac SIP sync 2017-01-23 12:45:22 +10:00
Nyall Dawson
e06192ec3f Use consistent names for data defined property collections 2017-01-23 12:45:22 +10:00
Nyall Dawson
43bbf68943 Port labeling to properties framework 2017-01-23 12:45:21 +10:00
Denis Rouzaud
748be8de71 [spelling] replace behaviour by behavior 2017-01-11 11:35:19 +01:00
Harrissou Sant-anna
ef85cdcf83 Replace "eg" by "e.g." or "for example" 2016-12-30 00:03:22 +01:00
Harrissou Sant-anna
8dca115b1c Replace prioritise by prioritize 2016-12-29 01:46:19 +01:00
Denis Rouzaud
9c4be41441 [spelling] labelling -> labeling 2016-12-19 23:58:29 +01:00
Martin Dobias
8e5fb436b7 Remove QgsLabelingEngineInterface base class and implementation in QgsPalLabeling
It was ready to go for some time, just waiting for QgsMapRender that still used it.
2016-12-15 18:15:12 +08:00
Nyall Dawson
08143475ed [FEATURE] QgsTextRenderer class for rich text rendering
Moves all the drawing code out of labeling into a new class
which just handles rendering text. This allows other parts
of the code to utilise all the advanced formatting options
that labeling supports, eg rendering text with shadows,
buffers and backgrounds.
2016-10-24 12:02:00 +10:00
Nyall Dawson
5495f20589 Minor refactor of label drawing
Remove use of scale factors from PAL layer settings and use
render context factors directly
2016-10-24 12:02:00 +10:00
Nyall Dawson
aac2622816 Remove option to show label shadow rectangles from GUI
...and instead just make it #ifdef out
2016-10-24 12:02:00 +10:00
Nyall Dawson
4d5e7536d9 Flip QgsPalLayerSettings to use QgsTextRenderer classes 2016-10-24 12:02:00 +10:00
Matthias Kuhn
722fdefe43 referencedColumns returns QSet<QString> instead of QStringList
The order of the elements is irrelevant and duplicate elements are unwanted. It
is therefore a perfect candidate for a set instead of a list. This prevents
filtering for duplicates manually be replacing some filer codes with (more
performant) builtin methods of QSet.
2016-10-05 14:33:38 +02:00
Nyall Dawson
fe65063c2b Remove many deprecated methods 2016-09-15 18:34:15 +10:00
Nyall Dawson
46fba7ce80 [FEATURE] Substitution list support for labeling
Adds the ability to specify a list of text substitutes to make
which apply to label text. Eg abbrevating street types.

Users can export and import lists of substitutes to make
reuse and sharing easier.
2016-08-29 17:18:34 +10:00
Juergen E. Fischer
3f22a7a77f another scripts/replacev2.sh with minor manual fixes 2016-08-10 12:12:28 +02:00
Juergen E. Fischer
0688621046 scripts/replacev2.sh run 2016-08-10 12:08:52 +02:00
Nyall Dawson
37ef6b8007 Add missing sip binding 2016-08-09 16:55:10 +10:00
Nyall Dawson
4b78b1c208 Make all QgsGeometry methods return values, not pointers
Reduces likelihood of crashes and leaks
2016-08-01 22:41:55 +10:00
Nyall Dawson
bd7d913379 Refine QgsFeature geometry getters/setters
All pointer based methods have been removed.

Now we have only:

  void setGeometry( const QgsGeometry& geom )

and

  QgsGeometry geometry() const

Benefits include avoiding a whole lot of tricky pointer lifetime
issues, potential memory leaks, and finally closing #777, which
has survived for over 9 years!...

Impacts on PyQGIS code:
- no more need for the messy
  g = QgsGeometry( feature.geometry() )
  workaround, just use g = feature.geometry() instead
- IMPORTANT: you can no longer test whether a feature has geometry
 using `if f.geometry():`, since QgsFeature::geometry() will
 *always* return an object. Instead, use
 `if not f.geometry().isEmpty():`, or preferably the new method
 `if not f.hasGeometry():`

Fix #777
2016-08-01 16:25:46 +10:00
Martin Dobias
ab4a83b49b Goodbye to QgsMapRenderer (#3333)
For the time being the class is kept in the server code while it is still being used there.
2016-07-24 22:40:52 +02:00
Nyall Dawson
cd33ccf7f6 Revert "Fix label word and letter spacing cannot be decimals"
This reverts commit 48f090ca79f0d2d9ae341ae3617f20b2fe3fe14f.

Causes issues with font sizes/spacing
2016-07-20 19:44:20 +10:00
Nyall Dawson
48f090ca79 Fix label word and letter spacing cannot be decimals 2016-07-20 13:04:50 +10:00
Nyall Dawson
adafeda82a Avoid all use of QgsCoordinateTransform pointers, replace with
copies or references

Makes the code more robust, fixes leaks and avoids potential
null pointer dereferencing
2016-07-16 20:36:45 +10:00
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