Changeset 31501 in osm for applications/editors/josm/plugins
- Timestamp:
- 2015-08-15T12:30:33+02:00 (9 years ago)
- Location:
- applications/editors/josm/plugins/mapillary
- Files:
-
- 1 added
- 19 edited
- 3 moved
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryData.java
r31500 r31501 11 11 12 12 /** 13 * Database class for all the MapillaryImageobjects.13 * Database class for all the {@link MapillaryAbstractImage} objects. 14 14 * 15 15 * @author nokutu … … 21 21 22 22 private List<MapillaryAbstractImage> images; 23 /** The image currently selected, this is the one being shown. */ 23 24 private MapillaryAbstractImage selectedImage; 24 /** The image under the cursor */25 /** The image under the cursor. */ 25 26 private MapillaryAbstractImage highlightedImage; 27 /** All the images selected, can be more than one. */ 26 28 private final List<MapillaryAbstractImage> multiSelectedImages; 27 29 /** Listeners of the class. */ 28 30 private CopyOnWriteArrayList<MapillaryDataListener> listeners = new CopyOnWriteArrayList<>(); 29 31 … … 39 41 this.selectedImage = null; 40 42 43 // Adds the basic set of listeners. 41 44 addListener(MapillaryPlugin.walkAction); 42 45 addListener(MapillaryPlugin.zoomAction); … … 67 70 68 71 /** 69 * Removes an image from the database. From the ArrayList in this object and70 * from its {@link MapillarySequence}.72 * Removes an image from the database. From the {@link List} in this object 73 * and from its {@link MapillarySequence}. 71 74 * 72 75 * @param image … … 120 123 121 124 /** 122 * Adds a set of MapillaryImages to the object, but doesn't repaint mapView. 123 * This is needed for concurrency. 125 * Adds a set of {link MapillaryAbstractImage} objects to this object. 124 126 * 125 127 * @param images 126 128 * The set of images to be added. 127 129 * @param update 128 * Whether the map must be updated or no .130 * Whether the map must be updated or not. 129 131 */ 130 132 public synchronized void add(List<MapillaryAbstractImage> images, -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryImage.java
r31445 r31501 14 14 /** Unique identifier of the object */ 15 15 private final String key; 16 17 16 /** The user that made the image */ 18 17 private String user; … … 24 23 * Returns the location where the image was taken. 25 24 * 26 * @return A Stringcontaining the location where the picture was taken.25 * @return A {@code String} containing the location where the picture was taken. 27 26 */ 28 27 public String getLocation() { … … 34 33 * 35 34 * @param location 36 * A Stringobject containing the place where the image was taken.35 * A {@code String} object containing the place where the image was taken. 37 36 */ 38 37 public void setLocation(String location) { … … 61 60 * Returns the unique identifier of the object. 62 61 * 63 * @return A Stringcontaining the unique identifier of the object.62 * @return A {@code String} containing the unique identifier of the object. 64 63 */ 65 64 public String getKey() { … … 71 70 * 72 71 * @param sign 73 * A Stringthat identifies the type of sign.72 * A {@code String} that identifies the type of sign. 74 73 */ 75 74 public void addSign(String sign) { … … 78 77 79 78 /** 80 * Returns a Listcontaining the signs assigned to this image.79 * Returns a {@link List} containing the signs assigned to this image. 81 80 * 82 * @return A Listobject containing the signs assigned to this image.81 * @return A {@link List} object containing the signs assigned to this image. 83 82 */ 84 83 public List<String> getSigns() { … … 90 89 * 91 90 * @param user 92 * A Stringcontaining the username of the person who took the image.91 * A {@code String} containing the username of the person who took the image. 93 92 */ 94 93 public void setUser(String user) { … … 99 98 * Returns the username of the person who took the picture. 100 99 * 101 * @return A Stringcontaining the username of the person who took the100 * @return A {@code String} containing the username of the person who took the 102 101 * picture. 103 102 */ -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryImportedImage.java
r31496 r31501 5 5 import java.io.IOException; 6 6 import java.text.ParseException; 7 import java.text.SimpleDateFormat;8 import java.util.Calendar;9 7 10 8 import javax.imageio.ImageIO; 9 10 import org.openstreetmap.josm.plugins.mapillary.utils.MapillaryUtils; 11 11 12 12 /** … … 24 24 25 25 /** 26 * Creates a new MapillaryImportedImage object using as date the current date ,27 * because it is missing in the file.26 * Creates a new MapillaryImportedImage object using as date the current date. 27 * Using when the EXIF tags doesn't contain that info. 28 28 * 29 29 * @param lat … … 37 37 */ 38 38 public MapillaryImportedImage(double lat, double lon, double ca, File file) { 39 this(lat, lon, ca, file, currentDate());39 this(lat, lon, ca, file, MapillaryUtils.currentDate()); 40 40 } 41 41 … … 73 73 * Returns the pictures of the file. 74 74 * 75 * @return A BufferedImage object containing the picture, or null if the76 * {@link File} given in the constructor was null.75 * @return A {@link BufferedImage} object containing the picture, or null if 76 * the {@link File} given in the constructor was null. 77 77 * @throws IOException 78 78 * If the file parameter of the object isn't an image. … … 85 85 86 86 /** 87 * Returns the Fileobject where the picture is located.87 * Returns the {@link File} object where the picture is located. 88 88 * 89 * @return The Fileobject where the picture is located.89 * @return The {@link File} object where the picture is located. 90 90 */ 91 91 public File getFile() { … … 104 104 return this.file.hashCode(); 105 105 } 106 107 private static String currentDate() {108 Calendar cal = Calendar.getInstance();109 SimpleDateFormat formatter = new SimpleDateFormat("yyyy:MM:dd hh:mm:ss");110 return formatter.format(cal.getTime());111 }112 106 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryLayer.java
r31495 r31501 86 86 /** The image pointed by the red line. */ 87 87 public static MapillaryImage RED; 88 89 88 /** {@link MapillaryData} object that stores the database. */ 90 89 private final MapillaryData data; … … 519 518 public void run() { 520 519 try { 521 sleep(1 000);520 sleep(1500); 522 521 } catch (InterruptedException e) { 523 522 Main.error(e); … … 529 528 @Override 530 529 public void primitivesAdded(PrimitivesAddedEvent event) { 531 // Nothing532 530 } 533 531 534 532 @Override 535 533 public void primitivesRemoved(PrimitivesRemovedEvent event) { 536 // Nothing537 534 } 538 535 539 536 @Override 540 537 public void tagsChanged(TagsChangedEvent event) { 541 // Nothing542 538 } 543 539 544 540 @Override 545 541 public void nodeMoved(NodeMovedEvent event) { 546 // Nothing547 542 } 548 543 549 544 @Override 550 545 public void wayNodesChanged(WayNodesChangedEvent event) { 551 // Nothing552 546 } 553 547 554 548 @Override 555 549 public void relationMembersChanged(RelationMembersChangedEvent event) { 556 // Nothing557 550 } 558 551 559 552 @Override 560 553 public void otherDatasetChange(AbstractDatasetChangedEvent event) { 561 // Nothing562 554 } 563 555 564 556 @Override 565 557 public void visitBoundingBox(BoundingXYVisitor v) { 566 // Nothing567 558 } 568 559 … … 598 589 @Override 599 590 public void actionPerformed(ActionEvent e) { 600 if (INSTANCE != null) {591 if (INSTANCE != null) 601 592 MapillaryRecord.getInstance().addCommand( 602 593 new CommandDelete(getData().getMultiSelectedImages())); 603 }604 594 } 605 595 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryPlugin.java
r31491 r31501 175 175 176 176 /** 177 * Enables/disables a JMenuItem.177 * Enables/disables a {@link JMenuItem}. 178 178 * 179 179 * @param menu -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillarySequence.java
r31460 r31501 5 5 6 6 /** 7 * Class that stores a sequence of MapillaryImageobjects.7 * Class that stores a sequence of {@link MapillaryAbstractImage} objects. 8 8 * 9 9 * @author nokutu 10 * @see Mapillary Image10 * @see MapillaryAbstractImage 11 11 * 12 12 */ … … 25 25 26 26 /** 27 * Creates a sequence object with the given parameters 27 * Creates a sequence object with the given parameters. 28 28 * 29 29 * @param key … … 39 39 40 40 /** 41 * Returns all MapillaryImages objects contained by this object. 41 * Returns all {@link MapillaryAbstractImage} objects contained by this 42 * object. 42 43 * 43 44 * @return A List object containing all the {@link MapillaryAbstractImage} … … 101 102 102 103 /** 103 * Returns the next {@link MapillaryAbstractImage} in the sequence. 104 * Returns the next {@link MapillaryAbstractImage} in the sequence of a given 105 * {@link MapillaryAbstractImage} object. 104 106 * 105 107 * @param image … … 121 123 122 124 /** 123 * Returns the previous {@link MapillaryAbstractImage} in the sequence. 125 * Returns the previous {@link MapillaryAbstractImage} in the sequence of a given 126 * {@link MapillaryAbstractImage} object. 124 127 * 125 128 * @param image -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/WalkThread.java
r31460 r31501 82 82 try { 83 83 synchronized (this) { 84 // Waits for full quality picture. 84 85 if (this.waitForFullQuality && image instanceof MapillaryImage) { 85 86 while (MapillaryMainDialog.getInstance().mapillaryImageDisplay … … 90 91 .getImage().getWidth() < 2048) 91 92 wait(100); 92 } else { 93 } 94 // Waits for thumbnail. 95 else { 93 96 while (MapillaryMainDialog.getInstance().mapillaryImageDisplay 94 97 .getImage() == this.lastImage … … 135 138 this.lock.unlock(); 136 139 } 137 138 140 } 139 141 -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/cache/CacheUtils.java
r31457 r31501 74 74 public void loadingFinished(CacheEntry arg0, CacheEntryAttributes arg1, 75 75 LoadResult arg2) { 76 // Nothing77 76 } 78 77 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/cache/MapillaryCache.java
r31445 r31501 30 30 /** Full quality image */ 31 31 FULL_IMAGE, 32 33 32 /** Low quality image */ 34 33 THUMBNAIL … … 41 40 * The key of the image. 42 41 * @param type 43 * The type of image that must be downloaded (THUM NAIL or42 * The type of image that must be downloaded (THUMBNAIL or 44 43 * FULL_IMAGE). 45 44 */ -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillaryDownloader.java
r31473 r31501 49 49 public final static String CLIENT_ID = "T1Fzd20xZjdtR0s1VDk5OFNIOXpYdzoxNDYyOGRkYzUyYTFiMzgz"; 50 50 /** Executor that will run the petitions. */ 51 private static ThreadPoolExecutor EXECUTOR = new ThreadPoolExecutor(3, 5, 100, TimeUnit.SECONDS,52 new ArrayBlockingQueue<Runnable>(100));;51 private static ThreadPoolExecutor EXECUTOR = new ThreadPoolExecutor(3, 5, 52 100, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(100));; 53 53 54 54 /** … … 114 114 115 115 /** 116 * Checks if the given {@ LatLon} object lies inside the bounds of the116 * Checks if the given {@link LatLon} object lies inside the bounds of the 117 117 * image. 118 118 * 119 119 * @param latlon 120 * The coordinates to check. 120 121 * @return true if it lies inside the bounds; false otherwise; 121 122 */ -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillaryExportDownloadThread.java
r31445 r31501 12 12 import org.openstreetmap.josm.data.cache.CacheEntryAttributes; 13 13 import org.openstreetmap.josm.data.cache.ICachedLoaderListener; 14 import org.openstreetmap.josm.gui.progress.ProgressMonitor;15 14 import org.openstreetmap.josm.plugins.mapillary.MapillaryAbstractImage; 16 15 import org.openstreetmap.josm.plugins.mapillary.MapillaryImage; … … 28 27 ICachedLoaderListener { 29 28 30 String url; 31 ArrayBlockingQueue<BufferedImage> queue; 32 ArrayBlockingQueue<MapillaryAbstractImage> queueImages; 29 private ArrayBlockingQueue<BufferedImage> queue; 30 private ArrayBlockingQueue<MapillaryAbstractImage> queueImages; 33 31 34 ProgressMonitor monitor; 35 MapillaryImage image; 32 private MapillaryImage image; 36 33 37 34 /** … … 50 47 ArrayBlockingQueue<BufferedImage> queue, 51 48 ArrayBlockingQueue<MapillaryAbstractImage> queueImages) { 52 this.url = "https://d1cuyjsrcm0gby.cloudfront.net/" + image.getKey()53 + "/thumb-2048.jpg";54 49 this.queue = queue; 55 50 this.image = image; … … 59 54 @Override 60 55 public void run() { 61 new MapillaryCache(this.image.getKey(), MapillaryCache.Type.FULL_IMAGE) .submit(62 this, false);56 new MapillaryCache(this.image.getKey(), MapillaryCache.Type.FULL_IMAGE) 57 .submit(this, false); 63 58 } 64 59 65 60 @Override 66 public void loadingFinished(CacheEntry data, CacheEntryAttributes attributes,67 LoadResult result) {61 public synchronized void loadingFinished(CacheEntry data, 62 CacheEntryAttributes attributes, LoadResult result) { 68 63 try { 69 this.queue.put(ImageIO.read(new ByteArrayInputStream(data.getContent()))); 70 this.queueImages.put(this.image); 64 synchronized (this.getClass()) { 65 this.queue 66 .put(ImageIO.read(new ByteArrayInputStream(data.getContent()))); 67 this.queueImages.put(this.image); 68 } 71 69 } catch (InterruptedException e) { 72 70 Main.error(e); -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillaryExportManager.java
r31445 r31501 28 28 * 29 29 * @author nokutu 30 * 30 * @see MapillaryExportWriterThread 31 * @see MapillaryExportDownloadThread 31 32 */ 32 33 public class MapillaryExportManager extends PleaseWaitRunnable { 33 34 34 ArrayBlockingQueue<BufferedImage> queue;35 ArrayBlockingQueue<MapillaryAbstractImage> queueImages;35 private ArrayBlockingQueue<BufferedImage> queue; 36 private ArrayBlockingQueue<MapillaryAbstractImage> queueImages; 36 37 37 final int amount;38 List<MapillaryAbstractImage> images;39 String path;38 private final int amount; 39 private List<MapillaryAbstractImage> images; 40 private String path; 40 41 41 42 private Thread writer; … … 137 138 Main.error(e); 138 139 } 139 140 140 } 141 141 142 142 @Override 143 143 protected void finish() { 144 // TODO Auto-generated method stub145 144 } 146 145 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillaryImageInfoDownloadThread.java
r31500 r31501 23 23 * @see MapillarySquareDownloadManagerThread 24 24 */ 25 public class MapillaryImageInfoDownload erThread extends Thread {25 public class MapillaryImageInfoDownloadThread extends Thread { 26 26 private static final String URL = MapillaryDownloader.BASE_URL + "search/im/"; 27 27 private final String queryString; … … 36 36 * A String containing the parameters for the download. 37 37 */ 38 public MapillaryImageInfoDownload erThread(ExecutorService ex,38 public MapillaryImageInfoDownloadThread(ExecutorService ex, 39 39 String queryString) { 40 40 this.ex = ex; -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillarySquareDownloadManagerThread.java
r31472 r31501 24 24 * 25 25 * @see MapillaryDownloader 26 * @see MapillarySequenceDownloadThread 27 * @see MapillaryImageInfoDownloadThread 28 * @see MapillaryTrafficSignDownloadThread 26 29 */ 27 30 public class MapillarySquareDownloadManagerThread extends Thread { … … 109 112 int page = 0; 110 113 while (!this.completeExecutor.isShutdown()) { 111 this.completeExecutor.execute(new MapillaryImageInfoDownload erThread(114 this.completeExecutor.execute(new MapillaryImageInfoDownloadThread( 112 115 this.completeExecutor, this.imageQueryString + "&page=" + page 113 116 + "&limit=20")); … … 122 125 int page = 0; 123 126 while (!this.signsExecutor.isShutdown()) { 124 this.signsExecutor.execute(new MapillaryTrafficSignDownload erThread(127 this.signsExecutor.execute(new MapillaryTrafficSignDownloadThread( 125 128 this.signsExecutor, this.signQueryString + "&page=" + page 126 129 + "&limit=20")); -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillaryTrafficSignDownloadThread.java
r31500 r31501 23 23 * 24 24 */ 25 public class MapillaryTrafficSignDownload erThread extends Thread {25 public class MapillaryTrafficSignDownloadThread extends Thread { 26 26 private static final String URL = MapillaryDownloader.BASE_URL 27 27 + "search/im/or/"; … … 37 37 * A String containing the parameter for the download. 38 38 */ 39 public MapillaryTrafficSignDownload erThread(ExecutorService ex,39 public MapillaryTrafficSignDownloadThread(ExecutorService ex, 40 40 String queryString) { 41 41 this.ex = ex; -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/HyperlinkLabel.java
r31473 r31501 24 24 25 25 /** 26 * JLabelthat acts as a hyperlink.26 * {@link JLabel} that acts as a hyperlink. 27 27 * 28 28 * @author nokutu -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryExportDialog.java
r31460 r31501 168 168 this.dlg.path.setText(this.lastPath); 169 169 } 170 171 170 } 172 173 171 } 174 172 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryFilterDialog.java
r31451 r31501 49 49 tr("Months"), tr("Days") }; 50 50 51 private final JPanel panel = new JPanel();51 private final JPanel panel; 52 52 53 53 /** Spinner to choose the range of dates. */ … … 93 93 KeyEvent.VK_M, Shortcut.NONE), 200); 94 94 95 this.panel = new JPanel(); 96 95 97 this.signChooser.setEnabled(false); 96 98 JPanel signChooserPanel = new JPanel(); -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryHistoryDialog.java
r31495 r31501 44 44 * allows the user to revert them. 45 45 * 46 * @author nokutu 46 47 * @see MapillaryRecord 47 48 * @see MapillaryCommand 48 * @author nokutu49 49 * 50 50 */ … … 211 211 MapillaryRecord.getInstance().undo(); 212 212 } 213 214 213 } 215 214 … … 227 226 MapillaryRecord.getInstance().redo(); 228 227 } 229 230 228 } 231 229 -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/history/MapillaryRecordListener.java
r31490 r31501 3 3 /** 4 4 * Interface for the listener of the {@link MapillaryRecord} class 5 * 5 * 6 6 * @author nokutu 7 7 * @see MapillaryRecord 8 8 */ 9 9 public interface MapillaryRecordListener { 10 10 11 /** 11 12 * Fired when any command is undone or redone. -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/utils/MapillaryUtils.java
r31500 r31501 7 7 import java.net.URISyntaxException; 8 8 import java.net.URL; 9 import java.text.SimpleDateFormat; 9 10 import java.util.ArrayList; 11 import java.util.Calendar; 10 12 import java.util.List; 11 13 … … 266 268 showPictures(MapillaryLayer.getInstance().getData().getImages(), false); 267 269 } 270 271 /** 272 * Returns the current date. 273 * @return A {@code String} object containing the current date. 274 */ 275 public static String currentDate() { 276 Calendar cal = Calendar.getInstance(); 277 SimpleDateFormat formatter = new SimpleDateFormat("yyyy:MM:dd hh:mm:ss"); 278 return formatter.format(cal.getTime()); 279 } 268 280 } -
applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/downloads/MapillarySequenceDownloadThreadTest.java
r31500 r31501 2 2 * 3 3 */ 4 package org.openstreetmap.josm.plugins.mapillary ;4 package org.openstreetmap.josm.plugins.mapillary.downloads; 5 5 6 6 import static org.junit.Assert.assertTrue; … … 13 13 import org.openstreetmap.josm.data.Bounds; 14 14 import org.openstreetmap.josm.data.coor.LatLon; 15 import org.openstreetmap.josm.plugins.mapillary.AbstractTest; 16 import org.openstreetmap.josm.plugins.mapillary.MapillaryLayer; 15 17 import org.openstreetmap.josm.plugins.mapillary.downloads.MapillaryDownloader; 16 18 import org.openstreetmap.josm.plugins.mapillary.downloads.MapillarySequenceDownloadThread;
Note:
See TracChangeset
for help on using the changeset viewer.