Changeset 938 in josm
- Timestamp:
- 2008-09-09T08:43:09+02:00 (16 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/Preferences.java
r931 r938 13 13 import java.util.LinkedList; 14 14 import java.util.Map; 15 import java.util.Properties; 15 16 import java.util.SortedMap; 16 17 import java.util.StringTokenizer; … … 19 20 20 21 import org.openstreetmap.josm.Main; 22 import org.openstreetmap.josm.gui.preferences.ProxyPreferences; 21 23 import org.openstreetmap.josm.tools.ColorHelper; 22 24 … … 213 215 public void save() { 214 216 try { 217 setSystemProperties(); 215 218 final PrintWriter out = new PrintWriter(new FileWriter(getPreferencesDir() + "preferences"), false); 216 219 for (final Entry<String, String> e : properties.entrySet()) { … … 241 244 throw new IOException("Malformed config file at lines " + errLines); 242 245 } 246 setSystemProperties(); 243 247 } 244 248 … … 377 381 return def; 378 382 } 383 384 private void setSystemProperties() { 385 Properties sysProp = System.getProperties(); 386 if (getBoolean(ProxyPreferences.PROXY_ENABLE)) { 387 sysProp.put("proxySet", "true"); 388 sysProp.put("http.proxyHost", get(ProxyPreferences.PROXY_HOST)); 389 sysProp.put("proxyPort", get(ProxyPreferences.PROXY_PORT)); 390 if (!getBoolean(ProxyPreferences.PROXY_ANONYMOUS)) { 391 sysProp.put("proxyUser", get(ProxyPreferences.PROXY_USER)); 392 sysProp.put("proxyPassword", get(ProxyPreferences.PROXY_PASS)); 393 } 394 } else { 395 sysProp.put("proxySet", "false"); 396 sysProp.remove("http.proxyHost"); 397 sysProp.remove("proxyPort"); 398 sysProp.remove("proxyUser"); 399 sysProp.remove("proxyPassword"); 400 } 401 System.setProperties(sysProp); 402 } 379 403 } -
trunk/src/org/openstreetmap/josm/gui/preferences/FilePreferences.java
r627 r938 6 6 import javax.swing.Box; 7 7 import javax.swing.JCheckBox; 8 import javax.swing.JSeparator; 9 import javax.swing.SwingConstants; 8 10 9 11 import org.openstreetmap.josm.Main; … … 21 23 22 24 public void addGui(PreferenceDialog gui) { 25 gui.connection.add(new JSeparator(SwingConstants.HORIZONTAL), GBC.eol().fill(GBC.HORIZONTAL)); 23 26 keepBackup.setSelected(Main.pref.getBoolean("save.keepbackup")); 24 27 keepBackup.setToolTipText(tr("When saving, keep backup files ending with a ~")); 25 28 gui.connection.add(keepBackup, GBC.eol().insets(20,0,0,0)); 26 gui.connection.add(Box.createVerticalGlue(), GBC.eol().fill(GBC.VERTICAL));27 29 } 28 30 -
trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceDialog.java
r804 r938 105 105 settings.add(new ServerAccessPreference()); 106 106 settings.add(new FilePreferences()); 107 settings.add(new ProxyPreferences()); 107 108 settings.add(new ProjectionPreference()); 108 109 settings.add(new TaggingPresetPreference()); -
trunk/src/org/openstreetmap/josm/io/NmeaReader.java
r814 r938 162 162 163 163 private LatLon parseLatLon(String[] e) throws NumberFormatException { 164 String widthNorth = e[GPRMC.WIDTH_NORTH.position] ;165 String lengthEast = e[GPRMC.LENGTH_EAST.position] ;164 String widthNorth = e[GPRMC.WIDTH_NORTH.position].trim(); 165 String lengthEast = e[GPRMC.LENGTH_EAST.position].trim(); 166 166 if ("".equals(widthNorth) || "".equals(lengthEast)) { 167 167 return null; 168 168 } 169 169 170 int latdeg = Integer.parseInt(widthNorth.substring(0, 2)); 171 double latmin = Double.parseDouble(widthNorth.substring(2)); 170 // The format is xxDDLL.LLLL 171 // xx optional whitespace 172 // DD (int) degres 173 // LL.LLLL (double) latidude 174 int latdegsep = widthNorth.indexOf('.') - 2; 175 if (latdegsep < 0) { 176 return null; 177 } 178 int latdeg = Integer.parseInt(widthNorth.substring(0, latdegsep)); 179 double latmin = Double.parseDouble(widthNorth.substring(latdegsep)); 172 180 double lat = latdeg + latmin / 60; 173 181 if ("S".equals(e[GPRMC.WIDTH_NORTH_NAME.position])) { … … 175 183 } 176 184 177 int londeg = Integer.parseInt(lengthEast.substring(0, 3)); 178 double lonmin = Double.parseDouble(lengthEast.substring(3)); 185 int londegsep = lengthEast.indexOf('.') - 2; 186 if (londegsep < 0) { 187 return null; 188 } 189 int londeg = Integer.parseInt(lengthEast.substring(0, londegsep)); 190 double lonmin = Double.parseDouble(lengthEast.substring(londegsep)); 179 191 double lon = londeg + lonmin / 60; 180 192 if ("W".equals(e[GPRMC.LENGTH_EAST_NAME.position])) {
Note:
See TracChangeset
for help on using the changeset viewer.