Changeset 32288 in osm
- Timestamp:
- 2016-06-16T23:10:09+02:00 (8 years ago)
- Location:
- applications/editors/josm/plugins/imagewaypoint/src/org/insignificant/josm/plugins/imagewaypoint
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/imagewaypoint/src/org/insignificant/josm/plugins/imagewaypoint/ImageEntries.java
r30737 r32288 75 75 this.locatedImages.clear(); 76 76 77 if (null != Main.map && null != Main.map.mapView) { 78 final Collection<Layer> layerCollection = Main.map.mapView.getAllLayers(); 79 final Layer[] layers = layerCollection.toArray(new Layer[layerCollection.size()]); 80 81 for (int index = 0; index < layers.length; index++) { 82 if (layers[index] instanceof GpxLayer 83 && null != ((GpxLayer) layers[index]).data 84 && !((GpxLayer) layers[index]).data.fromServer) { 85 this.doAssociateLayer((GpxLayer) layers[index]); 86 } 87 } 88 89 for (IImageChangeListener listener : this.listeners) { 90 listener.onSelectedImageEntryChanged(this); 91 } 77 final Collection<Layer> layerCollection = Main.getLayerManager().getLayers(); 78 final Layer[] layers = layerCollection.toArray(new Layer[layerCollection.size()]); 79 80 for (int index = 0; index < layers.length; index++) { 81 if (layers[index] instanceof GpxLayer 82 && null != ((GpxLayer) layers[index]).data 83 && !((GpxLayer) layers[index]).data.fromServer) { 84 this.doAssociateLayer((GpxLayer) layers[index]); 85 } 86 } 87 88 for (IImageChangeListener listener : this.listeners) { 89 listener.onSelectedImageEntryChanged(this); 92 90 } 93 91 } -
applications/editors/josm/plugins/imagewaypoint/src/org/insignificant/josm/plugins/imagewaypoint/ImageWayPointPlugin.java
r32287 r32288 1 1 package org.insignificant.josm.plugins.imagewaypoint; 2 3 import static org.openstreetmap.josm.tools.I18n.tr;4 2 5 3 import java.io.File; … … 9 7 import java.util.Iterator; 10 8 import java.util.List; 11 12 import javax.swing.filechooser.FileFilter;13 9 14 10 import org.openstreetmap.josm.Main; … … 23 19 24 20 public final class ImageWayPointPlugin extends org.openstreetmap.josm.plugins.Plugin { 25 private static final class ImageFileFilter extends FileFilter {26 @Override27 public final boolean accept(final File file) {28 return file.isDirectory()29 || file.getName().toLowerCase().endsWith(".jpg")30 || file.getName().toLowerCase().endsWith(".jpeg")31 || file.getName().toLowerCase().endsWith(".png")32 || file.getName().toLowerCase().endsWith(".gif");33 }34 35 @Override36 public final String getDescription() {37 return tr("Image files (*.jpg, *.jpeg, *.png, *.gif)");38 }39 }40 41 21 private final class ImageWaypointImporter extends FileImporter { 42 22 … … 64 44 65 45 // add files to ImageEntries 66 ImageEntries.getInstance() 67 .add(allFiles.toArray(new File[allFiles.size()])); 46 ImageEntries.getInstance().add(allFiles.toArray(new File[allFiles.size()])); 68 47 69 48 // check to see whether there's already an ImageWayPointLayer 70 49 boolean foundImageWayPointLayer = false; 71 if (null != Main.map && null != Main.map.mapView) { 72 final Collection<Layer> layerCollection = Main.map.mapView.getAllLayers(); 73 final Iterator<Layer> layerIterator = layerCollection.iterator(); 74 while (layerIterator.hasNext() && !foundImageWayPointLayer) { 75 if (layerIterator.next() instanceof ImageWayPointLayer) { 76 foundImageWayPointLayer = true; 77 } 50 final Collection<Layer> layerCollection = Main.getLayerManager().getLayers(); 51 final Iterator<Layer> layerIterator = layerCollection.iterator(); 52 while (layerIterator.hasNext() && !foundImageWayPointLayer) { 53 if (layerIterator.next() instanceof ImageWayPointLayer) { 54 foundImageWayPointLayer = true; 78 55 } 79 56 }
Note:
See TracChangeset
for help on using the changeset viewer.