Changeset 14399 in josm for trunk/src/org
- Timestamp:
- 2018-11-02T00:07:28+01:00 (6 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data/imagery
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/imagery/AbstractWMSTileSource.java
r13733 r14399 226 226 double e = se.getX(); 227 227 228 return ( 229 switchLatLon ? 230 String.format("%s,%s,%s,%s", 231 LATLON_FORMAT.format(s), LATLON_FORMAT.format(w), LATLON_FORMAT.format(n), LATLON_FORMAT.format(e)) 232 : 233 String.format("%s,%s,%s,%s", 234 LATLON_FORMAT.format(w), LATLON_FORMAT.format(s), LATLON_FORMAT.format(e), LATLON_FORMAT.format(n)) 235 236 ); 228 return switchLatLon ? 229 getBboxstr(s, w, n, e) 230 : getBboxstr(w, s, e, n); 231 } 232 233 private final String getBboxstr(double x1, double x2, double x3, double x4) { 234 return new StringBuilder(64) 235 .append(LATLON_FORMAT.format(x1)) 236 .append(',') 237 .append(LATLON_FORMAT.format(x2)) 238 .append(',') 239 .append(LATLON_FORMAT.format(x3)) 240 .append(',') 241 .append(LATLON_FORMAT.format(x4)) 242 .toString(); 237 243 } 238 244 } -
trunk/src/org/openstreetmap/josm/data/imagery/TemplatedWMSTileSource.java
r14120 r14399 51 51 }; 52 52 53 private final boolean switchLatLon; 53 54 /** 54 55 * Creates a tile source based on imagery info … … 62 63 handleTemplate(); 63 64 initProjection(); 65 // Bounding box coordinates have to be switched for WMS 1.3.0 EPSG:4326. 66 // 67 // Background: 68 // 69 // bbox=x_min,y_min,x_max,y_max 70 // 71 // SRS=... is WMS 1.1.1 72 // CRS=... is WMS 1.3.0 73 // 74 // The difference: 75 // For SRS x is east-west and y is north-south 76 // For CRS x and y are as specified by the EPSG 77 // E.g. [1] lists lat as first coordinate axis and lot as second, so it is switched for EPSG:4326. 78 // For most other EPSG code there seems to be no difference. 79 // CHECKSTYLE.OFF: LineLength 80 // [1] https://www.epsg-registry.org/report.htm?type=selection&entity=urn:ogc:def:crs:EPSG::4326&reportDetail=short&style=urn:uuid:report-style:default-with-code&style_name=OGP%20Default%20With%20Code&title=EPSG:4326 81 // CHECKSTYLE.ON: LineLength 82 if (baseUrl.toLowerCase(Locale.US).contains("crs=epsg:4326")) { 83 switchLatLon = true; 84 } else if (baseUrl.toLowerCase(Locale.US).contains("crs=")) { 85 // assume WMS 1.3.0 86 switchLatLon = ProjectionRegistry.getProjection().switchXY(); 87 } else { 88 switchLatLon = false; 89 } 64 90 } 65 91 … … 86 112 } 87 113 88 // Bounding box coordinates have to be switched for WMS 1.3.0 EPSG:4326.89 //90 // Background:91 //92 // bbox=x_min,y_min,x_max,y_max93 //94 // SRS=... is WMS 1.1.195 // CRS=... is WMS 1.3.096 //97 // The difference:98 // For SRS x is east-west and y is north-south99 // For CRS x and y are as specified by the EPSG100 // E.g. [1] lists lat as first coordinate axis and lot as second, so it is switched for EPSG:4326.101 // For most other EPSG code there seems to be no difference.102 // CHECKSTYLE.OFF: LineLength103 // [1] https://www.epsg-registry.org/report.htm?type=selection&entity=urn:ogc:def:crs:EPSG::4326&reportDetail=short&style=urn:uuid:report-style:default-with-code&style_name=OGP%20Default%20With%20Code&title=EPSG:4326104 // CHECKSTYLE.ON: LineLength105 boolean switchLatLon = false;106 if (baseUrl.toLowerCase(Locale.US).contains("crs=epsg:4326")) {107 switchLatLon = true;108 } else if (baseUrl.toLowerCase(Locale.US).contains("crs=")) {109 // assume WMS 1.3.0110 switchLatLon = ProjectionRegistry.getProjection().switchXY();111 }112 String bbox = getBbox(zoom, tilex, tiley, switchLatLon);113 114 114 // Using StringBuffer and generic PATTERN_PARAM matcher gives 2x performance improvement over replaceAll 115 115 StringBuffer url = new StringBuffer(baseUrl.length()); … … 125 125 break; 126 126 case "bbox": 127 replacement = bbox;127 replacement = getBbox(zoom, tilex, tiley, switchLatLon); 128 128 break; 129 129 case "w": -
trunk/src/org/openstreetmap/josm/data/imagery/WMSEndpointTileSource.java
r14214 r14399 60 60 @Override 61 61 public String getTileUrl(int zoom, int tilex, int tiley) { 62 String bbox = getBbox(zoom, tilex, tiley, !wmsi.belowWMS130() && getTileProjection().switchXY());63 64 62 // Using StringBuffer and generic PATTERN_PARAM matcher gives 2x performance improvement over replaceAll 65 63 StringBuffer url = new StringBuffer(urlPattern.length()); … … 72 70 break; 73 71 case "bbox": 74 replacement = bbox;72 replacement = getBbox(zoom, tilex, tiley, !wmsi.belowWMS130() && getTileProjection().switchXY()); 75 73 break; 76 74 case "width":
Note:
See TracChangeset
for help on using the changeset viewer.