1 | Index: src/org/openstreetmap/josm/gui/layer/GpxLayer.java
|
---|
2 | ===================================================================
|
---|
3 | --- src/org/openstreetmap/josm/gui/layer/GpxLayer.java (revision 2143)
|
---|
4 | +++ src/org/openstreetmap/josm/gui/layer/GpxLayer.java (working copy)
|
---|
5 | @@ -80,6 +80,11 @@
|
---|
6 | private int computeCacheColorTracksTune;
|
---|
7 | private boolean isLocalFile;
|
---|
8 |
|
---|
9 | + private class Markers {
|
---|
10 | + public boolean timedMarkersOmitted = false;
|
---|
11 | + public boolean untimedMarkersOmitted = false;
|
---|
12 | + }
|
---|
13 | +
|
---|
14 | public GpxLayer(GpxData d) {
|
---|
15 | super((String) d.attr.get("name"));
|
---|
16 | data = d;
|
---|
17 | @@ -260,8 +265,10 @@
|
---|
18 | if (sel != null) {
|
---|
19 | double firstStartTime = sel[0].lastModified() / 1000.0 /* ms -> seconds */
|
---|
20 | - AudioUtil.getCalibratedDuration(sel[0]);
|
---|
21 | +
|
---|
22 | + Markers m = new Markers();
|
---|
23 | for (int i = 0; i < sel.length; i++) {
|
---|
24 | - importAudio(sel[i], ml, firstStartTime);
|
---|
25 | + importAudio(sel[i], ml, firstStartTime, m);
|
---|
26 | }
|
---|
27 | }
|
---|
28 | Main.main.addLayer(ml);
|
---|
29 | @@ -948,8 +955,9 @@
|
---|
30 | * timestamp on the wav file (e) (in future) voice recognised markers in the sound recording (f)
|
---|
31 | * a single marker at the beginning of the track
|
---|
32 | * @param wavFile : the file to be associated with the markers in the new marker layer
|
---|
33 | + * @param markers : keeps track of warning messages to avoid repeated warnings
|
---|
34 | */
|
---|
35 | - private void importAudio(File wavFile, MarkerLayer ml, double firstStartTime) {
|
---|
36 | + private void importAudio(File wavFile, MarkerLayer ml, double firstStartTime, Markers markers) {
|
---|
37 | String uri = "file:".concat(wavFile.getAbsolutePath());
|
---|
38 | Collection<WayPoint> waypoints = new ArrayList<WayPoint>();
|
---|
39 | boolean timedMarkersOmitted = false;
|
---|
40 | @@ -1150,17 +1158,19 @@
|
---|
41 | ml.data.add(am);
|
---|
42 | }
|
---|
43 |
|
---|
44 | - if (timedMarkersOmitted) {
|
---|
45 | + if (timedMarkersOmitted && !markers.timedMarkersOmitted) {
|
---|
46 | JOptionPane
|
---|
47 | .showMessageDialog(
|
---|
48 | Main.parent,
|
---|
49 | tr("Some waypoints with timestamps from before the start of the track or after the end were omitted or moved to the start."));
|
---|
50 | + markers.timedMarkersOmitted = timedMarkersOmitted;
|
---|
51 | }
|
---|
52 | - if (untimedMarkersOmitted) {
|
---|
53 | + if (untimedMarkersOmitted && !markers.untimedMarkersOmitted) {
|
---|
54 | JOptionPane
|
---|
55 | .showMessageDialog(
|
---|
56 | Main.parent,
|
---|
57 | tr("Some waypoints which were too far from the track to sensibly estimate their time were omitted."));
|
---|
58 | + markers.untimedMarkersOmitted = untimedMarkersOmitted;
|
---|
59 | }
|
---|
60 | }
|
---|
61 |
|
---|