[josm-plugins] 02/06: Imported Upstream version 0.0.svn30893+ds1
Bas Couwenberg
sebastic at xs4all.nl
Wed Dec 31 19:12:42 UTC 2014
This is an automated email from the git hooks/post-receive script.
sebastic-guest pushed a commit to branch master
in repository josm-plugins.
commit cab0c231c67f68457b64573e8e53920cfe103c74
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date: Wed Dec 31 19:53:04 2014 +0100
Imported Upstream version 0.0.svn30893+ds1
---
build-common.xml | 2 +-
.../josm/plugins/lakewalker/Lakewalker.java | 9 ++-------
.../josm/plugins/lakewalker/LakewalkerAction.java | 23 ++++++++--------------
.../josm/plugins/lakewalker/LakewalkerPlugin.java | 8 ++++++--
.../josm/plugins/lakewalker/LakewalkerWMS.java | 7 ++-----
svn-info.xml | 10 +++++-----
6 files changed, 24 insertions(+), 35 deletions(-)
diff --git a/build-common.xml b/build-common.xml
index a910070..8a1ad80 100644
--- a/build-common.xml
+++ b/build-common.xml
@@ -14,7 +14,7 @@
<property name="josm" location="../../core/dist/josm-custom.jar"/>
<property name="josm.test.build.dir" location="../../core/test/build"/>
- <property name="groovy.jar" location="../00_core_tools/groovy-all-2.3.7.jar"/>
+ <property name="groovy.jar" location="../00_core_tools/groovy-all-2.3.9.jar"/>
<property name="plugin.build.dir" location="build"/>
<property name="plugin.test.dir" location="test"/>
<property name="plugin.src.dir" location="src"/>
diff --git a/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/Lakewalker.java b/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/Lakewalker.java
index 69ad9a0..1d9e825 100644
--- a/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/Lakewalker.java
+++ b/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/Lakewalker.java
@@ -2,7 +2,6 @@ package org.openstreetmap.josm.plugins.lakewalker;
import static org.openstreetmap.josm.tools.I18n.tr;
-import java.io.File;
import java.util.ArrayList;
import java.util.List;
@@ -18,23 +17,19 @@ public class Lakewalker {
private String startdir;
private String wmslayer;
- private File workingdir;
-
private int[] dirslat = new int[] {0,1,1,1,0,-1,-1,-1};
private int[] dirslon = new int[] {1,1,0,-1,-1,-1,0,1};
double start_radius_big = 0.001;
double start_radius_small = 0.0002;
- public Lakewalker(int waylen, int maxnode, int threshold, double epsilon, int resolution, int tilesize, String startdir, String wmslayer, File workingdir){
+ public Lakewalker(int waylen, int maxnode, int threshold, double epsilon, int resolution, int tilesize, String startdir, String wmslayer){
this.maxnode = maxnode;
this.threshold = threshold;
this.resolution = resolution;
this.tilesize = tilesize;
this.startdir = startdir;
this.wmslayer = wmslayer;
-
- this.workingdir = workingdir;
}
/**
@@ -87,7 +82,7 @@ public class Lakewalker {
try {
- LakewalkerWMS wms = new LakewalkerWMS(this.resolution, this.tilesize, this.wmslayer, this.workingdir);
+ LakewalkerWMS wms = new LakewalkerWMS(this.resolution, this.tilesize, this.wmslayer);
LakewalkerBBox bbox = new LakewalkerBBox(tl_lat,tl_lon,br_lat,br_lon);
Boolean detect_loop = false;
diff --git a/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerAction.java b/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerAction.java
index ca157ba..062393c 100644
--- a/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerAction.java
+++ b/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerAction.java
@@ -75,8 +75,7 @@ class LakewalkerAction extends JosmAction implements MouseListener {
final long maxCacheSize = Main.pref.getInteger(LakewalkerPreferences.PREF_MAXCACHESIZE, 300)*1024*1024L;
for (String wmsFolder : LakewalkerPreferences.WMSLAYERS) {
- String wmsCacheDirName = Main.pref.getPreferencesDir()+"plugins/Lakewalker/"+wmsFolder;
- File wmsCacheDir = new File(wmsCacheDirName);
+ File wmsCacheDir = new File(LakewalkerPlugin.getLakewalkerCacheDir(), wmsFolder);
if (wmsCacheDir.exists() && wmsCacheDir.isDirectory()) {
File wmsCache[] = wmsCacheDir.listFiles();
@@ -106,30 +105,23 @@ class LakewalkerAction extends JosmAction implements MouseListener {
cacheEntry.delete();
}
}
-
} else {
// create cache directory
if (!wmsCacheDir.mkdirs()) {
- JOptionPane.showMessageDialog(Main.parent, tr("Error creating cache directory: {0}", wmsCacheDirName));
+ JOptionPane.showMessageDialog(Main.parent,
+ tr("Error creating cache directory: {0}", wmsCacheDir.getPath()));
}
}
}
}
protected void lakewalk(Point clickPoint){
- /**
- * Positional data
- */
+ // Positional data
final LatLon pos = Main.map.mapView.getLatLon(clickPoint.x, clickPoint.y);
final LatLon topLeft = Main.map.mapView.getLatLon(0, 0);
final LatLon botRight = Main.map.mapView.getLatLon(Main.map.mapView.getWidth(),
Main.map.mapView.getHeight());
- /**
- * Cache/working directory location
- */
- final File working_dir = new File(Main.pref.getPreferencesDir(), "plugins/Lakewalker");
-
/*
* Collect options
*/
@@ -148,7 +140,7 @@ class LakewalkerAction extends JosmAction implements MouseListener {
progressMonitor.subTask(tr("checking cache..."));
cleanupCache();
processnodelist(pos, topLeft, botRight, waylen, maxnode, threshold,
- epsilon,resolution,tilesize,startdir,wmslayer, working_dir,
+ epsilon,resolution,tilesize,startdir,wmslayer,
progressMonitor.createSubTaskMonitor(ProgressMonitor.ALL_TICKS, false));
}
@Override protected void finish() {
@@ -166,12 +158,13 @@ class LakewalkerAction extends JosmAction implements MouseListener {
}
}
- private void processnodelist(LatLon pos, LatLon topLeft, LatLon botRight, int waylen, int maxnode, int threshold, double epsilon, int resolution, int tilesize, String startdir, String wmslayer, File workingdir, ProgressMonitor progressMonitor){
+ private void processnodelist(LatLon pos, LatLon topLeft, LatLon botRight, int waylen, int maxnode, int threshold,
+ double epsilon, int resolution, int tilesize, String startdir, String wmslayer, ProgressMonitor progressMonitor){
progressMonitor.beginTask(null, 3);
try {
ArrayList<double[]> nodelist = new ArrayList<>();
- Lakewalker lw = new Lakewalker(waylen,maxnode,threshold,epsilon,resolution,tilesize,startdir,wmslayer,workingdir);
+ Lakewalker lw = new Lakewalker(waylen,maxnode,threshold,epsilon,resolution,tilesize,startdir,wmslayer);
try {
nodelist = lw.trace(pos.lat(),pos.lon(),topLeft.lon(),botRight.lon(),topLeft.lat(),botRight.lat(),
progressMonitor.createSubTaskMonitor(1, false));
diff --git a/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerPlugin.java b/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerPlugin.java
index dcb2a43..ddc152b 100644
--- a/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerPlugin.java
+++ b/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerPlugin.java
@@ -2,6 +2,8 @@ package org.openstreetmap.josm.plugins.lakewalker;
import static org.openstreetmap.josm.tools.I18n.tr;
+import java.io.File;
+
import org.openstreetmap.josm.Main;
import org.openstreetmap.josm.gui.MainMenu;
import org.openstreetmap.josm.gui.preferences.PreferenceSetting;
@@ -20,9 +22,11 @@ public class LakewalkerPlugin extends Plugin {
}
@Override
- public PreferenceSetting getPreferenceSetting()
- {
+ public PreferenceSetting getPreferenceSetting() {
return new LakewalkerPreferences();
}
+ public static File getLakewalkerCacheDir() {
+ return new File(Main.pref.getCacheDirectory(), "lakewalkerwms");
+ }
}
diff --git a/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerWMS.java b/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerWMS.java
index ef3ca7b..ae71738 100644
--- a/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerWMS.java
+++ b/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerWMS.java
@@ -37,12 +37,9 @@ public class LakewalkerWMS {
private String wmslayer;
- private File working_dir;
-
- public LakewalkerWMS(int resolution, int tilesize, String wmslayer, File workdir){
+ public LakewalkerWMS(int resolution, int tilesize, String wmslayer){
this.resolution = resolution;
this.tilesize = tilesize;
- this.working_dir = workdir;
this.wmslayer = wmslayer;
}
@@ -77,7 +74,7 @@ public class LakewalkerWMS {
","+df.format(topright_geo[1])+","+df.format(topright_geo[0])+
"&width="+this.tilesize+"&height="+this.tilesize;
- File file = new File(this.working_dir,filename);
+ File file = new File(LakewalkerPlugin.getLakewalkerCacheDir(), filename);
// Calculate the hashmap key
String hashkey = Integer.toString(bottom_left_xy[0])+":"+Integer.toString(bottom_left_xy[1]);
diff --git a/svn-info.xml b/svn-info.xml
index 2a10661..15769b8 100644
--- a/svn-info.xml
+++ b/svn-info.xml
@@ -1,18 +1,18 @@
<?xml version="1.0"?>
<info>
<entry
- kind="dir"
path="plugins"
- revision="30838">
+ revision="30893"
+ kind="dir">
<url>http://svn.openstreetmap.org/applications/editors/josm/plugins</url>
<repository>
<root>http://svn.openstreetmap.org</root>
<uuid>b9d5c4c9-76e1-0310-9c85-f3177eceb1e4</uuid>
</repository>
<commit
- revision="30836">
-<author>akks</author>
-<date>2014-12-09T17:44:44.866268Z</date>
+ revision="30892">
+<author>donvip</author>
+<date>2014-12-31T13:39:42.235220Z</date>
</commit>
</entry>
</info>
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/josm-plugins.git
More information about the Pkg-grass-devel
mailing list