001// License: GPL. For details, see LICENSE file.
002package org.openstreetmap.josm.data;
003
004import java.awt.geom.Area;
005import java.util.Collection;
006import java.util.List;
007
008/**
009 * Generic data, holding data downloaded from various data sources.
010 * @since 7575
011 */
012@FunctionalInterface
013public interface Data {
014
015    /**
016     * Returns the collection of data sources.
017     * @return the collection of data sources.
018     */
019    Collection<DataSource> getDataSources();
020
021    /**
022     * Returns the total area of downloaded data (the "yellow rectangles").
023     * @return Area object encompassing downloaded data.
024     */
025    default Area getDataSourceArea() {
026        return DataSource.getDataSourceArea(getDataSources());
027    }
028
029    /**
030     * <p>Replies the list of data source bounds.</p>
031     *
032     * <p>Dataset maintains a list of data sources which have been merged into the
033     * data set. Each of these sources can optionally declare a bounding box of the
034     * data it supplied to the dataset.</p>
035     *
036     * <p>This method replies the list of defined (non {@code null}) bounding boxes.</p>
037     *
038     * @return the list of data source bounds. An empty list, if no non-null data source
039     * bounds are defined.
040     */
041    default List<Bounds> getDataSourceBounds() {
042        return DataSource.getDataSourceBounds(getDataSources());
043    }
044}