Modify

Opened 12 years ago

Last modified 3 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 Changed 12 years ago by bastiK

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);
        }
    }
Last edited 5 years ago by Don-vip (previous) (diff)

comment:2 Changed 9 years ago by Don-vip

See also #6020 and #7635.

comment:3 Changed 5 years ago by Don-vip

Keywords: multipolygon added

comment:4 Changed 3 years ago by skyper

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.
to The owner will be changed from team to the specified user.
The owner will change to stoecker
as duplicate The resolution will be set to duplicate.The specified ticket will be cross-referenced with this ticket
The owner will be changed from team to anonymous.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.