Changeset 31454 in osm


Ignore:
Timestamp:
2015-08-05T11:46:28+02:00 (9 years ago)
Author:
nokutu
Message:
  • Right click on "View in website" label allows the user to copy the key of the selected image to clipboard.
  • New test for upload.
Location:
applications/editors/josm/plugins/mapillary
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillaryDownloader.java

    r31451 r31454  
    157157  private static boolean isAreaTooBig() {
    158158    double area = 0;
    159     System.out.println(Main.map.mapView.getLayersOfType(OsmDataLayer.class));
    160159    for (Bounds bounds : Main.map.mapView.getEditLayer().data
    161160        .getDataSourceBounds()) {
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/HyperlinkLabel.java

    r31445 r31454  
    55import java.awt.AWTEvent;
    66import java.awt.Cursor;
     7import java.awt.Toolkit;
     8import java.awt.datatransfer.Clipboard;
     9import java.awt.datatransfer.StringSelection;
    710import java.awt.event.ActionEvent;
    811import java.awt.event.ActionListener;
     
    1417
    1518import javax.swing.JLabel;
     19import javax.swing.JMenuItem;
     20import javax.swing.JPopupMenu;
    1621import javax.swing.SwingConstants;
    1722
    1823import org.openstreetmap.josm.Main;
     24import org.openstreetmap.josm.plugins.mapillary.MapillaryImage;
    1925
    2026import java.awt.Desktop;
     
    8490   */
    8591  @Override
    86   protected void processMouseEvent(MouseEvent evt) {
    87     super.processMouseEvent(evt);
    88     if (evt.getID() == MouseEvent.MOUSE_CLICKED)
    89       fireActionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED,
    90           getNormalText()));
     92  protected void processMouseEvent(MouseEvent e) {
     93    super.processMouseEvent(e);
     94    if (e.getID() == MouseEvent.MOUSE_CLICKED) {
     95      if (e.getButton() == MouseEvent.BUTTON1)
     96        fireActionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED,
     97            getNormalText()));
     98      if (e.getButton() == MouseEvent.BUTTON3) {
     99        LinkPopUp menu = new LinkPopUp();
     100        menu.show(e.getComponent(), e.getX(), e.getY());
     101      }
     102    }
     103  }
     104
     105  /**
     106   * PopUp shown when right click on the label.
     107   *
     108   * @author nokutu
     109   *
     110   */
     111  private class LinkPopUp extends JPopupMenu {
     112
     113    private static final long serialVersionUID = 1384054752970921552L;
     114
     115    JMenuItem copy;
     116
     117    public LinkPopUp() {
     118      this.copy = new JMenuItem("Copy key");
     119      this.copy.addActionListener(new copyAction());
     120      add(this.copy);
     121    }
     122
     123    private class copyAction implements ActionListener {
     124
     125      @Override
     126      public void actionPerformed(ActionEvent arg0) {
     127        StringSelection stringSelection = new StringSelection(
     128            ((MapillaryImage) MapillaryMainDialog.getInstance().getImage())
     129                .getKey());
     130        Clipboard clpbrd = Toolkit.getDefaultToolkit().getSystemClipboard();
     131        clpbrd.setContents(stringSelection, null);
     132      }
     133
     134    }
    91135  }
    92136
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryMainDialog.java

    r31452 r31454  
    510510      });
    511511    } else if (data != null && result == LoadResult.SUCCESS) {
    512       System.out.println(attributes.getMetadata());
    513512      try {
    514513        BufferedImage img = ImageIO.read(new ByteArrayInputStream(data
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/oauth/OAuthUtils.java

    r31449 r31454  
    167167    HttpResponse response = httpClient.execute(httpPost);
    168168    if (response.getStatusLine().toString().contains("204")) {
    169       System.out.println("Succesfully uploaded image");
    170169      PluginState.imageUploaded();
    171170    }
     
    234233  }
    235234
    236   private static File updateFile(MapillaryImportedImage image)
     235  /**
     236   * Returns a file containing the picture and an updated version of the EXIF
     237   * tags.
     238   *
     239   * @param image
     240   * @return A File object containing the picture and an updated version of the
     241   *         EXIF tags.
     242   * @throws ImageReadException
     243   * @throws IOException
     244   * @throws ImageWriteException
     245   */
     246  public static File updateFile(MapillaryImportedImage image)
    237247      throws ImageReadException, IOException, ImageWriteException {
    238248    TiffOutputSet outputSet = null;
  • applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/MapillarySequenceDownloadThreadTest.java

    r31453 r31454  
    1010import java.util.concurrent.Executors;
    1111
    12 import org.junit.Before;
    1312import org.junit.Test;
    1413import org.openstreetmap.josm.data.Bounds;
     
    1615import org.openstreetmap.josm.plugins.mapillary.downloads.MapillaryDownloader;
    1716import org.openstreetmap.josm.plugins.mapillary.downloads.MapillarySequenceDownloadThread;
    18 import org.openstreetmap.josm.plugins.mapillary.util.TestUtil;
    1917
    2018/**
Note: See TracChangeset for help on using the changeset viewer.