75 Commits

Author SHA1 Message Date
Matthias Kuhn
0bccdfe8de
Merge pull request #33514 from m-kuhn/more-stable-dxf-export-alignment
[dxf export] Improve dxf alignment
2020-01-06 08:34:10 +01:00
Matthias Kuhn
e9d4e9fb12 Preserve anchor point instead of delta
It's way easier to understand the concept
2020-01-05 15:34:27 +01:00
Nyall Dawson
5b7decb37a [pal] Standardise naming 2019-12-30 18:16:09 +10:00
Nyall Dawson
10bda51e64 [pal] Modernise memory management 2019-12-30 18:16:09 +10:00
Nyall Dawson
da5cd52162 [pal] Bring back refined upstream version of superliminal rtree index
Turns out this index is MUCH (magnitudes) faster for use in pal. So
grab an updated version of the upstream library and place in external libs,
and use this for indices in pal.

(we should probably investigate whether this is faster for snapping and
other index use too!)
2019-12-15 10:18:47 +10:00
Nyall Dawson
3ae1b27299 Dox, nicer naming 2019-12-10 18:28:11 +10:00
Nyall Dawson
727a4da01f More pal::rtree swaps 2019-12-10 18:28:11 +10:00
Nyall Dawson
94306655b7 More pal::rtree -> QgsGenericSpatialIndex ports 2019-12-10 18:28:11 +10:00
Matthias Kuhn
2f5d210b02
Merge pull request #33161 from m-kuhn/dxf_export_quadrant_based
Respect placement quadrant in DXF export
2019-12-05 08:46:18 +01:00
Nyall Dawson
b736bf9a44 Huge speedup when labels are set to "boundary" obstacle mode
Because GEOS prepared predicates are "stubbed out" for many relation types,
such as overlaps and touches, we can get a HUGE speedup by reworking
the obstacle boundary check to utilise an intersects and within check instead
(with the same results)
2019-12-04 13:25:21 +10:00
Nyall Dawson
19b8d43388 [needs-docs] When running in label engine v2 mode, discard any candidates where
they collide with an obstacle feature of greater weight when compared
to the label's priority

Previously, obstacle weight was used ONLY to rank a features' label
candidates relative to each other, but was never used to actually prune candidates
completely. This meant that the labeling obstacle functionality was
confusing and frustrating for users to work with -- because despite
setting layers as the maximum possible blocking weight, you'd still
see labels being placed over these features (e.g. where the labeling
engine had no other choice).

Now, (when a project is set to v2 labeling engine mode), labels will
NEVER be placed over obstacles of greater weight. This means that
labels will potentially be omitted if the only choice is to place
them over a high weighting obstacle. But ultimately, that's much
more understandable for users -- they've manually set a particular
layer to a high obstacle factor, so we should respect that and
never place labels on these features.

In the end, this change makes the labeling placement much simpler
to understand for users, and should give power users a much
nicer experience all round.

Funded by the QGIS grants program
2019-12-03 13:48:45 +10:00
Nyall Dawson
499f240ca7 More raw double arrays to vectors 2019-12-03 13:48:45 +10:00
Matthias Kuhn
651219f390 Preserve anchor correction in PAL
To be able to reuse it for vector output like DXF
2019-11-29 17:54:06 +01:00
Nyall Dawson
634a815c64 [pal] More memory management, renames 2019-11-28 21:15:30 +10:00
Nyall Dawson
9bdc1882e6 Avoid using expensive geos polygon overlap calculation for two horizontal labels
We can dramatically speed up label overlap detection on this common case, since
it reduces to overlap of two axis-aligned rectangles.

Speeds up rendering of labels on complex maps
2019-09-24 03:43:19 +10:00
Nyall Dawson
4ecc081eb8 Use std::vector instead of raw arrays in pal pointsets 2019-07-26 18:24:20 +10:00
Nyall Dawson
ac17d300ca DBL_MAX -> std::numeric_limits 2018-06-17 09:24:37 +10:00
Nyall Dawson
d5626d9236 Remove geos include from qgsgeometry.h
Avoids the need to include geos from some build targets
2018-04-26 17:28:59 +12:00
Nyall Dawson
2d71309ef8 Add some more geometry relationship methods to LabelPosition 2018-01-18 10:37:33 +10:00
Nyall Dawson
92af1dacaf Replace default constructors/destructors with = default 2017-10-01 06:52:14 +10:00
Nyall Dawson
ba64e3e533 Remove redundant initializations
Fixes when a member is initialized both in the header and
source to the same initial value

