Collection<DataSource> dataSources = Main.main.editLayer().data.dataSources;
// ... with bounding box[es] of data loaded from OSM or a file...
BoundingXYVisitor bbox = new BoundingXYVisitor();
for (DataSource ds : dataSources) {
if (ds.bounds != null) {
bbox.visit(Main.proj.latlon2eastNorth(ds.bounds.max));
bbox.visit(Main.proj.latlon2eastNorth(ds.bounds.min));
}
if (bbox.max != null && bbox.min != null
&& !bbox.max.equals(bbox.min)) {
// ... we zoom to it's bounding box