Ticket #18522: 18522.patch
File 18522.patch, 5.0 KB (added by , 5 years ago) |
---|
-
src/org/openstreetmap/josm/data/imagery/ImageryInfo.java
235 235 private String origName; 236 236 /** (original) language of the translated name entry */ 237 237 private String langName; 238 /** preferred source tag value (for changeset source) */ 239 private String source; 238 240 /** whether this is a entry activated by default or not */ 239 241 private boolean defaultEntry; 240 242 /** Whether this service requires a explicit EULA acceptance before it can be activated */ … … 357 359 @StructEntry boolean transparent; 358 360 @StructEntry int minimumTileExpire; 359 361 @StructEntry String category; 362 @StructEntry 363 String source; 360 364 361 365 /** 362 366 * Constructs a new empty WMS {@code ImageryPreferenceEntry}. … … 393 397 icon = i.icon; 394 398 description = i.description; 395 399 category = i.category != null ? i.category.getCategoryString() : null; 400 source = i.source; 396 401 if (i.bounds != null) { 397 402 bounds = i.bounds.encodeAsString(","); 398 403 StringBuilder shapesString = new StringBuilder(); … … 585 590 transparent = e.transparent; 586 591 minimumTileExpire = e.minimumTileExpire; 587 592 category = ImageryCategory.fromString(e.category); 593 source = e.source; 588 594 } 589 595 590 596 /** … … 633 639 this.transparent = i.transparent; 634 640 this.minimumTileExpire = i.minimumTileExpire; 635 641 this.category = i.category; 642 this.source = i.source; 636 643 } 637 644 638 645 @Override … … 688 695 Objects.equals(this.customHttpHeaders, other.customHttpHeaders) && 689 696 Objects.equals(this.transparent, other.transparent) && 690 697 Objects.equals(this.minimumTileExpire, other.minimumTileExpire) && 691 Objects.equals(this.category, other.category) ;698 Objects.equals(this.category, other.category) && Objects.equals(this.source, other.source); 692 699 // CHECKSTYLE.ON: BooleanExpressionComplexity 693 700 } 694 701 … … 984 991 } 985 992 986 993 /** 994 * Returns the entry preferred source tag 995 * 996 * @return The preferred source tag. May be null or an empty string. 997 * @since xxx 998 */ 999 public String getSource() { 1000 return source; 1001 } 1002 1003 /** 1004 * Returns the entry preferred source tag 1005 * 1006 * @param source The preferred source tag for the source 1007 * @since xxx 1008 */ 1009 public void setSource(String source) { 1010 this.source = source; 1011 } 1012 1013 /** 987 1014 * Store the id of this info to the preferences and clear it afterwards. 988 1015 */ 989 1016 public void clearId() { … … 1631 1658 // Retrieve english name, unfortunately not saved in preferences 1632 1659 Optional<ImageryInfo> infoEn = ImageryLayerInfo.allDefaultLayers.stream().filter(x -> id.equals(x.getId())).findAny(); 1633 1660 if (infoEn.isPresent()) { 1634 return infoEn.get().getOriginalName(); 1661 ImageryInfo info = infoEn.get(); 1662 String sourceTag = info.getSource(); 1663 return sourceTag == null || sourceTag.trim().isEmpty() ? info.getOriginalName() : sourceTag; 1635 1664 } 1636 1665 } 1637 1666 return getOriginalName(); -
src/org/openstreetmap/josm/gui/layer/ImageryLayer.java
357 357 358 358 @Override 359 359 public String getChangesetSourceTag() { 360 return getInfo().getSourceName(); 360 String potentialSource = getInfo().getSourceName(); 361 return potentialSource != null && !potentialSource.trim().isEmpty() ? potentialSource 362 : getInfo().getSourceName(); 361 363 } 362 364 } -
src/org/openstreetmap/josm/io/imagery/ImageryReader.java
222 222 "permission-ref", 223 223 "country-code", 224 224 "category", 225 "source", 225 226 "icon", 226 227 "date", 227 228 TILE_SIZE, … … 528 529 entry.setImageryCategory(category); 529 530 entry.setImageryCategoryOriginalString(cat); 530 531 break; 532 case "source": 533 entry.setSource(accumulator.toString()); 534 break; 531 535 default: // Do nothing 532 536 } 533 537 break;