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 classStaticMapsRequest.ImageFormatstatic classStaticMapsRequest.Markersstatic classStaticMapsRequest.Pathstatic classStaticMapsRequest.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 Tawait()Performs the request synchronously.TawaitIgnoreError()Performs the request synchronously, ignoring exceptions while performing the request and errors returned by the server.voidcancel()Attempts to cancel the request.StaticMapsRequestcenter(LatLng location)center(required if markers not present) defines the center of the map, equidistant from all edges of the map.StaticMapsRequestcenter(java.lang.String location)center(required if markers not present) defines the center of the map, equidistant from all edges of the map.Achannel(java.lang.String channel)A channel to pass with the request.Acustom(java.lang.String parameter, java.lang.String value)Custom parameter.StaticMapsRequestformat(StaticMapsRequest.ImageFormat format)formatdefines the format of the resulting image.Alanguage(java.lang.String language)The language in which to return results.StaticMapsRequestmaptype(StaticMapsRequest.StaticMapType maptype)maptypedefines the type of map to construct.StaticMapsRequestmarkers(StaticMapsRequest.Markers markers)markersparameter defines a set of one or more markers (map pins) at a set of locations.protected Aparam(java.lang.String key, int val)protected Aparam(java.lang.String key, com.google.maps.internal.StringJoin.UrlValue val)protected Aparam(java.lang.String key, java.lang.String val)protected AparamAddToList(java.lang.String key, com.google.maps.internal.StringJoin.UrlValue val)protected AparamAddToList(java.lang.String key, java.lang.String val)protected java.util.Map<java.lang.String,java.util.List<java.lang.String>>params()StaticMapsRequestpath(EncodedPolyline path)Thepathparameter defines a set of one or more locations connected by a path to overlay on the map image.StaticMapsRequestpath(StaticMapsRequest.Path path)Thepathparameter defines a set of one or more locations connected by a path to overlay on the map image.StaticMapsRequestregion(java.lang.String region)regiondefines the appropriate borders to display, based on geo-political sensitivities.StaticMapsRequestscale(int scale)scaleaffects the number of pixels that are returned.voidsetCallback(PendingResult.Callback<T> callback)StaticMapsRequestsize(Size size)sizedefines the rectangular dimensions of the map image.protected voidvalidateRequest()StaticMapsRequestvisible(LatLng visibleLocation)visibleinstructs the Google Static Maps API service to construct a map such that the existing locations remain visible.StaticMapsRequestvisible(java.lang.String visibleLocation)visibleinstructs the Google Static Maps API service to construct a map such that the existing locations remain visible.StaticMapsRequestzoom(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
StaticMapsRequestfor 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
StaticMapsRequestfor 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
StaticMapsRequestfor call chaining.
-
size
public StaticMapsRequest size(Size size)
sizedefines the rectangular dimensions of the map image.- Parameters:
size- The Size of the static map.- Returns:
- Returns this
StaticMapsRequestfor call chaining.
-
scale
public StaticMapsRequest scale(int scale)
scaleaffects the number of pixels that are returned. Settingscaleto 2 returns twice as many pixels asscaleset 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
StaticMapsRequestfor call chaining.
-
format
public StaticMapsRequest format(StaticMapsRequest.ImageFormat format)
formatdefines 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
StaticMapsRequestfor call chaining.
-
maptype
public StaticMapsRequest maptype(StaticMapsRequest.StaticMapType maptype)
maptypedefines the type of map to construct.- Parameters:
maptype- The map type of the static map.- Returns:
- Returns this
StaticMapsRequestfor call chaining.
-
region
public StaticMapsRequest region(java.lang.String region)
regiondefines 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
StaticMapsRequestfor call chaining.
-
markers
public StaticMapsRequest markers(StaticMapsRequest.Markers markers)
markersparameter 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
StaticMapsRequestfor call chaining.
-
path
public StaticMapsRequest path(StaticMapsRequest.Path path)
Thepathparameter 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
StaticMapsRequestfor call chaining.
-
path
public StaticMapsRequest path(EncodedPolyline path)
Thepathparameter 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
StaticMapsRequestfor call chaining.
-
visible
public StaticMapsRequest visible(LatLng visibleLocation)
visibleinstructs 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
StaticMapsRequestfor call chaining.
-
visible
public StaticMapsRequest visible(java.lang.String visibleLocation)
visibleinstructs 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
StaticMapsRequestfor call chaining.
-
setCallback
public final void setCallback(PendingResult.Callback<T> callback)
Description copied from interface:PendingResultPerforms the request asynchronously, callingonResultoronFailureafter the request has been completed.- Specified by:
setCallbackin interfacePendingResult<T>- Parameters:
callback- The callback to call on completion.
-
await
public final T await() throws ApiException, java.lang.InterruptedException, java.io.IOExceptionDescription copied from interface:PendingResultPerforms the request synchronously.- Specified by:
awaitin 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:PendingResultPerforms the request synchronously, ignoring exceptions while performing the request and errors returned by the server.- Specified by:
awaitIgnoreErrorin interfacePendingResult<T>- Returns:
- The result, or null if there was any error or exception ignored.
-
cancel
public final void cancel()
Description copied from interface:PendingResultAttempts to cancel the request.- Specified by:
cancelin 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.
-
-