Changeset 11570 in josm
- Timestamp:
- 2017-02-16T22:21:43+01:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java
r11527 r11570 188 188 /** country code of the imagery (for country specific imagery) */ 189 189 private String countryCode = ""; 190 /** 191 * creation date of the imagery (in the form YYYY-MM-DD;YYYY-MM-DD, where 192 * DD and MM as well as a second date are optional) 193 * @since 11570 194 */ 195 private String date; 190 196 /** mirrors of different type for this entry */ 191 197 private List<ImageryInfo> mirrors; … … 204 210 public static class ImageryPreferenceEntry { 205 211 @pref String name; 212 @pref String d; 206 213 @pref String id; 207 214 @pref String type; … … 216 223 @pref String terms_of_use_url; 217 224 @pref String country_code = ""; 225 @pref String date; 218 226 @pref int max_zoom; 219 227 @pref int min_zoom; … … 253 261 attribution_text = i.attributionText; 254 262 attribution_url = i.attributionLinkURL; 263 date = i.date; 255 264 logo_image = i.attributionImage; 256 265 logo_url = i.attributionImageURL; … … 408 417 attributionImage = e.logo_image; 409 418 attributionImageURL = e.logo_url; 419 date = e.date; 410 420 termsOfUseText = e.terms_of_use_text; 411 421 termsOfUseURL = e.terms_of_use_url; … … 448 458 this.termsOfUseURL = i.termsOfUseURL; 449 459 this.countryCode = i.countryCode; 460 this.date = i.date; 450 461 this.icon = i.icon; 451 462 this.description = i.description; … … 495 506 Objects.equals(this.termsOfUseURL, other.termsOfUseURL) && 496 507 Objects.equals(this.countryCode, other.countryCode) && 508 Objects.equals(this.date, other.date) && 497 509 Objects.equals(this.icon, other.icon) && 498 510 Objects.equals(this.description, other.description) && … … 831 843 */ 832 844 public String getToolTipText() { 845 String res = getName(); 846 boolean html = false; 847 String date = getDate(); 848 if (date != null && !date.isEmpty()) { 849 res += "<br>" + tr("Date of imagery: {0}", date); 850 html = true; 851 } 833 852 String desc = getDescription(); 834 853 if (desc != null && !desc.isEmpty()) { 835 return "<html>" + getName() + "<br>" + desc + "</html>"; 836 } 837 return getName(); 854 res += "<br>" + desc; 855 html = true; 856 } 857 if (html) { 858 res = "<html>" + res + "</html>"; 859 } 860 return res; 838 861 } 839 862 … … 868 891 public void setCountryCode(String countryCode) { 869 892 this.countryCode = countryCode; 893 } 894 895 /** 896 * Returns the date information. 897 * @return The date (in the form YYYY-MM-DD;YYYY-MM-DD, where 898 * DD and MM as well as a second date are optional) 899 * @since 11570 900 */ 901 public String getDate() { 902 return date; 903 } 904 905 /** 906 * Sets the date information. 907 * @param date The date information 908 * @since 11570 909 */ 910 public void setDate(String date) { 911 this.date = date; 870 912 } 871 913 … … 1135 1177 List<ImageryInfo> l = new ArrayList<>(); 1136 1178 if (mirrors != null) { 1179 int num = 1; 1137 1180 for (ImageryInfo i : mirrors) { 1138 1181 ImageryInfo n = new ImageryInfo(this); … … 1149 1192 n.setTileSize(i.getTileSize()); 1150 1193 } 1194 if(n.id != null) { 1195 n.id = n.id + "_mirror"+num; 1196 } 1197 if(num > 1) { 1198 n.name = tr("{0} mirror server {1}", n.name, num); 1199 n.origName += " mirror server " + num; 1200 } else { 1201 n.name = tr("{0} mirror server", n.name); 1202 n.origName += " mirror server"; 1203 } 1151 1204 l.add(n); 1205 ++num; 1152 1206 } 1153 1207 } -
trunk/src/org/openstreetmap/josm/data/imagery/ImageryLayerInfo.java
r11528 r11570 33 33 34 34 public static final ImageryLayerInfo instance = new ImageryLayerInfo(); 35 /** List of all usable layers */ 35 36 private final List<ImageryInfo> layers = new ArrayList<>(); 37 /** List of layer ids of all usable layers */ 36 38 private final Map<String, ImageryInfo> layerIds = new HashMap<>(); 39 /** List of all available default layers */ 37 40 private static final List<ImageryInfo> defaultLayers = new ArrayList<>(); 41 /** List of all available default layers (including mirrors) */ 42 private static final List<ImageryInfo> allDefaultLayers = new ArrayList<>(); 43 /** List of all layer ids of available default layers (including mirrors) */ 38 44 private static final Map<String, ImageryInfo> defaultLayerIds = new HashMap<>(); 39 45 … … 164 170 protected void finish() { 165 171 defaultLayers.clear(); 172 allDefaultLayers.clear(); 166 173 defaultLayers.addAll(newLayers); 174 for (ImageryInfo layer : newLayers) { 175 allDefaultLayers.add(layer); 176 for (ImageryInfo sublayer : layer.getMirrors()) { 177 allDefaultLayers.add(sublayer); 178 } 179 } 167 180 defaultLayerIds.clear(); 168 181 Collections.sort(defaultLayers); 169 buildIdMap(defaultLayers, defaultLayerIds); 182 Collections.sort(allDefaultLayers); 183 buildIdMap(allDefaultLayers, defaultLayerIds); 170 184 updateEntriesFromDefaults(); 171 185 buildIdMap(layers, layerIds); … … 305 319 } 306 320 321 /** 322 * List of usable layers 323 * @return unmodifiable list containing usable layers 324 */ 307 325 public List<ImageryInfo> getLayers() { 308 326 return Collections.unmodifiableList(layers); 309 327 } 310 328 329 /** 330 * List of available default layers 331 * @return unmodifiable list containing available default layers 332 */ 311 333 public List<ImageryInfo> getDefaultLayers() { 312 334 return Collections.unmodifiableList(defaultLayers); 335 } 336 337 /** 338 * List of all available default layers (including mirrors) 339 * @return unmodifiable list containing available default layers 340 * @since 11570 341 */ 342 public List<ImageryInfo> getAllDefaultLayers() { 343 return Collections.unmodifiableList(allDefaultLayers); 313 344 } 314 345 -
trunk/src/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreference.java
r11183 r11570 326 326 mod = activeTable.getColumnModel(); 327 327 mod.getColumn(1).setPreferredWidth(800); 328 mod.getColumn(1).setCellRenderer(new ImageryURLTableCellRenderer(layerInfo.get DefaultLayers()));328 mod.getColumn(1).setCellRenderer(new ImageryURLTableCellRenderer(layerInfo.getAllDefaultLayers())); 329 329 mod.getColumn(0).setPreferredWidth(200); 330 330 … … 742 742 */ 743 743 public ImageryInfo getRow(int row) { 744 return layerInfo.get DefaultLayers().get(row);744 return layerInfo.getAllDefaultLayers().get(row); 745 745 } 746 746 747 747 @Override 748 748 public int getRowCount() { 749 return layerInfo.get DefaultLayers().size();749 return layerInfo.getAllDefaultLayers().size(); 750 750 } 751 751 752 752 @Override 753 753 public Object getValueAt(int row, int column) { 754 ImageryInfo info = layerInfo.get DefaultLayers().get(row);754 ImageryInfo info = layerInfo.getAllDefaultLayers().get(row); 755 755 switch (column) { 756 756 case 0: -
trunk/src/org/openstreetmap/josm/io/imagery/ImageryReader.java
r11518 r11570 190 190 "country-code", 191 191 "icon", 192 "date", 192 193 "tile-size", 193 194 "valid-georeference", … … 358 359 entry.setDescription(lang, accumulator.toString()); 359 360 break; 361 case "date": 362 entry.setDate(accumulator.toString()); 363 break; 360 364 case "id": 361 365 entry.setId(accumulator.toString());
Note:
See TracChangeset
for help on using the changeset viewer.