Changeset 1558 in josm for trunk/src/org


Ignore:
Timestamp:
2009-04-27T01:04:01+02:00 (16 years ago)
Author:
framm
Message:
  • only add new data sources to layer upon merge if new sources are not already part of the layer's area. Closes #2404.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java

    r1523 r1558  
    1919import java.awt.event.ActionEvent;
    2020import java.awt.geom.Area;
     21import java.awt.geom.Rectangle2D;
    2122import java.awt.image.BufferedImage;
    2223import java.io.File;
     
    234235//        System.out.println("");
    235236
    236         // copy the merged layer's data source info
    237         for (DataSource src : ((OsmDataLayer)from).data.dataSources)
    238             data.dataSources.add(src);
     237        Area a = data.getDataSourceArea();
     238       
     239        // copy the merged layer's data source info;
     240        // only add source rectangles if they are not contained in the
     241        // layer already.
     242        for (DataSource src : ((OsmDataLayer)from).data.dataSources) {
     243            if (a == null || !a.contains(src.bounds.asRect()))
     244                data.dataSources.add(src);
     245        }
    239246       
    240247        // copy the merged layer's API version, downgrade if required
Note: See TracChangeset for help on using the changeset viewer.