Ignore:
Timestamp:
2014-09-21T23:00:38+02:00 (10 years ago)
Author:
Don-vip
Message:

fix #7976 - Get downloaded gpx areas, on the same model as osm data

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/DataSet.java

    r7501 r7575  
    2424import org.openstreetmap.josm.Main;
    2525import org.openstreetmap.josm.data.Bounds;
     26import org.openstreetmap.josm.data.Data;
     27import org.openstreetmap.josm.data.DataSource;
    2628import org.openstreetmap.josm.data.SelectionChangedListener;
    2729import org.openstreetmap.josm.data.coor.EastNorth;
     
    9092 * @author imi
    9193 */
    92 public final class DataSet implements Cloneable, ProjectionChangeListener {
     94public final class DataSet implements Data, Cloneable, ProjectionChangeListener {
    9395
    9496    /**
     
    916918    }
    917919
    918     /**
    919      * Returns the total area of downloaded data (the "yellow rectangles").
    920      * @return Area object encompassing downloaded data.
    921      */
     920    @Override
     921    public Collection<DataSource> getDataSources() {
     922        return dataSources;
     923    }
     924
     925    @Override
    922926    public Area getDataSourceArea() {
    923         if (dataSources.isEmpty()) return null;
    924         Area a = new Area();
    925         for (DataSource source : dataSources) {
    926             // create area from data bounds
    927             a.add(new Area(source.bounds.asRect()));
    928         }
    929         return a;
     927        return DataSource.getDataSourceArea(dataSources);
    930928    }
    931929
     
    13171315    }
    13181316
    1319     /**
    1320      * <p>Replies the list of data source bounds.</p>
    1321      *
    1322      * <p>Dataset maintains a list of data sources which have been merged into the
    1323      * data set. Each of these sources can optionally declare a bounding box of the
    1324      * data it supplied to the dataset.</p>
    1325      *
    1326      * <p>This method replies the list of defined (non {@code null}) bounding boxes.</p>
    1327      *
    1328      * @return the list of data source bounds. An empty list, if no non-null data source
    1329      * bounds are defined.
    1330      */
     1317    @Override
    13311318    public List<Bounds> getDataSourceBounds() {
    1332         List<Bounds> ret = new ArrayList<>(dataSources.size());
    1333         for (DataSource ds : dataSources) {
    1334             if (ds.bounds != null) {
    1335                 ret.add(ds.bounds);
    1336             }
    1337         }
    1338         return ret;
     1319        return DataSource.getDataSourceBounds(dataSources);
    13391320    }
    13401321
Note: See TracChangeset for help on using the changeset viewer.