Changeset 18248 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2021-10-05T20:46:07+02:00 (3 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/layer/geoimage
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java
r18246 r18248 166 166 */ 167 167 public GeoImageLayer(final List<ImageEntry> data, GpxData gpxData, final String name, boolean useThumbs) { 168 super( name != null? name : tr("Geotagged Images"));168 super(!Utils.isBlank(name) ? name : tr("Geotagged Images")); 169 169 this.data = new ImageData(data); 170 170 this.gpxData = gpxData; -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImagesLoader.java
r18051 r18248 12 12 import java.util.LinkedHashSet; 13 13 import java.util.List; 14 import java.util.Map; 14 15 import java.util.Set; 16 import java.util.TreeMap; 17 import java.util.stream.Collectors; 15 18 16 19 import javax.swing.JOptionPane; 17 20 21 import org.openstreetmap.josm.data.preferences.BooleanProperty; 18 22 import org.openstreetmap.josm.gui.MainApplication; 19 23 import org.openstreetmap.josm.gui.PleaseWaitRunnable; … … 34 38 35 39 private boolean canceled; 36 private GeoImageLayer layer;40 private final List<GeoImageLayer> layers = new ArrayList<>(); 37 41 private final Collection<File> selection; 38 42 private final Set<String> loadedDirectories = new HashSet<>(); 39 43 private final Set<String> errorMessages; 40 44 private final GpxLayer gpxLayer; 45 46 private static final BooleanProperty PROP_ONE_LAYER_PER_FOLDER = new BooleanProperty("geoimage.one-layer-per-folder", false); 41 47 42 48 /** … … 73 79 74 80 // read the image files 75 List<ImageEntry> entries = new ArrayList<>(files.size());81 Map<String, List<ImageEntry>> entries = new TreeMap<>(); 76 82 77 83 for (File f : files) { … … 86 92 ImageEntry e = new ImageEntry(f); 87 93 e.extractExif(); 88 entries.add(e); 94 File parentFile = f.getParentFile(); 95 entries.computeIfAbsent(parentFile != null ? parentFile.getName() : "", x -> new ArrayList<>()).add(e); 89 96 } 90 layer = new GeoImageLayer(entries, gpxLayer); 97 if (Boolean.TRUE.equals(PROP_ONE_LAYER_PER_FOLDER.get())) { 98 entries.entrySet().stream().map(e -> new GeoImageLayer(e.getValue(), gpxLayer, e.getKey())).forEach(layers::add); 99 } else { 100 layers.add(new GeoImageLayer(entries.values().stream().flatMap(List<ImageEntry>::stream).collect(Collectors.toList()), gpxLayer)); 101 } 91 102 files.clear(); 92 103 } … … 160 171 ); 161 172 } 162 if (layer != null) {173 for (GeoImageLayer layer : layers) { 163 174 MainApplication.getLayerManager().addLayer(layer); 164 175
Note:
See TracChangeset
for help on using the changeset viewer.