Opened 8 years ago
Closed 8 years ago
#13385 closed defect (fixed)
[Patch] rendering artifacts
Reported by: | GerdP | Owned by: | team |
---|---|---|---|
Priority: | normal | Milestone: | 16.08 |
Component: | Core mappaint | Version: | |
Keywords: | template_report gsoc-core regression | Cc: | michael2402, Klumbumbus |
Description (last modified by )
What steps will reproduce the problem?
- load attached y.osm.bz
- zoom out (press "-" key three or more times)
What is the expected result?
no artifacts (blue lines which don't exist in the OSM data) when zooming out
What happens instead?
The more you zoom out the more artifacts appear. I don't see this with 10786.
Please provide any additional information below. Attach a screenshot if possible.
URL:http://josm.openstreetmap.de/svn/trunk Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b Last:Changed Date: 2016-08-19 02:40:50 +0200 (Fri, 19 Aug 2016) Build-Date:2016-08-19 01:35:35 Revision:10852 Relative:URL: ^/trunk Identification: JOSM/1.5 (10852 en) Windows 10 64-Bit Memory Usage: 4821 MB / 5461 MB (4510 MB allocated, but free) Java version: 1.8.0_102-b14, Oracle Corporation, Java HotSpot(TM) 64-Bit Server VM VM arguments: [-Dsun.java2d.opengl=true] Dataset consistency test: No problems found Plugins: + apache-commons (32699) + buildings_tools (32796) + ejml (32680) + geotools (32813) + jts (32699) + o5m (32837) + opendata (32811) + pbf (32699) + poly (32699) + reverter (32796) + utilsplugin2 (32815)
Attachments (7)
Change History (28)
by , 8 years ago
by , 8 years ago
Attachment: | screenshot.jpg added |
---|
comment:1 by , 8 years ago
Description: | modified (diff) |
---|
comment:2 by , 8 years ago
Cc: | added |
---|---|
Keywords: | gsoc-core regression added |
Milestone: | → 16.08 |
comment:3 by , 8 years ago
by , 8 years ago
Attachment: | 13385-1.png added |
---|
by , 8 years ago
Attachment: | 13385-2.png added |
---|
by , 8 years ago
Attachment: | 13385-3.png added |
---|
comment:4 by , 8 years ago
comment:5 by , 8 years ago
Cc: | added |
---|
comment:6 by , 8 years ago
@michael2402: I am not sure, but I think the offset that is used in OffsetIterator should be scaled.
This will solve the problem when zooming out, as the offset is getting close to 0.
OffsetIterator(List<Node> nodes, double offset) { this.nodes = nodes; this.offset = offset / mapState.getScale(); idx = 0; }
comment:7 by , 8 years ago
or better
this.offset = Math.max(offset, offset / mapState.getScale());
to avoid problems when zooming in.
comment:8 by , 8 years ago
No, this should not be done.
This value comes from the MapCSS offset
property. The style will set it to half the line width to draw a line on the inner side of the border. The problem is that the offset iterator does not handle the line cap correctly. Implementing this is not hard, just some case work - which I have not found time to do yet.
A quick fix would be to restrict the deltax/y values to e.g. offset * 4. This would simply cap the lines. A nicer solution would be to really add a line cap. We may even use bezier courves for this, it would make the road lane style look much nicer.
comment:9 by , 8 years ago
OK, I think I understand. The next() method just has to return more points in this case.
If you don't mind I'll try to this tomorrow.
comment:10 by , 8 years ago
Yes, that is all you need to do. Two points should be enough (for a flat linecup - if we want a curve, we should use Path2D.curveTo which would require a change in the interface)
You may not even need to add any special state information - you can compute the first of the two points you add and store a fake point as last
so that you will return the right point in the next iteration.
If you want to, you can replace that iterator with a complete new algorithm that directly works on a Path2D. This class is only used internally, so you can handle it however you want to ;-).
by , 8 years ago
Attachment: | 13385.patch added |
---|
comment:11 by , 8 years ago
I think I found a solution, see 13385.patch.
I found it quite difficult to calculate the point coordinates. I guess there are functions for this somewhere, but I don't know where to search. With the patch I see no more artifacts. I also tested with the "Lane and roads attributes" style and that also seems to profit.
follow-up: 14 comment:12 by , 8 years ago
Are you looking for Geometry#getSegmentSegmentIntersection
?
comment:13 by , 8 years ago
JOSM does not really have central geometry utility functions. There are some in Geometry
but a lot of useful stuff is missing there and in some tool classes instead. If you feel the need for any useful functions, simply add them there.
Your patch looks fine, thanks ;-).
comment:14 by , 8 years ago
Replying to simon04:
Are you looking for
Geometry#getSegmentSegmentIntersection
?
No, my problem was to find the rules when capping should happen and where to place the intermittend points. I assume the same
problem was already solved somewhere in the java graphics routines, maybe also in JOSM sources.
comment:15 by , 8 years ago
The line capping is implemented internally in Java2D. There is no public interface for it. Same for line clipping.
comment:16 by , 8 years ago
Summary: | rendering artifacts → [Patch] rendering artifacts |
---|
comment:18 by , 8 years ago
Component: | Core → Core mappaint |
---|
comment:19 by , 8 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
At least for really high zoom levels (from ~0.05 metres on), I still have some offsets and artifacts. access=private
seems to be a good test case.
Could be a related to #13636
follow-up: 21 comment:20 by , 8 years ago
Do you still have the osm file which created this artifact?
comment:21 by , 8 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Replying to Klumbumbus:
Do you still have the osm file which created this artifact?
This was not specific to one file/data set. Can still reproduce it with a access=private
and highway=footway
with josm-tested.jar.
With latest it is fixed. e.g. [11026] or [11027] did fix it.
I don't know what's causing this, but it's beautiful! I have never seen Ireland so shiny.