Package com.google.maps
Class StaticMapsRequest
- java.lang.Object
-
- com.google.maps.StaticMapsRequest
-
- All Implemented Interfaces:
PendingResult<ImageResult>
public class StaticMapsRequest extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
StaticMapsRequest.ImageFormat
static class
StaticMapsRequest.Markers
static class
StaticMapsRequest.Path
static class
StaticMapsRequest.StaticMapType
-
Nested classes/interfaces inherited from interface com.google.maps.PendingResult
PendingResult.Callback<T>
-
-
Constructor Summary
Constructors Constructor Description StaticMapsRequest(GeoApiContext context)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
await()
Performs the request synchronously.T
awaitIgnoreError()
Performs the request synchronously, ignoring exceptions while performing the request and errors returned by the server.void
cancel()
Attempts to cancel the request.StaticMapsRequest
center(LatLng location)
center
(required if markers not present) defines the center of the map, equidistant from all edges of the map.StaticMapsRequest
center(java.lang.String location)
center
(required if markers not present) defines the center of the map, equidistant from all edges of the map.A
channel(java.lang.String channel)
A channel to pass with the request.A
custom(java.lang.String parameter, java.lang.String value)
Custom parameter.StaticMapsRequest
format(StaticMapsRequest.ImageFormat format)
format
defines the format of the resulting image.A
language(java.lang.String language)
The language in which to return results.StaticMapsRequest
maptype(StaticMapsRequest.StaticMapType maptype)
maptype
defines the type of map to construct.StaticMapsRequest
markers(StaticMapsRequest.Markers markers)
markers
parameter defines a set of one or more markers (map pins) at a set of locations.protected A
param(java.lang.String key, int val)
protected A
param(java.lang.String key, com.google.maps.internal.StringJoin.UrlValue val)
protected A
param(java.lang.String key, java.lang.String val)
protected A
paramAddToList(java.lang.String key, com.google.maps.internal.StringJoin.UrlValue val)
protected A
paramAddToList(java.lang.String key, java.lang.String val)
protected java.util.Map<java.lang.String,java.util.List<java.lang.String>>
params()
StaticMapsRequest
path(EncodedPolyline path)
Thepath
parameter defines a set of one or more locations connected by a path to overlay on the map image.StaticMapsRequest
path(StaticMapsRequest.Path path)
Thepath
parameter defines a set of one or more locations connected by a path to overlay on the map image.StaticMapsRequest
region(java.lang.String region)
region
defines the appropriate borders to display, based on geo-political sensitivities.StaticMapsRequest
scale(int scale)
scale
affects the number of pixels that are returned.void
setCallback(PendingResult.Callback<T> callback)
StaticMapsRequest
size(Size size)
size
defines the rectangular dimensions of the map image.protected void
validateRequest()
StaticMapsRequest
visible(LatLng visibleLocation)
visible
instructs the Google Static Maps API service to construct a map such that the existing locations remain visible.StaticMapsRequest
visible(java.lang.String visibleLocation)
visible
instructs the Google Static Maps API service to construct a map such that the existing locations remain visible.StaticMapsRequest
zoom(int zoom)
zoom
(required if markers not present) defines the zoom level of the map, which determines the magnification level of the map.
-
-
-
Constructor Detail
-
StaticMapsRequest
public StaticMapsRequest(GeoApiContext context)
-
-
Method Detail
-
validateRequest
protected void validateRequest()
-
center
public StaticMapsRequest center(LatLng location)
center
(required if markers not present) defines the center of the map, equidistant from all edges of the map.- Parameters:
location
- The location of the center of the map.- Returns:
- Returns this
StaticMapsRequest
for call chaining.
-
center
public StaticMapsRequest center(java.lang.String location)
center
(required if markers not present) defines the center of the map, equidistant from all edges of the map.- Parameters:
location
- The location of the center of the map.- Returns:
- Returns this
StaticMapsRequest
for call chaining.
-
zoom
public StaticMapsRequest zoom(int zoom)
zoom
(required if markers not present) defines the zoom level of the map, which determines the magnification level of the map.- Parameters:
zoom
- The zoom level of the region.- Returns:
- Returns this
StaticMapsRequest
for call chaining.
-
size
public StaticMapsRequest size(Size size)
size
defines the rectangular dimensions of the map image.- Parameters:
size
- The Size of the static map.- Returns:
- Returns this
StaticMapsRequest
for call chaining.
-
scale
public StaticMapsRequest scale(int scale)
scale
affects the number of pixels that are returned. Settingscale
to 2 returns twice as many pixels asscale
set to 1 while retaining the same coverage area and level of detail (i.e. the contents of the map doesn't change).- Parameters:
scale
- The scale of the static map.- Returns:
- Returns this
StaticMapsRequest
for call chaining.
-
format
public StaticMapsRequest format(StaticMapsRequest.ImageFormat format)
format
defines the format of the resulting image. By default, the Google Static Maps API creates PNG images. There are several possible formats including GIF, JPEG and PNG types.- Parameters:
format
- The format of the static map.- Returns:
- Returns this
StaticMapsRequest
for call chaining.
-
maptype
public StaticMapsRequest maptype(StaticMapsRequest.StaticMapType maptype)
maptype
defines the type of map to construct.- Parameters:
maptype
- The map type of the static map.- Returns:
- Returns this
StaticMapsRequest
for call chaining.
-
region
public StaticMapsRequest region(java.lang.String region)
region
defines the appropriate borders to display, based on geo-political sensitivities. Accepts a region code specified as a two-character ccTLD ('top-level domain') value.- Parameters:
region
- The region of the static map.- Returns:
- Returns this
StaticMapsRequest
for call chaining.
-
markers
public StaticMapsRequest markers(StaticMapsRequest.Markers markers)
markers
parameter defines a set of one or more markers (map pins) at a set of locations. Each marker defined within a single markers declaration must exhibit the same visual style; if you wish to display markers with different styles, you will need to supply multiple markers parameters with separate style information.- Parameters:
markers
- A group of markers with the same style.- Returns:
- Returns this
StaticMapsRequest
for call chaining.
-
path
public StaticMapsRequest path(StaticMapsRequest.Path path)
Thepath
parameter defines a set of one or more locations connected by a path to overlay on the map image.- Parameters:
path
- A path to render atop the map.- Returns:
- Returns this
StaticMapsRequest
for call chaining.
-
path
public StaticMapsRequest path(EncodedPolyline path)
Thepath
parameter defines a set of one or more locations connected by a path to overlay on the map image. This variant of the method accepts the path as an EncodedPolyline.- Parameters:
path
- A path to render atop the map, as an EncodedPolyline.- Returns:
- Returns this
StaticMapsRequest
for call chaining.
-
visible
public StaticMapsRequest visible(LatLng visibleLocation)
visible
instructs the Google Static Maps API service to construct a map such that the existing locations remain visible.- Parameters:
visibleLocation
- The location to be made visible in the requested Static Map.- Returns:
- Returns this
StaticMapsRequest
for call chaining.
-
visible
public StaticMapsRequest visible(java.lang.String visibleLocation)
visible
instructs the Google Static Maps API service to construct a map such that the existing locations remain visible.- Parameters:
visibleLocation
- The location to be made visible in the requested Static Map.- Returns:
- Returns this
StaticMapsRequest
for call chaining.
-
setCallback
public final void setCallback(PendingResult.Callback<T> callback)
Description copied from interface:PendingResult
Performs the request asynchronously, callingonResult
oronFailure
after the request has been completed.- Specified by:
setCallback
in interfacePendingResult<T>
- Parameters:
callback
- The callback to call on completion.
-
await
public final T await() throws ApiException, java.lang.InterruptedException, java.io.IOException
Description copied from interface:PendingResult
Performs the request synchronously.- Specified by:
await
in interfacePendingResult<T>
- Returns:
- The result.
- Throws:
ApiException
- Thrown if the API Returned result is an error.java.lang.InterruptedException
- Thrown when a thread is waiting, sleeping, or otherwise occupied, and the thread is interrupted.java.io.IOException
- Thrown when an I/O exception of some sort has occurred.
-
awaitIgnoreError
public final T awaitIgnoreError()
Description copied from interface:PendingResult
Performs the request synchronously, ignoring exceptions while performing the request and errors returned by the server.- Specified by:
awaitIgnoreError
in interfacePendingResult<T>
- Returns:
- The result, or null if there was any error or exception ignored.
-
cancel
public final void cancel()
Description copied from interface:PendingResult
Attempts to cancel the request.- Specified by:
cancel
in interfacePendingResult<T>
-
param
protected A param(java.lang.String key, java.lang.String val)
-
param
protected A param(java.lang.String key, int val)
-
param
protected A param(java.lang.String key, com.google.maps.internal.StringJoin.UrlValue val)
-
paramAddToList
protected A paramAddToList(java.lang.String key, java.lang.String val)
-
paramAddToList
protected A paramAddToList(java.lang.String key, com.google.maps.internal.StringJoin.UrlValue val)
-
params
protected java.util.Map<java.lang.String,java.util.List<java.lang.String>> params()
-
language
public final A language(java.lang.String language)
The language in which to return results. Note that we often update supported languages so this list may not be exhaustive.- Parameters:
language
- The language code, e.g. "en-AU" or "es".- Returns:
- Returns the request for call chaining.
- See Also:
- List of supported domain languages
-
channel
public A channel(java.lang.String channel)
A channel to pass with the request. channel is used by Google Maps API for Work users to be able to track usage across different applications with the same clientID. See Premium Plan Usage Rates and Limits.- Parameters:
channel
- String to pass with the request for analytics.- Returns:
- Returns the request for call chaining.
-
custom
public A custom(java.lang.String parameter, java.lang.String value)
Custom parameter. For advanced usage only.- Parameters:
parameter
- The name of the custom parameter.value
- The value of the custom parameter.- Returns:
- Returns the request for call chaining.
-
-