Modify ↓
Opened 15 years ago
Last modified 16 months ago
#6338 new enhancement
Better display of incomplete multipolygons
| Reported by: | stoecker | Owned by: | team |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Core mappaint | Version: | |
| Keywords: | multipolygon incomplete display | Cc: | yaomtc@… |
Description
Incomplete multipolygons may be displayed a lot better, when they are clipped at the download boundaries. It is not possible to get this always right, but in most cases a good guess should be usable to improve display a lot.
Attachments (0)
Change History (7)
comment:3 by , 7 years ago
| Keywords: | multipolygon added |
|---|
comment:4 by , 5 years ago
| Keywords: | incomplete display added |
|---|
comment:5 by , 16 months ago
| Component: | Core → Core mappaint |
|---|
comment:7 by , 16 months ago
| Cc: | added |
|---|
Note:
See TracTickets
for help on using tickets.



Here is some simple clipping (by Gubaer):
https://github.com/openstreetmap/josm/compare/ca3cee8be00739941a1527aef84fa0496990fc6b...327561e86fed93965a5a#diff-9
/** * <p>Prepares the clipping area of the graphics context in such a way, that no * points, lines or areas are rendered outside the data source bounding boxes in * {@code ds}.</p> * * @param ds the data set. If null, no clipping area is set. */ public void prepareClippingAgainstDownloadArea(DataSet ds) { if (ds == null) return; Area clip = null; for (Bounds bounds: ds.getDataSourceBounds()) { if (bounds.isCollapsed()) { continue; } Point p1 = nc.getPoint(bounds.getMin()); Point p2 = nc.getPoint(bounds.getMax()); Rectangle r = new Rectangle(Math.min(p1.x, p2.x),Math.min(p1.y, p2.y),Math.abs(p2.x-p1.x),Math.abs(p2.y-p1.y)); if (clip == null){ clip = new Area(r); } else { clip.add(new Area(r)); } } if (clip != null && !clip.isEmpty()) { /* * Clipping area of g at this point already set to the map viewport. Intersect with * the areas of bounding boxes. */ Shape formerClip = g.getClip(); if (formerClip != null){ clip.intersect(new Area(formerClip)); } } if (clip != null && !clip.isEmpty()) { g.setClip(clip); } }