Ticket #11910: imagery_used-fixed.diff
| File imagery_used-fixed.diff, 2.3 KB (added by , 11 years ago) |
|---|
-
src/org/openstreetmap/josm/gui/MapView.java
1166 1166 } 1167 1167 return Utils.join("; ", layerInfo); 1168 1168 } 1169 1170 /** 1171 * Get a string representation of all visible TMS and WMS layers for the {@code imagery_used} changeset tag. 1172 * @return A String of imagery_used separated by ';' 1173 */ 1174 public String getLayerInformationForImageryUsedTag() { 1175 final Collection<String> layerInfo = new ArrayList<>(); 1176 for (final ImageryLayer i : getLayersOfType(ImageryLayer.class)) { 1177 if(i.isVisible()){ 1178 if(i.getInfo().getId() !=null && !i.getInfo().getId().isEmpty()){ 1179 layerInfo.add(i.getInfo().getId()); 1180 }else{ 1181 layerInfo.add(i.getName()); 1182 } 1183 } 1184 } 1185 //Return less or equal 255 characters, according https://github.com/openstreetmap/iD/issues/2181 1186 String imagery_used = Utils.join("; ", layerInfo); 1187 if(imagery_used.length() > 255){ 1188 imagery_used = Utils.join("; ", layerInfo).substring(0, 255); 1189 } 1190 return imagery_used; 1191 } 1192 1169 1193 1170 1194 /** 1171 1195 * This is a listener that gets informed whenever repaint is called for this MapView. -
src/org/openstreetmap/josm/gui/io/TagSettingsPanel.java
97 97 } else if (!created_by.contains(agent)) { 98 98 tags.put("created_by", created_by + ";" + agent); 99 99 } 100 //Add imagery_used tag accoding to http://wiki.openstreetmap.org/wiki/Key:imagery_used 101 if(Main.map.mapView.getLayerInformationForImageryUsedTag()!=null && !Main.map.mapView.getLayerInformationForImageryUsedTag().isEmpty()){ 102 tags.put("imagery_used", Main.map.mapView.getLayerInformationForImageryUsedTag()); 103 } 100 104 pnlTagEditor.getModel().initFromTags(tags); 101 105 } 102 106
