Changeset 11089 in josm
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/gpx/ConvertToDataLayerAction.java
r10436 r11089 9 9 import java.io.File; 10 10 import java.util.ArrayList; 11 import java.util.Arrays; 12 import java.util.Collection; 13 import java.util.Iterator; 11 14 import java.util.List; 15 import java.util.Optional; 12 16 13 17 import javax.swing.AbstractAction; … … 33 37 import org.openstreetmap.josm.tools.GBC; 34 38 import org.openstreetmap.josm.tools.ImageProvider; 39 import org.openstreetmap.josm.tools.Logging; 35 40 import org.openstreetmap.josm.tools.date.DateUtils; 36 41 … … 103 108 for (Marker marker : layer.data) { 104 109 final Node node = new Node(marker.getCoor()); 105 node.put("name", marker.getText()); 110 final Collection<String> mapping = Main.pref.getCollection("gpx.to-osm-mapping", 111 Arrays.asList("name", "name", "desc", "description", "cmt", "note", "sym", "gpxicon")); 112 if (mapping.size() % 2 == 0) { 113 final Iterator<String> it = mapping.iterator(); 114 while (it.hasNext()) { 115 final String gpxKey = it.next(); 116 final String osmKey = it.next(); 117 Optional.ofNullable(marker.getTemplateValue(gpxKey, false)) 118 .map(String::valueOf) 119 .ifPresent(s -> node.put(osmKey, s)); 120 } 121 } else { 122 Logging.warn("Invalid gpx.to-osm-mapping Einstein setting: expecting even number of entries"); 123 } 106 124 ds.addPrimitive(node); 107 125 }
Note:
See TracChangeset
for help on using the changeset viewer.