| 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 | |