public BoundingBox getBoundingBox() { Map map = (Map) getDownloadable(); return map.getBoundingBox(); } }
if (!contains(filterUrls, dataSource.getBaseUrl() + map.getUri())) continue; MapType mapType = createMapType(map.getUri(), asChecksums(fileToFragments.keySet()), map.getBoundingBox()); List<FragmentType> fragmentTypes = createFragmentTypes(map.getFragments(), fileToFragments); if (fragmentTypes != null) mapType.getFragment().addAll(fragmentTypes);
private Set<String> collectURIs(DataSource source) { Set<String> result = new HashSet<>(); switch (type) { case File: for (File file : source.getFiles()) result.add(file.getUri()); break; case Map: for (Map map : source.getMaps()) result.add(map.getUri()); break; case Theme: for (Theme theme : source.getThemes()) result.add(theme.getUri()); break; } return result; }
private void updateMap(DatasourceType datasourceType, Map map) throws IOException { String url = datasourceType.getBaseUrl() + map.getUri(); log.severe(format("Failed to download %s as a map", map.getUri())); return; MapType mapType = createMapType(map.getUri(), singletonList(checksum), null); datasourceType.getMap().add(mapType); log.severe(format("Failed to download %s partially as a map", map.getUri())); return; if (map.getUri().endsWith(DOT_ZIP)) { try (ZipInputStream zipInputStream = new ZipInputStream(new FileInputStream(download.getFile().getFile()))) { ZipEntry entry = zipInputStream.getNextEntry(); while (entry != null) { if (!entry.isDirectory() && entry.getName().endsWith(DOT_MAP)) { log.info(format("Found map %s in URI %s", entry.getName(), map.getUri())); mapType.getFragment().add(createFragmentType(entry.getName(), entry.getTime(), entry.getSize())); } else if (map.getUri().endsWith(DOT_MAP)) { log.info(format("Found map %s", map.getUri())); BoundingBox boundingBox = MapUtil.extractBoundingBox(download.getFile().getFile()); if (boundingBox != null) mapType.setBoundingBox(asBoundingBoxType(boundingBox)); } else log.warning(format("Ignoring %s as a map", map.getUri()));