/** Start to load thumbnails. */ public synchronized void startLoadThumbs() { if (useThumbs && !thumbsLoaded && !thumbsLoaderRunning) { stopLoadThumbs(); thumbsloader = new ThumbsLoader(this); thumbsLoaderExecutor.submit(thumbsloader); thumbsLoaderRunning = true; } }
/** * Enables or disables the display of thumbnails. Does not update the display. * * @param useThumbs New thumbnail display status * @since 6392 */ public void setUseThumbs(boolean useThumbs) { this.useThumbs = useThumbs; if (useThumbs && !thumbsLoaded) { startLoadThumbs(); } else if (!useThumbs) { stopLoadThumbs(); } }
@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; }