[jmapviewer] 01/05: New upstream version 2.4+dfsg
Bas Couwenberg
sebastic at debian.org
Mon Nov 27 09:03:07 UTC 2017
This is an automated email from the git hooks/post-receive script.
sebastic pushed a commit to branch master
in repository jmapviewer.
commit 3d94fb453223ae09aa388319f70711a4bfb029ee
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date: Mon Nov 27 08:26:32 2017 +0100
New upstream version 2.4+dfsg
---
Readme.txt | 1 +
build.xml | 22 +++++++++++-----------
.../openstreetmap/gui/jmapviewer/JMapViewer.java | 14 +++++++-------
.../gui/jmapviewer/OsmTileLoader.java | 5 +++++
.../gui/jmapviewer/interfaces/TileLoader.java | 11 +++++++++++
5 files changed, 35 insertions(+), 18 deletions(-)
diff --git a/Readme.txt b/Readme.txt
index a87c59d..bffb269 100644
--- a/Readme.txt
+++ b/Readme.txt
@@ -19,6 +19,7 @@ JMapViewer
(c) 2013, Alexei Kasatkin
(c) 2013, Galo Higueras
(c) 2015-2016, Wiktor Niesiobędzki
+(c) 2017, Robert Scott
This work bases partly on the JOSM plugin "Slippy Map Chooser" by Tim Haussmann
diff --git a/build.xml b/build.xml
index 2b2f229..3d83809 100644
--- a/build.xml
+++ b/build.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project default="all" name="Compile and build java classes plus jar archives">
- <target name="all" depends="clean,build,svn_info,pack,create_run_jar,findbugs,checkstyle,javadoc,create_release_zip,create_source_release_zip" />
+ <target name="all" depends="clean,build,svn_info,pack,create_run_jar,spotbugs,checkstyle,javadoc,create_release_zip,create_source_release_zip" />
<target name="clean">
<mkdir dir="bin" />
@@ -84,23 +84,23 @@
</checkstyle>
</target>
- <target name="findbugs" depends="pack">
- <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask"
- classpath="tools/findbugs/findbugs-ant.jar"/>
- <path id="findbugs-classpath">
- <fileset dir="tools/findbugs/">
+ <target name="spotbugs" depends="pack">
+ <taskdef name="spotbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask"
+ classpath="tools/spotbugs/spotbugs-ant.jar"/>
+ <path id="spotbugs-classpath">
+ <fileset dir="tools/spotbugs/">
<include name="*.jar"/>
</fileset>
</path>
- <property name="findbugs-classpath" refid="findbugs-classpath"/>
- <findbugs output="xml"
- outputFile="findbugs-jmapviewer.xml"
- classpath="${findbugs-classpath}"
+ <property name="spotbugs-classpath" refid="spotbugs-classpath"/>
+ <spotbugs output="xml"
+ outputFile="spotbugs-jmapviewer.xml"
+ classpath="${spotbugs-classpath}"
effort="max"
>
<sourcePath path="${basedir}/src" />
<class location="JMapViewer.jar" />
- </findbugs>
+ </spotbugs>
</target>
<target name="javadoc">
diff --git a/src/org/openstreetmap/gui/jmapviewer/JMapViewer.java b/src/org/openstreetmap/gui/jmapviewer/JMapViewer.java
index 9f7988a..00097b0 100644
--- a/src/org/openstreetmap/gui/jmapviewer/JMapViewer.java
+++ b/src/org/openstreetmap/gui/jmapviewer/JMapViewer.java
@@ -10,8 +10,8 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.net.URL;
+import java.util.ArrayList;
import java.util.Collections;
-import java.util.LinkedList;
import java.util.List;
import javax.swing.ImageIcon;
@@ -139,9 +139,9 @@ public class JMapViewer extends JPanel implements TileLoaderListener {
public JMapViewer(TileCache tileCache) {
tileSource = new OsmTileSource.Mapnik();
tileController = new TileController(tileSource, tileCache, this);
- mapMarkerList = Collections.synchronizedList(new LinkedList<MapMarker>());
- mapPolygonList = Collections.synchronizedList(new LinkedList<MapPolygon>());
- mapRectangleList = Collections.synchronizedList(new LinkedList<MapRectangle>());
+ mapMarkerList = Collections.synchronizedList(new ArrayList<MapMarker>());
+ mapPolygonList = Collections.synchronizedList(new ArrayList<MapPolygon>());
+ mapRectangleList = Collections.synchronizedList(new ArrayList<MapRectangle>());
mapMarkersVisible = true;
mapRectanglesVisible = true;
mapPolygonsVisible = true;
@@ -769,7 +769,7 @@ public class JMapViewer extends JPanel implements TileLoaderListener {
protected void paintPolygon(Graphics g, MapPolygon polygon) {
List<? extends ICoordinate> coords = polygon.getPoints();
if (coords != null && coords.size() >= 3) {
- List<Point> points = new LinkedList<>();
+ List<Point> points = new ArrayList<>();
for (ICoordinate c : coords) {
Point p = getMapPosition(c, false);
if (p == null) {
@@ -781,7 +781,7 @@ public class JMapViewer extends JPanel implements TileLoaderListener {
if (scrollWrapEnabled) {
int tilesize = tileSource.getTileSize();
int mapSize = tilesize << zoom;
- List<Point> pointsWrapped = new LinkedList<>(points);
+ List<Point> pointsWrapped = new ArrayList<>(points);
boolean keepWrapping = true;
while (keepWrapping) {
for (Point p : pointsWrapped) {
@@ -792,7 +792,7 @@ public class JMapViewer extends JPanel implements TileLoaderListener {
}
polygon.paint(g, pointsWrapped);
}
- pointsWrapped = new LinkedList<>(points);
+ pointsWrapped = new ArrayList<>(points);
keepWrapping = true;
while (keepWrapping) {
for (Point p : pointsWrapped) {
diff --git a/src/org/openstreetmap/gui/jmapviewer/OsmTileLoader.java b/src/org/openstreetmap/gui/jmapviewer/OsmTileLoader.java
index f654201..260819a 100644
--- a/src/org/openstreetmap/gui/jmapviewer/OsmTileLoader.java
+++ b/src/org/openstreetmap/gui/jmapviewer/OsmTileLoader.java
@@ -177,6 +177,11 @@ public class OsmTileLoader implements TileLoader {
}
@Override
+ public boolean hasOutstandingTasks() {
+ return jobDispatcher.getTaskCount() > jobDispatcher.getCompletedTaskCount();
+ }
+
+ @Override
public void cancelOutstandingTasks() {
jobDispatcher.getQueue().clear();
}
diff --git a/src/org/openstreetmap/gui/jmapviewer/interfaces/TileLoader.java b/src/org/openstreetmap/gui/jmapviewer/interfaces/TileLoader.java
index 8d1b5fd..69e9d7b 100644
--- a/src/org/openstreetmap/gui/jmapviewer/interfaces/TileLoader.java
+++ b/src/org/openstreetmap/gui/jmapviewer/interfaces/TileLoader.java
@@ -26,4 +26,15 @@ public interface TileLoader {
* to loading = false / loaded = false
*/
void cancelOutstandingTasks();
+
+ /**
+ * Determines whether this {@link TileLoader} has tasks which have not completed.
+ * @return whether this {@link TileLoader} has tasks which have not completed. This answer may well be
+ * "approximate" given that many implementations will be using mechanisms where a queue's state can change
+ * during the computation.
+ */
+ default boolean hasOutstandingTasks() {
+ // default implementation supplied just to make transition easier for external implementors
+ throw new UnsupportedOperationException("Not implemented");
+ }
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/jmapviewer.git
More information about the Pkg-grass-devel
mailing list