[Git][debian-gis-team/jmapviewer][upstream] New upstream version 2.25+dfsg
Bas Couwenberg (@sebastic)
gitlab at salsa.debian.org
Sat Apr 26 05:01:00 BST 2025
Bas Couwenberg pushed to branch upstream at Debian GIS Project / jmapviewer
Commits:
241a8306 by Bas Couwenberg at 2025-04-26T05:43:45+02:00
New upstream version 2.25+dfsg
- - - - -
2 changed files:
- build.xml
- src/org/openstreetmap/gui/jmapviewer/tilesources/TemplatedTMSTileSource.java
Changes:
=====================================
build.xml
=====================================
@@ -182,7 +182,7 @@
<!-- This stanza is necessary since the maven resolver doesn't read repo settings from the pom.xml file -->
<!-- resolver.repositories makes it global -->
<mvn:remoterepos id="resolver.repositories">
- <mvn:remoterepo id="JOSM-central" url="https://josm.openstreetmap.de/nexus/content/repositories/central/" />
+ <mvn:remoterepo id="JOSM-central" url="https://josm.openstreetmap.de/repository/public/" />
</mvn:remoterepos>
<mvn:resolve>
<mvn:path refid="testlib.classpath" classpath="test"/>
=====================================
src/org/openstreetmap/gui/jmapviewer/tilesources/TemplatedTMSTileSource.java
=====================================
@@ -29,6 +29,7 @@ import org.openstreetmap.gui.jmapviewer.interfaces.TemplatedTileSource;
* <li>{y} - substituted with Y tile number</li>
* <li>{!y} - substituted with Yahoo Y tile number</li>
* <li>{-y} - substituted with reversed Y tile number</li>
+ * <li>{quad} - Microsoft style quadkey</li>
* <li>{apikey} - substituted with API key retrieved for the imagery id</li>
* <li>{switch:VAL_A,VAL_B,VAL_C,...} - substituted with one of VAL_A, VAL_B, VAL_C. Usually
* used to specify many tile servers</li>
@@ -44,15 +45,17 @@ public class TemplatedTMSTileSource extends TMSTileSource implements TemplatedTi
private static final Pattern PATTERN_Y = Pattern.compile("\\{y}");
private static final Pattern PATTERN_Y_YAHOO = Pattern.compile("\\{!y}");
private static final Pattern PATTERN_NEG_Y = Pattern.compile("\\{-y}");
+ private static final Pattern PATTERN_QUAD = Pattern.compile("\\{quad}");
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_PARAM = Pattern.compile("\\{((?:\\d+-)?z(?:oom)?(:?[+-]\\d+)?|x|y|!y|-y|switch:([^}]+))}");
+ private static final Pattern PATTERN_PARAM = Pattern.compile("\\{((?:\\d+-)?z(?:oom)?(:?[+-]\\d+)?|x|y|!y|-y|quad|switch:([^}]+))}");
// CHECKSTYLE.ON: SingleSpaceSeparator
private static final Pattern[] ALL_PATTERNS = {
- PATTERN_HEADER, PATTERN_ZOOM, PATTERN_X, PATTERN_Y, PATTERN_Y_YAHOO, PATTERN_NEG_Y, PATTERN_SWITCH, PATTERN_API_KEY
+ PATTERN_HEADER, PATTERN_ZOOM, PATTERN_X, PATTERN_Y, PATTERN_Y_YAHOO, PATTERN_NEG_Y, PATTERN_SWITCH, PATTERN_API_KEY,
+ PATTERN_QUAD
};
private Random rand;
@@ -155,6 +158,9 @@ public class TemplatedTMSTileSource extends TMSTileSource implements TemplatedTi
case "switch:":
replacement = getRandomPart(randomParts);
break;
+ case "quad": // PATTERN_QUAD
+ replacement = xyzToQuadKey(tilex, tiley, zoom);
+ break;
default:
// handle switch/zoom here, as group will contain parameters and switch will not work
if (PATTERN_ZOOM.matcher("{" + matcher.group(1) + "}").matches()) {
@@ -171,6 +177,29 @@ public class TemplatedTMSTileSource extends TMSTileSource implements TemplatedTi
return url.toString().replace(" ", "%20");
}
+ /**
+ * Convert an x y z coordinate to a quadkey
+ * @param x The x coordinate
+ * @param y The y coordinate
+ * @param z The z coordinate
+ * @return The quadkey
+ */
+ private static String xyzToQuadKey(int x, int y, int z) {
+ final char[] string = new char[z];
+ for (int i = z; i > 0; i--) {
+ char digit = '0';
+ final int mask = 1 << (i - 1);
+ if ((x & mask) != 0) {
+ digit++;
+ }
+ if ((y & mask) != 0) {
+ digit += 2;
+ }
+ string[z - i] = digit;
+ }
+ return String.valueOf(string);
+ }
+
protected String getRandomPart(final String[] parts) {
return parts[rand.nextInt(parts.length)];
}
View it on GitLab: https://salsa.debian.org/debian-gis-team/jmapviewer/-/commit/241a83064a3c728d8f3bdf1ae1e7a3490ea7814c
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/jmapviewer/-/commit/241a83064a3c728d8f3bdf1ae1e7a3490ea7814c
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/20250426/d95256b1/attachment-0001.htm>
More information about the Pkg-grass-devel
mailing list