Changeset 13674 in josm
- Timestamp:
- 2018-04-24T21:32:50+02:00 (7 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/layer
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java
r13387 r13674 1208 1208 1209 1209 protected void sanitize() { 1210 if (minX < tileSource.getTileXMin(zoom)) { 1211 minX = tileSource.getTileXMin(zoom); 1212 } 1213 if (minY < tileSource.getTileYMin(zoom)) { 1214 minY = tileSource.getTileYMin(zoom); 1215 } 1216 if (maxX > tileSource.getTileXMax(zoom)) { 1217 maxX = tileSource.getTileXMax(zoom); 1218 } 1219 if (maxY > tileSource.getTileYMax(zoom)) { 1220 maxY = tileSource.getTileYMax(zoom); 1221 } 1210 minX = Utils.clamp(minX, tileSource.getTileXMin(zoom), tileSource.getTileXMax(zoom)); 1211 maxX = Utils.clamp(maxX, tileSource.getTileXMin(zoom), tileSource.getTileXMax(zoom)); 1212 minY = Utils.clamp(minY, tileSource.getTileYMin(zoom), tileSource.getTileYMax(zoom)); 1213 maxY = Utils.clamp(maxY, tileSource.getTileYMin(zoom), tileSource.getTileYMax(zoom)); 1222 1214 } 1223 1215 -
trunk/src/org/openstreetmap/josm/gui/layer/WMSLayer.java
r13206 r13674 18 18 import org.openstreetmap.josm.Main; 19 19 import org.openstreetmap.josm.data.cache.BufferedImageCacheEntry; 20 import org.openstreetmap.josm.data.coor.LatLon; 20 21 import org.openstreetmap.josm.data.imagery.AbstractWMSTileSource; 21 22 import org.openstreetmap.josm.data.imagery.ImageryInfo; … … 28 29 import org.openstreetmap.josm.data.projection.Projection; 29 30 import org.openstreetmap.josm.data.projection.Projections; 31 import org.openstreetmap.josm.gui.MainApplication; 30 32 import org.openstreetmap.josm.gui.layer.imagery.TileSourceDisplaySettings; 31 33 import org.openstreetmap.josm.tools.CheckParameterUtil; … … 130 132 return requested; 131 133 } else { 134 LatLon center = MainApplication.isDisplayingMapView() ? 135 requested.eastNorth2latlon(MainApplication.getMap().mapView.getCenter()) : null; 136 Projection firstNonNullproj = null; 137 Projection firstProjInBounds = null; 132 138 for (String code : serverProjections) { 133 139 Projection proj = Projections.getProjectionByCode(code); 134 140 if (proj != null) { 135 Logging.info(tr("Reprojecting layer {0} from {1} to {2}. For best image quality and performance," 136 + " switch to one of the supported projections: {3}", 137 getName(), proj.toCode(), Main.getProjection().toCode(), Utils.join(", ", getNativeProjections()))); 138 return proj; 141 if (firstNonNullproj == null) { 142 firstNonNullproj = proj; 143 } 144 if (center != null && proj.getWorldBoundsLatLon().contains(center)) { 145 firstProjInBounds = proj; 146 break; 147 } 139 148 } 149 } 150 if (firstProjInBounds != null) { 151 return selectProjection(firstProjInBounds); 152 } else if (firstNonNullproj != null) { 153 return selectProjection(firstNonNullproj); 140 154 } 141 155 Logging.warn(tr("Unable to find supported projection for layer {0}. Using {1}.", getName(), requested.toCode())); 142 156 return requested; 143 157 } 158 } 159 160 private Projection selectProjection(Projection proj) { 161 Logging.info(tr("Reprojecting layer {0} from {1} to {2}. For best image quality and performance," 162 + " switch to one of the supported projections: {3}", 163 getName(), proj.toCode(), Main.getProjection().toCode(), Utils.join(", ", getNativeProjections()))); 164 return proj; 144 165 } 145 166
Note:
See TracChangeset
for help on using the changeset viewer.