Changeset 4240 in josm for trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java
- Timestamp:
- 2011-07-14T12:48:27+02:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java
r4198 r4240 4 4 import java.util.ArrayList; 5 5 import java.util.Collection; 6 import java.util.Collections; 7 import java.util.List; 6 8 import java.util.regex.Matcher; 7 9 import java.util.regex.Pattern; … … 42 44 private String name; 43 45 private String url = null; 46 private boolean defaultEntry = false; 44 47 private String cookies = null; 45 48 private String eulaAcceptanceRequired= null; … … 50 53 private int defaultMinZoom = 0; 51 54 private Bounds bounds = null; 55 private List<String> serverProjections; 52 56 private String attributionText; 53 57 private String attributionImage; … … 55 59 private String termsOfUseURL; 56 60 61 public ImageryInfo() { 62 } 63 57 64 public ImageryInfo(String name) { 58 65 this.name=name; … … 61 68 public ImageryInfo(String name, String url) { 62 69 this.name=name; 63 setUrl(url); 70 setExtendedUrl(url); 64 71 } 65 72 66 73 public ImageryInfo(String name, String url, String eulaAcceptanceRequired) { 67 74 this.name=name; 68 setUrl(url); 75 setExtendedUrl(url); 69 76 this.eulaAcceptanceRequired = eulaAcceptanceRequired; 70 77 } … … 72 79 public ImageryInfo(String name, String url, String eulaAcceptanceRequired, String cookies) { 73 80 this.name=name; 74 setUrl(url); 81 setExtendedUrl(url); 75 82 this.cookies=cookies; 76 83 this.eulaAcceptanceRequired = eulaAcceptanceRequired; … … 79 86 public ImageryInfo(String name, String url, String cookies, double pixelPerDegree) { 80 87 this.name=name; 81 setUrl(url); 88 setExtendedUrl(url); 82 89 this.cookies=cookies; 83 90 this.pixelPerDegree=pixelPerDegree; … … 87 94 ArrayList<String> res = new ArrayList<String>(); 88 95 res.add(name); 89 res.add((url != null && !url.isEmpty()) ? get FullUrl() : null);96 res.add((url != null && !url.isEmpty()) ? getExtendedUrl() : null); 90 97 res.add(cookies); 91 98 if(imageryType == ImageryType.WMS || imageryType == ImageryType.HTML) { … … 106 113 this.name=array.get(0); 107 114 if(array.size() >= 2 && !array.get(1).isEmpty()) { 108 setUrl(array.get(1)); 115 setExtendedUrl(array.get(1)); 109 116 } 110 117 if(array.size() >= 3 && !array.get(2).isEmpty()) { … … 178 185 } 179 186 187 public void setDefaultMaxZoom(int defaultMaxZoom) { 188 this.defaultMaxZoom = defaultMaxZoom; 189 } 190 191 public void setDefaultMinZoom(int defaultMinZoom) { 192 this.defaultMinZoom = defaultMinZoom; 193 } 194 180 195 public void setMaxZoom(int maxZoom) { 181 196 this.maxZoom = maxZoom; … … 206 221 } 207 222 208 public void setUrl(String url) { 223 public void setExtendedUrl(String url) { 209 224 CheckParameterUtil.ensureParameterNotNull(url); 210 225 … … 244 259 } 245 260 261 public void setUrl(String url) { 262 this.url = url; 263 } 264 265 public boolean isDefaultEntry() { 266 return defaultEntry; 267 } 268 269 public void setDefaultEntry(boolean defaultEntry) { 270 this.defaultEntry = defaultEntry; 271 } 272 246 273 public String getCookies() { 247 274 return this.cookies; … … 264 291 } 265 292 266 public String getFullUrl() { 293 public void setEulaAcceptanceRequired(String eulaAcceptanceRequired) { 294 this.eulaAcceptanceRequired = eulaAcceptanceRequired; 295 } 296 297 /** 298 * Get the projections supported by the server. Only relevant for 299 * WMS-type ImageryInfo at the moment. 300 * @return null, if no projections have been specified; the list 301 * of supported projections otherwise. 302 */ 303 public List<String> getServerProjections() { 304 if (serverProjections == null) return null; 305 return Collections.unmodifiableList(serverProjections); 306 } 307 308 public void setServerProjections(Collection<String> serverProjections) { 309 this.serverProjections = new ArrayList<String>(serverProjections); 310 } 311 312 public String getExtendedUrl() { 267 313 return imageryType.getUrlString() + (defaultMaxZoom != 0 268 314 ? "["+(defaultMinZoom != 0 ? defaultMinZoom+",":"")+defaultMaxZoom+"]" : "") + ":" + url; … … 331 377 public ImageryType getImageryType() { 332 378 return imageryType; 379 } 380 381 public void setImageryType(ImageryType imageryType) { 382 this.imageryType = imageryType; 333 383 } 334 384
Note:
See TracChangeset
for help on using the changeset viewer.
