@Override public void mergeFrom(Layer from) { GeoImageLayer l = (GeoImageLayer) from; // Stop to load thumbnails on both layers. Thumbnail loading will continue the next time // the layer is painted. stopLoadThumbs(); l.stopLoadThumbs(); final ImageEntry selected = l.data != null && l.currentPhoto >= 0 ? l.data.get(l.currentPhoto) : null; if (l.data != null) { data.addAll(l.data); } Collections.sort(data); // Supress the double photos. if (data.size() > 1) { ImageEntry cur; ImageEntry prev = data.get(data.size() - 1); for (int i = data.size() - 2; i >= 0; i--) { cur = data.get(i); if (cur.getFile().equals(prev.getFile())) { data.remove(i); } else { prev = cur; } } } if (selected != null && !data.isEmpty()) { GuiHelper.runInEDTAndWait( new Runnable() { @Override public void run() { for (int i = 0; i < data.size(); i++) { if (selected.equals(data.get(i))) { currentPhoto = i; ImageViewerDialog.showImage(GeoImageLayer.this, data.get(i)); break; } } } }); } setName(l.getName()); thumbsLoaded &= l.thumbsLoaded; }
/** * Get a string representation of all layers suitable for the {@code source} changeset tag. * * @return A String of sources separated by ';' */ public String getLayerInformationForSourceTag() { final Collection<String> layerInfo = new ArrayList<>(); if (!getLayersOfType(GpxLayer.class).isEmpty()) { // no i18n for international values layerInfo.add("survey"); } for (final GeoImageLayer i : getLayersOfType(GeoImageLayer.class)) { layerInfo.add(i.getName()); } for (final ImageryLayer i : getLayersOfType(ImageryLayer.class)) { layerInfo.add( ImageryInfo.ImageryType.BING.equals(i.getInfo().getImageryType()) ? "Bing" : i.getName()); } return Utils.join("; ", layerInfo); }
@Override public void mergeFrom(Layer from) { GeoImageLayer l = (GeoImageLayer) from; ImageEntry selected = null; if (l.currentPhoto >= 0) { selected = l.data.get(l.currentPhoto); } data.addAll(l.data); Collections.sort(data); // Supress the double photos. if (data.size() > 1) { ImageEntry cur; ImageEntry prev = data.get(data.size() - 1); for (int i = data.size() - 2; i >= 0; i--) { cur = data.get(i); if (cur.getFile().equals(prev.getFile())) { data.remove(i); } else { prev = cur; } } } if (selected != null) { for (int i = 0; i < data.size(); i++) { if (data.get(i) == selected) { currentPhoto = i; ImageViewerDialog.showImage(GeoImageLayer.this, data.get(i)); break; } } } setName(l.getName()); }