Changeset 31387 in osm


Ignore:
Timestamp:
2015-07-16T13:56:12+02:00 (10 years ago)
Author:
nokutu
Message:

More comments

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  
    6363 *
    6464 */
    65 public class MapillaryLayer extends AbstractModifiableLayer implements
    66     DataSetListener, EditLayerChangeListener, LayerChangeListener {
     65public class MapillaryLayer extends AbstractModifiableLayer implements DataSetListener, EditLayerChangeListener,
     66    LayerChangeListener {
    6767
    6868  /** 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);
    7171
    7272  private boolean TEMP_MANUAL = false;
     
    130130   *
    131131   * @param mode
    132    *          The mode that is going to be activated.
     132   *        The mode that is going to be activated.
    133133   */
    134134  public void setMode(AbstractMode mode) {
     
    567567  @Override
    568568  public void primitivesAdded(PrimitivesAddedEvent event) {
     569    // Nothing
    569570  }
    570571
    571572  @Override
    572573  public void primitivesRemoved(PrimitivesRemovedEvent event) {
     574    // Nothing
    573575  }
    574576
    575577  @Override
    576578  public void tagsChanged(TagsChangedEvent event) {
     579    // Nothing
    577580  }
    578581
    579582  @Override
    580583  public void nodeMoved(NodeMovedEvent event) {
     584    // Nothing
    581585  }
    582586
    583587  @Override
    584588  public void wayNodesChanged(WayNodesChangedEvent event) {
     589    // Nothing
    585590  }
    586591
    587592  @Override
    588593  public void relationMembersChanged(RelationMembersChangedEvent event) {
     594    // Nothing
    589595  }
    590596
    591597  @Override
    592598  public void otherDatasetChange(AbstractDatasetChangedEvent event) {
     599    // Nothing
    593600  }
    594601
    595602  @Override
    596603  public void visitBoundingBox(BoundingXYVisitor v) {
     604    // Nothing
    597605  }
    598606
     
    608616  @Override
    609617  public void layerAdded(Layer newLayer) {
     618    // Nothing
    610619  }
    611620
    612621  @Override
    613622  public void layerRemoved(Layer oldLayer) {
     623    // Nothing
    614624  }
    615625
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillarySequence.java

    r31386 r31387  
    111111    if (i == images.size() - 1)
    112112      return null;
    113     else
    114       return images.get(i + 1);
     113    return images.get(i + 1);
    115114  }
    116115
     
    129128    if (i == 0)
    130129      return null;
    131     else
    132       return images.get(i - 1);
     130    return images.get(i - 1);
    133131  }
    134132
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryImportAction.java

    r31386 r31387  
    153153      if (datetimeOriginal != null)
    154154        MapillaryData.getInstance().add(
    155             new MapillaryImportedImage(latValue, lonValue, caValue, file,
    156                 datetimeOriginal.getStringValue()));
     155            new MapillaryImportedImage(latValue, lonValue, caValue, file, datetimeOriginal.getStringValue()));
    157156      else
    158157        MapillaryData.getInstance().add(
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryImportIntoSequenceAction.java

    r31386 r31387  
    189189      if (arg0.getCapturedAt() > arg1.getCapturedAt())
    190190        return 1;
    191       else
    192         return 0;
     191      return 0;
    193192    }
    194193  }
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryZoomAction.java

    r31386 r31387  
    5959  @Override
    6060  public void imagesAdded() {
     61    // Nothing
    6162  }
    6263}
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/cache/MapillaryCache.java

    r31386 r31387  
    1111
    1212/**
    13  * Sotres the
     13 * Stores the downloaded pictures locally.
    1414 *
    1515 * @author nokutu
     
    2828   */
    2929  public static enum Type {
    30     FULL_IMAGE, THUMBNAIL
     30    /** Full quality image */
     31    FULL_IMAGE,
     32   
     33    /** Low quality image */
     34    THUMBNAIL
    3135  }
    3236
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/commands/CommandMoveImage.java

    r31352 r31387  
    1919  private double y;
    2020
    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) {
    2329    this.images = new ArrayList<>(images);
    2430    this.x = x;
     
    4854  @Override
    4955  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());
    5257  }
    5358
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/commands/CommandTurnImage.java

    r31352 r31387  
    1818  private double ca;
    1919
     20  /**
     21   * Main constructor.
     22   *
     23   * @param images Set of images that is turned.
     24   * @param ca How much the images turn.
     25   */
    2026  public CommandTurnImage(List<MapillaryAbstractImage> images, double ca) {
    2127    this.images = new ArrayList<>(images);
     
    4551  @Override
    4652  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());
    4954  }
    5055
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/commands/MapillaryCommand.java

    r31350 r31387  
    1414  protected List<MapillaryAbstractImage> images;
    1515
     16  /**
     17   * Undoes the action.
     18   */
    1619  public abstract void undo();
    1720
     21  /**
     22   * Redoes the action.
     23   */
    1824  public abstract void redo();
    1925
     
    2733
    2834  /**
    29    * Checks if the image has been modified, compairing with its original values.
     35   * Checks if the image has been modified, comparing with its original values.
    3036   */
    3137  public void checkModified() {
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/commands/MapillaryRecord.java

    r31350 r31387  
    1212 */
    1313public class MapillaryRecord {
    14   public static MapillaryRecord INSTANCE;
     14  /** The unique instance of the class. */
     15  private static MapillaryRecord INSTANCE;
    1516
    1617  private ArrayList<MapillaryRecordListener> listeners;
    1718
     19  /** The set of commands that have taken place or that have been undone. */
    1820  public ArrayList<MapillaryCommand> commandList;
    19   /** Last written command */
     21  /** Last written command. */
    2022  public int position;
    2123
     24  /**
     25   * Main constructor.
     26   */
    2227  public MapillaryRecord() {
    2328    commandList = new ArrayList<>();
     
    2631  }
    2732
     33  /**
     34   * Returns the unique instance of the class.
     35   *
     36   * @return The unique instance of the class.
     37   */
    2838  public static synchronized MapillaryRecord getInstance() {
    2939    if (MapillaryRecord.INSTANCE == null)
     
    3242  }
    3343
     44  /**
     45   * Adds a listener.
     46   *
     47   * @param lis
     48   */
    3449  public void addListener(MapillaryRecordListener lis) {
    3550    this.listeners.add(lis);
    3651  }
    3752
     53  /**
     54   * Removes the given listener.
     55   *
     56   * @param lis
     57   */
    3858  public void removeListener(MapillaryRecordListener lis) {
    3959    this.listeners.remove(lis);
     
    5272        if (!command.images.contains(img))
    5373          equalSets = false;
    54       if (equalSets
    55           && commandList.get(position).getClass() == command.getClass()) {
     74      if (equalSets && commandList.get(position).getClass() == command.getClass()) {
    5675        commandList.get(position).sum(command);
    5776        fireRecordChanged();
     
    5978      }
    6079    }
    61     // Adds the command to the las position of the list.
     80    // Adds the command to the last position of the list.
    6281    commandList.add(position + 1, command);
    6382    position++;
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/commands/MapillaryRecordListener.java

    r31350 r31387  
    11package org.openstreetmap.josm.plugins.mapillary.commands;
    22
     3/**
     4 * Interface for the listener of the {@link MapillaryRecord} class
     5 *
     6 * @author nokutu
     7 * @see MapillaryRecord
     8 */
    39public interface MapillaryRecordListener {
     10  /**
     11   * Fired when any command is undone or redone.
     12   */
    413  public void recordChanged();
    514}
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillaryDownloader.java

    r31381 r31387  
    1919public class MapillaryDownloader {
    2020
     21  /** Base URL of the Mapillary API. */
    2122  public final static String BASE_URL = "https://a.mapillary.com/v2/";
     23  /** Client ID for the app */
    2224  public final static String CLIENT_ID = "NzNRM2otQkR2SHJzaXJmNmdQWVQ0dzo1YTA2NmNlODhlNWMwOTBm";
     25  /** Executor that will run the petitions */
    2326  public final static Executor EXECUTOR = Executors.newSingleThreadExecutor();
    2427
    25   public MapillaryDownloader() {
    26   }
    2728
    2829  /**
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillaryExportDownloadThread.java

    r31350 r31387  
    2323 * @author nokutu
    2424 * @see MapillaryExportManager
     25 * @see MapillaryExportWriterThread
    2526 */
    26 public class MapillaryExportDownloadThread extends Thread implements
    27     ICachedLoaderListener {
     27public class MapillaryExportDownloadThread extends Thread implements ICachedLoaderListener {
    2828
    2929  String url;
     
    3434  MapillaryImage image;
    3535
    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,
    3844      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";
    4146    this.queue = queue;
    4247    this.image = image;
     
    4651  @Override
    4752  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);
    5054  }
    5155
    5256  @Override
    53   public void loadingFinished(CacheEntry data, CacheEntryAttributes attributes,
    54       LoadResult result) {
     57  public void loadingFinished(CacheEntry data, CacheEntryAttributes attributes, LoadResult result) {
    5558    try {
    5659      queue.put(ImageIO.read(new ByteArrayInputStream(data.getContent())));
    5760      queueImages.put(image);
    58 
    5961    } catch (InterruptedException e) {
    6062      Main.error(e);
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillaryExportManager.java

    r31352 r31387  
    2020
    2121/**
    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
    2423 * {@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 first one and written on
     24 * 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
    2726 * the selected folder. Each image will be named by its key.
    2827 *
     
    4241  private ThreadPoolExecutor ex;
    4342
     43  /**
     44   * Main constructor.
     45   *
     46   * @param images Set of {@link MapillaryAbstractImage} objects to be exported.
     47   * @param path Export path.
     48   */
    4449  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);
    4751    queue = new ArrayBlockingQueue<>(10);
    4852    queueImages = new ArrayBlockingQueue<>(10);
     
    5963   * @throws IOException
    6064   */
    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);
    6567    queue = new ArrayBlockingQueue<>(10);
    6668    queueImages = new ArrayBlockingQueue<>(10);
     
    7981
    8082  @Override
    81   protected void realRun() throws SAXException, IOException,
    82       OsmTransferException {
     83  protected void realRun() throws SAXException, IOException, OsmTransferException {
    8384    // 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());
    8686    writer.start();
    8787    if (path == null) {
     
    9393      return;
    9494    }
    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));
    9796    for (MapillaryAbstractImage image : images) {
    9897      if (image instanceof MapillaryImage) {
    9998        try {
    100           ex.execute(new MapillaryExportDownloadThread((MapillaryImage) image,
    101               queue, queueImages));
     99          ex.execute(new MapillaryExportDownloadThread((MapillaryImage) image, queue, queueImages));
    102100        } catch (Exception e) {
    103101          Main.error(e);
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillaryExportWriterThread.java

    r31380 r31387  
    4444  private final ProgressMonitor monitor;
    4545
     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   */
    4655  public MapillaryExportWriterThread(String path,
    4756      ArrayBlockingQueue<BufferedImage> queue,
     
    6675        img = queue.take();
    6776        mimg = queueImages.take();
     77        if (img == null || mimg == null)
     78          throw new IllegalStateException("Null image");
    6879        if (path == null && mimg instanceof MapillaryImportedImage) {
    6980          String path = ((MapillaryImportedImage) mimg).getFile().getPath();
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillaryImageInfoDownloaderThread.java

    r31381 r31387  
    2929  private final MapillaryLayer layer;
    3030
     31  /**
     32   * Main constructor.
     33   *
     34   * @param ex {@link ExecutorService} object that is executing this thread.
     35   * @param url
     36   */
    3137  public MapillaryImageInfoDownloaderThread(ExecutorService ex, String queryString, MapillaryLayer layer) {
    3238    this.ex = ex;
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillarySignDownloaderThread.java

    r31381 r31387  
    2323  private final MapillaryLayer layer;
    2424
     25  /**
     26   * Main constructor.
     27   *
     28   * @param ex {@link ExecutorService} object that is executing this thread.
     29   * @param url
     30   */
    2531  public MapillarySignDownloaderThread(ExecutorService ex, String queryString, MapillaryLayer layer) {
    2632    this.ex = ex;
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillarySquareDownloadManagerThread.java

    r31381 r31387  
    3333  public boolean imagesAdded = false;
    3434
     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   */
    3542  public MapillarySquareDownloadManagerThread(ConcurrentHashMap<String, Double> queryStringParts, MapillaryLayer layer) {
    3643    this.imageQueryString = buildQueryString(queryStringParts);
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/HyperlinkLabel.java

    r31386 r31387  
    2727public class HyperlinkLabel extends JLabel implements ActionListener {
    2828
     29  private static final long serialVersionUID = -8965989079294159405L;
    2930  private String text;
    3031  private URL url;
     
    4647  @Override
    4748  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$
    5050    this.text = text;
    5151  }
     
    7070  /**
    7171   * Returns the text set by the user.
     72   *
     73   * @return The plain-text written in the label.
    7274   */
    7375  public String getNormalText() {
     
    8284    super.processMouseEvent(evt);
    8385    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()));
    8687  }
    8788
     
    8990   * Adds an ActionListener to the list of listeners receiving notifications
    9091   * when the label is clicked.
     92   *
     93   * @param listener
    9194   */
    9295  public void addActionListener(ActionListener listener) {
     
    97100   * Removes the given ActionListener from the list of listeners receiving
    98101   * notifications when the label is clicked.
     102   *
     103   * @param listener
    99104   */
    100105  public void removeActionListener(ActionListener listener) {
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryExportDialog.java

    r31380 r31387  
    3030public class MapillaryExportDialog extends JPanel implements ActionListener {
    3131
     32  private static final long serialVersionUID = 8675637080225099248L;
    3233  protected JOptionPane optionPane;
    3334  /** Button to export all downloaded images. */
    3435  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. */
    3837  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. */
    4339  public JRadioButton selected;
     40  /** Button to rewrite all imported images */
    4441  public JRadioButton rewrite;
    4542  public ButtonGroup group;
    46   protected JButton choose;
    47   protected JLabel path;
     43  private JButton choose;
     44  private JLabel path;
    4845  public JFileChooser chooser;
    4946  protected String exportDirectory;
     
    125122  public class RewriteButtonAction extends AbstractAction {
    126123
     124    private static final long serialVersionUID = -9103251296651015563L;
    127125    private String lastPath;
    128126    private MapillaryExportDialog dlg;
Note: See TracChangeset for help on using the changeset viewer.