public class Style
extends java.lang.Object
To create new instances of this object, create a new instance using a Style.Builder and load the style with
TrimbleMapsMap. This object is returned from TrimbleMapsMap.getStyle() once the style
has been loaded by underlying map.
| Modifier and Type | Class | Description |
|---|---|---|
static class |
Style.Builder |
Builder for composing a style object.
|
static interface |
Style.OnStyleLoaded |
Callback to be invoked when a style has finished loading.
|
static interface |
Style.StyleUrl |
Indicates the parameter accepts one of the values from Style.
|
| Modifier and Type | Field | Description |
|---|---|---|
static java.lang.String |
BASIC |
|
static java.lang.String |
DATADARK |
|
static java.lang.String |
DATALIGHT |
|
static java.lang.String |
DEFAULT |
|
static java.lang.String |
MOBILE_DAY |
|
static java.lang.String |
MOBILE_DEFAULT |
|
static java.lang.String |
MOBILE_NIGHT |
|
static java.lang.String |
MOBILE_SATELLITE |
|
static java.lang.String |
SATELLITE |
|
static java.lang.String |
TERRAIN |
|
static java.lang.String |
TRANSPORTATION |
| Modifier and Type | Method | Description |
|---|---|---|
void |
addImage(java.lang.String name,
android.graphics.Bitmap image) |
Adds an image to be used in the map's style
|
void |
addImage(java.lang.String name,
android.graphics.Bitmap bitmap,
boolean sdf) |
Adds an image to be used in the map's style
|
void |
addImage(java.lang.String name,
android.graphics.Bitmap bitmap,
boolean sdf,
java.util.List<ImageStretches> stretchX,
java.util.List<ImageStretches> stretchY,
ImageContent content) |
Adds an image to be used in the map's style
|
void |
addImage(java.lang.String name,
android.graphics.Bitmap image,
java.util.List<ImageStretches> stretchX,
java.util.List<ImageStretches> stretchY,
ImageContent content) |
Adds an image to be used in the map's style
|
void |
addImage(java.lang.String name,
android.graphics.drawable.Drawable drawable) |
Adds an drawable to be converted into a bitmap to be used in the map's style
|
void |
addImage(java.lang.String name,
android.graphics.drawable.Drawable drawable,
java.util.List<ImageStretches> stretchX,
java.util.List<ImageStretches> stretchY,
ImageContent content) |
Adds an drawable to be converted into a bitmap to be used in the map's style
|
void |
addImageAsync(java.lang.String name,
android.graphics.Bitmap image) |
Adds an image asynchronously, to be used in the map's style.
|
void |
addImageAsync(java.lang.String name,
android.graphics.Bitmap bitmap,
boolean sdf) |
Adds an image asynchronously, to be used in the map's style.
|
void |
addImageAsync(java.lang.String name,
android.graphics.Bitmap bitmap,
boolean sdf,
java.util.List<ImageStretches> stretchX,
java.util.List<ImageStretches> stretchY,
ImageContent content) |
Adds an image asynchronously, to be used in the map's style.
|
void |
addImageAsync(java.lang.String name,
android.graphics.Bitmap image,
java.util.List<ImageStretches> stretchX,
java.util.List<ImageStretches> stretchY,
ImageContent content) |
Adds an image asynchronously, to be used in the map's style.
|
void |
addImageAsync(java.lang.String name,
android.graphics.drawable.Drawable drawable) |
Adds an drawable asynchronously, to be converted into a bitmap to be used in the map's style.
|
void |
addImageAsync(java.lang.String name,
android.graphics.drawable.Drawable drawable,
java.util.List<ImageStretches> stretchX,
java.util.List<ImageStretches> stretchY,
ImageContent content) |
Adds an drawable asynchronously, to be converted into a bitmap to be used in the map's style.
|
void |
addImages(Image[] images) |
Add images synchronously, to be used in the map's style.
|
void |
addImages(java.util.HashMap<java.lang.String,android.graphics.Bitmap> images) |
Adds images to be used in the map's style.
|
void |
addImages(java.util.HashMap<java.lang.String,android.graphics.Bitmap> images,
boolean sdf) |
Adds images to be used in the map's style.
|
void |
addImages(java.util.HashMap<java.lang.String,android.graphics.Bitmap> images,
boolean sdf,
java.util.List<ImageStretches> stretchX,
java.util.List<ImageStretches> stretchY,
ImageContent content) |
Adds images to be used in the map's style.
|
void |
addImages(java.util.HashMap<java.lang.String,android.graphics.Bitmap> images,
java.util.List<ImageStretches> stretchX,
java.util.List<ImageStretches> stretchY,
ImageContent content) |
Adds images to be used in the map's style.
|
void |
addImagesAsync(java.util.HashMap<java.lang.String,android.graphics.Bitmap> images) |
Adds images asynchronously, to be used in the map's style.
|
void |
addImagesAsync(java.util.HashMap<java.lang.String,android.graphics.Bitmap> images,
boolean sdf) |
Adds images asynchronously, to be used in the map's style.
|
void |
addImagesAsync(java.util.HashMap<java.lang.String,android.graphics.Bitmap> images,
boolean sdf,
java.util.List<ImageStretches> stretchX,
java.util.List<ImageStretches> stretchY,
ImageContent content) |
Adds images asynchronously, to be used in the map's style.
|
void |
addImagesAsync(java.util.HashMap<java.lang.String,android.graphics.Bitmap> images,
java.util.List<ImageStretches> stretchX,
java.util.List<ImageStretches> stretchY,
ImageContent content) |
Adds images asynchronously, to be used in the map's style.
|
void |
addLayer(Layer layer) |
Adds the layer to the map.
|
void |
addLayerAbove(Layer layer,
java.lang.String above) |
Adds the layer to the map.
|
void |
addLayerAt(Layer layer,
int index) |
Adds the layer to the map at the specified index.
|
void |
addLayerBelow(Layer layer,
java.lang.String below) |
Adds the layer to the map.
|
void |
addSource(Source source) |
Adds the source to the map.
|
android.graphics.Bitmap |
getImage(java.lang.String id) |
Get an image from the map's style using an id.
|
java.lang.String |
getJson() |
Returns the current style json.
|
Layer |
getLayer(java.lang.String id) |
Get the layer by id
|
<T extends Layer> |
getLayerAs(java.lang.String layerId) |
Tries to cast the Layer to T, throws ClassCastException if it's another type.
|
java.util.List<Layer> |
getLayers() |
Retrieve all the layers in the style
|
Light |
getLight() |
Get the light source used to change lighting conditions on extruded fill layers.
|
Source |
getSource(java.lang.String id) |
Retrieve a source by id
|
<T extends Source> |
getSourceAs(java.lang.String sourceId) |
Tries to cast the Source to T, throws ClassCastException if it's another type.
|
java.util.List<Source> |
getSources() |
Retrieve all the sources in the style
|
TransitionOptions |
getTransition() |
Get the transition options for style changes.
|
java.lang.String |
getUri() |
Returns the current style uri.
|
java.lang.String |
getUrl() |
Deprecated.
use
getUri() instead |
boolean |
isFullyLoaded() |
Returns true if the style is fully loaded.
|
void |
removeImage(java.lang.String name) |
Removes an image from the map's style.
|
boolean |
removeLayer(Layer layer) |
Removes the layer.
|
boolean |
removeLayer(java.lang.String layerId) |
Removes the layer.
|
boolean |
removeLayerAt(int index) |
Removes the layer.
|
boolean |
removeSource(Source source) |
Removes the source, preserving the reference for re-use
|
boolean |
removeSource(java.lang.String sourceId) |
Removes the source from the style.
|
void |
setTransition(TransitionOptions transitionOptions) |
Set the transition options for style changes.
|
static Image |
toImage(Style.Builder.ImageWrapper imageWrapper) |
public static final java.lang.String MOBILE_DEFAULT
public static final java.lang.String MOBILE_DAY
public static final java.lang.String MOBILE_NIGHT
public static final java.lang.String MOBILE_SATELLITE
public static final java.lang.String DEFAULT
public static final java.lang.String TRANSPORTATION
public static final java.lang.String SATELLITE
public static final java.lang.String TERRAIN
public static final java.lang.String BASIC
public static final java.lang.String DATALIGHT
public static final java.lang.String DATADARK
@NonNull @Deprecated public java.lang.String getUrl()
getUri() instead@NonNull public java.lang.String getUri()
@NonNull public java.lang.String getJson()
@NonNull public java.util.List<Source> getSources()
public void addSource(@NonNull
Source source)
source - the source to add@Nullable public Source getSource(java.lang.String id)
id - the source's id@Nullable public <T extends Source> T getSourceAs(@NonNull java.lang.String sourceId)
T - the generic type of a SourcesourceId - the id used to look up a layerpublic boolean removeSource(@NonNull
java.lang.String sourceId)
sourceId - the source to removepublic boolean removeSource(@NonNull
Source source)
source - the source to removepublic void addLayer(@NonNull
Layer layer)
layer - the layer to addpublic void addLayerBelow(@NonNull
Layer layer,
@NonNull
java.lang.String below)
layer - the layer to addbelow - the layer id to add this layer beforepublic void addLayerAbove(@NonNull
Layer layer,
@NonNull
java.lang.String above)
layer - the layer to addabove - the layer id to add this layer abovepublic void addLayerAt(@NonNull
Layer layer,
int index)
layer - the layer to addindex - the index to insert the layer at@Nullable public Layer getLayer(@NonNull java.lang.String id)
id - the layer's id@Nullable public <T extends Layer> T getLayerAs(@NonNull java.lang.String layerId)
T - the generic attribute of a LayerlayerId - the layer id used to look up a layer@NonNull public java.util.List<Layer> getLayers()
public boolean removeLayer(@NonNull
java.lang.String layerId)
layerId - the layer to removepublic boolean removeLayer(@NonNull
Layer layer)
layer - the layer to removepublic boolean removeLayerAt(int index)
index - the layer indexpublic void addImage(@NonNull
java.lang.String name,
@NonNull
android.graphics.Bitmap image)
name - the name of the imageimage - the pre-multiplied Bitmappublic void addImage(@NonNull
java.lang.String name,
@NonNull
android.graphics.Bitmap image,
@NonNull
java.util.List<ImageStretches> stretchX,
@NonNull
java.util.List<ImageStretches> stretchY,
@Nullable
ImageContent content)
name - the name of the imageimage - the pre-multiplied BitmapstretchX - image stretch areas for x axixstretchY - image stretch areas for y axixcontent - image content for text to fitpublic void addImage(@NonNull
java.lang.String name,
@NonNull
android.graphics.drawable.Drawable drawable)
name - the name of the imagedrawable - the drawable instance to convertpublic void addImage(@NonNull
java.lang.String name,
@NonNull
android.graphics.drawable.Drawable drawable,
@NonNull
java.util.List<ImageStretches> stretchX,
@NonNull
java.util.List<ImageStretches> stretchY,
@Nullable
ImageContent content)
name - the name of the imagedrawable - the drawable instance to convertstretchX - image stretch areas for x axixstretchY - image stretch areas for y axixcontent - image content for text to fitpublic void addImage(@NonNull
java.lang.String name,
@NonNull
android.graphics.Bitmap bitmap,
boolean sdf)
name - the name of the imagebitmap - the pre-multiplied Bitmapsdf - the flag indicating image is an SDF or template imagepublic void addImage(@NonNull
java.lang.String name,
@NonNull
android.graphics.Bitmap bitmap,
boolean sdf,
@NonNull
java.util.List<ImageStretches> stretchX,
@NonNull
java.util.List<ImageStretches> stretchY,
@Nullable
ImageContent content)
name - the name of the imagebitmap - the pre-multiplied Bitmapsdf - the flag indicating image is an SDF or template imagestretchX - image stretch areas for x axixstretchY - image stretch areas for y axixcontent - image content for text to fitpublic void addImageAsync(@NonNull
java.lang.String name,
@NonNull
android.graphics.Bitmap image)
name - the name of the imageimage - the pre-multiplied Bitmappublic void addImageAsync(@NonNull
java.lang.String name,
@NonNull
android.graphics.Bitmap image,
@NonNull
java.util.List<ImageStretches> stretchX,
@NonNull
java.util.List<ImageStretches> stretchY,
@Nullable
ImageContent content)
name - the name of the imageimage - the pre-multiplied BitmapstretchX - image stretch areas for x axixstretchY - image stretch areas for y axixcontent - image content for text to fitpublic void addImageAsync(@NonNull
java.lang.String name,
@NonNull
android.graphics.drawable.Drawable drawable)
name - the name of the imagedrawable - the drawable instance to convertpublic void addImageAsync(@NonNull
java.lang.String name,
@NonNull
android.graphics.drawable.Drawable drawable,
@NonNull
java.util.List<ImageStretches> stretchX,
@NonNull
java.util.List<ImageStretches> stretchY,
@Nullable
ImageContent content)
name - the name of the imagedrawable - the drawable instance to convertstretchX - image stretch areas for x axixstretchY - image stretch areas for y axixcontent - image content for text to fitpublic void addImageAsync(@NonNull
java.lang.String name,
@NonNull
android.graphics.Bitmap bitmap,
boolean sdf)
name - the name of the imagebitmap - the pre-multiplied Bitmapsdf - the flag indicating image is an SDF or template imagepublic void addImageAsync(@NonNull
java.lang.String name,
@NonNull
android.graphics.Bitmap bitmap,
boolean sdf,
@NonNull
java.util.List<ImageStretches> stretchX,
@NonNull
java.util.List<ImageStretches> stretchY,
@Nullable
ImageContent content)
name - the name of the imagebitmap - the pre-multiplied Bitmapsdf - the flag indicating image is an SDF or template imagestretchX - image stretch areas for x axixstretchY - image stretch areas for y axixcontent - image content for text to fitpublic void addImages(@NonNull
java.util.HashMap<java.lang.String,android.graphics.Bitmap> images)
images - the map of images to addpublic void addImages(@NonNull
java.util.HashMap<java.lang.String,android.graphics.Bitmap> images,
@NonNull
java.util.List<ImageStretches> stretchX,
@NonNull
java.util.List<ImageStretches> stretchY,
@Nullable
ImageContent content)
images - the map of images to addstretchX - image stretch areas for x axixstretchY - image stretch areas for y axixcontent - image content for text to fitpublic void addImages(@NonNull
java.util.HashMap<java.lang.String,android.graphics.Bitmap> images,
boolean sdf)
images - the map of images to addsdf - the flag indicating image is an SDF or template imagepublic void addImages(@NonNull
java.util.HashMap<java.lang.String,android.graphics.Bitmap> images,
boolean sdf,
@NonNull
java.util.List<ImageStretches> stretchX,
@NonNull
java.util.List<ImageStretches> stretchY,
@Nullable
ImageContent content)
images - the map of images to addsdf - the flag indicating image is an SDF or template imagestretchX - image stretch areas for x axixstretchY - image stretch areas for y axixcontent - image content for text to fitpublic void addImagesAsync(@NonNull
java.util.HashMap<java.lang.String,android.graphics.Bitmap> images)
images - the map of images to addpublic void addImagesAsync(@NonNull
java.util.HashMap<java.lang.String,android.graphics.Bitmap> images,
@NonNull
java.util.List<ImageStretches> stretchX,
@NonNull
java.util.List<ImageStretches> stretchY,
@Nullable
ImageContent content)
images - the map of images to addstretchX - image stretch areas for x axixstretchY - image stretch areas for y axixcontent - image content for text to fitpublic void addImagesAsync(@NonNull
java.util.HashMap<java.lang.String,android.graphics.Bitmap> images,
boolean sdf)
images - the map of images to addsdf - the flag indicating image is an SDF or template imagepublic void addImagesAsync(@NonNull
java.util.HashMap<java.lang.String,android.graphics.Bitmap> images,
boolean sdf,
@NonNull
java.util.List<ImageStretches> stretchX,
@NonNull
java.util.List<ImageStretches> stretchY,
@Nullable
ImageContent content)
images - the map of images to addsdf - the flag indicating image is an SDF or template imagestretchX - image stretch areas for x axixstretchY - image stretch areas for y axixcontent - image content for text to fitpublic void addImages(Image[] images)
images - the array of images to addpublic void removeImage(@NonNull
java.lang.String name)
name - the name of the image to remove@Nullable
public android.graphics.Bitmap getImage(@NonNull
java.lang.String id)
id - the id of the imagepublic void setTransition(@NonNull
TransitionOptions transitionOptions)
Set the transition options for style changes.
If not set, any changes take effect without animation, besides symbols, which will fade in/out with a default duration after symbol collision detection.
To disable symbols fade in/out animation,
pass transition options with TransitionOptions.enablePlacementTransitions equal to false.
Both TransitionOptions.duration and TransitionOptions.delay
will also change the behavior of the symbols fade in/out animation if the placement transition is enabled.
transitionOptions - the transition options@NonNull public TransitionOptions getTransition()
Get the transition options for style changes.
By default, any changes take effect without animation, besides symbols, which will fade in/out with a default duration after symbol collision detection.
To disable symbols fade in/out animation,
pass transition options with TransitionOptions.enablePlacementTransitions equal to false
into setTransition(TransitionOptions).
Both TransitionOptions.duration and TransitionOptions.delay
will also change the behavior of the symbols fade in/out animation if the placement transition is enabled.
@Nullable public Light getLight()
public boolean isFullyLoaded()
public static Image toImage(Style.Builder.ImageWrapper imageWrapper)