Changeset 31386 in osm for applications/editors/josm/plugins/mapillary/src
- Timestamp:
- 2015-07-16T13:56:06+02:00 (9 years ago)
- Location:
- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryAbstractImage.java
r31359 r31386 20 20 public abstract class MapillaryAbstractImage { 21 21 22 /** 23 * Lock that locks next() and previous() methods. Used when downloading images 24 * to prevent concurrency problems. 25 */ 22 26 public static Lock lock = new ReentrantLock(); 23 27 24 /** The time the image was captured, in Epoch format */28 /** The time the image was captured, in Epoch format. */ 25 29 private long capturedAt; 26 /** Sequence of pictures containing this object */30 /** Sequence of pictures containing this object. */ 27 31 private MapillarySequence sequence; 28 /** Position of the picture */32 /** Position of the picture. */ 29 33 public final LatLon latLon; 30 /** Direction of the picture */34 /** Direction of the picture. */ 31 35 public final double ca; 36 /** If the image has been modified from its initial values. */ 32 37 public boolean isModified = false; 33 /** Temporal position of the picture until it is uploaded */38 /** Temporal position of the picture until it is uploaded. */ 34 39 public LatLon tempLatLon; 35 40 /** 36 41 * When the object is being dragged in the map, the temporal position is 37 * stored here 42 * stored here. 38 43 */ 39 44 public LatLon movingLatLon; … … 47 52 private boolean visible; 48 53 54 /** 55 * Main constructor of the class. 56 * 57 * @param lat 58 * The latitude where the picture was taken. 59 * @param lon 60 * The longitude where the picture was taken. 61 * @param ca 62 * The direction of the picture (0 means north). 63 */ 49 64 public MapillaryAbstractImage(double lat, double lon, double ca) { 50 65 this.latLon = new LatLon(lat, lon); … … 85 100 } 86 101 102 /** 103 * Set's whether the image should be visible on the map or not. 104 * 105 * @param visible 106 * true if the image is set to be visible; false otherwise. 107 */ 87 108 public void setVisible(boolean visible) { 88 109 this.visible = visible; … … 107 128 */ 108 129 public void move(double x, double y) { 109 this.movingLatLon = new LatLon(this.tempLatLon.getY() + y, this.tempLatLon.getX() + x); 130 this.movingLatLon = new LatLon(this.tempLatLon.getY() + y, 131 this.tempLatLon.getX() + x); 110 132 this.isModified = true; 111 133 } … … 169 191 } 170 192 193 /** 194 * Sets the Epoch time when the picture was captured. 195 * 196 * @param capturedAt 197 */ 171 198 public void setCapturedAt(long capturedAt) { 172 199 this.capturedAt = capturedAt; 173 200 } 174 201 202 /** 203 * Returns the Epoch time when the image was captured. 204 * 205 * @return The long containing the Epoch time when the image was captured. 206 */ 175 207 public long getCapturedAt() { 176 208 return capturedAt; … … 181 213 * 182 214 * @param format 183 * @return 215 * @return A String containing the date the picture was taken using the given 216 * format. 184 217 */ 185 218 public String getDate(String format) { -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryData.java
r31377 r31386 20 20 */ 21 21 public class MapillaryData implements ICachedLoaderListener { 22 23 /** Unique instance of the class */ 22 24 public volatile static MapillaryData INSTANCE; 25 /** Enable this if you are using in Unit Tests */ 23 26 public static boolean TEST_MODE = false; 24 27 … … 31 34 private List<MapillaryDataListener> listeners = new ArrayList<>(); 32 35 33 public MapillaryData() { 36 /** 37 * Main constructor. 38 */ 39 private MapillaryData() { 34 40 images = new CopyOnWriteArrayList<>(); 35 41 multiSelectedImages = new ArrayList<>(); … … 37 43 } 38 44 45 /** 46 * Returns the unique instance of the class. 47 * 48 * @return The unique instance of the class. 49 */ 39 50 public static MapillaryData getInstance() { 40 51 if (INSTANCE == null) { … … 48 59 * 49 60 * @param images 50 * 61 * The set of images to be added. 51 62 */ 52 63 public synchronized void add(List<MapillaryAbstractImage> images) { … … 60 71 * 61 72 * @param image 62 * 73 * The image to be added. 63 74 */ 64 75 public synchronized void add(MapillaryAbstractImage image) { … … 70 81 } 71 82 83 /** 84 * Adds a new listener. 85 * 86 * @param lis Listener to be added. 87 */ 72 88 public void addListener(MapillaryDataListener lis) { 73 89 listeners.add(lis); 74 90 } 75 91 92 /** 93 * Removes a listener. 94 * 95 * @param lis Listener to be removed. 96 */ 76 97 public void removeListener(MapillaryDataListener lis) { 77 98 listeners.remove(lis); … … 83 104 * 84 105 * @param images 85 * 106 * The set of images to be added. 86 107 */ 87 108 public synchronized void addWithoutUpdate(List<MapillaryAbstractImage> images) { … … 95 116 * 96 117 * @param image 97 * 118 * The image under the cursor. 98 119 */ 99 120 public void setHighlightedImage(MapillaryAbstractImage image) { … … 115 136 * 116 137 * @param image 117 * 138 * The image to be added. 118 139 */ 119 140 public synchronized void addWithoutUpdate(MapillaryAbstractImage image) { … … 198 219 199 220 /** 200 * Selects a new image and then starts a new 201 * {@link MapillaryImageDownloadThread} thread in order to download its 202 * surrounding thumbnails. If the user does ctrl+click, this isn't triggered. 203 * 204 * @param image 205 * The MapillaryImage which is going to be selected 221 * Selects a new image.If the user does ctrl+click, this isn't triggered. 222 * 223 * @param image 224 * The MapillaryImage which is going to be selected 206 225 */ 207 226 public void setSelectedImage(MapillaryAbstractImage image) { … … 210 229 211 230 /** 212 * Selects a new image and then starts a new 213 * {@link MapillaryImageDownloadThread} thread in order to download its 214 * surrounding thumbnails. If the user does ctrl+click, this isn't triggered. 231 * Selects a new image.If the user does ctrl+click, this isn't triggered. 215 232 * You can choose whether to center the view on the new image or not. 216 233 * 217 234 * @param image 218 * 235 * The {@link MapillaryImage} which is going to be selected. 219 236 * @param zoom 220 * 237 * True if the view must be centered on the image; false otherwise. 221 238 */ 222 239 public void setSelectedImage(MapillaryAbstractImage image, boolean zoom) { … … 264 281 * 265 282 * @param image 266 * 283 * The MapillaryImage object to be added. 267 284 */ 268 285 public void addMultiSelectedImage(MapillaryAbstractImage image) { … … 281 298 * 282 299 * @param images 283 * 300 * A List object containing the set of images to be added. 284 301 */ 285 302 public void addMultiSelectedImage(List<MapillaryAbstractImage> images) { -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryDataListener.java
r31350 r31386 1 1 package org.openstreetmap.josm.plugins.mapillary; 2 2 3 /** 4 * Interface for listeners of the class {@link MapillaryData}. 5 * 6 * @author nokutu 7 * 8 */ 3 9 public interface MapillaryDataListener { 4 10 … … 11 17 * Fired when the selected image is changed by something different from 12 18 * manually clicking on the icon. 19 * 20 * @param oldImage Old selected {@link MapillaryAbstractImage} 21 * @param newImage New selected {@link MapillaryAbstractImage} 13 22 */ 14 23 public void selectedImageChanged(MapillaryAbstractImage oldImage, -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryImage.java
r31359 r31386 21 21 private String location; 22 22 23 /** 24 * Returns the localtion where the image was taken. 25 * 26 * @return A String containing the location where the picture was taken. 27 */ 23 28 public String getLocation() { 24 29 return location; 25 30 } 26 31 32 /** 33 * Sets the location of the image. 34 * 35 * @param location 36 */ 27 37 public void setLocation(String location) { 28 38 this.location = location; … … 85 95 } 86 96 97 /** 98 * Returns the username of the person who took the picture. 99 * 100 * @return A String containing the username of the person who took the picture. 101 */ 87 102 public String getUser() { 88 103 return user; … … 91 106 @Override 92 107 public String toString() { 93 return "Image[key=" + this.key + ";lat=" + this.latLon.lat() + ";lon=" + this.latLon.lon() + ";ca=" + this.ca + "]"; 108 return "Image[key=" + this.key + ";lat=" + this.latLon.lat() + ";lon=" 109 + this.latLon.lon() + ";ca=" + this.ca + "]"; 94 110 } 95 111 -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryImportedImage.java
r31350 r31386 9 9 import javax.imageio.ImageIO; 10 10 11 /** 12 * A MapillaryImoprtedImage object represents a picture imported locally. 13 * 14 * @author nokutu 15 * 16 */ 11 17 public class MapillaryImportedImage extends MapillaryAbstractImage { 12 18 13 /** 14 * The picture file. 15 */ 19 /** The picture file. */ 16 20 protected File file; 21 /** The date when the picture was taken. */ 17 22 public final long datetimeOriginal; 18 23 24 /** 25 * Creates a new MapillaryImportedImage object using as date the current date, 26 * because it is missing in the file. 27 * 28 * @param lat 29 * Latitude where the picture was taken. 30 * @param lon 31 * Longitude where the picture was taken. 32 * @param ca 33 * Direction of the picture (0 means north). 34 * @param file 35 * The file containing the picture. 36 */ 19 37 public MapillaryImportedImage(double lat, double lon, double ca, File file) { 20 38 this(lat, lon, ca, file, currentDate()); 21 39 } 22 40 41 /** 42 * Main constructor of the class. 43 * 44 * @param lat 45 * Latitude where the picture was taken. 46 * @param lon 47 * Longitude where the picture was taken. 48 * @param ca 49 * Direction of the picture (0 means north), 50 * @param file 51 * The file containing the picture. 52 * @param datetimeOriginal 53 * The date the picture was taken. 54 */ 23 55 public MapillaryImportedImage(double lat, double lon, double ca, File file, 24 56 String datetimeOriginal) { … … 42 74 /** 43 75 * Returns the File object where the picture is located. 44 * 76 * 45 77 * @return The File object where the picture is located. 46 78 */ -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryLayer.java
r31381 r31386 4 4 import static org.openstreetmap.josm.tools.I18n.marktr; 5 5 6 import org.apache.commons.jcs.access.CacheAccess;7 6 import org.openstreetmap.josm.plugins.mapillary.actions.MapillaryDownloadViewAction; 8 7 import org.openstreetmap.josm.plugins.mapillary.cache.MapillaryCache; … … 21 20 import org.openstreetmap.josm.gui.layer.AbstractModifiableLayer; 22 21 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 23 import org.openstreetmap.josm.data.cache.BufferedImageCacheEntry;24 import org.openstreetmap.josm.data.cache.JCSCacheManager;25 22 import org.openstreetmap.josm.data.coor.LatLon; 26 23 import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor; … … 50 47 import java.awt.image.AffineTransformOp; 51 48 import java.awt.image.BufferedImage; 52 import java.io.IOException;53 49 54 50 import javax.swing.ImageIcon; … … 60 56 import java.util.ArrayList; 61 57 62 public class MapillaryLayer extends AbstractModifiableLayer implements DataSetListener, EditLayerChangeListener, 63 LayerChangeListener { 64 65 public final static int SEQUENCE_MAX_JUMP_DISTANCE = Main.pref 66 .getInteger("mapillary.sequence-max-jump-distance", 100); 58 /** 59 * This class represents the layer shown in JOSM. There can only exist one 60 * instance of this object. 61 * 62 * @author nokutu 63 * 64 */ 65 public class MapillaryLayer extends AbstractModifiableLayer implements 66 DataSetListener, EditLayerChangeListener, LayerChangeListener { 67 68 /** Maximum distance for the red/blue lines. */ 69 public final static int SEQUENCE_MAX_JUMP_DISTANCE = Main.pref.getInteger( 70 "mapillary.sequence-max-jump-distance", 100); 67 71 68 72 private boolean TEMP_MANUAL = false; 69 73 74 /** Unique instance of the class */ 70 75 public static MapillaryLayer INSTANCE; 71 public static CacheAccess<String, BufferedImageCacheEntry> CACHE;76 /** The image pointed by the blue line */ 72 77 public static MapillaryImage BLUE; 78 /** The image pointed by the red line */ 73 79 public static MapillaryImage RED; 74 80 75 private final MapillaryData data = MapillaryData.getInstance(); 76 81 /** {@link MapillaryData} object that stores the database */ 82 public final MapillaryData data = MapillaryData.getInstance(); 83 84 /** The bounds of the areas for which the pictures have been downloaded */ 77 85 public ArrayList<Bounds> bounds; 78 86 87 /** Mode of the layer */ 79 88 public AbstractMode mode; 80 89 81 private int highlightPointRadius = Main.pref.getInteger("mappaint.highlight.radius", 7); 82 private int highlightStep = Main.pref.getInteger("mappaint.highlight.step", 4); 90 private int highlightPointRadius = Main.pref.getInteger( 91 "mappaint.highlight.radius", 7); 92 private int highlightStep = Main.pref 93 .getInteger("mappaint.highlight.step", 4); 83 94 84 95 private volatile TexturePaint hatched; … … 95 106 private void init() { 96 107 mode = new SelectMode(); 97 try {98 CACHE = JCSCacheManager.getCache("Mapillary");99 } catch (IOException e) {100 Main.error(e);101 }102 108 if (Main.map != null && Main.map.mapView != null) { 103 109 Main.map.mapView.addMouseListener(mode); … … 120 126 } 121 127 128 /** 129 * Changes the mode the the given one. 130 * 131 * @param mode 132 * The mode that is going to be activated. 133 */ 122 134 public void setMode(AbstractMode mode) { 123 135 Main.map.mapView.removeMouseListener(this.mode); … … 130 142 } 131 143 144 /** 145 * Returns the unique instance of this class. 146 * 147 * @return The unique isntance of this class. 148 */ 132 149 public synchronized static MapillaryLayer getInstance() { 133 150 if (MapillaryLayer.INSTANCE == null) … … 144 161 if (Main.pref.getBoolean("mapillary.download-manually") || TEMP_MANUAL) 145 162 return; 146 for (Bounds bounds : Main.map.mapView.getEditLayer().data.getDataSourceBounds()) { 163 for (Bounds bounds : Main.map.mapView.getEditLayer().data 164 .getDataSourceBounds()) { 147 165 if (!this.bounds.contains(bounds)) { 148 166 this.bounds.add(bounds); … … 160 178 private void checkAreaTooBig() { 161 179 double area = 0; 162 for (Bounds bounds : Main.map.mapView.getEditLayer().data.getDataSourceBounds()) { 180 for (Bounds bounds : Main.map.mapView.getEditLayer().data 181 .getDataSourceBounds()) { 163 182 area += bounds.getArea(); 164 183 } … … 174 193 175 194 /** 176 * Returns the MapillaryData object, which acts as the database of the Layer. 177 * 178 * @return 195 * Returns the {@link MapillaryData} object, which acts as the database of the 196 * Layer. 197 * 198 * @return The {@link MapillaryData} object that stores the database. 179 199 */ 180 200 public MapillaryData getMapillaryData() { … … 292 312 Point p1 = mv.getPoint(bounds.getMin()); 293 313 Point p2 = mv.getPoint(bounds.getMax()); 294 Rectangle r = new Rectangle(Math.min(p1.x, p2.x), Math.min(p1.y, p2.y), Math.abs(p2.x - p1.x), Math.abs(p2.y295 - p1.y));314 Rectangle r = new Rectangle(Math.min(p1.x, p2.x), Math.min(p1.y, p2.y), 315 Math.abs(p2.x - p1.x), Math.abs(p2.y - p1.y)); 296 316 a.subtract(new Area(r)); 297 317 } … … 314 334 MapillaryLayer.BLUE = closestImages[0]; 315 335 g.setColor(Color.BLUE); 316 g.drawLine(mv.getPoint(closestImages[0].getLatLon()).x, mv.getPoint(closestImages[0].getLatLon()).y,317 selected.x, selected.y);336 g.drawLine(mv.getPoint(closestImages[0].getLatLon()).x, 337 mv.getPoint(closestImages[0].getLatLon()).y, selected.x, selected.y); 318 338 MapillaryMainDialog.getInstance().blueButton.setEnabled(true); 319 339 } … … 321 341 MapillaryLayer.RED = closestImages[1]; 322 342 g.setColor(Color.RED); 323 g.drawLine(mv.getPoint(closestImages[1].getLatLon()).x, mv.getPoint(closestImages[1].getLatLon()).y,324 selected.x, selected.y);343 g.drawLine(mv.getPoint(closestImages[1].getLatLon()).x, 344 mv.getPoint(closestImages[1].getLatLon()).y, selected.x, selected.y); 325 345 MapillaryMainDialog.getInstance().redButton.setEnabled(true); 326 346 } … … 356 376 draw(g, image, icon, p); 357 377 if (!image.getSigns().isEmpty()) { 358 g.drawImage(MapillaryPlugin.MAP_SIGN.getImage(), p.x + icon.getIconWidth() / 2, p.y - icon.getIconHeight() 359 / 2, Main.map.mapView); 378 g.drawImage(MapillaryPlugin.MAP_SIGN.getImage(), 379 p.x + icon.getIconWidth() / 2, p.y - icon.getIconHeight() / 2, 380 Main.map.mapView); 360 381 } 361 382 } else if (imageAbs instanceof MapillaryImportedImage) { … … 384 405 Color oldColor = g.getColor(); 385 406 Color highlightColor = PaintColors.HIGHLIGHT.get(); 386 Color highlightColorTransparent = new Color(highlightColor.getRed(), highlightColor.getGreen(),387 highlightColor.get Blue(), 100);407 Color highlightColorTransparent = new Color(highlightColor.getRed(), 408 highlightColor.getGreen(), highlightColor.getBlue(), 100); 388 409 g.setColor(highlightColorTransparent); 389 410 int s = size + highlightPointRadius; … … 405 426 * @param p 406 427 */ 407 private void draw(Graphics2D g, MapillaryAbstractImage image, ImageIcon icon, Point p) { 428 private void draw(Graphics2D g, MapillaryAbstractImage image, ImageIcon icon, 429 Point p) { 408 430 Image imagetemp = icon.getImage(); 409 431 BufferedImage bi = (BufferedImage) imagetemp; … … 473 495 ret[0] = image; 474 496 distances[0] = image.getLatLon().greatCircleDistance(selectedCoords); 475 } else if ((ret[1] == null || image.getLatLon().greatCircleDistance(selectedCoords) < distances[1]) 497 } else if ((ret[1] == null || image.getLatLon().greatCircleDistance( 498 selectedCoords) < distances[1]) 476 499 && image.getSequence() != ret[0].getSequence()) { 477 500 ret[1] = image; … … 482 505 // Predownloads the thumbnails 483 506 if (ret[0] != null) 484 new MapillaryCache(ret[0].getKey(), MapillaryCache.Type.THUMBNAIL).submit(data, false); 507 new MapillaryCache(ret[0].getKey(), MapillaryCache.Type.THUMBNAIL) 508 .submit(data, false); 485 509 if (ret[1] != null) 486 new MapillaryCache(ret[1].getKey(), MapillaryCache.Type.THUMBNAIL).submit(data, false); 510 new MapillaryCache(ret[1].getKey(), MapillaryCache.Type.THUMBNAIL) 511 .submit(data, false); 487 512 return ret; 488 513 } … … 589 614 } 590 615 616 /** 617 * Updates the help text at the bottom of the window. 618 */ 591 619 public void updateHelpText() { 592 620 String ret = ""; … … 597 625 ret += " -- " + tr(mode.toString()); 598 626 599 627 Main.map.statusLine.setHelpText(ret); 600 628 } 601 629 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryPlugin.java
r31374 r31386 30 30 public class MapillaryPlugin extends Plugin { 31 31 32 /** 24x24 icon. */ 32 33 public static final ImageIcon ICON24 = new ImageProvider("icon24.png").get(); 34 /** 16x16 icon. */ 33 35 public static final ImageIcon ICON16 = new ImageProvider("icon16.png").get(); 34 public static final ImageIcon MAP_ICON = new ImageProvider("mapicon.png").get(); 35 public static final ImageIcon MAP_ICON_SELECTED = new ImageProvider("mapiconselected.png").get(); 36 public static final ImageIcon MAP_ICON_IMPORTED = new ImageProvider("mapiconimported.png").get(); 36 /** Icon representing an image in the map. */ 37 public static final ImageIcon MAP_ICON = new ImageProvider("mapicon.png") 38 .get(); 39 /** Icon representing a selected image in the map. */ 40 public static final ImageIcon MAP_ICON_SELECTED = new ImageProvider( 41 "mapiconselected.png").get(); 42 /** Icon representing an imported iage in the map. */ 43 public static final ImageIcon MAP_ICON_IMPORTED = new ImageProvider( 44 "mapiconimported.png").get(); 45 /** Icon used to identify which images have signs on them */ 37 46 public static final ImageIcon MAP_SIGN = new ImageProvider("sign.png").get(); 38 47 public static final int ICON_SIZE = 24; 39 48 49 /** Cache that stores the pictures the downloaded pictures. */ 40 50 public static CacheAccess<String, BufferedImageCacheEntry> CACHE; 41 51 … … 48 58 private final MapillaryJoinAction joinAction; 49 59 60 /** Menu button for the {@link MapillaryDownloadAction} action. */ 50 61 public static JMenuItem DOWNLOAD_MENU; 62 /** Menu button for the {@link MapillaryExportAction} action. */ 51 63 public static JMenuItem EXPORT_MENU; 64 /** Menu button for the {@link MapillaryImportAction} action. */ 52 65 public static JMenuItem IMPORT_MENU; 66 /** Menu button for the {@link MapillaryZoomAction} action. */ 53 67 public static JMenuItem ZOOM_MENU; 68 /** Menu button for the {@link MapillaryDownloadViewAction} action. */ 54 69 public static JMenuItem DOWNLOAD_VIEW_MENU; 70 /** Menu button for the {@link MapillaryImportIntoSequenceAction} action. */ 55 71 public static JMenuItem IMPORT_INTO_SEQUENCE_MENU; 72 /** Menu button for the {@link MapillaryJoinAction} action. */ 56 73 public static JMenuItem JOIN_MENU; 57 74 75 /** 76 * Main constructor. 77 * 78 * @param info 79 */ 58 80 public MapillaryPlugin(PluginInformation info) { 59 81 super(info); … … 67 89 68 90 if (Main.main != null) { // important for headless mode 69 DOWNLOAD_MENU = MainMenu.add(Main.main.menu.imageryMenu, downloadAction, false); 70 EXPORT_MENU = MainMenu.add(Main.main.menu.fileMenu, exportAction, false, 14); 71 IMPORT_INTO_SEQUENCE_MENU = MainMenu.add(Main.main.menu.fileMenu, importIntoSequenceAction, false, 14); 72 IMPORT_MENU = MainMenu.add(Main.main.menu.fileMenu, importAction, false, 14); 91 DOWNLOAD_MENU = MainMenu.add(Main.main.menu.imageryMenu, downloadAction, 92 false); 93 EXPORT_MENU = MainMenu.add(Main.main.menu.fileMenu, exportAction, false, 94 14); 95 IMPORT_INTO_SEQUENCE_MENU = MainMenu.add(Main.main.menu.fileMenu, 96 importIntoSequenceAction, false, 14); 97 IMPORT_MENU = MainMenu.add(Main.main.menu.fileMenu, importAction, false, 98 14); 73 99 ZOOM_MENU = MainMenu.add(Main.main.menu.viewMenu, zoomAction, false, 15); 74 DOWNLOAD_VIEW_MENU = MainMenu.add(Main.main.menu.fileMenu, downloadViewAction, false, 14); 100 DOWNLOAD_VIEW_MENU = MainMenu.add(Main.main.menu.fileMenu, 101 downloadViewAction, false, 14); 75 102 JOIN_MENU = MainMenu.add(Main.main.menu.dataMenu, joinAction, false); 76 103 } … … 85 112 86 113 try { 87 CACHE = JCSCacheManager.getCache("mapillary", 10, 10000, this.getPluginDir() + "/cache/"); 114 CACHE = JCSCacheManager.getCache("mapillary", 10, 10000, 115 this.getPluginDir() + "/cache/"); 88 116 } catch (IOException e) { 89 117 Main.error(e); … … 117 145 } 118 146 147 /** 148 * Enables/disables a JMenuItem. 149 * 150 * @param menu 151 * The JMenuItem object that is going to be enabled or disabled. 152 * @param value 153 * true to enable de JMenuItem; false to disable it. 154 */ 119 155 public static void setMenuEnabled(JMenuItem menu, boolean value) { 120 156 menu.setEnabled(value); -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillarySequence.java
r31355 r31386 6 6 /** 7 7 * Class that stores a sequence of MapillaryImage objects. 8 * 8 * 9 9 * @author nokutu 10 10 * @see MapillaryImage … … 15 15 private String key; 16 16 private long created_at; 17 17 18 /** 19 * Creates a sequence without key or timestamp. Used for 20 * {@link MapillaryImportedImage} sequences. 21 */ 18 22 public MapillarySequence() { 19 23 this.images = new ArrayList<>(); 20 24 } 21 25 26 /** 27 * Creates a sequence object with the given parameters 28 * 29 * @param key 30 * The unique identifier of the sequence. 31 * @param created_at 32 * The date the sequence was created. 33 */ 22 34 public MapillarySequence(String key, long created_at) { 23 35 this.images = new ArrayList<>(); … … 28 40 /** 29 41 * Returns all MapillaryImages objects contained by this object. 30 * 31 * @return 42 * 43 * @return A List object containing all the {@link MapillaryAbstractImage} 44 * objects that are part of the sequence. 32 45 */ 33 46 public List<MapillaryAbstractImage> getImages() { … … 35 48 } 36 49 50 /** 51 * Returns the Epoch time when the sequence was captured. 52 * 53 * @return A long containing the Epoch time when the sequence was captured. 54 * 55 */ 37 56 public long getCreatedAt() { 38 57 return created_at; … … 41 60 /** 42 61 * Adds a new MapillaryImage object to this object. 43 * 62 * 44 63 * @param image 45 64 */ … … 48 67 } 49 68 69 /** 70 * Returns the unique identifier of the sequence. 71 * 72 * @return A String containing the unique identifier of the sequence. null 73 * means that the sequence has been created locally for imported 74 * images. 75 */ 50 76 public String getKey() { 51 77 return this.key; … … 54 80 /** 55 81 * Adds a set of MapillaryImage objects to this object. 56 * 82 * 57 83 * @param images 58 84 */ … … 64 90 /** 65 91 * Removes a MapillaryImage object from this object. 66 * 92 * 67 93 * @param image 68 94 */ … … 72 98 73 99 /** 74 * Returns the next MapillaryImagein the sequence.75 * 100 * Returns the next {@link MapillaryAbstractImage} in the sequence. 101 * 76 102 * @param image 77 * @return 103 * The {@link MapillaryAbstractImage} object whose next image is 104 * going to be returned. 105 * @return The next {@link MapillaryAbstractImage} object in the sequence. 78 106 */ 79 107 public MapillaryAbstractImage next(MapillaryAbstractImage image) { … … 89 117 /** 90 118 * Returns the previous {@link MapillaryAbstractImage} in the sequence. 91 * 119 * 92 120 * @param image 93 * @return 121 * The {@link MapillaryAbstractImage} object whose previous image is 122 * going to be returned. 123 * @return The previous {@link MapillaryAbstractImage} object in the sequence. 94 124 */ 95 125 public MapillaryAbstractImage previous(MapillaryAbstractImage image) { … … 106 136 * Returns the difference of index between two {@link MapillaryAbstractImage} 107 137 * objects belonging to the same {@link MapillarySequence}. 108 * 138 * 109 139 * @param image1 110 140 * @param image2 111 * @return 141 * @return The distance between two {@link MapillaryAbstractImage} objects 142 * belonging to the same {@link MapillarySequence}. 112 143 */ 113 public int getDistance(MapillaryAbstractImage image1, MapillaryAbstractImage image2) { 144 public int getDistance(MapillaryAbstractImage image1, 145 MapillaryAbstractImage image2) { 114 146 if (!this.images.contains(image1) || !this.images.contains(image2)) 115 147 throw new IllegalArgumentException(); -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryDownloadAction.java
r31350 r31386 24 24 public class MapillaryDownloadAction extends JosmAction { 25 25 26 private static final long serialVersionUID = 325060354730454948L; 27 28 /** 29 * Main constructor. 30 */ 26 31 public MapillaryDownloadAction() { 27 32 super(tr("Mapillary"), new ImageProvider("icon24.png"), -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryDownloadViewAction.java
r31350 r31386 23 23 public class MapillaryDownloadViewAction extends JosmAction { 24 24 25 private static final long serialVersionUID = -6837073336175123503L; 26 27 /** Max area to be downloaded */ 25 28 public static final double MAX_AREA = Main.pref.getDouble( 26 29 "mapillary.max-download-area", 0.020); 27 30 31 /** 32 * Main constructor. 33 */ 28 34 public MapillaryDownloadViewAction() { 29 35 super(tr("Download Mapillary images in current view"), new ImageProvider( -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryExportAction.java
r31380 r31386 28 28 /** 29 29 * Action that launches a MapillaryExportDialog and lets you export the images. 30 * 30 * 31 31 * @author nokutu 32 32 * … … 34 34 public class MapillaryExportAction extends JosmAction { 35 35 36 MapillaryExportDialog dialog;36 private static final long serialVersionUID = 6009490043174837948L; 37 37 38 private MapillaryExportDialog dialog; 39 40 /** 41 * Main constructor. 42 */ 38 43 public MapillaryExportAction() { 39 44 super(tr("Export pictures"), new ImageProvider("icon24.png"), … … 100 105 /** 101 106 * Exports the given images from the database. 107 * 108 * @param images 109 * The set of images to be exported. 102 110 */ 103 111 public void export(List<MapillaryAbstractImage> images) { -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryImportAction.java
r31379 r31386 36 36 public class MapillaryImportAction extends JosmAction { 37 37 38 public JFileChooser chooser; 38 private static final long serialVersionUID = 4995924098228081806L; 39 40 private JFileChooser chooser; 39 41 40 42 /** … … 43 45 private int noTagsPics = 0; 44 46 47 /** 48 * Main constructor. 49 */ 45 50 public MapillaryImportAction() { 46 51 super(tr("Import pictures"), new ImageProvider("icon24.png"), -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryImportIntoSequenceAction.java
r31379 r31386 32 32 import org.openstreetmap.josm.tools.Shortcut; 33 33 34 /** 35 * Imports a set of images and puts them in a single {@link MapillarySequence}. 36 * 37 * @author nokutu 38 * 39 */ 34 40 public class MapillaryImportIntoSequenceAction extends JosmAction { 35 41 36 public JFileChooser chooser; 42 private static final long serialVersionUID = -9190217809965894878L; 43 44 private JFileChooser chooser; 37 45 38 46 private LinkedList<MapillaryImportedImage> images; … … 129 137 final TiffField datetimeOriginal = jpegMetadata 130 138 .findEXIFValueWithExactMatch(ExifTagConstants.EXIF_TAG_DATE_TIME_ORIGINAL); 131 if (lat_ref == null || lat == null || lon == null || lon_ref == null 132 || datetimeOriginal == null) 133 throw new IllegalArgumentException( 134 "The picture has not correct EXIF tags"); 139 if (lat_ref == null || lat == null || lon == null || lon_ref == null || datetimeOriginal == null) 140 throw new IllegalArgumentException("The picture has not correct EXIF tags"); 135 141 136 142 double latValue = 0; … … 155 161 } 156 162 163 /** 164 * Joins all the images in a unique {@link MapillarySequence}. 165 */ 157 166 public void joinImages() { 158 167 Collections.sort(images, new MapillaryEpochComparator()); … … 164 173 } 165 174 175 /** 176 * Comparator that comperes two {@link MapillaryAbstractImage} objects 177 * depending on the time they were taken. 178 * 179 * @author nokutu 180 * 181 */ 166 182 public class MapillaryEpochComparator implements 167 183 Comparator<MapillaryAbstractImage> { -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryJoinAction.java
r31357 r31386 13 13 import org.openstreetmap.josm.tools.Shortcut; 14 14 15 /** 16 * Changes the mode of the Layer, from Select mode to Join mode and viceversa. 17 * 18 * @author nokutu 19 * 20 */ 15 21 public class MapillaryJoinAction extends JosmAction { 16 22 23 private static final long serialVersionUID = -7082300908202843706L; 24 25 /** 26 * Main constructor. 27 */ 17 28 public MapillaryJoinAction() { 18 29 super(tr("Join mode"), new ImageProvider("icon24.png"), -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryZoomAction.java
r31350 r31386 17 17 /** 18 18 * Zooms to the currently selected image. 19 * 19 * 20 20 * @author nokutu 21 21 * … … 24 24 MapillaryDataListener { 25 25 26 private static final long serialVersionUID = -6050566219765623059L; 27 28 /** 29 * Main constructor. 30 */ 26 31 public MapillaryZoomAction() { 27 32 super(tr("Zoom to selected image"), new ImageProvider("icon24.png"), -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/cache/MapillaryCache.java
r31350 r31386 10 10 import org.openstreetmap.josm.plugins.mapillary.MapillaryPlugin; 11 11 12 /** 13 * Sotres the 14 * 15 * @author nokutu 16 * 17 */ 12 18 public class MapillaryCache extends 13 19 JCSCachedTileLoaderJob<String, BufferedImageCacheEntry> { … … 16 22 private volatile String key; 17 23 24 /** 25 * Types of images. 26 * 27 * @author nokutu 28 */ 18 29 public static enum Type { 19 30 FULL_IMAGE, THUMBNAIL 20 31 } 21 32 33 /** 34 * Main constructor. 35 * 36 * @param key 37 * @param type 38 */ 22 39 public MapillaryCache(String key, Type type) { 23 40 super(MapillaryPlugin.CACHE, 50000, 50000, new HashMap<String, String>()); -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/HyperlinkLabel.java
r31352 r31386 19 19 import java.awt.Desktop; 20 20 21 /** 22 * JLabel that acts as a hyperlink. 23 * 24 * @author nokutu 25 * 26 */ 21 27 public class HyperlinkLabel extends JLabel implements ActionListener { 22 28
Note:
See TracChangeset
for help on using the changeset viewer.