Changeset 31797 in osm for applications/editors/josm/plugins
- Timestamp:
- 2015-12-04T17:55:52+01:00 (9 years ago)
- Location:
- applications/editors/josm/plugins/mapillary
- Files:
-
- 5 added
- 17 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryImage.java
r31796 r31797 110 110 public String toString() { 111 111 return "Image[key=" + this.key + ";lat=" + this.latLon.lat() + ";lon=" 112 + this.latLon.lon() + ";ca=" + this.ca + "]";112 + this.latLon.lon() + ";ca=" + this.ca + ']'; 113 113 } 114 114 -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryLayer.java
r31796 r31797 74 74 75 75 /** Maximum distance for the red/blue lines. */ 76 public final staticint SEQUENCE_MAX_JUMP_DISTANCE = Main.pref.getInteger(76 public static final int SEQUENCE_MAX_JUMP_DISTANCE = Main.pref.getInteger( 77 77 "mapillary.sequence-max-jump-distance", 100); 78 78 … … 81 81 82 82 /** Unique instance of the class. */ 83 p ublic static MapillaryLayer INSTANCE;83 private static MapillaryLayer instance; 84 84 /** The image pointed by the blue line. */ 85 p ublic static MapillaryImage BLUE;85 private MapillaryImage blue; 86 86 /** The image pointed by the red line. */ 87 p ublic static MapillaryImage RED;87 private MapillaryImage red; 88 88 /** {@link MapillaryData} object that stores the database. */ 89 89 private final MapillaryData data; … … 110 110 */ 111 111 private void init() { 112 if (INSTANCE == null)113 INSTANCE = this;114 112 if (Main.main != null && Main.map.mapView != null) { 115 113 setMode(new SelectMode()); … … 166 164 167 165 /** 166 * Clears the unique instance of this class. 167 */ 168 public static void clearInstance() { 169 instance = null; 170 } 171 172 /** 168 173 * Returns the unique instance of this class. 169 174 * 170 175 * @return The unique instance of this class. 171 176 */ 172 public synchronized static MapillaryLayer getInstance() { 173 if (INSTANCE == null) 174 return new MapillaryLayer(); 175 return MapillaryLayer.INSTANCE; 177 public static synchronized MapillaryLayer getInstance() { 178 if (instance == null) 179 instance = new MapillaryLayer(); 180 return instance; 181 } 182 183 /** 184 * @return if the unique instance of this layer is currently instantiated 185 */ 186 public static boolean hasInstance() { 187 return instance != null; 176 188 } 177 189 … … 184 196 public MapillaryData getData() { 185 197 return this.data; 198 } 199 200 /** 201 * @return The image that is linked to the current image with a blue line 202 */ 203 public MapillaryImage getBlue() { 204 return blue; 205 } 206 207 /** 208 * @return The image that is linked to the current image with a blue line 209 */ 210 public MapillaryImage getRed() { 211 return red; 186 212 } 187 213 … … 203 229 clearInstance(); 204 230 super.destroy(); 205 }206 207 /**208 * Clears the unique instance of this class.209 */210 public static void clearInstance() {211 INSTANCE = null;212 231 } 213 232 … … 284 303 285 304 // Draw colored lines 286 MapillaryLayer.BLUE= null;287 MapillaryLayer.RED= null;305 blue = null; 306 red = null; 288 307 MapillaryMainDialog.getInstance().blueButton.setEnabled(false); 289 308 MapillaryMainDialog.getInstance().redButton.setEnabled(false); … … 294 313 Point selected = mv.getPoint(this.data.getSelectedImage().getLatLon()); 295 314 if (closestImages[0] != null) { 296 MapillaryLayer.BLUE= closestImages[0];315 blue = closestImages[0]; 297 316 g.setColor(Color.BLUE); 298 317 g.drawLine(mv.getPoint(closestImages[0].getLatLon()).x, … … 301 320 } 302 321 if (closestImages[1] != null) { 303 MapillaryLayer.RED= closestImages[1];322 red = closestImages[1]; 304 323 g.setColor(Color.RED); 305 324 g.drawLine(mv.getPoint(closestImages[1].getLatLon()).x, … … 392 411 * The P¡{@link Point} when the image lies. 393 412 */ 394 private void draw(Graphics2D g, MapillaryAbstractImage image, ImageIcon icon, 395 Point p) { 413 private void draw(Graphics2D g, MapillaryAbstractImage image, ImageIcon icon, Point p) { 396 414 Image imagetemp = icon.getImage(); 397 415 BufferedImage bi = (BufferedImage) imagetemp; … … 401 419 // Rotate the image 402 420 double rotationRequired = Math.toRadians(image.getCa()); 403 double locationX = width / 2; 404 double locationY = height / 2; 405 AffineTransform tx = AffineTransform.getRotateInstance(rotationRequired, 406 locationX, locationY); 407 AffineTransformOp op = new AffineTransformOp(tx, 408 AffineTransformOp.TYPE_BILINEAR); 409 410 g.drawImage(op.filter(bi, null), p.x - (width / 2), p.y - (height / 2), 411 Main.map.mapView); 421 double locationX = width / 2d; 422 double locationY = height / 2d; 423 AffineTransform tx = AffineTransform.getRotateInstance(rotationRequired, locationX, locationY); 424 AffineTransformOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_BILINEAR); 425 426 g.drawImage(op.filter(bi, null), p.x - (width / 2), p.y - (height / 2), Main.map.mapView); 412 427 if (this.data.getHighlightedImage() == image) { 413 428 drawPointHighlight(g, p, 16); … … 433 448 @Override 434 449 public Action[] getMenuEntries() { 435 List<Action> actions = new ArrayList<>();436 actions.add(LayerListDialog.getInstance().createShowHideLayerAction());437 actions.add(LayerListDialog.getInstance().createDeleteLayerAction());438 actions.add(new LayerListPopup.InfoAction(this));439 return actions.toArray(new Action[actions.size()]);450 return new Action[]{ 451 LayerListDialog.getInstance().createShowHideLayerAction(), 452 LayerListDialog.getInstance().createDeleteLayerAction(), 453 new LayerListPopup.InfoAction(this) 454 }; 440 455 } 441 456 … … 560 575 @Override 561 576 public void layerAdded(Layer newLayer) { 577 // Do nothing, we're only interested in layer change, not addition 562 578 } 563 579 564 580 @Override 565 581 public void layerRemoved(Layer oldLayer) { 582 // Do nothing, we're only interested in layer change, not removal 566 583 } 567 584 … … 597 614 @Override 598 615 public void actionPerformed(ActionEvent e) { 599 if ( INSTANCE!= null)616 if (instance != null) 600 617 MapillaryRecord.getInstance().addCommand( 601 618 new CommandDelete(getData().getMultiSelectedImages())); -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryDownloadAction.java
r31787 r31797 37 37 @Override 38 38 public void actionPerformed(ActionEvent arg0) { 39 if (MapillaryLayer.INSTANCE == null) { 40 MapillaryLayer.getInstance(); 41 } else { 42 if (Main.map.mapView.getActiveLayer() != MapillaryLayer.getInstance()) 43 Main.map.mapView.setActiveLayer(MapillaryLayer.getInstance()); 44 else 45 Main.map.mapView.setActiveLayer(Main.map.mapView.getEditLayer()); 46 } 39 MapillaryLayer.getInstance(); 40 if (Main.map.mapView.getActiveLayer() != MapillaryLayer.getInstance()) 41 Main.map.mapView.setActiveLayer(MapillaryLayer.getInstance()); 42 else 43 Main.map.mapView.setActiveLayer(Main.map.mapView.getEditLayer()); 47 44 } 48 45 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/WalkThread.java
r31787 r31797 124 124 125 125 @Override 126 public synchronized void interrupt() {127 super.interrupt();128 }129 130 @Override131 126 public void imagesAdded() { 132 127 // Nothing -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/cache/CacheUtils.java
r31787 r31797 18 18 public class CacheUtils { 19 19 20 private static IgnoreDownload IGNORE_DOWNLOAD= new IgnoreDownload();20 private static IgnoreDownload ignoreDownload = new IgnoreDownload(); 21 21 22 22 /** Picture quality */ … … 54 54 switch (pic) { 55 55 case BOTH: 56 if (new MapillaryCache(img.getKey(), MapillaryCache.Type.THUMBNAIL) 57 .get() == null) 58 submit(img.getKey(), MapillaryCache.Type.THUMBNAIL, IGNORE_DOWNLOAD); 59 if (new MapillaryCache(img.getKey(), MapillaryCache.Type.FULL_IMAGE) 60 .get() == null) 61 submit(img.getKey(), MapillaryCache.Type.FULL_IMAGE, IGNORE_DOWNLOAD); 56 if (new MapillaryCache(img.getKey(), MapillaryCache.Type.THUMBNAIL).get() == null) 57 submit(img.getKey(), MapillaryCache.Type.THUMBNAIL, ignoreDownload); 58 if (new MapillaryCache(img.getKey(), MapillaryCache.Type.FULL_IMAGE).get() == null) 59 submit(img.getKey(), MapillaryCache.Type.FULL_IMAGE, ignoreDownload); 62 60 break; 63 61 case THUMBNAIL: 64 submit(img.getKey(), MapillaryCache.Type.THUMBNAIL, IGNORE_DOWNLOAD);62 submit(img.getKey(), MapillaryCache.Type.THUMBNAIL, ignoreDownload); 65 63 break; 66 64 case FULL_IMAGE: 67 submit(img.getKey(), MapillaryCache.Type.FULL_IMAGE, IGNORE_DOWNLOAD);65 submit(img.getKey(), MapillaryCache.Type.FULL_IMAGE, ignoreDownload); 68 66 break; 69 67 } … … 93 91 94 92 @Override 95 public void loadingFinished(CacheEntry arg0, CacheEntryAttributes arg1, 96 LoadResult arg2) {93 public void loadingFinished(CacheEntry arg0, CacheEntryAttributes arg1, LoadResult arg2) { 94 // Ignore download 97 95 } 98 96 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/cache/MapillaryCache.java
r31787 r31797 17 17 * 18 18 */ 19 public class MapillaryCache extends 20 JCSCachedTileLoaderJob<String, BufferedImageCacheEntry> { 19 public class MapillaryCache extends JCSCachedTileLoaderJob<String, BufferedImageCacheEntry> { 21 20 22 private volatileURL url;23 private volatileString key;21 private final URL url; 22 private final String key; 24 23 25 24 /** … … 28 27 * @author nokutu 29 28 */ 30 public staticenum Type {29 public enum Type { 31 30 /** Full quality image */ 32 31 FULL_IMAGE, … … 46 45 public MapillaryCache(String key, Type type) { 47 46 super(MapillaryPlugin.CACHE, 50000, 50000, new HashMap<String, String>()); 48 this.key = key; 49 try { 50 switch (type) { 51 case FULL_IMAGE: 52 this.url = new URL("https://d1cuyjsrcm0gby.cloudfront.net/" + key 53 + "/thumb-2048.jpg"); 54 this.key += ".FULL_IMAGE"; 55 break; 56 case THUMBNAIL: 57 this.url = new URL("https://d1cuyjsrcm0gby.cloudfront.net/" + key 58 + "/thumb-320.jpg"); 59 this.key += ".THUMBNAIL"; 60 break; 47 String k = null; 48 URL u = null; 49 if (key != null && type != null) { 50 try { 51 switch (type) { 52 case FULL_IMAGE: 53 k = key + ".FULL_IMAGE"; 54 u = new URL("https://d1cuyjsrcm0gby.cloudfront.net/" + key + "/thumb-2048.jpg"); 55 break; 56 case THUMBNAIL: 57 default: 58 k = key + ".THUMBNAIL"; 59 u = new URL("https://d1cuyjsrcm0gby.cloudfront.net/" + key + "/thumb-320.jpg"); 60 break; 61 } 62 } catch (MalformedURLException e) { 63 // TODO: Throw exception, so that a MapillaryCache with malformed URL can't be instantiated. 64 Main.error(e); 61 65 } 62 } catch (MalformedURLException e) {63 Main.error(e);64 66 } 67 this.key = k; 68 this.url = u; 65 69 } 66 70 -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryFilterChooseSigns.java
r31787 r31797 47 47 public final JCheckBox noTurn = new JCheckBox(); 48 48 49 private static MapillaryFilterChooseSigns INSTANCE;49 private static MapillaryFilterChooseSigns instance; 50 50 51 51 private MapillaryFilterChooseSigns() { … … 172 172 */ 173 173 public static MapillaryFilterChooseSigns getInstance() { 174 if ( INSTANCE== null)175 INSTANCE= new MapillaryFilterChooseSigns();176 return INSTANCE;174 if (instance == null) 175 instance = new MapillaryFilterChooseSigns(); 176 return instance; 177 177 } 178 178 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryFilterDialog.java
r31787 r31797 47 47 private static MapillaryFilterDialog INSTANCE; 48 48 49 private final staticString[] TIME_LIST = { tr("All"), tr("Years"),49 private static final String[] TIME_LIST = { tr("All"), tr("Years"), 50 50 tr("Months"), tr("Days") }; 51 51 -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryHistoryDialog.java
r31787 r31797 54 54 private static final long serialVersionUID = -3019715241209349372L; 55 55 56 private static MapillaryHistoryDialog INSTANCE;56 private static MapillaryHistoryDialog instance; 57 57 58 58 private transient UndoRedoSelectionListener undoSelectionListener; … … 133 133 */ 134 134 public static MapillaryHistoryDialog getInstance() { 135 if ( INSTANCE== null)136 INSTANCE= new MapillaryHistoryDialog();137 return INSTANCE;135 if (instance == null) 136 instance = new MapillaryHistoryDialog(); 137 return instance; 138 138 } 139 139 … … 149 149 this.undoButton.setEnabled(false); 150 150 ArrayList<MapillaryCommand> redoCommands = new ArrayList<>(); 151 if (commands.size() > 0 && position + 1 < commands.size()) 152 redoCommands = new ArrayList<>(commands.subList(position + 1, 153 commands.size())); 151 if (!commands.isEmpty() && position + 1 < commands.size()) 152 redoCommands = new ArrayList<>(commands.subList(position + 1, commands.size())); 154 153 else 155 154 this.redoButton.setEnabled(false); … … 161 160 for (MapillaryCommand command : undoCommands) { 162 161 if (command != null) { 163 DefaultMutableTreeNode node = new DefaultMutableTreeNode( 164 command.toString()); 162 DefaultMutableTreeNode node = new DefaultMutableTreeNode(command.toString()); 165 163 this.map.put(node, command); 166 164 undoRoot.add(node); … … 169 167 for (MapillaryCommand command : redoCommands) { 170 168 if (command != null) { 171 DefaultMutableTreeNode node = new DefaultMutableTreeNode( 172 command.toString()); 169 DefaultMutableTreeNode node = new DefaultMutableTreeNode(command.toString()); 173 170 this.map.put(node, command); 174 171 redoRoot.add(node); … … 176 173 } 177 174 178 this.separator.setVisible(!undoCommands.isEmpty() 179 || !redoCommands.isEmpty()); 175 this.separator.setVisible(!undoCommands.isEmpty() || !redoCommands.isEmpty()); 180 176 this.spacer.setVisible(undoCommands.isEmpty() && !redoCommands.isEmpty()); 181 177 … … 246 242 */ 247 243 public static void destroyInstance() { 248 MapillaryHistoryDialog. INSTANCE= null;244 MapillaryHistoryDialog.instance = null; 249 245 } 250 246 -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryImageDisplay.java
r31787 r31797 429 429 } 430 430 431 private final staticPoint getCenterImgCoord(Rectangle visibleRect) {431 private static final Point getCenterImgCoord(Rectangle visibleRect) { 432 432 return new Point(visibleRect.x + visibleRect.width / 2, visibleRect.y 433 433 + visibleRect.height / 2); … … 500 500 } 501 501 502 private final staticvoid checkVisibleRectPos(Image image, Rectangle visibleRect) {502 private static final void checkVisibleRectPos(Image image, Rectangle visibleRect) { 503 503 if (visibleRect.x < 0) { 504 504 visibleRect.x = 0; -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryMainDialog.java
r31787 r31797 54 54 private static final long serialVersionUID = 6856496736429480600L; 55 55 56 private final staticString BASE_TITLE = marktr("Mapillary picture");57 58 private static MapillaryMainDialog INSTANCE;56 private static final String BASE_TITLE = marktr("Mapillary picture"); 57 58 private static MapillaryMainDialog instance; 59 59 60 60 private volatile MapillaryAbstractImage image; … … 62 62 private final SideButton nextButton = new SideButton(new nextPictureAction()); 63 63 private final SideButton previousButton = new SideButton( 64 new previousPictureAction());64 new PreviousPictureAction()); 65 65 /** Button used to jump to the image following the red line */ 66 public final SideButton redButton = new SideButton(new redAction());66 public final SideButton redButton = new SideButton(new RedAction()); 67 67 /** Button used to jump to the image following the blue line */ 68 public final SideButton blueButton = new SideButton(new blueAction());69 70 private final SideButton playButton = new SideButton(new playAction());71 private final SideButton pauseButton = new SideButton(new pauseAction());72 private final SideButton stopButton = new SideButton(new stopAction());68 public final SideButton blueButton = new SideButton(new BlueAction()); 69 70 private final SideButton playButton = new SideButton(new PlayAction()); 71 private final SideButton pauseButton = new SideButton(new PauseAction()); 72 private final SideButton stopButton = new SideButton(new StopAction()); 73 73 74 74 /** … … 78 78 * 79 79 */ 80 public staticenum MODE {80 public enum MODE { 81 81 /** Standard mode to view pictures. */ 82 82 NORMAL, … … 123 123 KeyStroke.getKeyStroke("PAGE_UP"), "previous"); 124 124 this.previousButton.getActionMap().put("previous", 125 new previousPictureAction());125 new PreviousPictureAction()); 126 126 this.blueButton.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put( 127 127 KeyStroke.getKeyStroke("control PAGE_UP"), "blue"); 128 this.blueButton.getActionMap().put("blue", new blueAction());128 this.blueButton.getActionMap().put("blue", new BlueAction()); 129 129 this.redButton.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put( 130 130 KeyStroke.getKeyStroke("control PAGE_DOWN"), "red"); 131 this.redButton.getActionMap().put("red", new redAction());131 this.redButton.getActionMap().put("red", new RedAction()); 132 132 } 133 133 … … 138 138 */ 139 139 public static MapillaryMainDialog getInstance() { 140 if ( INSTANCE== null)141 INSTANCE= new MapillaryMainDialog();142 return INSTANCE;140 if (instance == null) 141 instance = new MapillaryMainDialog(); 142 return instance; 143 143 } 144 144 … … 151 151 public void setMode(MODE mode) { 152 152 switch (mode) { 153 case NORMAL:154 createLayout(155 this.mapillaryImageDisplay,156 Arrays.asList(new SideButton[] { this.blueButton,157 this.previousButton, this.nextButton, this.redButton }),158 Main.pref.getBoolean("mapillary.reverse-buttons"));159 break;160 153 case WALK: 161 154 createLayout( 162 155 this.mapillaryImageDisplay, 163 Arrays.asList(new SideButton[] { this.playButton, this.pauseButton, 164 this.stopButton }), 156 Arrays.asList(new SideButton[] { playButton, pauseButton, stopButton }), 157 Main.pref.getBoolean("mapillary.reverse-buttons")); 158 break; 159 case NORMAL: 160 default: 161 createLayout( 162 this.mapillaryImageDisplay, 163 Arrays.asList(new SideButton[] { blueButton, previousButton, nextButton, redButton }), 165 164 Main.pref.getBoolean("mapillary.reverse-buttons")); 166 165 break; … … 176 175 */ 177 176 public static void destroyInstance() { 178 INSTANCE= null;177 instance = null; 179 178 } 180 179 … … 204 203 }); 205 204 } else { 206 if ( MapillaryLayer.INSTANCE == null) {205 if (!MapillaryLayer.hasInstance()) { 207 206 return; 208 207 } … … 309 308 } 310 309 }); 311 } else { 312 if (this.image != null) { 313 if (this.image instanceof MapillaryImage) { 314 MapillaryImage mapillaryImage = (MapillaryImage) this.image; 315 String title = tr(BASE_TITLE); 316 if (mapillaryImage.getUser() != null) 317 title += " -- " + mapillaryImage.getUser(); 318 if (mapillaryImage.getCapturedAt() != 0) 319 title += " -- " + mapillaryImage.getDate(); 320 setTitle(title); 321 } else if (this.image instanceof MapillaryImportedImage) { 322 MapillaryImportedImage mapillaryImportedImage = (MapillaryImportedImage) this.image; 323 String title = tr(BASE_TITLE); 324 title += " -- " + mapillaryImportedImage.getFile().getName(); 325 title += " -- " + mapillaryImportedImage.getDate(); 326 setTitle(title); 327 } 310 } else if (this.image != null) { 311 if (this.image instanceof MapillaryImage) { 312 MapillaryImage mapillaryImage = (MapillaryImage) this.image; 313 String title = tr(BASE_TITLE); 314 if (mapillaryImage.getUser() != null) 315 title += " -- " + mapillaryImage.getUser(); 316 if (mapillaryImage.getCapturedAt() != 0) 317 title += " -- " + mapillaryImage.getDate(); 318 setTitle(title); 319 } else if (this.image instanceof MapillaryImportedImage) { 320 MapillaryImportedImage mapillaryImportedImage = (MapillaryImportedImage) this.image; 321 String title = tr(BASE_TITLE); 322 title += " -- " + mapillaryImportedImage.getFile().getName(); 323 title += " -- " + mapillaryImportedImage.getDate(); 324 setTitle(title); 328 325 } 329 326 } … … 366 363 * 367 364 */ 368 private class previousPictureAction extends AbstractAction {365 private class PreviousPictureAction extends AbstractAction { 369 366 370 367 private static final long serialVersionUID = -6420511632957956012L; 371 368 372 public previousPictureAction() {369 public PreviousPictureAction() { 373 370 putValue(NAME, tr("Previous picture")); 374 371 putValue(SHORT_DESCRIPTION, … … 388 385 * 389 386 */ 390 private class redAction extends AbstractAction {387 private class RedAction extends AbstractAction { 391 388 392 389 private static final long serialVersionUID = -6480229431481386376L; 393 390 394 public redAction() {391 public RedAction() { 395 392 putValue(NAME, tr("Jump to red")); 396 393 putValue(SHORT_DESCRIPTION, … … 402 399 if (MapillaryMainDialog.getInstance().getImage() != null) { 403 400 MapillaryLayer.getInstance().getData() 404 .setSelectedImage(MapillaryLayer. RED, true);401 .setSelectedImage(MapillaryLayer.getInstance().getRed(), true); 405 402 } 406 403 } … … 413 410 * 414 411 */ 415 private class blueAction extends AbstractAction {412 private class BlueAction extends AbstractAction { 416 413 417 414 private static final long serialVersionUID = 6250690644594703314L; 418 415 419 public blueAction() {416 public BlueAction() { 420 417 putValue(NAME, tr("Jump to blue")); 421 418 putValue(SHORT_DESCRIPTION, … … 427 424 if (MapillaryMainDialog.getInstance().getImage() != null) { 428 425 MapillaryLayer.getInstance().getData() 429 .setSelectedImage(MapillaryLayer. BLUE, true);430 } 431 } 432 } 433 434 private class stopAction extends AbstractAction implements WalkListener {426 .setSelectedImage(MapillaryLayer.getInstance().getBlue(), true); 427 } 428 } 429 } 430 431 private class StopAction extends AbstractAction implements WalkListener { 435 432 436 433 private static final long serialVersionUID = -6561451575815789198L; … … 438 435 private WalkThread thread; 439 436 440 public stopAction() {437 public StopAction() { 441 438 putValue(NAME, tr("Stop")); 442 439 putValue(SHORT_DESCRIPTION, tr("Stops the walk.")); … … 457 454 } 458 455 459 private class playAction extends AbstractAction implements WalkListener {456 private class PlayAction extends AbstractAction implements WalkListener { 460 457 461 458 private static final long serialVersionUID = -17943404752082788L; 462 459 private WalkThread thread; 463 460 464 public playAction() {461 public PlayAction() { 465 462 putValue(NAME, tr("Play")); 466 463 putValue(SHORT_DESCRIPTION, tr("Continues with the paused walk.")); … … 482 479 } 483 480 484 private class pauseAction extends AbstractAction implements WalkListener {481 private class PauseAction extends AbstractAction implements WalkListener { 485 482 486 483 private static final long serialVersionUID = 4400240686337741192L; … … 488 485 private WalkThread thread; 489 486 490 public pauseAction() {487 public PauseAction() { 491 488 putValue(NAME, tr("Pause")); 492 489 putValue(SHORT_DESCRIPTION, tr("Pauses the walk.")); -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/history/MapillaryRecord.java
r31787 r31797 3 3 4 4 import java.util.ArrayList; 5 import java.util.List; 5 6 6 7 import org.openstreetmap.josm.plugins.mapillary.MapillaryAbstractImage; … … 16 17 public class MapillaryRecord { 17 18 /** The unique instance of the class. */ 18 private static MapillaryRecord INSTANCE;19 private static MapillaryRecord instance; 19 20 20 21 private ArrayList<MapillaryRecordListener> listeners; … … 40 41 */ 41 42 public static synchronized MapillaryRecord getInstance() { 42 if (MapillaryRecord. INSTANCE== null)43 MapillaryRecord. INSTANCE= new MapillaryRecord();44 return MapillaryRecord. INSTANCE;43 if (MapillaryRecord.instance == null) 44 MapillaryRecord.instance = new MapillaryRecord(); 45 return MapillaryRecord.instance; 45 46 } 46 47 -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/io/download/MapillaryDownloader.java
r31796 r31797 39 39 40 40 /** Base URL of the Mapillary API. */ 41 public final staticString BASE_URL = "https://a.mapillary.com/v2/";41 public static final String BASE_URL = "https://a.mapillary.com/v2/"; 42 42 /** Client ID for the app */ 43 public final staticString CLIENT_ID = "T1Fzd20xZjdtR0s1VDk5OFNIOXpYdzoxNDYyOGRkYzUyYTFiMzgz";43 public static final String CLIENT_ID = "T1Fzd20xZjdtR0s1VDk5OFNIOXpYdzoxNDYyOGRkYzUyYTFiMzgz"; 44 44 /** Executor that will run the petitions. */ 45 45 private static ThreadPoolExecutor EXECUTOR = new ThreadPoolExecutor(3, 5, … … 179 179 public static MapillaryDownloader.MODES getMode() { 180 180 if (Main.pref.get("mapillary.download-mode").equals(MODES.Automatic.toString()) 181 && ( MapillaryLayer.INSTANCE == null || !MapillaryLayer.INSTANCE.TEMP_SEMIAUTOMATIC))181 && (!MapillaryLayer.hasInstance() || !MapillaryLayer.getInstance().TEMP_SEMIAUTOMATIC)) 182 182 return MODES.Automatic; 183 183 else if (Main.pref.get("mapillary.download-mode").equals(MODES.Semiautomatic.toString()) 184 || (MapillaryLayer. INSTANCE != null&& MapillaryLayer.getInstance().TEMP_SEMIAUTOMATIC))184 || (MapillaryLayer.hasInstance() && MapillaryLayer.getInstance().TEMP_SEMIAUTOMATIC)) 185 185 return MODES.Semiautomatic; 186 186 else if (Main.pref.get("mapillary.download-mode").equals(MODES.Manual.toString())) 187 187 return MODES.Manual; 188 else if ( Main.pref.get("mapillary.download-mode").equals(""))188 else if ("".equals(Main.pref.get("mapillary.download-mode"))) 189 189 return MODES.Automatic; 190 190 else -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/io/export/MapillaryExportWriterThread.java
r31787 r31797 73 73 public void run() { 74 74 this.monitor.setCustomText("Downloaded 0/" + this.amount); 75 // File tempFile = null;76 75 BufferedImage img; 77 MapillaryAbstractImage mimg = null;76 MapillaryAbstractImage mimg; 78 77 String finalPath = ""; 79 78 for (int i = 0; i < this.amount; i++) { … … 91 90 finalPath = this.path + "/" 92 91 + ((MapillaryImportedImage) mimg).getFile().getName(); 93 ;94 92 95 93 // Transforms the image into a byte array. … … 100 98 // Write EXIF tags 101 99 TiffOutputSet outputSet = null; 102 TiffOutputDirectory exifDirectory = null;103 TiffOutputDirectory gpsDirectory = null;100 TiffOutputDirectory exifDirectory; 101 TiffOutputDirectory gpsDirectory; 104 102 // If the image is imported, loads the rest of the EXIF data. 105 103 if (mimg instanceof MapillaryImportedImage) { … … 135 133 exifDirectory.add(ExifTagConstants.EXIF_TAG_DATE_TIME_ORIGINAL, 136 134 ((MapillaryImage) mimg).getDate("yyyy/MM/dd hh/mm/ss")); 137 outputSet.setGPSInDegrees(mimg.getLatLon().lon(), mimg.getLatLon() 138 .lat()); 139 OutputStream os = new BufferedOutputStream(new FileOutputStream( 140 finalPath + ".jpg")); 141 new ExifRewriter() 142 .updateExifMetadataLossless(imageBytes, os, outputSet); 135 outputSet.setGPSInDegrees(mimg.getLatLon().lon(), mimg.getLatLon().lat()); 136 OutputStream os = new BufferedOutputStream(new FileOutputStream(finalPath + ".jpg")); 137 new ExifRewriter().updateExifMetadataLossless(imageBytes, os, outputSet); 143 138 144 139 os.close(); … … 155 150 156 151 // Increases the progress bar. 157 this.monitor.worked(PleaseWaitProgressMonitor.PROGRESS_BAR_MAX 158 / this.amount); 152 this.monitor.worked(PleaseWaitProgressMonitor.PROGRESS_BAR_MAX / this.amount); 159 153 this.monitor.setCustomText("Downloaded " + (i + 1) + "/" + this.amount); 160 154 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/mode/AbstractMode.java
r31796 r31797 27 27 ZoomChangeListener { 28 28 29 private final staticint DOWNLOAD_COOLDOWN = 2000;29 private static final int DOWNLOAD_COOLDOWN = 2000; 30 30 31 31 protected MapillaryData data = MapillaryLayer.getInstance().getData(); -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/utils/MapillaryUtils.java
r31789 r31797 190 190 * @param mapillaryAbstractImage2 191 191 */ 192 public s ynchronized staticvoid join(192 public static synchronized void join( 193 193 MapillaryAbstractImage mapillaryAbstractImage, 194 194 MapillaryAbstractImage mapillaryAbstractImage2) { … … 433 433 * @param mapillaryAbstractImage2 434 434 */ 435 public s ynchronized staticvoid unjoin(435 public static synchronized void unjoin( 436 436 MapillaryAbstractImage mapillaryAbstractImage, 437 437 MapillaryAbstractImage mapillaryAbstractImage2) { -
applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/history/MapillaryRecordTest.java
r31500 r31797 2 2 3 3 import static org.junit.Assert.assertEquals; 4 import static org.junit.Assert.assertFalse; 5 import static org.junit.Assert.assertTrue; 4 6 import static org.junit.Assert.fail; 5 7 … … 266 268 267 269 this.record.addCommand(cmd1); 268 assertEquals(false, MapillaryLayer.getInstance().getData().getImages() 269 .contains(this.img1)); 270 assertFalse(MapillaryLayer.getInstance().getData().getImages().contains(this.img1)); 270 271 assertEquals(null, this.img2.previous()); 271 272 this.record.undo(); 272 assertEquals(true, MapillaryLayer.getInstance().getData().getImages() 273 .contains(this.img1)); 273 assertTrue(MapillaryLayer.getInstance().getData().getImages().contains(this.img1)); 274 274 this.record.redo(); 275 275 this.record.addCommand(cmd2); -
applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/io/download/MapillarySequenceDownloadThreadTest.java
r31796 r31797 2 2 * 3 3 */ 4 package org.openstreetmap.josm.plugins.mapillary. downloads;4 package org.openstreetmap.josm.plugins.mapillary.io.download; 5 5 6 6 import static org.junit.Assert.assertTrue;
Note:
See TracChangeset
for help on using the changeset viewer.