Changeset 24615 in osm for applications
- Timestamp:
- 2010-12-06T15:34:54+01:00 (14 years ago)
- Location:
- applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/ImageryLayer.java
r24584 r24615 8 8 import java.awt.Toolkit; 9 9 import java.awt.event.ActionEvent; 10 import java.awt.image.BufferedImage; 11 import java.awt.image.BufferedImageOp; 12 import java.awt.image.ConvolveOp; 13 import java.awt.image.Kernel; 10 14 import java.util.List; 11 15 … … 41 45 protected double dy = 0.0; 42 46 47 protected int sharpenLevel; 48 43 49 public ImageryLayer(ImageryInfo info) { 44 50 super(info.getName()); 45 51 this.info = info; 46 52 this.mv = Main.map.mapView; 53 this.sharpenLevel = ImageryPreferences.PROP_SHARPEN_LEVEL.get(); 47 54 } 48 55 … … 175 182 } 176 183 184 public BufferedImage sharpenImage(BufferedImage img) { 185 if (sharpenLevel <= 0) return img; 186 int width = img.getWidth(null); 187 int height = img.getHeight(null); 188 BufferedImage tmp = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); 189 tmp.getGraphics().drawImage(img, 0, 0, null); 190 Kernel kernel; 191 if (sharpenLevel == 1) { 192 kernel = new Kernel(2, 2, new float[] { 4, -1, -1, -1}); 193 } else { 194 kernel = new Kernel(3, 3, new float[] { -1, -1, -1, -1, 9, -1, -1, -1, -1}); 195 } 196 BufferedImageOp op = new ConvolveOp(kernel, ConvolveOp.EDGE_NO_OP, null); 197 return op.filter(tmp, null); 198 } 177 199 } -
applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/ImageryPlugin.java
r24584 r24615 57 57 /** RemoteControlPlugin older than this SVN revision is not compatible */ 58 58 final int REMOTECONTROL_MIN_REVISION = 22734; 59 /** WMSPlugin needs this specific API major version of RemoteControlPlugin */59 /** Imagery Plugin needs this specific API major version of RemoteControlPlugin */ 60 60 final int REMOTECONTROL_NEED_API_MAJOR = 1; 61 61 /** All API minor versions starting from this should be compatible */ -
applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/ImageryPreferenceEditor.java
r24584 r24615 38 38 ImageryProvidersPanel imageryProviders; 39 39 40 WMSAdapter wmsAdapter = ImageryPlugin.wmsAdapter; 41 ImageryPlugin plugin = ImageryPlugin.instance; 42 40 43 // Common settings 41 44 private Color colFadeColor; … … 43 46 private JSlider fadeAmount = new JSlider(0, 100); 44 47 private JCheckBox remoteCheckBox; 45 boolean allowRemoteControl = true; 48 private JComboBox sharpen; 49 private boolean allowRemoteControl = true; 46 50 47 51 // WMS Settings … … 51 55 JSpinner spinNorth; 52 56 JSpinner spinSimConn; 53 WMSAdapter wmsAdapter = ImageryPlugin.wmsAdapter;54 ImageryPlugin plugin = ImageryPlugin.instance;55 57 56 58 //TMS settings controls … … 98 100 p.add(remoteCheckBox,GBC.eol().fill(GBC.HORIZONTAL)); 99 101 102 this.sharpen = new JComboBox(new String[] { 103 tr("None"), 104 tr("Soft"), 105 tr("Strong")}); 106 p.add(new JLabel(tr("Sharpen (requires layer re-add): "))); 107 p.add(GBC.glue(5, 0), GBC.std().fill(GBC.HORIZONTAL)); 108 p.add(this.sharpen, GBC.std().fill(GBC.HORIZONTAL)); 109 this.sharpen.setSelectedIndex(ImageryPreferences.PROP_SHARPEN_LEVEL.get()); 110 100 111 return p; 101 112 } … … 109 120 "webkit-image-gtk {0}"}); 110 121 browser.setEditable(true); 111 browser.setSelectedItem( Main.pref.get("wmsplugin.browser", "webkit-image {0}"));122 browser.setSelectedItem(wmsAdapter.PROP_BROWSER.get()); 112 123 p.add(new JLabel(tr("Downloader:")), GBC.eol().fill(GBC.HORIZONTAL)); 113 124 p.add(browser); … … 219 230 allowRemoteControl = remoteCheckBox.getModel().isSelected(); 220 231 221 Main.pref.put("wmsplugin.browser", browser.getEditor().getItem().toString()); 222 232 Main.pref.put("imagery.wms.browser", browser.getEditor().getItem().toString()); 223 233 224 234 TMSPreferences.PROP_DEFAULT_AUTOZOOM.put(this.autozoomActive.isSelected()); … … 227 237 TMSPreferences.setMinZoomLvl((Integer)this.minZoomLvl.getValue()); 228 238 229 ImageryPreferences.PROP_REMOTE_CONTROL.put(allowRemoteControl);230 239 ImageryPreferences.PROP_FADE_AMOUNT.put(this.fadeAmount.getValue()); 231 240 ImageryPreferences.setFadeColor(this.colFadeColor); 241 ImageryPreferences.PROP_REMOTE_CONTROL.put(allowRemoteControl); 242 ImageryPreferences.PROP_SHARPEN_LEVEL.put(sharpen.getSelectedIndex()); 232 243 233 244 return false; -
applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/ImageryPreferences.java
r24584 r24615 8 8 9 9 public class ImageryPreferences { 10 11 10 public static final BooleanProperty PROP_REMOTE_CONTROL = new BooleanProperty("imagery.remotecontrol", true); 12 11 public static final IntegerProperty PROP_FADE_AMOUNT = new IntegerProperty("imagery.fade_amount", 0); 12 public static final IntegerProperty PROP_SHARPEN_LEVEL = new IntegerProperty("imagery.sharpen_level", 0); 13 13 14 14 public static Color getFadeColor() { -
applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/tms/TMSLayer.java
r24584 r24615 53 53 import org.openstreetmap.josm.gui.layer.Layer; 54 54 import org.openstreetmap.josm.plugins.imagery.ImageryInfo; 55 import org.openstreetmap.josm.plugins.imagery.ImageryInfo.ImageryType; 55 56 import org.openstreetmap.josm.plugins.imagery.ImageryLayer; 56 57 import org.openstreetmap.josm.plugins.imagery.ImageryPreferences; 57 import org.openstreetmap.josm.plugins.imagery.ImageryInfo.ImageryType;58 58 59 59 /** … … 85 85 Main.map.repaint(100); 86 86 tileRequestsOutstanding.remove(tile); 87 if (sharpenLevel != 0) tile.setImage(sharpenImage(tile.getImage())); 87 88 if (debug) 88 89 out("tileLoadingFinished() tile: " + tile + " success: " + success); -
applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/wms/GeorefImage.java
r24548 r24615 97 97 } 98 98 default: 99 this.image = layer.sharpenImage(this.image); 99 100 break; 100 101 } -
applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/wms/HTMLGrabber.java
r24501 r24615 10 10 import javax.imageio.ImageIO; 11 11 12 import org.openstreetmap.josm.Main;13 12 import org.openstreetmap.josm.gui.MapView; 14 13 import org.openstreetmap.josm.io.CacheFiles; 14 import org.openstreetmap.josm.plugins.imagery.ImageryPlugin; 15 15 16 16 public class HTMLGrabber extends WMSGrabber { … … 27 27 ArrayList<String> cmdParams = new ArrayList<String>(); 28 28 StringTokenizer st = new StringTokenizer(MessageFormat.format( 29 Main.pref.get("wmsplugin.browser", "webkit-image {0}"), urlstring));29 ImageryPlugin.wmsAdapter.PROP_BROWSER.get(), urlstring)); 30 30 while( st.hasMoreTokens() ) 31 31 cmdParams.add(st.nextToken()); -
applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/wms/WMSAdapter.java
r24555 r24615 4 4 import org.openstreetmap.josm.data.preferences.BooleanProperty; 5 5 import org.openstreetmap.josm.data.preferences.IntegerProperty; 6 import org.openstreetmap.josm.data.preferences.StringProperty; 6 7 import org.openstreetmap.josm.gui.MapView; 7 8 import org.openstreetmap.josm.io.CacheFiles; … … 14 15 CacheFiles cache = new CacheFiles("wmsplugin"); 15 16 16 public final IntegerProperty PROP_SIMULTANEOUS_CONNECTIONS = new IntegerProperty("wmsplugin.simultaneousConnections", 3); 17 public final BooleanProperty PROP_OVERLAP = new BooleanProperty("wmsplugin.url.overlap", false); 18 public final IntegerProperty PROP_OVERLAP_EAST = new IntegerProperty("wmsplugin.url.overlapEast", 14); 19 public final IntegerProperty PROP_OVERLAP_NORTH = new IntegerProperty("wmsplugin.url.overlapNorth", 4); 17 public final StringProperty PROP_BROWSER = new StringProperty("imagery.wms.browser", "webkit-image {0}"); 18 public final IntegerProperty PROP_SIMULTANEOUS_CONNECTIONS = new IntegerProperty("imagery.wms.simultaneousConnections", 3); 19 public final BooleanProperty PROP_OVERLAP = new BooleanProperty("imagery.wms.overlap", false); 20 public final IntegerProperty PROP_OVERLAP_EAST = new IntegerProperty("imagery.wms.overlapEast", 14); 21 public final IntegerProperty PROP_OVERLAP_NORTH = new IntegerProperty("imagery.wms.overlapNorth", 4); 20 22 21 23 protected void initExporterAndImporter() { -
applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/wms/WMSGrabber.java
r24555 r24615 170 170 if(layer.getInfo().getCookies() != null && !layer.getInfo().getCookies().equals("")) 171 171 conn.setRequestProperty("Cookie", layer.getInfo().getCookies()); 172 conn.setRequestProperty("User-Agent", Main.pref.get(" wmsplugin.user_agent", Version.getInstance().getAgentString()));173 conn.setConnectTimeout(Main.pref.getInteger(" wmsplugin.timeout.connect", 30) * 1000);174 conn.setReadTimeout(Main.pref.getInteger(" wmsplugin.timeout.read", 30) * 1000);172 conn.setRequestProperty("User-Agent", Main.pref.get("imagery.wms.user_agent", Version.getInstance().getAgentString())); 173 conn.setConnectTimeout(Main.pref.getInteger("imagery.wms.timeout.connect", 30) * 1000); 174 conn.setReadTimeout(Main.pref.getInteger("imagery.wms.timeout.read", 30) * 1000); 175 175 176 176 String contentType = conn.getHeaderField("Content-Type"); -
applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/wms/WMSLayer.java
r24584 r24615 54 54 public class WMSLayer extends ImageryLayer implements PreferenceChangedListener { 55 55 56 public static final BooleanProperty PROP_ALPHA_CHANNEL = new BooleanProperty(" wmsplugin.alpha_channel", true);56 public static final BooleanProperty PROP_ALPHA_CHANNEL = new BooleanProperty("imagery.wms.alpha_channel", true); 57 57 WMSAdapter plugin = ImageryPlugin.wmsAdapter; 58 58
Note:
See TracChangeset
for help on using the changeset viewer.