Changeset 15184 in josm


Ignore:
Timestamp:
2019-06-18T23:06:56+02:00 (4 weeks ago)
Author:
Don-vip
Message:

fix #17825 - support Geo URIs with WGS84 CRS and/or uncertainty

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/GeoUrlToBounds.java

    r12624 r15184  
    1919     * The pattern of a geo: url, having named match groups.
    2020     */
    21     public static final Pattern PATTERN = Pattern.compile("geo:(?<lat>[+-]?[0-9.]+),(?<lon>[+-]?[0-9.]+)(\\?z=(?<zoom>[0-9]+))?");
     21    public static final Pattern PATTERN = Pattern.compile(
     22            "geo:(?<lat>[+-]?[0-9.]+),(?<lon>[+-]?[0-9.]+)(?<crs>;crs=wgs84)?(?<uncertainty>;u=[0-9.]+)?(\\?z=(?<zoom>[0-9]+))?");
    2223
    2324    private GeoUrlToBounds() {
  • trunk/test/unit/org/openstreetmap/josm/tools/GeoUrlToBoundsTest.java

    r10636 r15184  
    4040
    4141    /**
     42     * Tests parsing Geo URLs with a CRS and/or uncertainty.
     43     */
     44    @Test
     45    public void testParseCrsUncertainty() {
     46        assertThat(
     47                GeoUrlToBounds.parse("geo:60.00000,17.000000;crs=wgs84"),
     48                is(OsmUrlToBounds.positionToBounds(60.0, 17.0, 18))
     49        );
     50        assertThat(
     51                GeoUrlToBounds.parse("geo:60.00000,17.000000;crs=wgs84;u=0"),
     52                is(OsmUrlToBounds.positionToBounds(60.0, 17.0, 18))
     53        );
     54        assertThat(
     55                GeoUrlToBounds.parse("geo:60.00000,17.000000;u=20"),
     56                is(OsmUrlToBounds.positionToBounds(60.0, 17.0, 18))
     57        );
     58    }
     59
     60    /**
    4261     * Tests parsing invalid Geo URL.
    4362     */
Note: See TracChangeset for help on using the changeset viewer.