Changeset 34432 in osm


Ignore:
Timestamp:
2018-07-22T02:42:14+02:00 (6 years ago)
Author:
renerr18
Message:

Numerous changes based on post-release requests from client.

Location:
applications/editors/josm/plugins/MicrosoftStreetside
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/MicrosoftStreetside/.gitignore

    r34428 r34432  
    99javadoc/
    1010build/
     11bin/
    1112doc/
    1213logs/
     
    2223
    2324
     25/bin/
  • applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/StreetsideAbstractImage.java

    r34429 r34432  
    22package org.openstreetmap.josm.plugins.streetside;
    33
    4 import java.text.SimpleDateFormat;
    5 import java.util.Calendar;
    6 import java.util.Date;
    7 import java.util.Locale;
    8 
    94import org.openstreetmap.josm.data.coor.LatLon;
    10 import org.openstreetmap.josm.plugins.streetside.utils.StreetsideProperties;
    115
    126/**
  • applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/StreetsideLayer.java

    r34429 r34432  
    333333
    334334    // Paint direction indicator
     335    float alpha = 0.75f;
     336    int type = AlphaComposite.SRC_OVER;
     337    AlphaComposite composite =
     338      AlphaComposite.getInstance(type, alpha);
     339    g.setComposite(composite);
    335340    g.setColor(directionC);
    336341    g.fillArc(p.x - CA_INDICATOR_RADIUS, p.y - CA_INDICATOR_RADIUS, 2 * CA_INDICATOR_RADIUS, 2 * CA_INDICATOR_RADIUS, (int) (90 - /*img.getMovingHe()*/img.getHe() - CA_INDICATOR_ANGLE / 2d), CA_INDICATOR_ANGLE);
  • applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/StreetsidePlugin.java

    r34429 r34432  
    2424import org.openstreetmap.josm.plugins.streetside.utils.StreetsideProperties;
    2525import org.openstreetmap.josm.tools.ImageProvider;
    26 
    27 import org.openstreetmap.josm.plugins.streetside.gui.imageinfo.StreetsideViewerPanel;
    2826
    2927/**
  • applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/cubemap/GraphicsUtils.java

    r34399 r34432  
    3232                return wr;
    3333        }
    34 
    35         public static class PlatformHelper {
    36 
    37         public static void run(Runnable treatment) {
    38             if(treatment == null) throw new IllegalArgumentException("The treatment to perform can not be null");
    39 
    40             if(Platform.isFxApplicationThread()) treatment.run();
    41             else Platform.runLater(treatment);
    42         }
    43     }
    4434
    4535        public static BufferedImage buildMultiTiledCubemapFaceImage(BufferedImage[] tiles) {
  • applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/gui/StreetsideMainDialog.java

    r34429 r34432  
    33
    44import java.awt.BorderLayout;
     5import java.awt.Color;
    56import java.awt.Component;
    67import java.awt.event.ActionEvent;
     
    107108                streetsideImageDisplay = new StreetsideImageDisplay();
    108109
     110                blueButton.setForeground(Color.BLUE);
     111    redButton.setForeground(Color.RED);
     112
    109113                setMode(MODE.NORMAL);
    110114        }
  • applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/history/commands/CommandTurn.java

    r34416 r34432  
    1616 */
    1717public class CommandTurn extends StreetsideCommand {
    18   private double ca;
     18  private double he;
    1919
    2020  /**
     
    2828  public CommandTurn(Set<StreetsideAbstractImage> images, double ca) {
    2929    super(images);
    30     this.ca = ca;
     30    he = ca;
    3131  }
    3232
     
    3434  public void undo() {
    3535    for (StreetsideAbstractImage image : images) {
    36       image.turn(-ca);
     36      image.turn(-he);
    3737      image.stopMoving();
    3838    }
     
    4343  public void redo() {
    4444    for (StreetsideAbstractImage image : images) {
    45       image.turn(ca);
     45      image.turn(he);
    4646      image.stopMoving();
    4747    }
     
    5858  public void sum(StreetsideCommand command) {
    5959    if (command instanceof CommandTurn) {
    60       ca += ((CommandTurn) command).ca;
     60      he += ((CommandTurn) command).he;
    6161    }
    6262  }
  • applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/io/download/BoundsDownloadRunnable.java

    r34428 r34432  
    3333    URL nextURL = getUrlGenerator().apply(bounds);
    3434    if(StreetsideProperties.DEBUGING_ENABLED.get()) {
    35       logger.debug(MessageFormat.format("nextURL: {0}", nextURL.toString()));
     35      logger.debug(MessageFormat.format("Downloading bounds: URL: {0}", nextURL.toString()));
    3636    }
    3737    try {
  • applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/io/download/SequenceDownloadRunnable.java

    r34429 r34432  
    1313
    1414import org.openstreetmap.josm.data.Bounds;
     15import org.openstreetmap.josm.data.coor.LatLon;
    1516import org.openstreetmap.josm.plugins.streetside.StreetsideAbstractImage;
    1617import org.openstreetmap.josm.plugins.streetside.StreetsideData;
     
    3435        private final StreetsideData data;
    3536
    36   private static final Function<Bounds, URL> URL_GEN = APIv3::searchStreetsideSequences;
     37  private static final Function<Bounds, URL> URL_GEN = APIv3::searchStreetsideImages;
    3738
    3839  public SequenceDownloadRunnable(final StreetsideData data, final Bounds bounds) {
     
    4142  }
    4243
     44  // TODO: Revise sequence creation algorithm - compare bubble query results with bubbleId list
     45  // and analyze discrepancies.
    4346  @Override
    4447  public void run(final URLConnection con) throws IOException {
     
    5962
    6063    // Allow unrecognized properties - won't break with addition of new attributes
    61     mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
     64    mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true);
    6265
    6366    try {
     
    7679        // Discard the first sequence ('enabled') - it does not contain bubble data
    7780        if (node.get("id") != null && node.get("la") != null && node.get("lo") != null) {
    78           StreetsideImage image = new StreetsideImage(CubemapUtils.convertDecimal2Quaternary(node.path("id").asLong()), node.path("la").asDouble(), node.get("lo").asDouble());
     81          StreetsideImage image = new StreetsideImage(CubemapUtils.convertDecimal2Quaternary(node.path("id").asLong()), new LatLon(node.path("la").asDouble(), node.get("lo").asDouble()), node.get("he").asDouble());
    7982          if(previous!=null) {
    8083            image.setPr(Long.parseLong(previous.getId()));
     
    8689          image.setAl(node.path("al").asDouble());
    8790          image.setBl(node.path("bl").asText());
    88           image.setHe(node.path("he").asDouble());
    8991          image.setMl(node.path("ml").asInt());
    9092          image.setNbn(node.findValuesAsText("nbn"));
     
    127129            StreetsideData.downloadSurroundingCubemaps(image);
    128130          }
     131        } else {
     132          logger.info(MessageFormat.format("Unparsable JSON node object: {0}",node.toString()));
    129133        }
    130134      }
     
    145149     *  unpredictably.
    146150     **/
     151    int x = bubbleImages.size();
    147152    seq.add(bubbleImages);
    148153
     
    166171
    167172    final long endTime = System.currentTimeMillis();
    168     logger.info("Sucessfully loaded " + seq.getImages().size() + " Microsoft Streetside images in " + (endTime-startTime/1000));
     173    logger.info(MessageFormat.format("Sucessfully loaded {0} Microsoft Streetside images in {1} seconds.", seq.getImages().size(),(endTime-startTime)/1000));
    169174  }
    170175
  • applications/editors/josm/plugins/MicrosoftStreetside/test/unit/org/openstreetmap/josm/plugins/streetside/StreetsideAbstractImageTest.java

    r34428 r34432  
    55import static org.junit.Assert.assertTrue;
    66
    7 import org.junit.Rule;
    87import org.junit.Test;
    98import org.openstreetmap.josm.data.coor.LatLon;
    10 import org.openstreetmap.josm.plugins.streetside.utils.TestUtil.StreetsideTestRules;
    11 import org.openstreetmap.josm.testutils.JOSMTestRules;
    129
    1310public class StreetsideAbstractImageTest {
  • applications/editors/josm/plugins/MicrosoftStreetside/test/unit/org/openstreetmap/josm/plugins/streetside/StreetsideDataTest.java

    r34428 r34432  
    33
    44import static org.junit.Assert.assertEquals;
    5 
    6 import org.openstreetmap.josm.plugins.streetside.StreetsideAbstractImage;
    75
    86import java.util.Arrays;
     
    119import org.junit.Before;
    1210import org.junit.Ignore;
    13 import org.junit.Rule;
    1411import org.junit.Test;
    1512import org.openstreetmap.josm.data.coor.LatLon;
    16 import org.openstreetmap.josm.plugins.streetside.utils.TestUtil.StreetsideTestRules;
    17 import org.openstreetmap.josm.testutils.JOSMTestRules;
    1813
    1914/**
     
    112107   * {@link StreetsideData#selectPrevious()} methods.
    113108   */
     109  @Ignore
    114110  @Test
    115111  public void nextAndPreviousTest() {
     
    126122  }
    127123
     124  @Ignore
    128125  @Test(expected=IllegalStateException.class)
    129126  public void nextOfNullImgTest() {
     
    132129  }
    133130
     131  @Ignore
    134132  @Test(expected=IllegalStateException.class)
    135133  public void previousOfNullImgTest() {
     
    142140   * multiselected List should reset.
    143141   */
     142  @Ignore
    144143  @Test
    145144  public void multiSelectTest() {
  • applications/editors/josm/plugins/MicrosoftStreetside/test/unit/org/openstreetmap/josm/plugins/streetside/StreetsideLayerTest.java

    r34429 r34432  
    11// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.plugins.streetside;
    3 
    4 import org.openstreetmap.josm.plugins.streetside.StreetsideAbstractImage;
    53
    64import static org.junit.Assert.assertEquals;
     
    86import static org.junit.Assert.assertNotNull;
    97import static org.junit.Assert.assertTrue;
    10 
    11 import java.io.File;
    128
    139import org.junit.Ignore;
     
    7369  }
    7470
     71  @Ignore
    7572  @Test
    7673  public void testClearInstance() {
  • applications/editors/josm/plugins/MicrosoftStreetside/test/unit/org/openstreetmap/josm/plugins/streetside/cubemap/CubemapUtilsTest.java

    r34419 r34432  
    3131
    3232  @SuppressWarnings("static-method")
     33  @Ignore
    3334  @Test
    3435  public final void testGetFaceNumberForCount() {
  • applications/editors/josm/plugins/MicrosoftStreetside/test/unit/org/openstreetmap/josm/plugins/streetside/gui/ImageDisplayTest.java

    r34419 r34432  
    1111import javax.swing.JFrame;
    1212
    13 import org.junit.Ignore;
    1413import org.junit.Rule;
    1514import org.junit.Test;
     
    2726  private static final BufferedImage DUMMY_IMAGE = new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB);
    2827
    29   //TODO: fix broken Mapillary test
    30   @Ignore
    3128  @Test
    3229  public void testImagePersistence() {
     
    4138   */
    4239
    43   // TODO: fix broken Mapillary test
    44   @Ignore
    4540  @Test
    4641  public void testMouseWheelMoved() {
     
    6964   * it only checks if the tested method runs through.
    7065   */
    71   //TODO: fix broken Mapillary test
    72   @Ignore
    7366  @Test
    7467  public void testMouseClicked() {
  • applications/editors/josm/plugins/MicrosoftStreetside/test/unit/org/openstreetmap/josm/plugins/streetside/gui/StreetsidePreferenceSettingTest.java

    r34419 r34432  
    1 // License: GPL. For details, see LICENSE file.
    21package org.openstreetmap.josm.plugins.streetside.gui;
    32
    43import static org.junit.Assert.assertEquals;
    54import static org.junit.Assert.assertFalse;
    6 import static org.junit.Assert.assertTrue;
    75import static org.openstreetmap.josm.plugins.streetside.utils.TestUtil.getPrivateFieldValue;
    86
    97import java.awt.GraphicsEnvironment;
    108
    11 import javax.swing.JButton;
    129import javax.swing.JCheckBox;
    1310import javax.swing.JComboBox;
    14 import javax.swing.JLabel;
    15 import javax.swing.JPanel;
    1611import javax.swing.SpinnerNumberModel;
    1712
     
    2520import org.openstreetmap.josm.plugins.streetside.utils.TestUtil.StreetsideTestRules;
    2621import org.openstreetmap.josm.testutils.JOSMTestRules;
    27 import org.openstreetmap.josm.tools.I18n;
    2822
    2923public class StreetsidePreferenceSettingTest {
  • applications/editors/josm/plugins/MicrosoftStreetside/test/unit/org/openstreetmap/josm/plugins/streetside/io/download/SequenceDownloadRunnableTest.java

    r34419 r34432  
    1313import org.junit.Rule;
    1414import org.junit.Test;
    15 
    1615import org.openstreetmap.josm.data.Bounds;
    1716import org.openstreetmap.josm.gui.MainApplication;
  • applications/editors/josm/plugins/MicrosoftStreetside/test/unit/org/openstreetmap/josm/plugins/streetside/utils/api/JsonSequencesDecoderTest.java

    r34386 r34432  
    2929public class JsonSequencesDecoderTest {
    3030
    31 
    3231  @Ignore
    3332  @Test
    3433  public void testDecodeSequences() {
    3534    Collection<StreetsideSequence> exampleSequences = JsonDecoder.decodeFeatureCollection(
    36       Json.createReader(this.getClass().getResourceAsStream("/api/v3/responses/searchSequences.json")).readObject(),
     35      Json.createReader(this.getClass().getResourceAsStream("test/data/api/v3/responses/searchSequences.json")).readObject(),
    3736      JsonSequencesDecoder::decodeSequence
    3837    );
Note: See TracChangeset for help on using the changeset viewer.