[Git][debian-gis-team/jmapviewer][buster-backports] 7 commits: Bump debhelper compat to 10.

Bas Couwenberg gitlab at salsa.debian.org
Thu Jun 4 05:55:25 BST 2020



Bas Couwenberg pushed to branch buster-backports at Debian GIS Project / jmapviewer


Commits:
77f5e854 by Bas Couwenberg at 2020-03-19T18:41:50+01:00
Bump debhelper compat to 10.

Changes:
- Drop --parallel option, enabled by default

- - - - -
6445c402 by Bas Couwenberg at 2020-05-30T06:56:05+02:00
New upstream version 2.14+dfsg
- - - - -
07639f3e by Bas Couwenberg at 2020-05-30T06:56:05+02:00
Update upstream source from tag 'upstream/2.14+dfsg'

Update to upstream version '2.14+dfsg'
with Debian dir cb7e17fe30b6527ad75efb81c231addf563a7f03
- - - - -
175d75f5 by Bas Couwenberg at 2020-05-30T06:56:21+02:00
New upstream release.

- - - - -
66baf4ce by Bas Couwenberg at 2020-05-30T06:57:04+02:00
Set distribution to unstable.

- - - - -
670bcb5e by Bas Couwenberg at 2020-06-04T06:43:29+02:00
Merge tag 'debian/2.14+dfsg-1' into buster-backports

releasing package jmapviewer version 2.14+dfsg-1

- - - - -
4b627e70 by Bas Couwenberg at 2020-06-04T06:43:44+02:00
Rebuild for buster-backports.

- - - - -


8 changed files:

- debian/changelog
- debian/compat
- debian/control
- debian/rules
- src/org/openstreetmap/gui/jmapviewer/Coordinate.java
- src/org/openstreetmap/gui/jmapviewer/Projected.java
- src/org/openstreetmap/gui/jmapviewer/tilesources/BingAerialTileSource.java
- src/org/openstreetmap/gui/jmapviewer/tilesources/TemplatedTMSTileSource.java


Changes:

=====================================
debian/changelog
=====================================
@@ -1,3 +1,17 @@
+jmapviewer (2.14+dfsg-1~bpo10+1) buster-backports; urgency=medium
+
+  * Rebuild for buster-backports.
+
+ -- Bas Couwenberg <sebastic at debian.org>  Thu, 04 Jun 2020 06:43:40 +0200
+
+jmapviewer (2.14+dfsg-1) unstable; urgency=medium
+
+  * New upstream release.
+  * Bump debhelper compat to 10, changes:
+    - Drop --parallel option, enabled by default
+
+ -- Bas Couwenberg <sebastic at debian.org>  Sat, 30 May 2020 06:56:54 +0200
+
 jmapviewer (2.13+dfsg-1~bpo10+1) buster-backports; urgency=medium
 
   * Rebuild for buster-backports.


=====================================
debian/compat
=====================================
@@ -1 +1 @@
-9
+10


=====================================
debian/control
=====================================
@@ -6,7 +6,7 @@ Uploaders: Felix Natter <fnatter at gmx.net>,
            Bas Couwenberg <sebastic at debian.org>
 Section: utils
 Priority: optional
-Build-Depends: debhelper (>= 9~),
+Build-Depends: debhelper (>= 10~),
                default-jdk (>= 2:1.8) | java8-sdk,
                ant,
                docbook-xsl,


=====================================
debian/rules
=====================================
@@ -6,7 +6,7 @@ include /usr/share/dpkg/pkg-info.mk
 VERSION=$(shell echo $(DEB_VERSION_UPSTREAM) | sed -e 's/\+.*//')
 
 %:
-	dh $@ --parallel
+	dh $@
 
 override_dh_auto_clean:
 	rm -rf $(CURDIR)/bin/*


=====================================
src/org/openstreetmap/gui/jmapviewer/Coordinate.java
=====================================
@@ -1,23 +1,24 @@
 // License: GPL. For details, see Readme.txt file.
 package org.openstreetmap.gui.jmapviewer;
 
-import java.awt.geom.Point2D;
 import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
+import java.io.Serializable;
 import java.util.Objects;
 
 import org.openstreetmap.gui.jmapviewer.interfaces.ICoordinate;
 
 /**
- * This class encapsulates a Point2D.Double and provide access
- * via <code>lat</code> and <code>lon</code>.
+ * A geographical coordinate consisting of latitude and longitude.
  *
  * @author Jan Peter Stotz
  *
  */