(via clang-tidy modernize-use-default-member-init fixit)
2017-09-11 17:09:35 +10:00
Nyall Dawson
725301ad58 Make more use of math constants 2017-08-26 04:17:44 +10:00
Nyall Dawson
7f447374cd Remove redundant math constant defines
Since we use _USE_MATH_DEFINES for windows builds, these are
not required
2017-08-26 04:06:57 +10:00
Nyall Dawson
2d192791c2 qMin/qMax -> std::min/max 2017-08-25 16:37:54 +10:00
Nyall Dawson
c19418c447 Add more missing std:: prefixes 2017-08-25 04:13:38 +10:00
Nyall Dawson
b5ca4b4ea8 (q)sqrt -> std::sqrt 2017-08-25 03:22:15 +10:00
Nyall Dawson
fec03ca423 (q)sin -> std::sin 2017-08-25 03:18:05 +10:00
Nyall Dawson
2e5d1abbb1 (q)cos -> std::cos 2017-08-25 03:05:22 +10:00
Denis Rouzaud
40c056cae0 run astyle on src/core 2017-03-03 09:09:37 +01:00
Harrissou Sant-anna
ef85cdcf83 Replace "eg" by "e.g." or "for example" 2016-12-30 00:03:22 +01:00
Frits van Veen
a21946abd9 Fix curved labels sometimes shown upside down
And improve handling of perimeter based labels
2016-09-23 14:27:07 +10:00
Frits van Veen
34e2bea246 'Using perimeter (curved)' labels on polygon layers will now respect 'Show upside-down labels' setting. 2016-08-17 14:43:23 +10:00
Nyall Dawson
5f33991e7b [FEATURE] Label polygons using curved labels along perimeter
This adds a new mode for labeling polygons, where the perimeter
of the polygon is labeled using curved labeling.
2016-07-27 13:36:49 +10:00
Nyall Dawson
8df09a6f47 Pal cleanups:
- remove use of namespace blocks (avoids unnecessary indentation)
- cleanup includes
- remove old std::cout debugging blocks
- move some documentation from cpp to headers
2016-01-04 08:58:07 +11:00
Nyall Dawson
4cc590c929 Cleanup labeling, avoid some duplicate enums, add docs 2016-01-04 07:23:58 +11:00
Nyall Dawson
766bfa1a7f Fix some more old style cast and float comparison warnings 2015-12-31 07:27:58 +11:00
Juergen E. Fischer
8214608169 more nullptr updates (folloup 320c696) 2015-12-16 16:29:29 +01:00
Nyall Dawson
576875e998 Followup 320c696 use clang-modernize to replace 0/NULL use with nullptr 2015-12-15 11:24:51 +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
03f9e1b351 [pal] Never treat features as obstacles for their own labels
Fixes issues like rule based labelling registering two labels for
a single feature which was resulting in each label colliding
with the feature's geometry registered by the other label. This
resulted in poor placement for these labels.

Sponsored by City of Uster
2015-11-21 20:49:28 +11:00
Nyall Dawson
b384f18a3d Followup f9fa9793, avoid expensive intersection calculation when
testing label candidates against polygon obstacles

Fix #13556
2015-11-11 19:51:42 +11:00
Martin Dobias
1782d1a505 [FEATURE] Rule-based labeling
Work in progress

This code has been funded by Tuscany Region (Italy) - SITA (CIG: 63526840AE) and commissioned to Gis3W s.a.s.
2015-09-24 15:48:05 +08:00
Nyall Dawson
a7e9ef51d2 [pal] Consider all label parts when checking polygon obstacle cost
Fixes curved label candidates not being marked as in conflict with
polygon obstacles when letters other than the first letter conflict
with the polygon.
2015-09-01 16:06:52 +10:00
Nyall Dawson
0b15d8bc18 Fix many leaks in PAL and simplify code 2015-09-01 06:43:25 +10:00
Nyall Dawson
f9fa9793f0 [pal] Improved test for candidate against polygon obstacles
Previous test was just checking point in polygon for the corner,
mid points and center. This test was not sufficient for narrow
or small polygons which were not covered by these points
but were still covering parts of the label candidate.

Now, the area of the intersection between the obstacle polygon
and the label candidate is used to calculate the obstacle
cost.
2015-08-31 12:20:14 +10:00
Nyall Dawson
36675babc2 Fix some leaks in labeling (many left) 2015-08-26 22:53:38 +10:00
Nyall Dawson
fec5d5ef7d [pal] Catch GEOS exceptions 2015-08-14 20:33:04 +10:00
Nyall Dawson
ff28e6a9d9 [pal] Shade all parts of label candidate as conflicting when
appropriate
2015-08-06 11:03:15 +10:00
Nyall Dawson
39c728bbc5 [pal] Fix test for polygon boundary obstacles (followup 3a44e294)
Test was incorrectly checking for intersection of the candidate
and polygon obstacle, when it should have been checking for
overlapping or touching obstacles.
2015-08-06 10:53:12 +10:00
Nyall Dawson
dfff1257bf [pal] When set to draw all label candidates, shade candidates which
conflict with obstacles in red
2015-08-03 16:46:58 +10:00