Changeset 31425 in osm for applications/editors/josm/plugins/mapillary
- Timestamp:
- 2015-07-31T18:23:44+02:00 (10 years ago)
- Location:
- applications/editors/josm/plugins/mapillary
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryPlugin.java
r31424 r31425 1 1 package org.openstreetmap.josm.plugins.mapillary; 2 2 3 import java.io.File;4 3 import java.io.IOException; 5 4 … … 32 31 public class MapillaryPlugin extends Plugin { 33 32 34 /** Plugin's directory */35 public static String directory;36 33 /** OS route separator */ 37 34 public static final String SEPARATOR = System.getProperty("file.separator"); … … 88 85 super(info); 89 86 90 91 directory = new File("").getAbsolutePath() + SEPARATOR; 92 ICON24 = new ImageProvider(directory + "images" + SEPARATOR + "icon24.png").get(); 93 ICON16 = new ImageProvider(directory + "images" + SEPARATOR + "icon16.png").get(); 94 MAP_ICON = new ImageProvider(directory + "images" + SEPARATOR + "mapicon.png").get(); 95 MAP_ICON_SELECTED = new ImageProvider(directory 96 + "images" + SEPARATOR + "mapiconselected.png").get(); 97 MAP_ICON_IMPORTED = new ImageProvider(directory 98 + "images/mapiconimported.png").get(); 99 MAP_SIGN = new ImageProvider(directory + "images" + SEPARATOR + "sign.png").get(); 87 ICON24 = new ImageProvider("icon24.png").get(); 88 ICON16 = new ImageProvider("icon16.png").get(); 89 MAP_ICON = new ImageProvider("mapicon.png").get(); 90 MAP_ICON_SELECTED = new ImageProvider("mapiconselected.png").get(); 91 MAP_ICON_IMPORTED = new ImageProvider("mapiconimported.png").get(); 92 MAP_SIGN = new ImageProvider("sign.png").get(); 100 93 101 94 downloadAction = new MapillaryDownloadAction(); … … 184 177 return new MapillaryPreferenceSetting(); 185 178 } 179 180 /** 181 * Returns a ImageProvider for the given string or null if in headless mode. 182 * 183 * @param s 184 * @return A ImageProvider object for the given string or null if in headless mode. 185 */ 186 public static ImageProvider getProvider(String s) { 187 if (Main.map == null) 188 return null; 189 else 190 return new ImageProvider(s); 191 } 186 192 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryDownloadAction.java
r31424 r31425 13 13 import org.openstreetmap.josm.plugins.mapillary.MapillaryLayer; 14 14 import org.openstreetmap.josm.plugins.mapillary.MapillaryPlugin; 15 import org.openstreetmap.josm.tools.ImageProvider;16 15 import org.openstreetmap.josm.tools.Shortcut; 17 16 … … 31 30 */ 32 31 public MapillaryDownloadAction() { 33 super(tr("Mapillary"), new ImageProvider(MapillaryPlugin.directory 34 + "images" + MapillaryPlugin.SEPARATOR + "icon24.png"), 32 super(tr("Mapillary"), MapillaryPlugin.getProvider("icon24.png"), 35 33 tr("Create Mapillary layer"), Shortcut.registerShortcut("Mapillary", 36 34 tr("Start Mapillary layer"), KeyEvent.VK_COMMA, Shortcut.SHIFT), -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryDownloadViewAction.java
r31424 r31425 7 7 8 8 import org.openstreetmap.josm.actions.JosmAction; 9 import org.openstreetmap.josm.plugins.mapillary.MapillaryPlugin;10 9 import org.openstreetmap.josm.plugins.mapillary.downloads.MapillaryDownloader; 11 10 import org.openstreetmap.josm.tools.ImageProvider; … … 27 26 public MapillaryDownloadViewAction() { 28 27 super(tr("Download Mapillary images in current view"), new ImageProvider( 29 MapillaryPlugin.directory + "images" + MapillaryPlugin.SEPARATOR +"icon24.png"), tr("Download Mapillary images in current view"),28 "icon24.png"), tr("Download Mapillary images in current view"), 30 29 Shortcut.registerShortcut("Mapillary area", 31 30 tr("Download Mapillary images in current view"), -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryExportAction.java
r31424 r31425 24 24 import org.openstreetmap.josm.plugins.mapillary.downloads.MapillaryExportManager; 25 25 import org.openstreetmap.josm.plugins.mapillary.gui.MapillaryExportDialog; 26 import org.openstreetmap.josm.tools.ImageProvider;27 26 import org.openstreetmap.josm.tools.Shortcut; 28 27 … … 43 42 */ 44 43 public MapillaryExportAction() { 45 super(tr("Export pictures"), new ImageProvider(MapillaryPlugin.directory 46 + "images" + MapillaryPlugin.SEPARATOR + "icon24.png"), 44 super(tr("Export pictures"), MapillaryPlugin.getProvider("icon24.png"), 47 45 tr("Export pictures"), Shortcut.registerShortcut("Export Mapillary", 48 46 tr("Export Mapillary pictures"), KeyEvent.CHAR_UNDEFINED, -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryImportAction.java
r31424 r31425 26 26 import org.openstreetmap.josm.plugins.mapillary.MapillaryLayer; 27 27 import org.openstreetmap.josm.plugins.mapillary.MapillaryPlugin; 28 import org.openstreetmap.josm.tools.ImageProvider;29 28 import org.openstreetmap.josm.tools.Shortcut; 30 29 … … 50 49 */ 51 50 public MapillaryImportAction() { 52 super(tr("Import pictures"), new ImageProvider(MapillaryPlugin.directory 53 + "images" + MapillaryPlugin.SEPARATOR + "icon24.png"), 51 super(tr("Import pictures"), MapillaryPlugin.getProvider("icon24.png"), 54 52 tr("Import local pictures"), Shortcut.registerShortcut( 55 53 "Import Mapillary", tr("Import pictures into Mapillary layer"), -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryImportIntoSequenceAction.java
r31424 r31425 30 30 import org.openstreetmap.josm.plugins.mapillary.MapillaryPlugin; 31 31 import org.openstreetmap.josm.plugins.mapillary.MapillarySequence; 32 import org.openstreetmap.josm.tools.ImageProvider;33 32 import org.openstreetmap.josm.tools.Shortcut; 34 33 … … 51 50 */ 52 51 public MapillaryImportIntoSequenceAction() { 53 super(tr("Import pictures into sequence"), new ImageProvider( 54 MapillaryPlugin.directory 55 + "images" + MapillaryPlugin.SEPARATOR + "icon24.png"), 52 super(tr("Import pictures into sequence"), MapillaryPlugin.getProvider("icon24.png"), 56 53 tr("Import local pictures"), Shortcut.registerShortcut( 57 54 "Import Mapillary Sequence", -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryJoinAction.java
r31424 r31425 11 11 import org.openstreetmap.josm.plugins.mapillary.mode.JoinMode; 12 12 import org.openstreetmap.josm.plugins.mapillary.mode.SelectMode; 13 import org.openstreetmap.josm.tools.ImageProvider;14 13 import org.openstreetmap.josm.tools.Shortcut; 15 14 … … 28 27 */ 29 28 public MapillaryJoinAction() { 30 super(tr("Join mode"), new ImageProvider(MapillaryPlugin.directory 31 + "images" + MapillaryPlugin.SEPARATOR + "icon24.png"), 29 super(tr("Join mode"), MapillaryPlugin.getProvider("icon24.png"), 32 30 tr("Join/unjoin pictures"), Shortcut.registerShortcut("Mapillary join", 33 31 tr("Join Mapillary pictures"), KeyEvent.CHAR_UNDEFINED, -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryWalkAction.java
r31424 r31425 18 18 import org.openstreetmap.josm.plugins.mapillary.gui.MapillaryMainDialog; 19 19 import org.openstreetmap.josm.plugins.mapillary.gui.MapillaryWalkDialog; 20 import org.openstreetmap.josm.tools.ImageProvider;21 20 import org.openstreetmap.josm.tools.Shortcut; 22 21 … … 39 38 */ 40 39 public MapillaryWalkAction() { 41 super(tr("Walk mode"), new ImageProvider(MapillaryPlugin.directory 42 + "images" + MapillaryPlugin.SEPARATOR + "icon24.png"), tr("Walk mode"), 40 super(tr("Walk mode"), MapillaryPlugin.getProvider("icon24.png"), tr("Walk mode"), 43 41 Shortcut.registerShortcut("Mapillary walk", tr("Start walk mode"), 44 42 KeyEvent.CHAR_UNDEFINED, Shortcut.NONE), false, "mapillaryWalk", -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryZoomAction.java
r31424 r31425 12 12 import org.openstreetmap.josm.plugins.mapillary.MapillaryDataListener; 13 13 import org.openstreetmap.josm.plugins.mapillary.MapillaryPlugin; 14 import org.openstreetmap.josm.tools.ImageProvider;15 14 import org.openstreetmap.josm.tools.Shortcut; 16 15 … … 30 29 */ 31 30 public MapillaryZoomAction() { 32 super(tr("Zoom to selected image"), new ImageProvider( 33 MapillaryPlugin.directory 34 + "images" + MapillaryPlugin.SEPARATOR + "icon24.png"), 31 super(tr("Zoom to selected image"), MapillaryPlugin.getProvider("icon24.png"), 35 32 tr("Zoom to selected image"), Shortcut.registerShortcut( 36 33 "Zoom Mapillary", -
applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/AbstractTest.java
r31418 r31425 19 19 @BeforeClass 20 20 public static void setUpBeforeClass() { 21 if (!started) { 22 TestUtil.initPlugin(); 23 started = true; 24 } 21 TestUtil.initPlugin(); 25 22 } 26 23 } -
applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/ImportTest.java
r31424 r31425 2 2 3 3 import static org.junit.Assert.*; 4 4 5 import org.junit.Test; 5 6 … … 27 28 @Test 28 29 public void importNoTagsTest() { 29 File image = new File( MapillaryPlugin.directory +"images/icon16.png");30 MapillaryImportedImage img = Mapillary Plugin.importAction.readNoTags(image,30 File image = new File("images/icon16.png"); 31 MapillaryImportedImage img = new MapillaryImportAction().readNoTags(image, 31 32 new LatLon(0, 0)); 32 33 assertEquals(0, img.getCa(), 0.01); -
applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/util/TestUtil.java
r31418 r31425 41 41 I18n.set(Main.pref.get("language", "en")); 42 42 Main.setProjection(Projections.getProjectionByCode("EPSG:3857")); // Mercator 43 try {44 new MapillaryPlugin(new PluginInformation(new File(45 "./build/libs/josm-mapillary-plugin.jar")));46 } catch (PluginException e) {47 e.printStackTrace();48 }49 43 isInitialized = true; 50 44 }
Note:
See TracChangeset
for help on using the changeset viewer.