-public class Coordinate implements ICoordinate {
-    private transient Point2D.Double data;
+public class Coordinate implements ICoordinate, Serializable {
+    private static final long serialVersionUID = 1L;
+    private double x;
+    private double y;
 
     /**
      * Constructs a new {@code Coordinate}.
@@ -25,57 +26,55 @@ public class Coordinate implements ICoordinate {
      * @param lon longitude in degrees
      */
     public Coordinate(double lat, double lon) {
-        data = new Point2D.Double(lon, lat);
+        setLat(lat);
+        setLon(lon);
     }
 
     @Override
     public double getLat() {
-        return data.y;
+        return y;
     }
 
     @Override
     public void setLat(double lat) {
-        data.y = lat;
+        y = lat;
     }
 
     @Override
     public double getLon() {
-        return data.x;
+        return x;
     }
 
     @Override
     public void setLon(double lon) {
-        data.x = lon;
+        x = lon;
     }
 
     private void writeObject(ObjectOutputStream out) throws IOException {
-        out.writeObject(data.x);
-        out.writeObject(data.y);
+        out.writeObject(x);
+        out.writeObject(y);
     }
 
     private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
-        data = new Point2D.Double();
-        data.x = (Double) in.readObject();
-        data.y = (Double) in.readObject();
+        x = (Double) in.readObject();
+        y = (Double) in.readObject();
     }
 
     @Override
     public String toString() {
-        return "Coordinate[" + data.y + ", " + data.x + ']';
+        return "Coordinate[" + y + ", " + x + ']';
     }
 
     @Override
     public int hashCode() {
-        return Objects.hashCode(data);
+        return Objects.hash(x, y);
     }
 
     @Override
-    public boolean equals(Object obj) {
-        if (this == obj)
-            return true;
-        if (obj == null || !(obj instanceof Coordinate))
-            return false;
-        final Coordinate other = (Coordinate) obj;
-        return Objects.equals(data, other.data);
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (!(o instanceof Coordinate)) return false;
+        Coordinate that = (Coordinate) o;
+        return Double.compare(that.x, x) == 0 && Double.compare(that.y, y) == 0;
     }
 }


=====================================
src/org/openstreetmap/gui/jmapviewer/Projected.java
=====================================
@@ -5,6 +5,7 @@ import java.awt.geom.Point2D;
 import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
+import java.io.Serializable;
 import java.util.Objects;
 
 import org.openstreetmap.gui.jmapviewer.interfaces.IProjected;
@@ -12,7 +13,8 @@ import org.openstreetmap.gui.jmapviewer.interfaces.IProjected;
 /**
  * Projected coordinates represented by an encapsulates a Point2D.Double value.
  */
