Changeset 35456 in osm for applications/viewer/jmapviewer
- Timestamp:
- 2020-05-17T12:09:32+02:00 (5 years ago)
- Location:
- applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/tilesources
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/tilesources/BingAerialTileSource.java
r35329 r35456 17 17 import java.util.logging.Logger; 18 18 import java.util.regex.Pattern; 19 import java.util.stream.Collectors; 19 20 20 21 import javax.xml.parsers.DocumentBuilder; … … 290 291 if (data == null) 291 292 return "Error loading Bing attribution data"; 292 StringBuilder a = new StringBuilder(); 293 for (Attribution attr : data) { 294 if (zoom <= attr.maxZoom && zoom >= attr.minZoom) { 295 if (topLeft.getLon() < attr.max.getLon() && botRight.getLon() > attr.min.getLon() 296 && topLeft.getLat() > attr.min.getLat() && botRight.getLat() < attr.max.getLat()) { 297 a.append(attr.attributionText); 298 a.append(' '); 299 } 300 } 301 } 302 return a.toString(); 293 return data.stream() 294 .filter(attr -> zoom <= attr.maxZoom && zoom >= attr.minZoom) 295 .filter(attr -> topLeft.getLon() < attr.max.getLon() && botRight.getLon() > attr.min.getLon()) 296 .filter(attr -> topLeft.getLat() > attr.min.getLat() && botRight.getLat() < attr.max.getLat()) 297 .map(attr -> attr.attributionText) 298 .collect(Collectors.joining(" ")); 303 299 } catch (RuntimeException e) { 304 300 e.printStackTrace(); -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/tilesources/TemplatedTMSTileSource.java
r35421 r35456 3 3 4 4 import java.io.IOException; 5 import java.util.Arrays; 5 6 import java.util.HashMap; 6 7 import java.util.Map; … … 187 188 Matcher m = Pattern.compile("\\{[^}]*\\}").matcher(url); 188 189 while (m.find()) { 189 boolean isSupportedPattern = false; 190 for (Pattern pattern : ALL_PATTERNS) { 191 if (pattern.matcher(m.group()).matches()) { 192 isSupportedPattern = true; 193 break; 194 } 195 } 190 boolean isSupportedPattern = Arrays.stream(ALL_PATTERNS).anyMatch(pattern -> pattern.matcher(m.group()).matches()); 196 191 if (!isSupportedPattern) { 197 192 throw new IllegalArgumentException(
Note:
See TracChangeset
for help on using the changeset viewer.