diff --git a/src/org/openstreetmap/josm/gui/layer/gpx/ConvertToDataLayerAction.java b/src/org/openstreetmap/josm/gui/layer/gpx/ConvertToDataLayerAction.java
index 0d97078..9b25af6 100644
a
|
b
|
|
8 | 8 | import java.awt.event.ActionEvent; |
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; |
14 | 18 | import javax.swing.JLabel; |
… |
… |
|
32 | 36 | import org.openstreetmap.josm.gui.widgets.UrlLabel; |
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 | |
37 | 42 | /** |
… |
… |
public DataSet convert() {
|
102 | 107 | final DataSet ds = new DataSet(); |
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 | } |
108 | 126 | return ds; |