Changeset 4188 in josm for trunk/src/org/openstreetmap/josm/data
- Timestamp:
- 2011-07-01T09:27:15+02:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java
r3974 r4188 4 4 import java.util.ArrayList; 5 5 import java.util.Collection; 6 import java.util.regex.Matcher; 7 import java.util.regex.Pattern; 6 8 7 9 import org.openstreetmap.josm.io.OsmApi; … … 38 40 double pixelPerDegree = 0.0; 39 41 int maxZoom = 0; 42 int defaultMaxZoom = 0; 43 int defaultMinZoom = 0; 40 44 41 45 public ImageryInfo(String name) { … … 135 139 this.cookies=i.cookies; 136 140 this.imageryType=i.imageryType; 141 this.defaultMaxZoom=i.defaultMaxZoom; 137 142 this.pixelPerDegree=i.pixelPerDegree; 138 143 this.eulaAcceptanceRequired = null; … … 169 174 170 175 for (ImageryType type : ImageryType.values()) { 171 if (url.startsWith(type.getUrlString() + ":")) { 172 this.url = url.substring(type.getUrlString().length() + 1); 176 Matcher m = Pattern.compile(type.getUrlString()+"(?:\\[(?:(\\d+),)?(\\d+)\\])?:(.*)").matcher(url); 177 if(m.matches()) { 178 this.url = m.group(3); 173 179 this.imageryType = type; 180 if(m.group(2) != null) { 181 defaultMaxZoom = Integer.valueOf(m.group(2)); 182 maxZoom = defaultMaxZoom; 183 } 184 if(m.group(1) != null) { 185 defaultMinZoom = Integer.valueOf(m.group(1)); 186 } 174 187 return; 175 188 } … … 205 218 } 206 219 220 public int getMinZoom() { 221 return this.defaultMinZoom; 222 } 223 207 224 public String getFullUrl() { 208 return imageryType.getUrlString() + ":" + url; 225 return imageryType.getUrlString() + (defaultMaxZoom != 0 226 ? "["+(defaultMinZoom != 0 ? defaultMinZoom+",":"")+defaultMaxZoom+"]" : "") + ":" + url; 209 227 } 210 228 … … 223 241 if(pixelPerDegree != 0.0) { 224 242 res += " ("+pixelPerDegree+")"; 225 } else if(maxZoom != 0 ) {243 } else if(maxZoom != 0 && maxZoom != defaultMaxZoom) { 226 244 res += " (z"+maxZoom+")"; 227 245 }
Note:
See TracChangeset
for help on using the changeset viewer.