- Timestamp:
- 2021-07-17T21:44:51+02:00 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java
r18045 r18059 366 366 } 367 367 368 /** 369 * Construct the list of loaded GPX tracks 370 * @param nogdw Data wrapper with no GPX data 371 */ 372 private void constructGpxModel(NoGpxDataWrapper nogdw) { 373 gpxModel = new DefaultComboBoxModel<>(); 374 GpxDataWrapper defaultItem = null; 375 for (GpxLayer cur : MainApplication.getLayerManager().getLayersOfType(GpxLayer.class)) { 376 GpxDataWrapper gdw = new GpxDataWrapper(cur.getName(), cur.data, cur.data.storageFile); 377 cur.addPropertyChangeListener(new GpxLayerRenamedListener(gdw)); 378 gpxModel.addElement(gdw); 379 if (cur == yLayer.gpxLayer || defaultItem == null) { 380 defaultItem = gdw; 381 } 382 } 383 384 if (gpxModel.getSize() == 0) { 385 gpxModel.addElement(nogdw); 386 } else if (defaultItem != null) { 387 gpxModel.setSelectedItem(defaultItem); 388 } 389 MainApplication.getLayerManager().addLayerChangeListener(new GpxLayerAddedListener()); 390 } 391 392 static GpxTimezone loadTimezone() { 393 try { 394 String tz = Config.getPref().get("geoimage.timezone"); 395 if (!tz.isEmpty()) { 396 return GpxTimezone.parseTimezone(tz); 397 } else { 398 return new GpxTimezone(TimeUnit.MILLISECONDS.toMinutes(TimeZone.getDefault().getRawOffset()) / 60.); //hours is double 399 } 400 } catch (ParseException e) { 401 Logging.trace(e); 402 return GpxTimezone.ZERO; 403 } 404 } 405 406 static GpxTimeOffset loadDelta() { 407 try { 408 return GpxTimeOffset.parseOffset(Config.getPref().get("geoimage.delta", "0")); 409 } catch (ParseException e) { 410 Logging.trace(e); 411 return GpxTimeOffset.ZERO; 412 } 413 } 414 368 415 @Override 369 416 public void actionPerformed(ActionEvent ae) { 370 417 NoGpxDataWrapper nogdw = new NoGpxDataWrapper(); 371 418 if (gpxModel == null) { 372 // Construct the list of loaded GPX tracks 373 gpxModel = new DefaultComboBoxModel<>(); 374 GpxDataWrapper defaultItem = null; 375 for (GpxLayer cur : MainApplication.getLayerManager().getLayersOfType(GpxLayer.class)) { 376 GpxDataWrapper gdw = new GpxDataWrapper(cur.getName(), cur.data, cur.data.storageFile); 377 cur.addPropertyChangeListener(new GpxLayerRenamedListener(gdw)); 378 gpxModel.addElement(gdw); 379 if (cur == yLayer.gpxLayer || defaultItem == null) { 380 defaultItem = gdw; 381 } 382 } 383 384 if (gpxModel.getSize() == 0) { 385 gpxModel.addElement(nogdw); 386 } else if (defaultItem != null) { 387 gpxModel.setSelectedItem(defaultItem); 388 } 389 MainApplication.getLayerManager().addLayerChangeListener(new GpxLayerAddedListener()); 419 constructGpxModel(nogdw); 390 420 } 391 421 … … 405 435 JPanel panelTf = new JPanel(new GridBagLayout()); 406 436 407 try { 408 String tz = Config.getPref().get("geoimage.timezone"); 409 if (!tz.isEmpty()) { 410 timezone = GpxTimezone.parseTimezone(tz); 411 } else { 412 timezone = new GpxTimezone(TimeUnit.MILLISECONDS.toMinutes(TimeZone.getDefault().getRawOffset()) / 60.); //hours is double 413 } 414 } catch (ParseException e) { 415 timezone = GpxTimezone.ZERO; 416 Logging.trace(e); 417 } 437 timezone = loadTimezone(); 418 438 419 439 tfTimezone = new JosmTextField(10); 420 440 tfTimezone.setText(timezone.formatTimezone()); 421 441 422 try { 423 delta = GpxTimeOffset.parseOffset(Config.getPref().get("geoimage.delta", "0")); 424 } catch (ParseException e) { 425 delta = GpxTimeOffset.ZERO; 426 Logging.trace(e); 427 } 442 delta = loadDelta(); 428 443 429 444 tfOffset = new JosmTextField(10);
Note:
See TracChangeset
for help on using the changeset viewer.