Changeset 31985 in osm for applications/editors


Ignore:
Timestamp:
2016-01-13T17:26:34+01:00 (9 years ago)
Author:
floscher
Message:

[mapillary] Clean up some oversights from last two commits

Location:
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary
Files:
4 edited

Legend:

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

    r31983 r31985  
    1414import java.awt.Rectangle;
    1515import java.awt.RenderingHints;
    16 import java.awt.Shape;
    1716import java.awt.TexturePaint;
    1817import java.awt.event.ActionEvent;
     
    327326      if (imageAbs.isVisible()) {
    328327        final Point p = mv.getPoint(imageAbs.getLatLon());
     328        ImageIcon icon = MapillaryPlugin.MAP_ICON;
    329329        if (getData().getMultiSelectedImages().contains(imageAbs)) {
    330           draw(g, imageAbs, MapillaryPlugin.MAP_ICON_SELECTED, p);
    331         } else {
    332           draw(g, imageAbs, imageAbs instanceof MapillaryImage ? MapillaryPlugin.MAP_ICON : MapillaryPlugin.MAP_ICON_IMPORTED, p);
     330          icon = MapillaryPlugin.MAP_ICON_SELECTED;
     331        } else if (imageAbs instanceof MapillaryImportedImage) {
     332          icon = MapillaryPlugin.MAP_ICON_IMPORTED;
    333333        }
     334        draw(g, imageAbs, icon, p);
    334335        if (imageAbs instanceof MapillaryImage && !((MapillaryImage) imageAbs).getSigns().isEmpty()) {
    335336          g.drawImage(
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryImportIntoSequenceAction.java

    r31918 r31985  
    1515
    1616import javax.swing.JFileChooser;
    17 import javax.swing.filechooser.FileNameExtensionFilter;
    1817
    19 import org.apache.commons.imaging.ImageReadException;
    2018import org.openstreetmap.josm.Main;
    2119import org.openstreetmap.josm.actions.JosmAction;
    2220import org.openstreetmap.josm.plugins.mapillary.MapillaryAbstractImage;
    23 import org.openstreetmap.josm.plugins.mapillary.MapillaryLayer;
    2421import org.openstreetmap.josm.plugins.mapillary.MapillaryPlugin;
    2522import org.openstreetmap.josm.plugins.mapillary.MapillarySequence;
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/oauth/UploadUtils.java

    r31983 r31985  
    4040import org.apache.http.entity.mime.content.FileBody;
    4141import org.apache.http.entity.mime.content.StringBody;
     42import org.apache.http.impl.client.CloseableHttpClient;
    4243import org.apache.http.impl.client.HttpClientBuilder;
    4344import org.openstreetmap.josm.Main;
     
    246247  public static void uploadFile(File file, Map<String, String> hash) throws IOException {
    247248    HttpClientBuilder builder = HttpClientBuilder.create();
    248     HttpClient httpClient = builder.build();
    249249    HttpPost httpPost = new HttpPost(UPLOAD_URL);
    250250
    251     MultipartEntityBuilder entityBuilder = MultipartEntityBuilder.create();
    252     for (String key : keys) {
    253       if (hash.get(key) == null)
    254         throw new IllegalArgumentException();
    255       entityBuilder.addPart(key, new StringBody(hash.get(key),
    256               ContentType.TEXT_PLAIN));
    257     }
    258     entityBuilder.addPart("file", new FileBody(file));
    259     HttpEntity entity = entityBuilder.build();
    260     httpPost.setEntity(entity);
    261     HttpResponse response = httpClient.execute(httpPost);
    262     if (response.getStatusLine().toString().contains("204")) {
    263       PluginState.imageUploaded();
    264       Main.info(PluginState.getUploadString() + " (Mapillary)");
    265     } else
    266       Main.info("Upload error");
     251    try (CloseableHttpClient httpClient = builder.build()) {
     252      MultipartEntityBuilder entityBuilder = MultipartEntityBuilder.create();
     253      for (String key : keys) {
     254        if (hash.get(key) == null)
     255          throw new IllegalArgumentException();
     256        entityBuilder.addPart(key, new StringBody(hash.get(key),
     257                ContentType.TEXT_PLAIN));
     258      }
     259      entityBuilder.addPart("file", new FileBody(file));
     260      HttpEntity entity = entityBuilder.build();
     261      httpPost.setEntity(entity);
     262      HttpResponse response = httpClient.execute(httpPost);
     263
     264      if (response.getStatusLine().toString().contains("204")) {
     265        PluginState.imageUploaded();
     266        Main.info(PluginState.getUploadString() + " (Mapillary)");
     267      } else {
     268        Main.info("Upload error");
     269      }
     270    }
    267271    file.delete();
    268272    MapillaryUtils.updateHelpText();
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/utils/MapViewGeometryUtil.java

    r31983 r31985  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.mapillary.utils;
    23
     
    4344      a.subtract(new Area(r));
    4445    }
    45     Shape s = null;
    4646    return a;
    4747  }
Note: See TracChangeset for help on using the changeset viewer.