public final class OsmUrlToBounds extends java.lang.Object
Bounds
.Modifier and Type | Field and Description |
---|---|
private static java.util.function.Supplier<java.awt.Dimension> |
mapSize |
private static char[] |
SHORTLINK_CHARS |
private static java.lang.String |
SHORTLINK_PREFIX |
private static int |
TILE_SIZE_IN_PIXELS |
Modifier | Constructor and Description |
---|---|
private |
OsmUrlToBounds() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
getURL(Bounds b)
Return OSM URL for given area.
|
static java.lang.String |
getURL(double dlat,
double dlon,
int zoom)
Return OSM URL for given lat/lon and zoom.
|
static java.lang.String |
getURL(LatLon pos,
int zoom)
Return OSM URL for given position and zoom.
|
static int |
getZoom(Bounds b)
Return OSM Zoom level for a given area
|
static Bounds |
parse(java.lang.String url)
Parses an URL into
Bounds |
private static double |
parseDouble(java.util.Map<java.lang.String,java.lang.String> map,
java.lang.String key) |
private static Bounds |
parseHashURLs(java.lang.String url)
Openstreetmap.org changed it's URL scheme in August 2013, which breaks the URL parsing.
|
private static Bounds |
parseShortLink(java.lang.String url)
Parse OSM short link
|
static Bounds |
positionToBounds(double lat,
double lon,
int zoom)
Compute the bounds for a given lat/lon position and the zoom level
|
static void |
setMapSizeSupplier(java.util.function.Supplier<java.awt.Dimension> mapSizeSupplier)
Sets the map size supplier.
|
private static final java.lang.String SHORTLINK_PREFIX
private static volatile java.util.function.Supplier<java.awt.Dimension> mapSize
private static final char[] SHORTLINK_CHARS
private static final int TILE_SIZE_IN_PIXELS
private OsmUrlToBounds()
public static Bounds parse(java.lang.String url)
Bounds
url
- the URL to be parsedBounds
, or null
private static Bounds parseHashURLs(java.lang.String url)
url
- string for parsingnull
otherwiseprivate static double parseDouble(java.util.Map<java.lang.String,java.lang.String> map, java.lang.String key)
private static Bounds parseShortLink(java.lang.String url)
url
- string for parsingpublic static void setMapSizeSupplier(java.util.function.Supplier<java.awt.Dimension> mapSizeSupplier)
mapSizeSupplier
- returns the map size in pixelspublic static Bounds positionToBounds(double lat, double lon, int zoom)
lat
- The latitudelon
- The longitudezoom
- The current zoom levelpublic static int getZoom(Bounds b)
b
- bounds of the areapublic static java.lang.String getURL(Bounds b)
b
- bounds of the areapublic static java.lang.String getURL(LatLon pos, int zoom)
pos
- center position of areazoom
- zoom depth of displaypublic static java.lang.String getURL(double dlat, double dlon, int zoom)
dlat
- center latitude of areadlon
- center longitude of areazoom
- zoom depth of display