-public class Projected implements IProjected {
+public class Projected implements IProjected, Serializable {
+    private static final long serialVersionUID = 1L;
     private transient Point2D.Double data;
 
     /**
@@ -59,7 +61,7 @@ public class Projected implements IProjected {
     public boolean equals(Object obj) {
         if (this == obj)
             return true;
-        if (obj == null || !(obj instanceof Projected))
+        if (!(obj instanceof Projected))
             return false;
         final Projected other = (Projected) obj;
         return Objects.equals(data, other.data);


=====================================
src/org/openstreetmap/gui/jmapviewer/tilesources/BingAerialTileSource.java
=====================================
@@ -16,6 +16,7 @@ import java.util.concurrent.TimeUnit;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 import java.util.regex.Pattern;
+import java.util.stream.Collectors;
 
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
@@ -50,7 +51,7 @@ public class BingAerialTileSource extends TMSTileSource {
     /** Setting key for Bing API key */
     public static final String API_KEY_SETTING = "jmapviewer.bing.api-key";
     /** Placeholder to specify Bing API key in metadata API URL*/
-    public static final String API_KEY_PLACEHOLDER = "{apiKey}";
+    public static final String API_KEY_PLACEHOLDER = "{apikey}";
 
     /** Bing Metadata API URL */
     private static final String METADATA_API_URL =
@@ -289,17 +290,12 @@ public class BingAerialTileSource extends TMSTileSource {
             final List<Attribution> data = getAttribution();
             if (data == null)
                 return "Error loading Bing attribution data";
-            StringBuilder a = new StringBuilder();
-            for (Attribution attr : data) {
-                if (zoom <= attr.maxZoom && zoom >= attr.minZoom) {
-                    if (topLeft.getLon() < attr.max.getLon() && botRight.getLon() > attr.min.getLon()
-                            && topLeft.getLat() > attr.min.getLat() && botRight.getLat() < attr.max.getLat()) {
-                        a.append(attr.attributionText);
-                        a.append(' ');
-                    }
-                }
-            }
-            return a.toString();
+            return data.stream()
+                    .filter(attr -> zoom <= attr.maxZoom && zoom >= attr.minZoom)
+                    .filter(attr -> topLeft.getLon() < attr.max.getLon() && botRight.getLon() > attr.min.getLon())
+                    .filter(attr -> topLeft.getLat() > attr.min.getLat() && botRight.getLat() < attr.max.getLat())
+                    .map(attr -> attr.attributionText)
+                    .collect(Collectors.joining(" "));
         } catch (RuntimeException e) {
             e.printStackTrace();
         }


=====================================
src/org/openstreetmap/gui/jmapviewer/tilesources/TemplatedTMSTileSource.java
=====================================
@@ -2,6 +2,7 @@
 package org.openstreetmap.gui.jmapviewer.tilesources;
 
 import java.io.IOException;
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Random;
@@ -27,7 +28,7 @@ import org.openstreetmap.gui.jmapviewer.interfaces.TemplatedTileSource;
  * {y} - substituted with Y tile number
  * {!y} - substituted with Yahoo Y tile number
  * {-y} - substituted with reversed Y tile number
- * {apiKey} - substituted with API key retrieved for the imagery id
+ * {apikey} - substituted with API key retrieved for the imagery id
  * {switch:VAL_A,VAL_B,VAL_C,...} - substituted with one of VAL_A, VAL_B, VAL_C. Usually
  *                                  used to specify many tile servers
  * {header:(HEADER_NAME,HEADER_VALUE)} - sets the headers to be sent to tile server
@@ -49,7 +50,7 @@ public class TemplatedTMSTileSource extends TMSTileSource implements TemplatedTi
     private static final Pattern PATTERN_NEG_Y   = Pattern.compile("\\{-y\\}");
     private static final Pattern PATTERN_SWITCH  = Pattern.compile("\\{switch:([^}]+)\\}");
     private static final Pattern PATTERN_HEADER  = Pattern.compile("\\{header\\(([^,]+),([^}]+)\\)\\}");
-    private static final Pattern PATTERN_API_KEY = Pattern.compile("\\{apiKey\\}");
+    private static final Pattern PATTERN_API_KEY = Pattern.compile("\\{apikey\\}");
     private static final Pattern PATTERN_PARAM  = Pattern.compile("\\{((?:\\d+-)?z(?:oom)?(:?[+-]\\d+)?|x|y|!y|-y|switch:([^}]+))\\}");
 
     /**
@@ -137,7 +138,7 @@ public class TemplatedTMSTileSource extends TMSTileSource implements TemplatedTi
         StringBuffer url = new StringBuffer(baseUrl.length());
         Matcher matcher = PATTERN_PARAM.matcher(baseUrl);
         while (matcher.find()) {
-            String replacement = "replace";
+            final String replacement;
             switch (matcher.group(1)) {
             case "z": // PATTERN_ZOOM
             case "zoom":
@@ -156,14 +157,14 @@ public class TemplatedTMSTileSource extends TMSTileSource implements TemplatedTi
                 replacement = Integer.toString((int) Math.pow(2, zoom)-1-tiley);
                 break;
             case "switch:":
-                replacement = randomParts[rand.nextInt(randomParts.length)];
+                replacement = getRandomPart(randomParts);
                 break;
             default:
                 // handle switch/zoom here, as group will contain parameters and switch will not work
                 if (PATTERN_ZOOM.matcher("{" + matcher.group(1) + "}").matches()) {
                     replacement = Integer.toString((inverse_zoom ? -1 * zoom : zoom) + zoom_offset);
                 } else if (PATTERN_SWITCH.matcher("{" + matcher.group(1) + "}").matches()) {
-                    replacement = randomParts[rand.nextInt(randomParts.length)];
+                    replacement = getRandomPart(randomParts);
                 } else {
                     replacement = '{' + matcher.group(1) + '}';
                 }
@@ -174,6 +175,10 @@ public class TemplatedTMSTileSource extends TMSTileSource implements TemplatedTi
         return url.toString().replace(" ", "%20");
     }
 
+    protected String getRandomPart(final String[] parts) {
+        return parts[rand.nextInt(parts.length)];
+    }
+
     /**
      * Checks if url is acceptable by this Tile Source
      * @param url URL to check
@@ -182,13 +187,7 @@ public class TemplatedTMSTileSource extends TMSTileSource implements TemplatedTi
         assert url != null && !"".equals(url) : "URL cannot be null or empty";
         Matcher m = Pattern.compile("\\{[^}]*\\}").matcher(url);
         while (m.find()) {
-            boolean isSupportedPattern = false;
-            for (Pattern pattern : ALL_PATTERNS) {
-                if (pattern.matcher(m.group()).matches()) {
-                    isSupportedPattern = true;
-                    break;
-                }
-            }
+            boolean isSupportedPattern = Arrays.stream(ALL_PATTERNS).anyMatch(pattern -> pattern.matcher(m.group()).matches());
             if (!isSupportedPattern) {
                 throw new IllegalArgumentException(
                         m.group() + " is not a valid TMS argument. Please check this server URL:\n" + url);



View it on GitLab: https://salsa.debian.org/debian-gis-team/jmapviewer/-/compare/fc0855d774e344895aa5399a90103eee1706b421...4b627e7050d09a6eb8c01f5034034de0dd4f4f83

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/jmapviewer/-/compare/fc0855d774e344895aa5399a90103eee1706b421...4b627e7050d09a6eb8c01f5034034de0dd4f4f83
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20200604/38dbb1d4/attachment-0001.html>


More information about the Pkg-grass-devel mailing list