[DebianGIS-dev] [SCM] josm-plugins branch, master, updated. debian/0.0.svn21666-1-1-g219d38f
David Paleino
dapal at debian.org
Thu Jun 17 11:37:14 UTC 2010
The following commit has been merged in the master branch:
commit 219d38f19144976ff9198bacfe1576c755923f27
Author: David Paleino <dapal at debian.org>
Date: Thu Jun 17 13:36:12 2010 +0200
debian/patches/160-wmsplugin_max-connections.patch added, thanks to Matteo Gottardi.
diff --git a/debian/changelog b/debian/changelog
index 34d9723..9e09590 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+josm-plugins (0.0.svn21666-2) UNRELEASED; urgency=low
+
+ * debian/patches/160-wmsplugin_max-connections.patch added,
+ thanks to Matteo Gottardi.
+
+ -- David Paleino <dapal at debian.org> Thu, 17 Jun 2010 13:35:45 +0200
+
josm-plugins (0.0.svn21666-1) unstable; urgency=low
* Updated to revision 21666
diff --git a/debian/patches/160-wmsplugin_max-connections.patch b/debian/patches/160-wmsplugin_max-connections.patch
new file mode 100644
index 0000000..6f36d16
--- /dev/null
+++ b/debian/patches/160-wmsplugin_max-connections.patch
@@ -0,0 +1,121 @@
+From: Matteo Gottardi <matgott at tin.it>
+Date: Wed, 16 Jun 2010 12:05:59 +0200
+Subject: [PATCH] max number of concurrent connections
+
+---
+ wmsplugin/src/wmsplugin/WMSLayer.java | 15 +++++++++++++--
+ wmsplugin/src/wmsplugin/WMSPlugin.java | 6 ++++++
+ wmsplugin/src/wmsplugin/WMSPreferenceEditor.java | 13 ++++++++++++-
+ 3 files changed, 31 insertions(+), 3 deletions(-)
+
+--- josm-plugins.orig/wmsplugin/src/wmsplugin/WMSLayer.java
++++ josm-plugins/wmsplugin/src/wmsplugin/WMSLayer.java
+@@ -37,12 +37,14 @@ import org.openstreetmap.josm.gui.dialog
+ import org.openstreetmap.josm.gui.layer.Layer;
+ import org.openstreetmap.josm.io.CacheFiles;
+ import org.openstreetmap.josm.tools.ImageProvider;
++import org.openstreetmap.josm.data.Preferences.PreferenceChangeEvent;
++import org.openstreetmap.josm.data.Preferences.PreferenceChangedListener;
+
+ /**
+ * This is a layer that grabs the current screen from an WMS server. The data
+ * fetched this way is tiled and managed to the disc to reduce server load.
+ */
+-public class WMSLayer extends Layer {
++public class WMSLayer extends Layer implements PreferenceChangedListener {
+ protected static final Icon icon =
+ new ImageIcon(Toolkit.getDefaultToolkit().createImage(WMSPlugin.class.getResource("/images/wms_small.png")));
+
+@@ -96,7 +98,7 @@ public class WMSLayer extends Layer {
+ }
+ resolution = mv.getDist100PixelText();
+
+- executor = Executors.newFixedThreadPool(3);
++ executor = Executors.newFixedThreadPool( Main.pref.getInteger("wmsplugin.numThreads", WMSPlugin.simultaneousConnections) );
+ if (baseURL != null && !baseURL.startsWith("html:") && !WMSGrabber.isUrlWithPatterns(baseURL)) {
+ if (!(baseURL.endsWith("&") || baseURL.endsWith("?"))) {
+ if (!confirmMalformedUrl(baseURL)) {
+@@ -109,6 +111,8 @@ public class WMSLayer extends Layer {
+ }
+ }
+ }
++
++ Main.pref.addPreferenceChangeListener(this);
+ }
+
+ public boolean hasAutoDownload(){
+@@ -475,4 +479,11 @@ public class WMSLayer extends Layer {
+ WMSPlugin.refreshMenu();
+ }
+ }
++
++ public void preferenceChanged(PreferenceChangeEvent event) {
++ if (event.getKey().equals("wmsplugin.simultaneousConnections")) {
++ executor.shutdownNow();
++ executor = Executors.newFixedThreadPool( Main.pref.getInteger("wmsplugin.numThreads", WMSPlugin.simultaneousConnections) );
++ }
++ }
+ }
+--- josm-plugins.orig/wmsplugin/src/wmsplugin/WMSPlugin.java
++++ josm-plugins/wmsplugin/src/wmsplugin/WMSPlugin.java
+@@ -52,6 +52,7 @@ public class WMSPlugin extends Plugin {
+ static boolean doOverlap = false;
+ static int overlapEast = 14;
+ static int overlapNorth = 4;
++ static int simultaneousConnections = 3;
+
+ // remember state of menu item to restore on changed preferences
+ static private boolean menuEnabled = false;
+@@ -110,6 +111,11 @@ public class WMSPlugin extends Plugin {
+ overlapNorth = Integer.valueOf(prefs.get("wmsplugin.url.overlapNorth"));
+ } catch (Exception e) {} // If sth fails, we drop to default settings.
+
++ // Load the settings for number of simultaneous connections
++ try {
++ simultaneousConnections = Integer.valueOf(prefs.get("wmsplugin.simultanousConnections"));
++ } catch (Exception e) {} // If sth fails, we drop to default settings.
++
+ // And then the names+urls of WMS servers
+ int prefid = 0;
+ String name = null;
+--- josm-plugins.orig/wmsplugin/src/wmsplugin/WMSPreferenceEditor.java
++++ josm-plugins/wmsplugin/src/wmsplugin/WMSPreferenceEditor.java
+@@ -38,6 +38,7 @@ public class WMSPreferenceEditor impleme
+ JCheckBox overlapCheckBox;
+ JSpinner spinEast;
+ JSpinner spinNorth;
++ JSpinner spinSimConn;
+
+ public void addGui(final PreferenceTabbedPane gui) {
+ JPanel p = gui.createPreferenceTab("wms", tr("WMS Plugin Preferences"), tr("Modify list of WMS servers displayed in the WMS plugin menu"));
+@@ -180,6 +181,15 @@ public class WMSPreferenceEditor impleme
+ overlapPanel.add(spinNorth);
+
+ p.add(overlapPanel);
++
++ // Simultaneous connections
++ p.add(Box.createHorizontalGlue(), GBC.eol().fill(GridBagConstraints.HORIZONTAL));
++ JLabel labelSimConn = new JLabel(tr("Simultaneous connections"));
++ spinSimConn = new JSpinner(new SpinnerNumberModel(WMSPlugin.simultaneousConnections, 1, 30, 1));
++ JPanel overlapPanelSimConn = new JPanel(new FlowLayout());
++ overlapPanelSimConn.add(labelSimConn);
++ overlapPanelSimConn.add(spinSimConn);
++ p.add(overlapPanelSimConn);
+ }
+
+ public boolean ok() {
+@@ -222,12 +232,13 @@ public class WMSPreferenceEditor impleme
+ WMSPlugin.doOverlap = overlapCheckBox.getModel().isSelected();
+ WMSPlugin.overlapEast = (Integer) spinEast.getModel().getValue();
+ WMSPlugin.overlapNorth = (Integer) spinNorth.getModel().getValue();
++ WMSPlugin.simultaneousConnections = (Integer) spinSimConn.getModel().getValue();
+
+ Main.pref.put("wmsplugin.url.overlap", String.valueOf(WMSPlugin.doOverlap));
+ Main.pref.put("wmsplugin.url.overlapEast", String.valueOf(WMSPlugin.overlapEast));
+ Main.pref.put("wmsplugin.url.overlapNorth", String.valueOf(WMSPlugin.overlapNorth));
+
+- Main.pref.put("wmsplugin.browser", browser.getEditor().getItem().toString());
++ Main.pref.put("wmsplugin.simultaneousConnections", String.valueOf(WMSPlugin.simultaneousConnections));
+ return false;
+ }
+
diff --git a/debian/patches/series b/debian/patches/series
index 18bf2fc..b7b6e34 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -10,3 +10,4 @@
30_slippymap.diff
20_livegps.diff
10_colorscheme.diff
+160-wmsplugin_max-connections.patch
--
Plugins for josm
More information about the Pkg-grass-devel
mailing list