- Timestamp:
- 2019-12-07T16:38:26+01:00 (5 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/gpx/GpxConstants.java
r15496 r15560 239 239 static Map<String, String> getExtensionAbbreviations() { 240 240 TreeMap<String, String> m = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); 241 m.put("gpx:extension:gpxx:TrackExtension s:DisplayColor", "gpxx:DisplayColor");241 m.put("gpx:extension:gpxx:TrackExtension:DisplayColor", "gpxx:DisplayColor"); 242 242 m.put("gpx:extension:gpxd:color", "gpxd:color"); 243 243 return m; -
trunk/src/org/openstreetmap/josm/data/gpx/GpxExtensionCollection.java
r15497 r15560 148 148 /** 149 149 * Adds an extension from a flat chain without prefix, e.g. when converting from OSM 150 * @param chain the full key chain, e.g. ["extension", "gpxx", "TrackExtension s", "DisplayColor"]150 * @param chain the full key chain, e.g. ["extension", "gpxx", "TrackExtension", "DisplayColor"] 151 151 * @param value the value 152 152 */ -
trunk/src/org/openstreetmap/josm/data/gpx/GpxTrack.java
r15497 r15560 170 170 } 171 171 closestGarminColorCache.put(c, colorString); 172 getExtensions().addIfNotPresent("gpxx", "TrackExtension s").getExtensions().addOrUpdate("gpxx", "DisplayColor", colorString);172 getExtensions().addIfNotPresent("gpxx", "TrackExtension").getExtensions().addOrUpdate("gpxx", "DisplayColor", colorString); 173 173 } else if (cFormat == ColorFormat.GPXD) { 174 174 setColor(c); -
trunk/src/org/openstreetmap/josm/gui/io/importexport/GpxImporter.java
r15496 r15560 13 13 import org.openstreetmap.josm.data.gpx.GpxData; 14 14 import org.openstreetmap.josm.gui.MainApplication; 15 import org.openstreetmap.josm.gui.Notification; 15 16 import org.openstreetmap.josm.gui.layer.GpxLayer; 17 import org.openstreetmap.josm.gui.layer.ImageryLayer; 18 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 16 19 import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer; 17 20 import org.openstreetmap.josm.gui.progress.ProgressMonitor; … … 154 157 } 155 158 } 159 160 final boolean isSameColor = MainApplication.getLayerManager() 161 .getLayersOfType(ImageryLayer.class) 162 .stream().noneMatch(ImageryLayer::isVisible) 163 && data.getTracks().stream().anyMatch(t -> OsmDataLayer.getBackgroundColor().equals(t.getColor())); 164 156 165 Runnable postLayerTask = () -> { 157 166 if (!parsedProperly) { … … 166 175 JOptionPane.showMessageDialog(null, msg); 167 176 } 177 if (isSameColor) { 178 new Notification(tr("The imported track \"{0}\" might not be visible because it has the same color as the background." + 179 "<br>You can change this in the context menu of the imported layer.", gpxLayerName)) 180 .setIcon(JOptionPane.WARNING_MESSAGE) 181 .setDuration(Notification.TIME_LONG) 182 .show(); 183 } 168 184 }; 169 185 return new GpxImporterData(gpxLayer, markerLayer, postLayerTask); -
trunk/test/data/tracks/tracks-extensions.gpx
r15496 r15560 18 18 <extensions> 19 19 <test:tag>Track extension</test:tag> 20 <gpxx:TrackExtension s>20 <gpxx:TrackExtension> 21 21 <gpxx:DisplayColor>Red</gpxx:DisplayColor> 22 </gpxx:TrackExtension s>22 </gpxx:TrackExtension> 23 23 </extensions> 24 24 <trkseg> -
trunk/test/unit/org/openstreetmap/josm/data/gpx/GpxTrackTest.java
r15496 r15560 48 48 trk.invalidate(); 49 49 assertNull(trk.getColor()); 50 ext.add("gpxx", "TrackExtension s").getExtensions().add("gpxx", "DisplayColor", "Blue");50 ext.add("gpxx", "TrackExtension").getExtensions().add("gpxx", "DisplayColor", "Blue"); 51 51 trk.invalidate(); 52 52 assertEquals(trk.getColor(), Color.BLUE); -
trunk/test/unit/org/openstreetmap/josm/io/GpxWriterTest.java
r15503 r15560 191 191 " <trk>\n" + 192 192 " <extensions>\n" + 193 " <gpxx:TrackExtension s>\n" +193 " <gpxx:TrackExtension>\n" + 194 194 " <gpxx:DisplayColor>Red</gpxx:DisplayColor>\n" + 195 " </gpxx:TrackExtension s>\n" +195 " </gpxx:TrackExtension>\n" + 196 196 " </extensions>\n" + 197 197 " <trkseg>\n" + … … 263 263 " <trk>\n" + 264 264 " <extensions>\n" + 265 " <gpxx:TrackExtension s>\n" +265 " <gpxx:TrackExtension>\n" + 266 266 " <gpxx:DisplayColor>Red</gpxx:DisplayColor>\n" + 267 " </gpxx:TrackExtension s>\n" +267 " </gpxx:TrackExtension>\n" + 268 268 " </extensions>\n" + 269 269 " <trkseg>\n" +
Note:
See TracChangeset
for help on using the changeset viewer.