package com.mapbox.mapboxsdk.maps; import android.graphics.Bitmap; import android.graphics.drawable.Drawable; import android.os.AsyncTask; import android.support.annotation.IntRange; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.annotation.StringDef; import android.util.DisplayMetrics; import android.util.Pair; import com.mapbox.mapboxsdk.constants.MapboxConstants; import com.mapbox.mapboxsdk.style.layers.Layer; import com.mapbox.mapboxsdk.style.layers.TransitionOptions; import com.mapbox.mapboxsdk.style.light.Light; import com.mapbox.mapboxsdk.style.sources.Source; import com.mapbox.mapboxsdk.utils.BitmapUtils; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.ref.WeakReference; import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; /** * The proxy object for current map style. *
* To create new instances of this object, create a new instance using a {@link Builder} and load the style with * {@link MapboxMap#setStyle(Builder)}. This object is returned from {@link MapboxMap#getStyle()} once the style * has been loaded by underlying map. *
*/ @SuppressWarnings("unchecked") public class Style { private final NativeMap nativeMap; private final HashMap* 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 {@link TransitionOptions#enablePlacementTransitions} equal to false. *
* Both {@link TransitionOptions#duration} and {@link TransitionOptions#delay} * will also change the behavior of the symbols fade in/out animation if the placement transition is enabled. * * @param transitionOptions the transition options */ public void setTransition(@NonNull TransitionOptions transitionOptions) { validateState("setTransition"); nativeMap.setTransitionOptions(transitionOptions); } /** *
* 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 {@link TransitionOptions#enablePlacementTransitions} equal to false * into {@link #setTransition(TransitionOptions)}. *
* Both {@link TransitionOptions#duration} and {@link TransitionOptions#delay}
* will also change the behavior of the symbols fade in/out animation if the placement transition is enabled.
*
* @return TransitionOptions the transition options
*/
@NonNull
public TransitionOptions getTransition() {
validateState("getTransition");
return nativeMap.getTransitionOptions();
}
//
// Light
//
/**
* Get the light source used to change lighting conditions on extruded fill layers.
*
* @return the global light source
*/
@Nullable
public Light getLight() {
validateState("getLight");
return nativeMap.getLight();
}
//
// State
//
/**
* Called when the underlying map will start loading a new style or the map is destroyed.
* This method will clean up this style by setting the java sources and layers
* in a detached state and removing them from core.
*/
void clear() {
fullyLoaded = false;
for (Source source : sources.values()) {
if (source != null) {
source.setDetached();
nativeMap.removeSource(source);
}
}
for (Layer layer : layers.values()) {
if (layer != null) {
layer.setDetached();
nativeMap.removeLayer(layer);
}
}
for (Map.Entry
* Will loads a new map style asynchronous from the specified URL.
*
*