Changeset 31810 in osm for applications/editors
- Timestamp:
- 2015-12-10T23:24:30+01:00 (9 years ago)
- 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/MapillaryTrafficSignLayer.java
r31799 r31810 26 26 import org.openstreetmap.josm.tools.I18n; 27 27 28 public class MapillaryTrafficSignLayer extends AbstractModifiableLayer { 28 public final class MapillaryTrafficSignLayer extends AbstractModifiableLayer { 29 29 private static final String TRAFFICO_PATH = "data/fonts/traffico/traffico.ttf"; 30 30 private static MapillaryTrafficSignLayer instance; … … 49 49 * if the traffico font has the wrong format 50 50 */ 51 public static MapillaryTrafficSignLayer getInstance() throws IOException { 51 public static synchronized MapillaryTrafficSignLayer getInstance() throws IOException { 52 52 if (instance == null) 53 53 instance = new MapillaryTrafficSignLayer(); … … 89 89 for (TrafficoSignElement layer : signs[i]) { // TODO: NPE 90 90 g.setColor(layer.getColor()); 91 g.drawString( "" +layer.getGlyph(), points[i].x - 25, points[i].y + 25);91 g.drawString(Character.toString(layer.getGlyph()), points[i].x - 25, points[i].y + 25); 92 92 } 93 93 } … … 98 98 if (img instanceof MapillaryImage) { 99 99 g.fillOval(mv.getPoint(img.getLatLon()).x - 3, mv.getPoint(img.getLatLon()).y - 3, 6, 6); 100 if (((MapillaryImage) img).getSigns(). size() >= 1) {100 if (!((MapillaryImage) img).getSigns().isEmpty()) { 101 101 Point imgLoc = mv.getPoint(img.getLatLon()); 102 102 for (TrafficoSignElement e : TrafficoSign.getSign("de", ((MapillaryImage) img).getSigns().get(0))) { 103 103 g.setColor(e.getColor()); 104 g.drawString( "" +e.getGlyph(), imgLoc.x, imgLoc.y);104 g.drawString(Character.toString(e.getGlyph()), imgLoc.x, imgLoc.y); 105 105 } 106 106 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryPreferenceSetting.java
r31809 r31810 3 3 4 4 import java.awt.FlowLayout; 5 import java.awt.GridBagConstraints;6 5 import java.awt.GridBagLayout; 7 6 import java.awt.event.ActionEvent; … … 9 8 import java.net.URL; 10 9 11 import javax.json.Json;12 10 import javax.swing.AbstractAction; 13 11 import javax.swing.BorderFactory; … … 42 40 public class MapillaryPreferenceSetting implements SubPreferenceSetting, MapillaryLoginListener { 43 41 44 private JCheckBox reverseButtons = new JCheckBox(I18n.tr("Reverse buttons position when displaying images.")); 45 private JComboBox<String> downloadMode = new JComboBox<>(new String[]{ 42 private final JCheckBox reverseButtons = new JCheckBox(I18n.tr("Reverse buttons position when displaying images.")); 43 private final JComboBox<String> downloadMode = new JComboBox<>(new String[]{ 46 44 MapillaryDownloader.MODES.Automatic.toString(), 47 45 MapillaryDownloader.MODES.Semiautomatic.toString(), 48 46 MapillaryDownloader.MODES.Manual.toString() 49 47 }); 50 private JCheckBox displayHour = new JCheckBox(I18n.tr("Display hour when the picture was taken")); 51 private JCheckBox format24 = new JCheckBox(I18n.tr("Use 24 hour format")); 52 private JCheckBox moveTo = new JCheckBox(I18n.tr("Move to picture''s location with next/previous buttons")); 48 private final JCheckBox displayHour = new JCheckBox(I18n.tr("Display hour when the picture was taken")); 49 private final JCheckBox format24 = new JCheckBox(I18n.tr("Use 24 hour format")); 50 private final JCheckBox moveTo = new JCheckBox(I18n.tr("Move to picture''s location with next/previous buttons")); 53 51 54 private JButton loginButton = new JButton(new LoginAction(this)); 55 private JButton logoutButton = new JButton(new LogoutAction()); 56 private JLabel loginLabel = new JLabel(); 57 private JPanel loginPanel = new JPanel(); 52 private final JButton loginButton = new JButton(new LoginAction(this)); 53 private final JButton logoutButton = new JButton(new LogoutAction()); 54 private final JLabel loginLabel = new JLabel(); 55 private final JPanel loginPanel = new JPanel(); 58 56 59 57 @Override … … 113 111 } 114 112 115 /** 116 * Should be called whenever the user logs into a mapillary account. 117 * This updates the GUI to reflect the login status. 118 * @param username the username that the user is now logged in with 119 */ 113 @Override 120 114 public void onLogin(final String username) { 121 115 loginPanel.add(logoutButton, 1); … … 125 119 } 126 120 127 /** 128 * Should be called whenever the user logs out of a mapillary account. 129 * This updates the GUI to reflect the login status. 130 */ 121 @Override 131 122 public void onLogout() { 132 123 loginPanel.remove(logoutButton); … … 168 159 public class LoginAction extends AbstractAction { 169 160 private static final long serialVersionUID = -3908477563072057344L; 170 final transient MapillaryLoginListener callback; 161 private final transient MapillaryLoginListener callback; 171 162 172 163 public LoginAction(MapillaryLoginListener loginCallback) { -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/oauth/MapillaryLoginListener.java
r31808 r31810 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.mapillary.oauth; 2 3 4 /** 5 * This interface should be implemented by components that want to get notified when the user 6 * logs in or logs out of his Mapillary account. 7 * Such listeners can be registered e.g. at a {@link OAuthPortListener}. 8 */ 3 9 public interface MapillaryLoginListener { 10 /** 11 * Should be called whenever the user logs into a mapillary account. 12 * E.g. for updating the GUI to reflect the login status. 13 * @param username the username that the user is now logged in with 14 */ 4 15 public void onLogin(final String username); 16 /** 17 * Should be called whenever the user logs out of a mapillary account. 18 * E.g. for updating the GUI to reflect the login status. 19 */ 5 20 public void onLogout(); 6 21 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/oauth/MapillaryUser.java
r31807 r31810 17 17 * 18 18 */ 19 public class MapillaryUser { 19 public final class MapillaryUser { 20 20 21 21 private static String username;
Note:
See TracChangeset
for help on using the changeset viewer.