Changeset 9134 in josm for trunk/src/org/openstreetmap/josm/gui/layer/WMSLayer.java
- Timestamp:
- 2015-12-15T20:55:53+01:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/WMSLayer.java
r9078 r9134 14 14 import javax.swing.AbstractAction; 15 15 import javax.swing.Action; 16 import javax.swing.JOptionPane; 16 17 17 18 import org.apache.commons.jcs.access.CacheAccess; … … 29 30 import org.openstreetmap.josm.data.preferences.IntegerProperty; 30 31 import org.openstreetmap.josm.data.projection.Projection; 32 import org.openstreetmap.josm.gui.ExtendedDialog; 31 33 32 34 /** … … 113 115 @Override 114 116 public boolean isProjectionSupported(Projection proj) { 115 return supportedProjections == null || supportedProjections.isEmpty() || supportedProjections.contains(proj.toCode()); 117 return supportedProjections == null || supportedProjections.isEmpty() || supportedProjections.contains(proj.toCode()) || 118 (info.isEpsg4326To3857Supported() && supportedProjections.contains("EPSG:4326") && "EPSG:3857".equals(Main.getProjection().toCode())); 116 119 } 117 120 … … 124 127 String appendix = ""; 125 128 126 if ( supportedProjections.contains("EPSG:4326") && "EPSG:3857".equals(Main.getProjection().toCode())) {129 if (isReprojectionPossible()) { 127 130 appendix = ". " + tr("JOSM will use EPSG:4326 to query the server, but results may vary " 128 131 + "depending on the WMS server"); … … 133 136 @Override 134 137 public void projectionChanged(Projection oldValue, Projection newValue) { 135 super.projectionChanged(oldValue, newValue); 138 // do not call super - we need custom warning dialog 139 140 if (!isProjectionSupported(newValue)) { 141 String message = tr("The layer {0} does not support the new projection {1}.\n" 142 + " Supported projections are: {2}\n" 143 + "Change the projection again or remove the layer.", 144 getName(), newValue.toCode(), nameSupportedProjections()); 145 146 ExtendedDialog warningDialog = new ExtendedDialog(Main.parent, tr("Warning"), new String[]{tr("OK")}). 147 setContent(message). 148 setIcon(JOptionPane.WARNING_MESSAGE); 149 150 if (isReprojectionPossible()) { 151 warningDialog.toggleEnable("imagery.wms.projectionSupportWarnings." + tileSource.getBaseUrl()); 152 } 153 warningDialog.showDialog(); 154 } 136 155 137 156 if (!newValue.equals(oldValue) && tileSource instanceof TemplatedWMSTileSource) { … … 156 175 return AbstractCachedTileSourceLayer.getCache(CACHE_REGION_NAME); 157 176 } 177 178 private boolean isReprojectionPossible() { 179 return supportedProjections.contains("EPSG:4326") && "EPSG:3857".equals(Main.getProjection().toCode()); 180 } 158 181 }
Note:
See TracChangeset
for help on using the changeset viewer.