Changeset 9660 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2016-01-28T00:23:22+01:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java
r9078 r9660 11 11 import java.awt.FlowLayout; 12 12 import java.awt.Graphics; 13 import java.awt.GraphicsEnvironment; 13 14 import java.awt.GridBagLayout; 14 15 import java.awt.GridLayout; … … 382 383 this.setVisible(true); 383 384 titleBar.setVisible(false); 384 detachedDialog = new DetachedDialog(); 385 detachedDialog.setVisible(true); 385 if (!GraphicsEnvironment.isHeadless()) { 386 detachedDialog = new DetachedDialog(); 387 detachedDialog.setVisible(true); 388 } 386 389 setIsShowing(true); 387 390 setIsDocked(false); -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java
r9543 r9660 9 9 import java.awt.Dimension; 10 10 import java.awt.FlowLayout; 11 import java.awt.GraphicsEnvironment; 11 12 import java.awt.GridBagConstraints; 12 13 import java.awt.GridBagLayout; … … 750 751 outerPanel.add(statusBar, BorderLayout.PAGE_END); 751 752 752 syncDialog = new ExtendedDialog( 753 Main.parent, 754 tr("Correlate images with GPX track"), 755 new String[] {tr("Correlate"), tr("Cancel")}, 756 false 757 ); 758 syncDialog.setContent(panelTf, false); 759 syncDialog.setButtonIcons(new String[] {"ok", "cancel"}); 760 syncDialog.setupDialog(); 761 outerPanel.add(syncDialog.getContentPane(), BorderLayout.PAGE_START); 762 syncDialog.setContentPane(outerPanel); 763 syncDialog.pack(); 764 syncDialog.addWindowListener(new SyncDialogWindowListener()); 765 syncDialog.showDialog(); 753 if (!GraphicsEnvironment.isHeadless()) { 754 syncDialog = new ExtendedDialog( 755 Main.parent, 756 tr("Correlate images with GPX track"), 757 new String[] {tr("Correlate"), tr("Cancel")}, 758 false 759 ); 760 syncDialog.setContent(panelTf, false); 761 syncDialog.setButtonIcons(new String[] {"ok", "cancel"}); 762 syncDialog.setupDialog(); 763 outerPanel.add(syncDialog.getContentPane(), BorderLayout.PAGE_START); 764 syncDialog.setContentPane(outerPanel); 765 syncDialog.pack(); 766 syncDialog.addWindowListener(new SyncDialogWindowListener()); 767 syncDialog.showDialog(); 768 } 766 769 } 767 770 -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java
r9296 r9660 71 71 public class GeoImageLayer extends Layer implements PropertyChangeListener, JumpToMarkerLayer { 72 72 73 private static List<Action> menuAdditions = new LinkedList<>(); 74 75 private static volatile List<MapMode> supportedMapModes; 76 73 77 List<ImageEntry> data; 74 78 GpxLayer gpxLayer; … … 88 92 boolean updateOffscreenBuffer = true; 89 93 90 /** Loads a set of images, while displaying a dialog that indicates what the plugin is currently doing. 94 private MouseAdapter mouseAdapter; 95 private MapModeChangeListener mapModeListener; 96 97 /** 98 * Constructs a new {@code GeoImageLayer}. 99 * @param data The list of images to display 100 * @param gpxLayer The associated GPX layer 101 */ 102 public GeoImageLayer(final List<ImageEntry> data, GpxLayer gpxLayer) { 103 this(data, gpxLayer, null, false); 104 } 105 106 /** 107 * Constructs a new {@code GeoImageLayer}. 108 * @param data The list of images to display 109 * @param gpxLayer The associated GPX layer 110 * @param name Layer name 111 * @since 6392 112 */ 113 public GeoImageLayer(final List<ImageEntry> data, GpxLayer gpxLayer, final String name) { 114 this(data, gpxLayer, name, false); 115 } 116 117 /** 118 * Constructs a new {@code GeoImageLayer}. 119 * @param data The list of images to display 120 * @param gpxLayer The associated GPX layer 121 * @param useThumbs Thumbnail display flag 122 * @since 6392 123 */ 124 public GeoImageLayer(final List<ImageEntry> data, GpxLayer gpxLayer, boolean useThumbs) { 125 this(data, gpxLayer, null, useThumbs); 126 } 127 128 /** 129 * Constructs a new {@code GeoImageLayer}. 130 * @param data The list of images to display 131 * @param gpxLayer The associated GPX layer 132 * @param name Layer name 133 * @param useThumbs Thumbnail display flag 134 * @since 6392 135 */ 136 public GeoImageLayer(final List<ImageEntry> data, GpxLayer gpxLayer, final String name, boolean useThumbs) { 137 super(name != null ? name : tr("Geotagged Images")); 138 if (data != null) { 139 Collections.sort(data); 140 } 141 this.data = data; 142 this.gpxLayer = gpxLayer; 143 this.useThumbs = useThumbs; 144 } 145 146 /** 147 * Loads a set of images, while displaying a dialog that indicates what the plugin is currently doing. 91 148 * In facts, this object is instantiated with a list of files. These files may be JPEG files or 92 149 * directories. In case of directories, they are scanned to find all the images they contain. 93 150 * Then all the images that have be found are loaded as ImageEntry instances. 94 151 */ 95 privatestatic final class Loader extends PleaseWaitRunnable {152 static final class Loader extends PleaseWaitRunnable { 96 153 97 154 private boolean canceled; … … 102 159 private final GpxLayer gpxLayer; 103 160 104 protected void rememberError(String message) {105 this.errorMessages.add(message);106 }107 108 161 Loader(Collection<File> selection, GpxLayer gpxLayer) { 109 162 super(tr("Extracting GPS locations from EXIF")); … … 111 164 this.gpxLayer = gpxLayer; 112 165 errorMessages = new LinkedHashSet<>(); 166 } 167 168 protected void rememberError(String message) { 169 this.errorMessages.add(message); 113 170 } 114 171 … … 133 190 134 191 // read the image files 135 List<ImageEntry> data= new ArrayList<>(files.size());192 List<ImageEntry> entries = new ArrayList<>(files.size()); 136 193 137 194 for (File f : files) { … … 146 203 ImageEntry e = new ImageEntry(f); 147 204 e.extractExif(); 148 data.add(e);149 } 150 layer = new GeoImageLayer( data, gpxLayer);205 entries.add(e); 206 } 207 layer = new GeoImageLayer(entries, gpxLayer); 151 208 files.clear(); 152 209 } … … 242 299 243 300 public static void create(Collection<File> files, GpxLayer gpxLayer) { 244 Loader loader = new Loader(files, gpxLayer); 245 Main.worker.execute(loader); 246 } 247 248 /** 249 * Constructs a new {@code GeoImageLayer}. 250 * @param data The list of images to display 251 * @param gpxLayer The associated GPX layer 252 */ 253 public GeoImageLayer(final List<ImageEntry> data, GpxLayer gpxLayer) { 254 this(data, gpxLayer, null, false); 255 } 256 257 /** 258 * Constructs a new {@code GeoImageLayer}. 259 * @param data The list of images to display 260 * @param gpxLayer The associated GPX layer 261 * @param name Layer name 262 * @since 6392 263 */ 264 public GeoImageLayer(final List<ImageEntry> data, GpxLayer gpxLayer, final String name) { 265 this(data, gpxLayer, name, false); 266 } 267 268 /** 269 * Constructs a new {@code GeoImageLayer}. 270 * @param data The list of images to display 271 * @param gpxLayer The associated GPX layer 272 * @param useThumbs Thumbnail display flag 273 * @since 6392 274 */ 275 public GeoImageLayer(final List<ImageEntry> data, GpxLayer gpxLayer, boolean useThumbs) { 276 this(data, gpxLayer, null, useThumbs); 277 } 278 279 /** 280 * Constructs a new {@code GeoImageLayer}. 281 * @param data The list of images to display 282 * @param gpxLayer The associated GPX layer 283 * @param name Layer name 284 * @param useThumbs Thumbnail display flag 285 * @since 6392 286 */ 287 public GeoImageLayer(final List<ImageEntry> data, GpxLayer gpxLayer, final String name, boolean useThumbs) { 288 super(name != null ? name : tr("Geotagged Images")); 289 if (data != null) { 290 Collections.sort(data); 291 } 292 this.data = data; 293 this.gpxLayer = gpxLayer; 294 this.useThumbs = useThumbs; 301 Main.worker.execute(new Loader(files, gpxLayer)); 295 302 } 296 303 … … 299 306 return ImageProvider.get("dialogs/geoimage"); 300 307 } 301 302 private static List<Action> menuAdditions = new LinkedList<>();303 308 304 309 public static void registerMenuAddition(Action addition) { … … 509 514 Point p = mv.getPoint(e.getPos()); 510 515 511 int imgWidth = 100;512 int imgHeight = 100;516 int imgWidth; 517 int imgHeight; 513 518 if (useThumbs && e.hasThumbnail()) { 514 519 Dimension d = scaledDimension(e.getThumbnail()); … … 570 575 } 571 576 577 /** 578 * Shows next photo. 579 */ 572 580 public void showNextPhoto() { 573 581 if (data != null && !data.isEmpty()) { … … 583 591 } 584 592 593 /** 594 * Shows previous photo. 595 */ 585 596 public void showPreviousPhoto() { 586 597 if (data != null && !data.isEmpty()) { … … 596 607 } 597 608 609 /** 610 * Shows first photo. 611 */ 598 612 public void showFirstPhoto() { 599 613 if (data != null && !data.isEmpty()) { … … 606 620 } 607 621 622 /** 623 * Shows last photo. 624 */ 608 625 public void showLastPhoto() { 609 626 if (data != null && !data.isEmpty()) { … … 638 655 639 656 public void removeCurrentPhotoFromDisk() { 640 ImageEntry toDelete = null;657 ImageEntry toDelete; 641 658 if (data != null && !data.isEmpty() && currentPhoto >= 0 && currentPhoto < data.size()) { 642 659 toDelete = data.get(currentPhoto); … … 684 701 685 702 public void copyCurrentPhotoPath() { 686 ImageEntry toCopy = null;687 703 if (data != null && !data.isEmpty() && currentPhoto >= 0 && currentPhoto < data.size()) { 688 toCopy = data.get(currentPhoto); 689 String copyString = toCopy.getFile().toString(); 690 Utils.copyToClipboard(copyString); 704 Utils.copyToClipboard(data.get(currentPhoto).getFile().toString()); 691 705 } 692 706 } … … 759 773 } 760 774 761 private static volatile List<MapMode> supportedMapModes;762 763 775 /** 764 776 * Registers a map mode for which the functionality of this layer should be available. … … 794 806 return false; 795 807 } 796 797 private MouseAdapter mouseAdapter;798 private MapModeChangeListener mapModeListener;799 808 800 809 @Override
Note:
See TracChangeset
for help on using the changeset viewer.