Class Style.Builder
- Enclosing class:
- Style
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classclassclassclassclass -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionWill load a new map style from a json string.Will loads a new map style asynchronous from the specified URI.Deprecated.getJson()getUri()withBitmapImages(boolean sdf, android.util.Pair<String, android.graphics.Bitmap>... values) Will add the images when the map style has loaded.withBitmapImages(android.util.Pair<String, android.graphics.Bitmap>... values) Will add the images when the map style has loaded.withDrawableImages(boolean sdf, android.util.Pair<String, android.graphics.drawable.Drawable>... values) Will add the drawables as images when the map style has loaded.withDrawableImages(android.util.Pair<String, android.graphics.drawable.Drawable>... values) Will add the drawables as images when the map style has loaded.Will add the image when the map style has loaded.Will add the image when the map style has loaded.withImage(String id, android.graphics.Bitmap image, boolean sdf, List<ImageStretches> stretchX, List<ImageStretches> stretchY, ImageContent content) Will add the image when the map style has loaded.withImage(String id, android.graphics.Bitmap image, List<ImageStretches> stretchX, List<ImageStretches> stretchY, ImageContent content) Will add the image when the map style has loaded.Will add the drawable as image when the map style has loaded.Will add the drawable as image when the map style has loaded.withImage(String id, android.graphics.drawable.Drawable drawable, boolean sdf, List<ImageStretches> stretchX, List<ImageStretches> stretchY, ImageContent content) Will add the drawable as image when the map style has loaded.withImage(String id, android.graphics.drawable.Drawable drawable, List<ImageStretches> stretchX, List<ImageStretches> stretchY, ImageContent content) Will add the drawable as image when the map style has loaded.Will add the layer when the style has loaded.withLayerAbove(Layer layer, String aboveLayerId) Will add the layer when the style has loaded above a specified layer id.withLayerAt(Layer layer, int index) Will add the layer when the style has loaded at a specified index.withLayerBelow(Layer layer, String belowLayerId) Will add the layer when the style has loaded below a specified layer id.withLayers(Layer... layers) Will add the layers when the style has loaded.withSource(Source source) Will add the source when map style has loaded.withSources(Source... sources) Will add the sources when map style has loaded.withTransition(TransitionOptions transition) Will add the transition when the map style has loaded.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
fromUrl
Deprecated.usefromUri(String)insteadWill loads a new map style asynchronous from the specified URL.
urlcan take the following forms:http://...orhttps://...: loads the style over the Internet from any web server.asset://...: loads the style from the APKassets/directory. This is used to load a style bundled with your app.file://...: loads the style from a file path. This is used to load a style from disk.
This method is asynchronous and will return before the style finishes loading. If you wish to wait for the map to finish loading, listen to the
If the style fails to load or an invalid style URL is set, the map view will become blank. An error message will be logged in the Android logcat andMapView.OnDidFinishLoadingStyleListenercallback or provide anStyle.OnStyleLoadedcallback when setting the style on TrimbleMapsMap.MapView.OnDidFailLoadingMapListenercallback will be triggered.- Parameters:
url- The URL of the map style- Returns:
- this
- See Also:
-
fromUri
Will loads a new map style asynchronous from the specified URI.
urican take the following forms:http://...orhttps://...: loads the style over the Internet from any web server.asset://...: loads the style from the APKassets/directory. This is used to load a style bundled with your app.file://...: loads the style from a file path. This is used to load a style from disk.
This method is asynchronous and will return before the style finishes loading. If you wish to wait for the map to finish loading, listen to the
If the style fails to load or an invalid style URI is set, the map view will become blank. An error message will be logged in the Android logcat andMapView.OnDidFinishLoadingStyleListenercallback or useTrimbleMapsMap.setStyle(String, OnStyleLoaded)instead.MapView.OnDidFailLoadingMapListenercallback will be triggered.- Parameters:
uri- The URI of the map style- Returns:
- this
- See Also:
-
fromJson
Will load a new map style from a json string.If the style fails to load or an invalid style URI is set, the map view will become blank. An error message will be logged in the Android logcat and
MapView.OnDidFailLoadingMapListenercallback will be triggered.- Returns:
- this
-
withSource
Will add the source when map style has loaded.- Parameters:
source- the source to add- Returns:
- this
-
withSources
Will add the sources when map style has loaded.- Parameters:
sources- the sources to add- Returns:
- this
-
withLayer
Will add the layer when the style has loaded.- Parameters:
layer- the layer to be added- Returns:
- this
-
withLayers
Will add the layers when the style has loaded.- Parameters:
layers- the layers to be added- Returns:
- this
-
withLayerAt
Will add the layer when the style has loaded at a specified index.- Parameters:
layer- the layer to be added- Returns:
- this
-
withLayerAbove
Will add the layer when the style has loaded above a specified layer id.- Parameters:
layer- the layer to be added- Returns:
- this
-
withLayerBelow
Will add the layer when the style has loaded below a specified layer id.- Parameters:
layer- the layer to be added- Returns:
- this
-
withTransition
Will add the transition when the map style has loaded.- Parameters:
transition- the transition to be added- Returns:
- this
-
withImage
@NonNull public Style.Builder withImage(@NonNull String id, @NonNull android.graphics.drawable.Drawable drawable) Will add the drawable as image when the map style has loaded.- Parameters:
id- the id for the imagedrawable- the drawable to be converted and added- Returns:
- this
-
withImage
@NonNull public Style.Builder withImage(@NonNull String id, @NonNull android.graphics.drawable.Drawable drawable, @NonNull List<ImageStretches> stretchX, @NonNull List<ImageStretches> stretchY, @Nullable ImageContent content) Will add the drawable as image when the map style has loaded.- Parameters:
id- the id for the imagedrawable- the drawable to be converted and addedstretchX- image stretch areas for x axixstretchY- image stretch areas for y axixcontent- image content for text to fit- Returns:
- this
-
withDrawableImages
@NonNull public Style.Builder withDrawableImages(@NonNull android.util.Pair<String, android.graphics.drawable.Drawable>... values) Will add the drawables as images when the map style has loaded.- Parameters:
values- pairs, where first is the id for te image and second is the drawable- Returns:
- this
-
withImage
Will add the image when the map style has loaded.- Parameters:
id- the id for the imageimage- the image to be added- Returns:
- this
-
withImage
@NonNull public Style.Builder withImage(@NonNull String id, @NonNull android.graphics.Bitmap image, @NonNull List<ImageStretches> stretchX, @NonNull List<ImageStretches> stretchY, @Nullable ImageContent content) Will add the image when the map style has loaded.- Parameters:
id- the id for the imageimage- the image to be addedstretchX- image stretch areas for x axixstretchY- image stretch areas for y axixcontent- image content for text to fit- Returns:
- this
-
withBitmapImages
@NonNull public Style.Builder withBitmapImages(@NonNull android.util.Pair<String, android.graphics.Bitmap>... values) Will add the images when the map style has loaded.- Parameters:
values- pairs, where first is the id for te image and second is the bitmap- Returns:
- this
-
withImage
@NonNull public Style.Builder withImage(@NonNull String id, @NonNull android.graphics.drawable.Drawable drawable, boolean sdf) Will add the drawable as image when the map style has loaded.- Parameters:
id- the id for the imagedrawable- the drawable to be converted and addedsdf- the flag indicating image is an SDF or template image- Returns:
- this
-
withImage
@NonNull public Style.Builder withImage(@NonNull String id, @NonNull android.graphics.drawable.Drawable drawable, boolean sdf, @NonNull List<ImageStretches> stretchX, @NonNull List<ImageStretches> stretchY, @Nullable ImageContent content) Will add the drawable as image when the map style has loaded.- Parameters:
id- the id for the imagedrawable- the drawable to be converted and addedsdf- 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 fit- Returns:
- this
-
withDrawableImages
@NonNull public Style.Builder withDrawableImages(boolean sdf, @NonNull android.util.Pair<String, android.graphics.drawable.Drawable>... values) Will add the drawables as images when the map style has loaded.- Parameters:
sdf- the flag indicating image is an SDF or template imagevalues- pairs, where first is the id for te image and second is the drawable- Returns:
- this
-
withImage
@NonNull public Style.Builder withImage(@NonNull String id, @NonNull android.graphics.Bitmap image, boolean sdf) Will add the image when the map style has loaded.- Parameters:
id- the id for the imageimage- the image to be addedsdf- the flag indicating image is an SDF or template image- Returns:
- this
-
withImage
@NonNull public Style.Builder withImage(@NonNull String id, @NonNull android.graphics.Bitmap image, boolean sdf, @NonNull List<ImageStretches> stretchX, @NonNull List<ImageStretches> stretchY, @Nullable ImageContent content) Will add the image when the map style has loaded.- Parameters:
id- the id for the imageimage- the image to be addedsdf- 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 fit- Returns:
- this
-
withBitmapImages
@NonNull public Style.Builder withBitmapImages(boolean sdf, @NonNull android.util.Pair<String, android.graphics.Bitmap>... values) Will add the images when the map style has loaded.- Parameters:
sdf- the flag indicating image is an SDF or template imagevalues- pairs, where first is the id for te image and second is the bitmap- Returns:
- this
-
getUri
-
getJson
-
getSources
-
getLayers
-
getImages
-
fromUri(String)instead