[Git][debian-gis-team/jmapviewer][upstream] New upstream version 2.23+dfsg

Bas Couwenberg (@sebastic) gitlab at salsa.debian.org
Mon Jan 27 16:49:46 GMT 2025



Bas Couwenberg pushed to branch upstream at Debian GIS Project / jmapviewer


Commits:
f12f543d by Bas Couwenberg at 2025-01-27T17:46:05+01:00
New upstream version 2.23+dfsg
- - - - -


3 changed files:

- build.xml
- src/org/openstreetmap/gui/jmapviewer/tilesources/AbstractTMSTileSource.java
- src/org/openstreetmap/gui/jmapviewer/tilesources/BingAerialTileSource.java


Changes:

=====================================
build.xml
=====================================
@@ -13,7 +13,7 @@
     <property name="jacoco.inclbootstrapclasses" value="false" />
     <property name="jacoco.inclnolocationclasses" value="false" />
     <!-- For Java specific stuff by version -->
-    <condition property="isJava9"><matches string="${ant.java.version}" pattern="(1.)?(9|1[0-9])" /></condition>
+    <condition property="isJava9"><matches string="${ant.java.version}" pattern="(1.)?(9|[2-9][0-9])" /></condition>
     <condition property="isJava23"><matches string="${ant.java.version}" pattern="2[3-9]|[3-9][0-9]" /></condition>
     <!-- Disable jacoco 0.8.11 on Java 23+, see https://www.jacoco.org/jacoco/trunk/doc/changes.html for latest supported version -->
     <condition property="coverageByDefault">


=====================================
src/org/openstreetmap/gui/jmapviewer/tilesources/AbstractTMSTileSource.java
=====================================
@@ -43,7 +43,7 @@ public abstract class AbstractTMSTileSource extends AbstractTileSource {
         if (baseUrl != null && baseUrl.endsWith("/")) {
             baseUrl = baseUrl.substring(0, baseUrl.length()-1);
         }
-        this.id = info.getUrl();
+        this.id = info.getId();
         this.noTileHeaders = info.getNoTileHeaders();
         this.noTileChecksums = info.getNoTileChecksums();
         this.metadataHeaders = info.getMetadataHeaders();


=====================================
src/org/openstreetmap/gui/jmapviewer/tilesources/BingAerialTileSource.java
=====================================
@@ -80,7 +80,7 @@ public class BingAerialTileSource extends TMSTileSource {
      * Constructs a new {@code BingAerialTileSource}.
      */
     public BingAerialTileSource() {
-        super(new TileSourceInfo("Bing", null, null));
+        super(new TileSourceInfo("Bing", null, "Bing"));
         minZoom = 1;
     }
 
@@ -131,7 +131,7 @@ public class BingAerialTileSource extends TMSTileSource {
     protected URL getAttributionUrl() throws MalformedURLException {
         try {
             return new URI(FeatureAdapter.getSetting(METADATA_API_SETTING, METADATA_API_URL)
-                    .replace(API_KEY_PLACEHOLDER, FeatureAdapter.getSetting(API_KEY_SETTING, API_KEY))
+                    .replace(API_KEY_PLACEHOLDER, getKey())
                     .replace(API_KEY_LAYER, this.layer)).toURL();
         } catch (URISyntaxException e) {
             MalformedURLException malformedURLException = new MalformedURLException(e.getMessage());
@@ -140,6 +140,32 @@ public class BingAerialTileSource extends TMSTileSource {
         }
     }
 
+    /**
+     * Get the API key for Bing imagery
+     * Order of preference is as follows:
+     * <ol>
+     *     <li>Custom API key provided by {@link FeatureAdapter#getSetting(String, String)} via {@link #API_KEY_SETTING}</li>
+     *     <li>API key provided by {@link FeatureAdapter#retrieveApiKey(String)}</li>
+     *     <li>The hardcoded API key. This should not be used whenever possible.</li>
+     * </ol>
+     * @return The API key to use
+     */
+    private String getKey() {
+        // Preference order for key
+        // 1. Custom API key
+        // 2. Remote API key
+        // 3. Hardcoded API key
+        String key = FeatureAdapter.getSetting(API_KEY_SETTING, API_KEY);
+        if (API_KEY.equals(key)) { // If the API key has not been customized, we try to retrieve the API key
+            try {
+                key = FeatureAdapter.retrieveApiKey(this.getId());
+            } catch (IOException ioException) {
+                FeatureAdapter.getLogger(this.getClass()).log(Level.WARNING, "Failed to retrieve api key", ioException);
+            }
+        }
+        return key;
+    }
+
     protected List<Attribution> parseAttributionText(InputSource xml) throws IOException {
         try {
             DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();



View it on GitLab: https://salsa.debian.org/debian-gis-team/jmapviewer/-/commit/f12f543daa22c29128e439db3855d8e4f6ff8fc3

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/jmapviewer/-/commit/f12f543daa22c29128e439db3855d8e4f6ff8fc3
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/20250127/197b3865/attachment-0001.htm>


More information about the Pkg-grass-devel mailing list