diff --git a/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java b/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java
index 764e7dc..6b2671a 100644
|
a
|
b
|
public class ImageryInfo extends TileSourceInfo implements Comparable<ImageryInf
|
| 167 | 167 | /** display bounds of imagery, displayed in prefs and used for automatic imagery selection */ |
| 168 | 168 | private ImageryBounds bounds; |
| 169 | 169 | /** projections supported by WMS servers */ |
| 170 | | private List<String> serverProjections; |
| | 170 | private List<String> serverProjections = Collections.emptyList(); |
| 171 | 171 | /** description of the imagery entry, should contain notes what type of data it is */ |
| 172 | 172 | private String description; |
| 173 | 173 | /** language of the description entry */ |
| … |
… |
public class ImageryInfo extends TileSourceInfo implements Comparable<ImageryInf
|
| 270 | 270 | shapes = shapesString.toString(); |
| 271 | 271 | } |
| 272 | 272 | } |
| 273 | | if (i.serverProjections != null && !i.serverProjections.isEmpty()) { |
| | 273 | if (!i.serverProjections.isEmpty()) { |
| 274 | 274 | StringBuilder val = new StringBuilder(); |
| 275 | 275 | for (String p : i.serverProjections) { |
| 276 | 276 | if (val.length() > 0) { |
| … |
… |
public class ImageryInfo extends TileSourceInfo implements Comparable<ImageryInf
|
| 536 | 536 | return url.equals(in.url); |
| 537 | 537 | } |
| 538 | 538 | |
| | 539 | /** |
| | 540 | * Sets the pixel per degree value. |
| | 541 | * @param ppd The ppd value |
| | 542 | * @see #getPixelPerDegree() |
| | 543 | */ |
| 539 | 544 | public void setPixelPerDegree(double ppd) { |
| 540 | 545 | this.pixelPerDegree = ppd; |
| 541 | 546 | } |
| … |
… |
public class ImageryInfo extends TileSourceInfo implements Comparable<ImageryInf
|
| 611 | 616 | return termsOfUseURL; |
| 612 | 617 | } |
| 613 | 618 | |
| | 619 | /** |
| | 620 | * Set the attribution text |
| | 621 | * @param text The text |
| | 622 | * @see #getAttributionText(int, ICoordinate, ICoordinate) |
| | 623 | */ |
| 614 | 624 | public void setAttributionText(String text) { |
| 615 | 625 | attributionText = text; |
| 616 | 626 | } |
| 617 | 627 | |
| 618 | | public void setAttributionImageURL(String text) { |
| 619 | | attributionImageURL = text; |
| | 628 | /** |
| | 629 | * Set the attribution image |
| | 630 | * @param url The url of the image. |
| | 631 | * @see #getAttributionImageURL() |
| | 632 | */ |
| | 633 | public void setAttributionImageURL(String url) { |
| | 634 | attributionImageURL = url; |
| 620 | 635 | } |
| 621 | 636 | |
| 622 | | public void setAttributionImage(String text) { |
| 623 | | attributionImage = text; |
| | 637 | /** |
| | 638 | * Set the image for the attribution |
| | 639 | * @param res The image resource |
| | 640 | * @see #getAttributionImage() |
| | 641 | */ |
| | 642 | public void setAttributionImage(String res) { |
| | 643 | attributionImage = res; |
| 624 | 644 | } |
| 625 | 645 | |
| 626 | | public void setAttributionLinkURL(String text) { |
| 627 | | attributionLinkURL = text; |
| | 646 | /** |
| | 647 | * Sets the URL the attribution should link to. |
| | 648 | * @param url The url. |
| | 649 | * @see #getAttributionLinkURL() |
| | 650 | */ |
| | 651 | public void setAttributionLinkURL(String url) { |
| | 652 | attributionLinkURL = url; |
| 628 | 653 | } |
| 629 | 654 | |
| | 655 | /** |
| | 656 | * Sets the text to display to the user as terms of use. |
| | 657 | * @param text The text |
| | 658 | * @see #getTermsOfUseText() |
| | 659 | */ |
| 630 | 660 | public void setTermsOfUseText(String text) { |
| 631 | 661 | termsOfUseText = text; |
| 632 | 662 | } |
| 633 | 663 | |
| | 664 | /** |
| | 665 | * Sets a url that links to the terms of use text. |
| | 666 | * @param text The url. |
| | 667 | * @see #getTermsOfUseURL() |
| | 668 | */ |
| 634 | 669 | public void setTermsOfUseURL(String text) { |
| 635 | 670 | termsOfUseURL = text; |
| 636 | 671 | } |
| … |
… |
public class ImageryInfo extends TileSourceInfo implements Comparable<ImageryInf
|
| 663 | 698 | } |
| 664 | 699 | } |
| 665 | 700 | |
| 666 | | if (serverProjections == null || serverProjections.isEmpty()) { |
| | 701 | if (serverProjections.isEmpty()) { |
| 667 | 702 | serverProjections = new ArrayList<>(); |
| 668 | 703 | Matcher m = Pattern.compile(".*\\{PROJ\\(([^)}]+)\\)\\}.*").matcher(url.toUpperCase(Locale.ENGLISH)); |
| 669 | 704 | if (m.matches()) { |
| … |
… |
public class ImageryInfo extends TileSourceInfo implements Comparable<ImageryInf
|
| 700 | 735 | } |
| 701 | 736 | } |
| 702 | 737 | |
| | 738 | /** |
| | 739 | * Store the id of this info to the preferences and clear it afterwards. |
| | 740 | */ |
| 703 | 741 | public void clearId() { |
| 704 | 742 | if (this.id != null) { |
| 705 | 743 | Collection<String> newAddedIds = new TreeSet<>(Main.pref.getCollection("imagery.layers.addedIds")); |
| … |
… |
public class ImageryInfo extends TileSourceInfo implements Comparable<ImageryInf
|
| 734 | 772 | return this.cookies; |
| 735 | 773 | } |
| 736 | 774 | |
| | 775 | /** |
| | 776 | * Gets the pixel per degree value |
| | 777 | * @return The ppd value. |
| | 778 | */ |
| 737 | 779 | public double getPixelPerDegree() { |
| 738 | 780 | return this.pixelPerDegree; |
| 739 | 781 | } |
| … |
… |
public class ImageryInfo extends TileSourceInfo implements Comparable<ImageryInf
|
| 847 | 889 | * of supported projections otherwise. |
| 848 | 890 | */ |
| 849 | 891 | public List<String> getServerProjections() { |
| 850 | | if (serverProjections == null) |
| 851 | | return Collections.emptyList(); |
| 852 | 892 | return Collections.unmodifiableList(serverProjections); |
| 853 | 893 | } |
| 854 | 894 | |
| | 895 | /** |
| | 896 | * Sets the list of collections the server supports |
| | 897 | * @param serverProjections The list of supported projections |
| | 898 | */ |
| 855 | 899 | public void setServerProjections(Collection<String> serverProjections) { |
| | 900 | CheckParameterUtil.ensureParameterNotNull(serverProjections, "serverProjections"); |
| 856 | 901 | this.serverProjections = new ArrayList<>(serverProjections); |
| 857 | 902 | } |
| 858 | 903 | |
| … |
… |
public class ImageryInfo extends TileSourceInfo implements Comparable<ImageryInf
|
| 865 | 910 | ? ('['+(defaultMinZoom != 0 ? (Integer.toString(defaultMinZoom) + ',') : "")+defaultMaxZoom+']') : "") + ':' + url; |
| 866 | 911 | } |
| 867 | 912 | |
| | 913 | /** |
| | 914 | * Gets a unique toolbar key to store this layer as toolbar item |
| | 915 | * @return The kay. |
| | 916 | */ |
| 868 | 917 | public String getToolbarName() { |
| 869 | 918 | String res = name; |
| 870 | 919 | if (pixelPerDegree != 0) { |
| … |
… |
public class ImageryInfo extends TileSourceInfo implements Comparable<ImageryInf
|
| 873 | 922 | return res; |
| 874 | 923 | } |
| 875 | 924 | |
| | 925 | /** |
| | 926 | * Gets the name that should be displayed in the menu to add this imagery layer. |
| | 927 | * @return The text. |
| | 928 | */ |
| 876 | 929 | public String getMenuName() { |
| 877 | 930 | String res = name; |
| 878 | 931 | if (pixelPerDegree != 0) { |
| … |
… |
public class ImageryInfo extends TileSourceInfo implements Comparable<ImageryInf
|
| 1019 | 1072 | this.metadataHeaders = metadataHeaders; |
| 1020 | 1073 | } |
| 1021 | 1074 | |
| | 1075 | /** |
| | 1076 | * Gets the flag if epsg 4326 to 3857 is supported |
| | 1077 | * @return The flag. |
| | 1078 | */ |
| 1022 | 1079 | public boolean isEpsg4326To3857Supported() { |
| 1023 | 1080 | return isEpsg4326To3857Supported; |
| 1024 | 1081 | } |
| 1025 | 1082 | |
| | 1083 | /** |
| | 1084 | * Sets the flag that epsg 4326 to 3857 is supported |
| | 1085 | * @param isEpsg4326To3857Supported The flag. |
| | 1086 | */ |
| 1026 | 1087 | public void setEpsg4326To3857Supported(boolean isEpsg4326To3857Supported) { |
| 1027 | 1088 | this.isEpsg4326To3857Supported = isEpsg4326To3857Supported; |
| 1028 | 1089 | } |
| 1029 | 1090 | |
| | 1091 | /** |
| | 1092 | * Gets the flag if the georeference is valid. |
| | 1093 | * @return <code>true</code> if it is valid. |
| | 1094 | */ |
| 1030 | 1095 | public boolean isGeoreferenceValid() { |
| 1031 | 1096 | return isGeoreferenceValid; |
| 1032 | 1097 | } |
| 1033 | 1098 | |
| | 1099 | /** |
| | 1100 | * Sets an indicator that the georeference is valid |
| | 1101 | * @param isGeoreferenceValid <code>true</code> if it is marked as valid. |
| | 1102 | */ |
| 1034 | 1103 | public void setGeoreferenceValid(boolean isGeoreferenceValid) { |
| 1035 | 1104 | this.isGeoreferenceValid = isGeoreferenceValid; |
| 1036 | 1105 | } |
| … |
… |
public class ImageryInfo extends TileSourceInfo implements Comparable<ImageryInf
|
| 1066 | 1135 | if (i.defaultMinZoom != 0) { |
| 1067 | 1136 | n.defaultMinZoom = i.defaultMinZoom; |
| 1068 | 1137 | } |
| 1069 | | if (i.serverProjections != null) { |
| 1070 | | n.serverProjections = i.serverProjections; |
| 1071 | | } |
| | 1138 | n.setServerProjections(i.getServerProjections()); |
| 1072 | 1139 | n.url = i.url; |
| 1073 | 1140 | n.imageryType = i.imageryType; |
| 1074 | 1141 | if (i.getTileSize() != 0) { |