Changeset 31387 in osm
- Timestamp:
- 2015-07-16T13:56:12+02:00 (10 years ago)
- Location:
- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryLayer.java
r31386 r31387 63 63 * 64 64 */ 65 public class MapillaryLayer extends AbstractModifiableLayer implements 66 DataSetListener, EditLayerChangeListener,LayerChangeListener {65 public class MapillaryLayer extends AbstractModifiableLayer implements DataSetListener, EditLayerChangeListener, 66 LayerChangeListener { 67 67 68 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); 69 public final static int SEQUENCE_MAX_JUMP_DISTANCE = Main.pref 70 .getInteger("mapillary.sequence-max-jump-distance", 100); 71 71 72 72 private boolean TEMP_MANUAL = false; … … 130 130 * 131 131 * @param mode 132 * 132 * The mode that is going to be activated. 133 133 */ 134 134 public void setMode(AbstractMode mode) { … … 567 567 @Override 568 568 public void primitivesAdded(PrimitivesAddedEvent event) { 569 // Nothing 569 570 } 570 571 571 572 @Override 572 573 public void primitivesRemoved(PrimitivesRemovedEvent event) { 574 // Nothing 573 575 } 574 576 575 577 @Override 576 578 public void tagsChanged(TagsChangedEvent event) { 579 // Nothing 577 580 } 578 581 579 582 @Override 580 583 public void nodeMoved(NodeMovedEvent event) { 584 // Nothing 581 585 } 582 586 583 587 @Override 584 588 public void wayNodesChanged(WayNodesChangedEvent event) { 589 // Nothing 585 590 } 586 591 587 592 @Override 588 593 public void relationMembersChanged(RelationMembersChangedEvent event) { 594 // Nothing 589 595 } 590 596 591 597 @Override 592 598 public void otherDatasetChange(AbstractDatasetChangedEvent event) { 599 // Nothing 593 600 } 594 601 595 602 @Override 596 603 public void visitBoundingBox(BoundingXYVisitor v) { 604 // Nothing 597 605 } 598 606 … … 608 616 @Override 609 617 public void layerAdded(Layer newLayer) { 618 // Nothing 610 619 } 611 620 612 621 @Override 613 622 public void layerRemoved(Layer oldLayer) { 623 // Nothing 614 624 } 615 625 -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillarySequence.java
r31386 r31387 111 111 if (i == images.size() - 1) 112 112 return null; 113 else 114 return images.get(i + 1); 113 return images.get(i + 1); 115 114 } 116 115 … … 129 128 if (i == 0) 130 129 return null; 131 else 132 return images.get(i - 1); 130 return images.get(i - 1); 133 131 } 134 132 -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryImportAction.java
r31386 r31387 153 153 if (datetimeOriginal != null) 154 154 MapillaryData.getInstance().add( 155 new MapillaryImportedImage(latValue, lonValue, caValue, file, 156 datetimeOriginal.getStringValue())); 155 new MapillaryImportedImage(latValue, lonValue, caValue, file, datetimeOriginal.getStringValue())); 157 156 else 158 157 MapillaryData.getInstance().add( -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryImportIntoSequenceAction.java
r31386 r31387 189 189 if (arg0.getCapturedAt() > arg1.getCapturedAt()) 190 190 return 1; 191 else 192 return 0; 191 return 0; 193 192 } 194 193 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryZoomAction.java
r31386 r31387 59 59 @Override 60 60 public void imagesAdded() { 61 // Nothing 61 62 } 62 63 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/cache/MapillaryCache.java
r31386 r31387 11 11 12 12 /** 13 * S otres the13 * Stores the downloaded pictures locally. 14 14 * 15 15 * @author nokutu … … 28 28 */ 29 29 public static enum Type { 30 FULL_IMAGE, THUMBNAIL 30 /** Full quality image */ 31 FULL_IMAGE, 32 33 /** Low quality image */ 34 THUMBNAIL 31 35 } 32 36 -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/commands/CommandMoveImage.java
r31352 r31387 19 19 private double y; 20 20 21 public CommandMoveImage(List<MapillaryAbstractImage> images, double x, 22 double y) { 21 /** 22 * Main constructor. 23 * 24 * @param images Set of images that are going to be moved. 25 * @param x How much the x coordinate increases. 26 * @param y How much the y coordinate increases. 27 */ 28 public CommandMoveImage(List<MapillaryAbstractImage> images, double x, double y) { 23 29 this.images = new ArrayList<>(images); 24 30 this.x = x; … … 48 54 @Override 49 55 public String toString() { 50 return trn("Moved {0} image", "Moved {0} images", images.size(), 51 images.size()); 56 return trn("Moved {0} image", "Moved {0} images", images.size(), images.size()); 52 57 } 53 58 -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/commands/CommandTurnImage.java
r31352 r31387 18 18 private double ca; 19 19 20 /** 21 * Main constructor. 22 * 23 * @param images Set of images that is turned. 24 * @param ca How much the images turn. 25 */ 20 26 public CommandTurnImage(List<MapillaryAbstractImage> images, double ca) { 21 27 this.images = new ArrayList<>(images); … … 45 51 @Override 46 52 public String toString() { 47 return trn("Turned {0} image", "Turned {0} images", this.images.size(), 48 this.images.size()); 53 return trn("Turned {0} image", "Turned {0} images", this.images.size(), this.images.size()); 49 54 } 50 55 -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/commands/MapillaryCommand.java
r31350 r31387 14 14 protected List<MapillaryAbstractImage> images; 15 15 16 /** 17 * Undoes the action. 18 */ 16 19 public abstract void undo(); 17 20 21 /** 22 * Redoes the action. 23 */ 18 24 public abstract void redo(); 19 25 … … 27 33 28 34 /** 29 * Checks if the image has been modified, compa iring with its original values.35 * Checks if the image has been modified, comparing with its original values. 30 36 */ 31 37 public void checkModified() { -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/commands/MapillaryRecord.java
r31350 r31387 12 12 */ 13 13 public class MapillaryRecord { 14 public static MapillaryRecord INSTANCE; 14 /** The unique instance of the class. */ 15 private static MapillaryRecord INSTANCE; 15 16 16 17 private ArrayList<MapillaryRecordListener> listeners; 17 18 19 /** The set of commands that have taken place or that have been undone. */ 18 20 public ArrayList<MapillaryCommand> commandList; 19 /** Last written command */ 21 /** Last written command. */ 20 22 public int position; 21 23 24 /** 25 * Main constructor. 26 */ 22 27 public MapillaryRecord() { 23 28 commandList = new ArrayList<>(); … … 26 31 } 27 32 33 /** 34 * Returns the unique instance of the class. 35 * 36 * @return The unique instance of the class. 37 */ 28 38 public static synchronized MapillaryRecord getInstance() { 29 39 if (MapillaryRecord.INSTANCE == null) … … 32 42 } 33 43 44 /** 45 * Adds a listener. 46 * 47 * @param lis 48 */ 34 49 public void addListener(MapillaryRecordListener lis) { 35 50 this.listeners.add(lis); 36 51 } 37 52 53 /** 54 * Removes the given listener. 55 * 56 * @param lis 57 */ 38 58 public void removeListener(MapillaryRecordListener lis) { 39 59 this.listeners.remove(lis); … … 52 72 if (!command.images.contains(img)) 53 73 equalSets = false; 54 if (equalSets 55 && commandList.get(position).getClass() == command.getClass()) { 74 if (equalSets && commandList.get(position).getClass() == command.getClass()) { 56 75 commandList.get(position).sum(command); 57 76 fireRecordChanged(); … … 59 78 } 60 79 } 61 // Adds the command to the las position of the list. 80 // Adds the command to the last position of the list. 62 81 commandList.add(position + 1, command); 63 82 position++; -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/commands/MapillaryRecordListener.java
r31350 r31387 1 1 package org.openstreetmap.josm.plugins.mapillary.commands; 2 2 3 /** 4 * Interface for the listener of the {@link MapillaryRecord} class 5 * 6 * @author nokutu 7 * @see MapillaryRecord 8 */ 3 9 public interface MapillaryRecordListener { 10 /** 11 * Fired when any command is undone or redone. 12 */ 4 13 public void recordChanged(); 5 14 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillaryDownloader.java
r31381 r31387 19 19 public class MapillaryDownloader { 20 20 21 /** Base URL of the Mapillary API. */ 21 22 public final static String BASE_URL = "https://a.mapillary.com/v2/"; 23 /** Client ID for the app */ 22 24 public final static String CLIENT_ID = "NzNRM2otQkR2SHJzaXJmNmdQWVQ0dzo1YTA2NmNlODhlNWMwOTBm"; 25 /** Executor that will run the petitions */ 23 26 public final static Executor EXECUTOR = Executors.newSingleThreadExecutor(); 24 27 25 public MapillaryDownloader() {26 }27 28 28 29 /** -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillaryExportDownloadThread.java
r31350 r31387 23 23 * @author nokutu 24 24 * @see MapillaryExportManager 25 * @see MapillaryExportWriterThread 25 26 */ 26 public class MapillaryExportDownloadThread extends Thread implements 27 ICachedLoaderListener { 27 public class MapillaryExportDownloadThread extends Thread implements ICachedLoaderListener { 28 28 29 29 String url; … … 34 34 MapillaryImage image; 35 35 36 public MapillaryExportDownloadThread(MapillaryImage image, 37 ArrayBlockingQueue<BufferedImage> queue, 36 /** 37 * Main constructor. 38 * 39 * @param image Image to be downloaded. 40 * @param queue Queue of {@link BufferedImage} objects for the {@link MapillaryExportWriterThread}. 41 * @param queueImages Queue of {@link MapillaryAbstractImage} objects for the {@link MapillaryExportWriterThread}. 42 */ 43 public MapillaryExportDownloadThread(MapillaryImage image, ArrayBlockingQueue<BufferedImage> queue, 38 44 ArrayBlockingQueue<MapillaryAbstractImage> queueImages) { 39 url = "https://d1cuyjsrcm0gby.cloudfront.net/" + image.getKey() 40 + "/thumb-2048.jpg"; 45 url = "https://d1cuyjsrcm0gby.cloudfront.net/" + image.getKey() + "/thumb-2048.jpg"; 41 46 this.queue = queue; 42 47 this.image = image; … … 46 51 @Override 47 52 public void run() { 48 new MapillaryCache(image.getKey(), MapillaryCache.Type.FULL_IMAGE).submit( 49 this, false); 53 new MapillaryCache(image.getKey(), MapillaryCache.Type.FULL_IMAGE).submit(this, false); 50 54 } 51 55 52 56 @Override 53 public void loadingFinished(CacheEntry data, CacheEntryAttributes attributes, 54 LoadResult result) { 57 public void loadingFinished(CacheEntry data, CacheEntryAttributes attributes, LoadResult result) { 55 58 try { 56 59 queue.put(ImageIO.read(new ByteArrayInputStream(data.getContent()))); 57 60 queueImages.put(image); 58 59 61 } catch (InterruptedException e) { 60 62 Main.error(e); -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillaryExportManager.java
r31352 r31387 20 20 21 21 /** 22 * Export main thread. Exportation works by creating a 23 * {@link MapillaryExportWriterThread} and several 22 * Export main thread. Exportation works by creating a {@link MapillaryExportWriterThread} and several 24 23 * {@link MapillaryExportDownloadThread}. The second ones download every single 25 * image that is going to be exported and stores them in an 26 * {@link ArrayBlockingQueue}. Then it is picked by the firstone and written on24 * image that is going to be exported and stores them in an {@link ArrayBlockingQueue}. Then it is picked by the first 25 * one and written on 27 26 * the selected folder. Each image will be named by its key. 28 27 * … … 42 41 private ThreadPoolExecutor ex; 43 42 43 /** 44 * Main constructor. 45 * 46 * @param images Set of {@link MapillaryAbstractImage} objects to be exported. 47 * @param path Export path. 48 */ 44 49 public MapillaryExportManager(List<MapillaryAbstractImage> images, String path) { 45 super(tr("Downloading") + "...", new PleaseWaitProgressMonitor( 46 "Exporting Mapillary Images"), true); 50 super(tr("Downloading") + "...", new PleaseWaitProgressMonitor("Exporting Mapillary Images"), true); 47 51 queue = new ArrayBlockingQueue<>(10); 48 52 queueImages = new ArrayBlockingQueue<>(10); … … 59 63 * @throws IOException 60 64 */ 61 public MapillaryExportManager(List<MapillaryImportedImage> images) 62 throws IOException { 63 super(tr("Downloading") + "...", new PleaseWaitProgressMonitor( 64 "Exporting Mapillary Images"), true); 65 public MapillaryExportManager(List<MapillaryImportedImage> images) throws IOException { 66 super(tr("Downloading") + "...", new PleaseWaitProgressMonitor("Exporting Mapillary Images"), true); 65 67 queue = new ArrayBlockingQueue<>(10); 66 68 queueImages = new ArrayBlockingQueue<>(10); … … 79 81 80 82 @Override 81 protected void realRun() throws SAXException, IOException, 82 OsmTransferException { 83 protected void realRun() throws SAXException, IOException, OsmTransferException { 83 84 // Starts a writer thread in order to write the pictures on the disk. 84 writer = new MapillaryExportWriterThread(path, queue, queueImages, amount, 85 this.getProgressMonitor()); 85 writer = new MapillaryExportWriterThread(path, queue, queueImages, amount, this.getProgressMonitor()); 86 86 writer.start(); 87 87 if (path == null) { … … 93 93 return; 94 94 } 95 ex = new ThreadPoolExecutor(20, 35, 25, TimeUnit.SECONDS, 96 new ArrayBlockingQueue<Runnable>(10)); 95 ex = new ThreadPoolExecutor(20, 35, 25, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(10)); 97 96 for (MapillaryAbstractImage image : images) { 98 97 if (image instanceof MapillaryImage) { 99 98 try { 100 ex.execute(new MapillaryExportDownloadThread((MapillaryImage) image, 101 queue, queueImages)); 99 ex.execute(new MapillaryExportDownloadThread((MapillaryImage) image, queue, queueImages)); 102 100 } catch (Exception e) { 103 101 Main.error(e); -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillaryExportWriterThread.java
r31380 r31387 44 44 private final ProgressMonitor monitor; 45 45 46 /** 47 * Main constructor. 48 * 49 * @param path Path to write the pictures. 50 * @param queue Queue of {@link MapillaryAbstractImage} objects. 51 * @param queueImages Queue of {@link BufferedImage} objects. 52 * @param amount Amount of images that are going to be exported. 53 * @param monitor Progress monitor. 54 */ 46 55 public MapillaryExportWriterThread(String path, 47 56 ArrayBlockingQueue<BufferedImage> queue, … … 66 75 img = queue.take(); 67 76 mimg = queueImages.take(); 77 if (img == null || mimg == null) 78 throw new IllegalStateException("Null image"); 68 79 if (path == null && mimg instanceof MapillaryImportedImage) { 69 80 String path = ((MapillaryImportedImage) mimg).getFile().getPath(); -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillaryImageInfoDownloaderThread.java
r31381 r31387 29 29 private final MapillaryLayer layer; 30 30 31 /** 32 * Main constructor. 33 * 34 * @param ex {@link ExecutorService} object that is executing this thread. 35 * @param url 36 */ 31 37 public MapillaryImageInfoDownloaderThread(ExecutorService ex, String queryString, MapillaryLayer layer) { 32 38 this.ex = ex; -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillarySignDownloaderThread.java
r31381 r31387 23 23 private final MapillaryLayer layer; 24 24 25 /** 26 * Main constructor. 27 * 28 * @param ex {@link ExecutorService} object that is executing this thread. 29 * @param url 30 */ 25 31 public MapillarySignDownloaderThread(ExecutorService ex, String queryString, MapillaryLayer layer) { 26 32 this.ex = ex; -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillarySquareDownloadManagerThread.java
r31381 r31387 33 33 public boolean imagesAdded = false; 34 34 35 /** 36 * Main constructor. 37 * 38 * @param urlImages URL used to download the images. 39 * @param urlSequences URL used to download the sequences. 40 * @param urlSigns URL used to download the signs. 41 */ 35 42 public MapillarySquareDownloadManagerThread(ConcurrentHashMap<String, Double> queryStringParts, MapillaryLayer layer) { 36 43 this.imageQueryString = buildQueryString(queryStringParts); -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/HyperlinkLabel.java
r31386 r31387 27 27 public class HyperlinkLabel extends JLabel implements ActionListener { 28 28 29 private static final long serialVersionUID = -8965989079294159405L; 29 30 private String text; 30 31 private URL url; … … 46 47 @Override 47 48 public void setText(String text) { 48 super 49 .setText("<html><font color=\"#0000CF\" size=\"2\">" + text + "</font></html>"); //$NON-NLS-1$ //$NON-NLS-2$ 49 super.setText("<html><font color=\"#0000CF\" size=\"2\">" + text + "</font></html>"); //$NON-NLS-1$ //$NON-NLS-2$ 50 50 this.text = text; 51 51 } … … 70 70 /** 71 71 * Returns the text set by the user. 72 * 73 * @return The plain-text written in the label. 72 74 */ 73 75 public String getNormalText() { … … 82 84 super.processMouseEvent(evt); 83 85 if (evt.getID() == MouseEvent.MOUSE_CLICKED) 84 fireActionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, 85 getNormalText())); 86 fireActionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, getNormalText())); 86 87 } 87 88 … … 89 90 * Adds an ActionListener to the list of listeners receiving notifications 90 91 * when the label is clicked. 92 * 93 * @param listener 91 94 */ 92 95 public void addActionListener(ActionListener listener) { … … 97 100 * Removes the given ActionListener from the list of listeners receiving 98 101 * notifications when the label is clicked. 102 * 103 * @param listener 99 104 */ 100 105 public void removeActionListener(ActionListener listener) { -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryExportDialog.java
r31380 r31387 30 30 public class MapillaryExportDialog extends JPanel implements ActionListener { 31 31 32 private static final long serialVersionUID = 8675637080225099248L; 32 33 protected JOptionPane optionPane; 33 34 /** Button to export all downloaded images. */ 34 35 public JRadioButton all; 35 /** 36 * Button to export all images in the sequence of the selected MapillaryImage. 37 */ 36 /** Button to export all images in the sequence of the selected MapillaryImage. */ 38 37 public JRadioButton sequence; 39 /** 40 * Button to export all images belonging to the selected MapillaryImage 41 * objects. 42 */ 38 /** Button to export all images belonging to the selected {@link MapillaryImage} objects. */ 43 39 public JRadioButton selected; 40 /** Button to rewrite all imported images */ 44 41 public JRadioButton rewrite; 45 42 public ButtonGroup group; 46 pr otectedJButton choose;47 pr otectedJLabel path;43 private JButton choose; 44 private JLabel path; 48 45 public JFileChooser chooser; 49 46 protected String exportDirectory; … … 125 122 public class RewriteButtonAction extends AbstractAction { 126 123 124 private static final long serialVersionUID = -9103251296651015563L; 127 125 private String lastPath; 128 126 private MapillaryExportDialog dlg;
Note:
See TracChangeset
for help on using the changeset viewer.