Modify

Opened 13 years ago

Last modified 4 years ago

#6338 new enhancement

Better display of incomplete multipolygons

Reported by: stoecker Owned by: team
Priority: normal Milestone:
Component: Core Version:
Keywords: multipolygon incomplete display Cc:

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 (4)

comment:1 by bastiK, 13 years ago

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);
        }
    }
Version 0, edited 13 years ago by bastiK (next)

comment:2 by Don-vip, 10 years ago

See also #6020 and #7635.

comment:3 by Don-vip, 6 years ago

Keywords: multipolygon added

comment:4 by skyper, 4 years ago

Keywords: incomplete display added

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain team.
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from team to the specified user.
Next status will be 'needinfo'. The owner will be changed from team to stoecker.
as duplicate The resolution will be set to duplicate. Next status will be 'closed'. The specified ticket will be cross-referenced with this ticket.
The owner will be changed from team to anonymous. Next status will be 'assigned'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.