Changeset 34514 in osm for applications/editors/josm
- Timestamp:
- 2018-08-18T17:50:45+02:00 (6 years ago)
- Location:
- applications/editors/josm/plugins/globalsat
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/globalsat/build.xml
r33854 r34514 5 5 <property name="commit.message" value="Changed constructor signature of plugin main class"/> 6 6 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 7 <property name="plugin.main.version" value="1 2840"/>7 <property name="plugin.main.version" value="14153"/> 8 8 9 9 <!-- Configure these properties (replace "..." accordingly). -
applications/editors/josm/plugins/globalsat/src/org/kaintoch/gps/globalsat/dg100/GpsRec.java
r34120 r34514 69 69 70 70 @Override 71 public boolean equals(Object arg0) 72 { 73 boolean isEqual = false; 74 if (arg0 != null && arg0 instanceof GpsRec) 75 { 76 GpsRec otherGpsRec = (GpsRec)arg0; 77 isEqual = 78 dg100TypeOfNextRec == otherGpsRec.dg100TypeOfNextRec 79 && dg100TypeOfCurRec == otherGpsRec.dg100TypeOfCurRec 80 && dg100Latitude == otherGpsRec.dg100Latitude 81 && dg100Longitude == otherGpsRec.dg100Longitude 82 && dg100TimeZ == otherGpsRec.dg100TimeZ 83 && dg100Date == otherGpsRec.dg100Date 84 && dg100Speed == otherGpsRec.dg100Speed 85 && dg100Altitude == otherGpsRec.dg100Altitude 86 //&& dg100Unk1 == otherGpsRec.unk1 87 ; 88 } 89 return isEqual; 71 public int hashCode() { 72 final int prime = 31; 73 int result = 1; 74 result = prime * result + dg100Altitude; 75 result = prime * result + dg100Date; 76 result = prime * result + dg100Latitude; 77 result = prime * result + dg100Longitude; 78 result = prime * result + dg100Speed; 79 result = prime * result + dg100TimeZ; 80 result = prime * result + dg100TypeOfCurRec; 81 result = prime * result + dg100TypeOfNextRec; 82 return result; 83 } 84 85 @Override 86 public boolean equals(Object obj) { 87 if (this == obj) 88 return true; 89 if (obj == null || getClass() != obj.getClass()) 90 return false; 91 GpsRec other = (GpsRec) obj; 92 return dg100Altitude == other.dg100Altitude 93 && dg100Date == other.dg100Date 94 && dg100Latitude == other.dg100Latitude 95 && dg100Longitude == other.dg100Longitude 96 && dg100Speed == other.dg100Speed 97 && dg100TimeZ == other.dg100TimeZ 98 && dg100TypeOfCurRec == other.dg100TypeOfCurRec 99 && dg100TypeOfNextRec == other.dg100TypeOfNextRec; 90 100 } 91 101 -
applications/editors/josm/plugins/globalsat/src/org/openstreetmap/josm/plugins/globalsat/GlobalsatConfigDialog.java
r33854 r34514 24 24 25 25 import org.kaintoch.gps.globalsat.dg100.Dg100Config; 26 import org.openstreetmap.josm. Main;26 import org.openstreetmap.josm.gui.MainApplication; 27 27 28 28 /** … … 243 243 break; 244 244 default: 245 JOptionPane.showMessageDialog(Main .parent, tr("Unknown logFormat"));245 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), tr("Unknown logFormat")); 246 246 } 247 247 … … 260 260 } 261 261 262 private static ButtonGroup createButtonGroup(AbstractButton 262 private static ButtonGroup createButtonGroup(AbstractButton... buttons) { 263 263 ButtonGroup group = new ButtonGroup(); 264 264 for (AbstractButton b : buttons) { -
applications/editors/josm/plugins/globalsat/src/org/openstreetmap/josm/plugins/globalsat/GlobalsatImportDialog.java
r33394 r34514 21 21 22 22 import org.kaintoch.gps.globalsat.dg100.Dg100Config; 23 import org.openstreetmap.josm.Main; 23 import org.openstreetmap.josm.gui.MainApplication; 24 import org.openstreetmap.josm.spi.preferences.Config; 24 25 25 26 import gnu.io.CommPortIdentifier; … … 60 61 if (i instanceof CommPortIdentifier) { 61 62 GlobalsatPlugin.setPortIdent((CommPortIdentifier) i); 62 Main.pref.put("globalsat.portIdentifier", ((CommPortIdentifier) i).getName());63 Config.getPref().put("globalsat.portIdentifier", ((CommPortIdentifier) i).getName()); 63 64 } 64 65 } … … 105 106 GlobalsatConfigDialog dialog = new GlobalsatConfigDialog(conf); 106 107 JOptionPane pane = new JOptionPane(dialog, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION); 107 JDialog dlg = pane.createDialog(Main .parent, tr("Configure Device"));108 JDialog dlg = pane.createDialog(MainApplication.getMainFrame(), tr("Configure Device")); 108 109 dlg.setVisible(true); 109 110 if (((Integer) pane.getValue()) == JOptionPane.OK_OPTION) { … … 112 113 dlg.dispose(); 113 114 } else { 114 JOptionPane.showMessageDialog(Main.parent, tr("Connection Error."), tr("Connection Error."), JOptionPane.ERROR); 115 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), 116 tr("Connection Error."), tr("Connection Error."), JOptionPane.ERROR); 115 117 } 116 118 } catch (GlobalsatDg100.ConnectionException ex) { 117 JOptionPane.showMessageDialog(Main .parent, tr("Connection Error.") + " " + ex.toString());119 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), tr("Connection Error.") + " " + ex.toString()); 118 120 } 119 121 System.out.println("configuring the device finished"); … … 130 132 131 133 delete = new JCheckBox(tr("delete data after import")); 132 delete.setSelected( Main.pref.getBoolean("globalsat.deleteAfterDownload", false));134 delete.setSelected(Config.getPref().getBoolean("globalsat.deleteAfterDownload", false)); 133 135 134 136 c.gridwidth = 3; … … 140 142 141 143 public void refreshPorts() { 142 String sel = Main.pref.get("globalsat.portIdentifier");144 String sel = Config.getPref().get("globalsat.portIdentifier"); 143 145 portCombo.setVisible(false); 144 146 portCombo.removeAllItems(); -
applications/editors/josm/plugins/globalsat/src/org/openstreetmap/josm/plugins/globalsat/GlobalsatPlugin.java
r33854 r34514 12 12 import javax.swing.JOptionPane; 13 13 14 import org.openstreetmap.josm.Main;15 14 import org.openstreetmap.josm.actions.JosmAction; 16 15 import org.openstreetmap.josm.data.gpx.GpxData; … … 21 20 import org.openstreetmap.josm.plugins.Plugin; 22 21 import org.openstreetmap.josm.plugins.PluginInformation; 22 import org.openstreetmap.josm.spi.preferences.Config; 23 23 import org.openstreetmap.josm.tools.Logging; 24 24 import org.openstreetmap.josm.tools.Shortcut; … … 61 61 @Override protected void finish() { 62 62 if (deleteAfter && GlobalsatPlugin.dg100().isCanceled() == false) { 63 Main.pref.putBoolean("globalsat.deleteAfterDownload", true);63 Config.getPref().putBoolean("globalsat.deleteAfterDownload", true); 64 64 try { 65 65 GlobalsatPlugin.dg100().deleteData(); 66 66 } catch (Exception ex) { 67 JOptionPane.showMessageDialog(Main .parent, tr("Error deleting data.") + " " + ex.toString());67 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), tr("Error deleting data.") + " " + ex.toString()); 68 68 } 69 69 } else { 70 Main.pref.putBoolean("globalsat.deleteAfterDownload", false);70 Config.getPref().putBoolean("globalsat.deleteAfterDownload", false); 71 71 } 72 72 if (data != null && data.hasTrackPoints()) { … … 74 74 MainApplication.getMap().repaint(); 75 75 } else { 76 JOptionPane.showMessageDialog(Main .parent, tr("No data found on device."));76 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), tr("No data found on device.")); 77 77 } 78 78 if (eee != null) { 79 79 eee.printStackTrace(); 80 80 System.out.println(eee.getMessage()); 81 JOptionPane.showMessageDialog(Main .parent, tr("Connection failed.") + " (" + eee.toString() + ")");81 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), tr("Connection failed.") + " (" + eee.toString() + ")"); 82 82 } 83 83 GlobalsatPlugin.dg100().disconnect(); … … 103 103 Logging.error(msg); 104 104 if (!GraphicsEnvironment.isHeadless()) { 105 JOptionPane.showMessageDialog(Main .parent, "<html>" + msg + "</html>");105 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), "<html>" + msg + "</html>"); 106 106 } 107 107 } … … 124 124 GlobalsatImportDialog dialog = new GlobalsatImportDialog(); 125 125 JOptionPane pane = new JOptionPane(dialog, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION); 126 JDialog dlg = pane.createDialog(Main .parent, tr("Import"));126 JDialog dlg = pane.createDialog(MainApplication.getMainFrame(), tr("Import")); 127 127 dlg.setVisible(true); 128 128 if (((Integer) pane.getValue()) == JOptionPane.OK_OPTION) {
Note:
See TracChangeset
for help on using the changeset viewer.