Changeset 32067 in osm


Ignore:
Timestamp:
2016-02-13T19:35:29+01:00 (9 years ago)
Author:
floscher
Message:

[mapillary] Fix usage of traffico.ttf

Location:
applications/editors/josm/plugins/mapillary
Files:
4 edited

Legend:

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

    r32064 r32067  
    1111import org.openstreetmap.josm.Main;
    1212import org.openstreetmap.josm.data.Bounds;
    13 import org.openstreetmap.josm.data.coor.LatLon;
    1413import org.openstreetmap.josm.plugins.mapillary.cache.CacheUtils;
    1514import org.openstreetmap.josm.plugins.mapillary.gui.MapillaryMainDialog;
    16 import org.openstreetmap.josm.plugins.mapillary.utils.MapillaryUtils;
    1715
    1816/**
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryImage.java

    r32064 r32067  
    66
    77import org.openstreetmap.josm.data.coor.LatLon;
    8 import org.openstreetmap.josm.plugins.mapillary.utils.MapillaryUtils;
    98import org.openstreetmap.josm.plugins.mapillary.utils.ValidationUtil;
    109
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryTrafficSignLayer.java

    r32066 r32067  
    99import java.awt.Point;
    1010import java.awt.RenderingHints;
    11 import java.io.File;
    1211import java.io.IOException;
    1312
     
    2625
    2726public final class MapillaryTrafficSignLayer extends AbstractModifiableLayer {
    28   private static final String TRAFFICO_PATH = "data/fonts/traffico/traffico.ttf";
     27  private static final String TRAFFICO_PATH = "/data/fonts/traffico/traffico.ttf";
    2928  private static MapillaryTrafficSignLayer instance;
    3029  private final Font traffico;
     
    3332    super("Mapillary traffic signs");
    3433    try {
    35       traffico = Font.createFont(Font.TRUETYPE_FONT, new File("data/fonts/traffico/traffico.ttf")).deriveFont(50.0f);
     34      traffico = Font.createFont(
     35          Font.TRUETYPE_FONT,
     36          MapillaryTrafficSignLayer.class.getResourceAsStream(TRAFFICO_PATH)
     37      ).deriveFont(50.0f);
    3638    } catch (FontFormatException e) {
    37       throw new IOException(I18n.tr("Traffic sign font at ''{0}'' has wrong format.", TRAFFICO_PATH), e);
     39      throw new IOException(I18n.tr("Traffic sign font at ''{0}'' has wrong format", TRAFFICO_PATH), e);
    3840    } catch (IOException e) {
    39       throw new IOException(I18n.tr("Could not read font-file from ''{0}''.", TRAFFICO_PATH), e);
     41      throw new IOException(I18n.tr("Could not read font-file from ''{0}''", TRAFFICO_PATH), e);
    4042    }
    4143  }
     
    4951   */
    5052  public static synchronized MapillaryTrafficSignLayer getInstance() throws IOException {
    51     if (instance == null)
     53    if (instance == null) {
    5254      instance = new MapillaryTrafficSignLayer();
     55    }
    5356    return instance;
    5457  }
     
    8184
    8285    TrafficoSign[] signs = {
    83         TrafficoSign.getSign("europe", "mandatory_cycle_track"),
    84         TrafficoSign.getSign("de", "information_bus_stop"),
    85         TrafficoSign.getSign("europe", "information_pedestrian_crossing") };
     86        TrafficoSign.getSign("de", "bicycles-only"),
     87        TrafficoSign.getSign("de", "bus-stop"),
     88        TrafficoSign.getSign("de", "pedestrian-crossing") };
    8689
    8790    for (int i = 0; i < signs.length && i < points.length; i++) {
  • applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/utils/TestUtil.java

    r31820 r32067  
    33import static org.junit.Assert.assertEquals;
    44import static org.junit.Assert.assertTrue;
     5import static org.junit.Assert.fail;
    56
    67import java.lang.reflect.Constructor;
     8import java.lang.reflect.InvocationTargetException;
    79import java.lang.reflect.Method;
    810import java.lang.reflect.Modifier;
     
    2022 * @author floscher
    2123 */
    22 public class TestUtil {
     24public final class TestUtil {
    2325  private static boolean isInitialized;
    2426
     
    3335   * That is needed e.g. to use {@link MapillaryLayer#getInstance()}
    3436   */
    35   public static final void initPlugin() {
     37  public static final synchronized void initPlugin() {
    3638    if (!isInitialized) {
    3739      System.setProperty("josm.home", "test/data/preferences");
     
    7375        assertTrue(m.getDeclaringClass() != c || Modifier.isStatic(m.getModifiers()));
    7476      }
    75     } catch (Exception e) {
    76       assertTrue(e.getMessage(), false);
     77    } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
     78      fail(e.getLocalizedMessage());
    7779    }
    7880  }
Note: See TracChangeset for help on using the changeset viewer.