Changeset 31815 in osm
- Timestamp:
- 2015-12-12T14:35:46+01:00 (9 years ago)
- Location:
- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryData.java
r31799 r31815 187 187 * @return A List object containing all images. 188 188 */ 189 public List<MapillaryAbstractImage> getImages() {189 public synchronized List<MapillaryAbstractImage> getImages() { 190 190 return this.images; 191 191 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryPlugin.java
r31812 r31815 59 59 60 60 /** Cache that stores the pictures the downloaded pictures. */ 61 public static CacheAccess<String, BufferedImageCacheEntry> CACHE;61 public static CacheAccess<String, BufferedImageCacheEntry> cache; 62 62 63 63 private static final MapillaryDownloadAction downloadAction = new MapillaryDownloadAction(); … … 125 125 126 126 try { 127 CACHE= JCSCacheManager.getCache("mapillary", 10, 10000, this.getPluginDir() + "/cache/");127 cache = JCSCacheManager.getCache("mapillary", 10, 10000, this.getPluginDir() + "/cache/"); 128 128 } catch (IOException e) { 129 129 Main.error(e); -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillarySequence.java
r31787 r31815 18 18 private String key; 19 19 /** Epoch time when the sequence was created */ 20 private long created _at;20 private long createdAt; 21 21 22 22 /** … … 33 33 * @param key 34 34 * The unique identifier of the sequence. 35 * @param created _at35 * @param createdAt 36 36 * The date the sequence was created. 37 37 */ 38 public MapillarySequence(String key, long created _at) {38 public MapillarySequence(String key, long createdAt) { 39 39 this.images = new ArrayList<>(); 40 40 this.key = key; 41 this.created _at = created_at;41 this.createdAt = createdAt; 42 42 } 43 43 … … 61 61 */ 62 62 public long getCreatedAt() { 63 return this.created _at;63 return this.createdAt; 64 64 } 65 65 -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/cache/MapillaryCache.java
r31797 r31815 44 44 */ 45 45 public MapillaryCache(String key, Type type) { 46 super(MapillaryPlugin. CACHE, 50000, 50000, new HashMap<String, String>());46 super(MapillaryPlugin.cache, 50000, 50000, new HashMap<String, String>()); 47 47 String k = null; 48 48 URL u = null; -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/HyperlinkLabel.java
r31811 r31815 7 7 import java.awt.Cursor; 8 8 import java.awt.Toolkit; 9 import java.awt.datatransfer.Clipboard;10 9 import java.awt.datatransfer.StringSelection; 11 10 import java.awt.event.ActionEvent; … … 22 21 23 22 import org.openstreetmap.josm.Main; 24 import org.openstreetmap.josm.plugins.mapillary.MapillaryImage;25 23 import org.openstreetmap.josm.plugins.mapillary.utils.MapillaryUtils; 26 24 … … 54 52 @Override 55 53 public void setText(String text) { 56 super 57 .setText("<html><font color=\"#0000CF\" size=\"2\">" + text + "</font></html>"); //$NON-NLS-1$ //$NON-NLS-2$ 54 super.setText("<html><a style=\"color:#0000CF;font-size:8px\">" + text + "</a></html>"); //$NON-NLS-1$ //$NON-NLS-2$ 58 55 this.text = text; 59 56 } … … 64 61 * @param key 65 62 * The key of the image that the hyperlink will point to. 63 * @throws MalformedURLException 66 64 */ 67 public void setURL(String key) {65 public void setURL(String key) throws MalformedURLException { 68 66 this.key = key; 69 67 if (key == null) { … … 71 69 return; 72 70 } 73 try { 74 this.url = new URL("http://www.mapillary.com/map/im/" + key); 75 } catch (MalformedURLException e) { 76 Main.error(e); 77 } 71 this.url = new URL("http://www.mapillary.com/map/im/" + key); 78 72 } 79 73 … … 98 92 getNormalText())); 99 93 if (e.getButton() == MouseEvent.BUTTON3) { 100 LinkPopUp menu = new LinkPopUp( );94 LinkPopUp menu = new LinkPopUp(key); 101 95 menu.show(e.getComponent(), e.getX(), e.getY()); 102 96 } … … 118 112 private final JMenuItem edit; 119 113 120 public LinkPopUp( ) {114 public LinkPopUp(final String key) { 121 115 this.copy = new JMenuItem(tr("Copy key")); 122 this.copy.addActionListener(new copyAction()); 116 this.copy.addActionListener(new ActionListener() { 117 @Override 118 public void actionPerformed(ActionEvent paramActionEvent) { 119 Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(key), null); 120 } 121 }); 123 122 add(this.copy); 124 123 125 124 this.copyTag = new JMenuItem(tr("Copy key tag")); 126 this.copyTag.addActionListener(new copyTagAction()); 125 this.copyTag.addActionListener(new ActionListener() { 126 @Override 127 public void actionPerformed(ActionEvent paramActionEvent) { 128 Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection("mapillary=" + key), null); 129 } 130 }); 127 131 add(this.copyTag); 128 132 129 133 this.edit = new JMenuItem(tr("Edit on website")); 130 this.edit.addActionListener(new editAction()); 134 this.edit.addActionListener(new ActionListener() { 135 @Override 136 public void actionPerformed(ActionEvent paramActionEvent) { 137 try { 138 MapillaryUtils.browse(new URL("http://www.mapillary.com/map/e/" + key)); 139 } catch (IOException e) { 140 Main.error(e); 141 } 142 } 143 }); 131 144 add(this.edit); 132 }133 134 private class copyAction implements ActionListener {135 136 @Override137 public void actionPerformed(ActionEvent arg0) {138 StringSelection stringSelection = new StringSelection(139 ((MapillaryImage) MapillaryMainDialog.getInstance().getImage())140 .getKey());141 Clipboard clpbrd = Toolkit.getDefaultToolkit().getSystemClipboard();142 clpbrd.setContents(stringSelection, null);143 }144 }145 146 private class copyTagAction implements ActionListener {147 148 @Override149 public void actionPerformed(ActionEvent arg0) {150 StringSelection stringSelection = new StringSelection(151 "mapillary="152 + ((MapillaryImage) MapillaryMainDialog.getInstance()153 .getImage()).getKey());154 Clipboard clpbrd = Toolkit.getDefaultToolkit().getSystemClipboard();155 clpbrd.setContents(stringSelection, null);156 }157 }158 159 private class editAction implements ActionListener {160 161 @Override162 public void actionPerformed(ActionEvent arg0) {163 try {164 MapillaryUtils.browse(new URL("http://www.mapillary.com/map/e/" + HyperlinkLabel.this.key));165 } catch (IOException e) {166 Main.error(e);167 }168 }169 145 } 170 146 } … … 201 177 for (int i = 0; i < listeners.length; i += 2) { 202 178 if (listeners[i] == ActionListener.class) { 203 ActionListener listener = (ActionListener) listeners[i + 1]; 204 listener.actionPerformed(evt); 179 ((ActionListener) listeners[i + 1]).actionPerformed(evt); 205 180 } 206 181 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryImageDisplay.java
r31797 r31815 44 44 45 45 /** The image currently displayed */ 46 private transient BufferedImage image = null;46 private transient BufferedImage image; 47 47 48 48 /** … … 50 50 * rectangle is calculated each time the zoom is modified 51 51 */ 52 private Rectangle visibleRect = null;52 private Rectangle visibleRect; 53 53 54 54 /** … … 56 56 * coordinates) 57 57 */ 58 private Rectangle selectedRect = null;58 private Rectangle selectedRect; 59 59 60 60 /** HyperlinkLabel shown in the bottom right corner. */ … … 63 63 private class ImgDisplayMouseListener implements MouseListener, 64 64 MouseWheelListener, MouseMotionListener { 65 private boolean mouseIsDragging = false;66 private long lastTimeForMousePoint = 0L;67 private Point mousePointInImg = null;65 private boolean mouseIsDragging; 66 private long lastTimeForMousePoint; 67 private Point mousePointInImg; 68 68 69 69 /** … … 302 302 @Override 303 303 public void mouseEntered(MouseEvent e) { 304 // Do nothing, method is enforced by MouseListener 304 305 } 305 306 306 307 @Override 307 308 public void mouseExited(MouseEvent e) { 309 // Do nothing, method is enforced by MouseListener 308 310 } 309 311 310 312 @Override 311 313 public void mouseMoved(MouseEvent e) { 314 // Do nothing, method is enforced by MouseListener 312 315 } 313 316 … … 449 452 * @return the part of compRect with the same width/height ratio as the image 450 453 */ 451 static Rectangle calculateDrawImageRectangle(Rectangle imgRect, 452 Rectangle compRect) { 453 int x, y, w, h; 454 x = 0; 455 y = 0; 456 w = compRect.width; 457 h = compRect.height; 454 static Rectangle calculateDrawImageRectangle(Rectangle imgRect, Rectangle compRect) { 455 int x = 0; 456 int y = 0; 457 int w = compRect.width; 458 int h = compRect.height; 458 459 int wFact = w * imgRect.height; 459 460 int hFact = h * imgRect.width; -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryMainDialog.java
r31799 r31815 15 15 import java.io.ByteArrayInputStream; 16 16 import java.io.IOException; 17 import java.net.MalformedURLException; 17 18 import java.util.Arrays; 18 19 import java.util.List; … … 106 107 createLayout( 107 108 this.mapillaryImageDisplay, 108 Arrays.asList(new SideButton[] { this.blueButton, this.previousButton, 109 this.nextButton, this.redButton }), 109 Arrays.asList(new SideButton[] {this.blueButton, this.previousButton, this.nextButton, this.redButton}), 110 110 Main.pref.getBoolean("mapillary.reverse-buttons")); 111 111 disableAllButtons(); … … 137 137 * @return The unique instance of the class. 138 138 */ 139 public static MapillaryMainDialog getInstance() {139 public static synchronized MapillaryMainDialog getInstance() { 140 140 if (instance == null) 141 141 instance = new MapillaryMainDialog(); … … 154 154 createLayout( 155 155 this.mapillaryImageDisplay, 156 Arrays.asList(new SideButton[] { playButton, pauseButton, stopButton}),156 Arrays.asList(new SideButton[] {playButton, pauseButton, stopButton}), 157 157 Main.pref.getBoolean("mapillary.reverse-buttons")); 158 158 break; … … 161 161 createLayout( 162 162 this.mapillaryImageDisplay, 163 Arrays.asList(new SideButton[] { blueButton, previousButton, nextButton, redButton}),163 Arrays.asList(new SideButton[] {blueButton, previousButton, nextButton, redButton}), 164 164 Main.pref.getBoolean("mapillary.reverse-buttons")); 165 165 break; … … 238 238 this.mapillaryImageDisplay.hyperlink.setVisible(true); 239 239 MapillaryImage mapillaryImage = (MapillaryImage) this.image; 240 this.mapillaryImageDisplay.hyperlink.setURL(mapillaryImage.getKey()); 240 try { 241 this.mapillaryImageDisplay.hyperlink.setURL(mapillaryImage.getKey()); 242 } catch (MalformedURLException e1) { 243 Main.error(e1); 244 } 241 245 // Downloads the thumbnail. 242 246 this.mapillaryImageDisplay.setImage(null); … … 265 269 } else if (this.image instanceof MapillaryImportedImage) { 266 270 this.mapillaryImageDisplay.hyperlink.setVisible(false); 267 this.mapillaryImageDisplay.hyperlink.setURL(null); 271 try { 272 this.mapillaryImageDisplay.hyperlink.setURL(null); 273 } catch (MalformedURLException e1) { 274 Main.error(e1); 275 } 268 276 MapillaryImportedImage mapillaryImage = (MapillaryImportedImage) this.image; 269 277 try { -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/history/MapillaryRecord.java
r31811 r31815 3 3 4 4 import java.util.ArrayList; 5 import java.util.List;6 5 7 6 import org.openstreetmap.josm.plugins.mapillary.MapillaryAbstractImage;
Note:
See TracChangeset
for help on using the changeset viewer.