Replace mapboxMap with maplibreMap (#2314)
This commit is contained in:
@@ -45,7 +45,7 @@ Then add markers to the map with GeoJSON:
|
||||
```
|
||||
|
||||
4. Call `mapview.getMapSync()` in order to get a `MapboxMap` object.
|
||||
After `mapboxMap` is assigned, call the `getEarthQuakeDataFromUSGS()` method
|
||||
After `maplibreMap` is assigned, call the `getEarthQuakeDataFromUSGS()` method
|
||||
to make a HTTP request and transform data into the map annotations.
|
||||
|
||||
```kotlin
|
||||
|
||||
@@ -70,18 +70,18 @@ public abstract class Annotation implements Comparable<Annotation> {
|
||||
/**
|
||||
* Do not use this method, used internally by the SDK.
|
||||
*
|
||||
* @param maplibreMap the hosting mapbox map
|
||||
* @param maplibreMap the hosting MapLibreMap
|
||||
*/
|
||||
public void setMapboxMap(MapLibreMap maplibreMap) {
|
||||
public void setMapLibreMap(MapLibreMap maplibreMap) {
|
||||
this.maplibreMap = maplibreMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the hosting mapbox map.
|
||||
* Gets the hosting MapLibreMap.
|
||||
*
|
||||
* @return the MapboxMap
|
||||
* @return the MapLibreMap
|
||||
*/
|
||||
protected MapLibreMap getMapboxMap() {
|
||||
protected MapLibreMap getMapLibreMap() {
|
||||
return maplibreMap;
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ import java.lang.ref.WeakReference;
|
||||
public class InfoWindow {
|
||||
|
||||
private WeakReference<Marker> boundMarker;
|
||||
private WeakReference<MapLibreMap> mapboxMap;
|
||||
private WeakReference<MapLibreMap> maplibreMap;
|
||||
protected WeakReference<View> view;
|
||||
|
||||
private float markerHeightOffset;
|
||||
@@ -64,14 +64,14 @@ public class InfoWindow {
|
||||
}
|
||||
|
||||
private void initialize(@NonNull View view, MapLibreMap maplibreMap) {
|
||||
this.mapboxMap = new WeakReference<>(maplibreMap);
|
||||
this.maplibreMap = new WeakReference<>(maplibreMap);
|
||||
isVisible = false;
|
||||
this.view = new WeakReference<>(view);
|
||||
|
||||
view.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
MapLibreMap maplibreMap = InfoWindow.this.mapboxMap.get();
|
||||
MapLibreMap maplibreMap = InfoWindow.this.maplibreMap.get();
|
||||
if (maplibreMap != null) {
|
||||
MapLibreMap.OnInfoWindowClickListener onInfoWindowClickListener = maplibreMap.getOnInfoWindowClickListener();
|
||||
boolean handledDefaultClick = false;
|
||||
@@ -90,7 +90,7 @@ public class InfoWindow {
|
||||
view.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
MapLibreMap maplibreMap = InfoWindow.this.mapboxMap.get();
|
||||
MapLibreMap maplibreMap = InfoWindow.this.maplibreMap.get();
|
||||
if (maplibreMap != null) {
|
||||
MapLibreMap.OnInfoWindowLongClickListener listener = maplibreMap.getOnInfoWindowLongClickListener();
|
||||
if (listener != null) {
|
||||
@@ -103,7 +103,7 @@ public class InfoWindow {
|
||||
}
|
||||
|
||||
private void closeInfoWindow() {
|
||||
MapLibreMap mapbox = mapboxMap.get();
|
||||
MapLibreMap mapbox = maplibreMap.get();
|
||||
Marker marker = boundMarker.get();
|
||||
if (marker != null && mapbox != null) {
|
||||
mapbox.deselectMarker(marker);
|
||||
@@ -129,7 +129,7 @@ public class InfoWindow {
|
||||
MapView.LayoutParams lp = new MapView.LayoutParams(MapView.LayoutParams.WRAP_CONTENT,
|
||||
MapView.LayoutParams.WRAP_CONTENT);
|
||||
|
||||
MapLibreMap maplibreMap = this.mapboxMap.get();
|
||||
MapLibreMap maplibreMap = this.maplibreMap.get();
|
||||
View view = this.view.get();
|
||||
if (view != null && maplibreMap != null) {
|
||||
view.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
|
||||
@@ -222,7 +222,7 @@ public class InfoWindow {
|
||||
*/
|
||||
@NonNull
|
||||
InfoWindow close() {
|
||||
MapLibreMap maplibreMap = this.mapboxMap.get();
|
||||
MapLibreMap maplibreMap = this.maplibreMap.get();
|
||||
if (isVisible && maplibreMap != null) {
|
||||
isVisible = false;
|
||||
View view = this.view.get();
|
||||
@@ -253,7 +253,7 @@ public class InfoWindow {
|
||||
view = LayoutInflater.from(mapView.getContext()).inflate(layoutRes, mapView, false);
|
||||
initialize(view, maplibreMap);
|
||||
}
|
||||
this.mapboxMap = new WeakReference<>(maplibreMap);
|
||||
this.maplibreMap = new WeakReference<>(maplibreMap);
|
||||
String title = overlayItem.getTitle();
|
||||
TextView titleTextView = ((TextView) view.findViewById(R.id.infowindow_title));
|
||||
if (!TextUtils.isEmpty(title)) {
|
||||
@@ -291,7 +291,7 @@ public class InfoWindow {
|
||||
* Will result in getting this {@link InfoWindow} and updating the view being displayed.
|
||||
*/
|
||||
public void update() {
|
||||
MapLibreMap maplibreMap = this.mapboxMap.get();
|
||||
MapLibreMap maplibreMap = this.maplibreMap.get();
|
||||
Marker marker = boundMarker.get();
|
||||
View view = this.view.get();
|
||||
if (maplibreMap != null && marker != null && view != null) {
|
||||
|
||||
@@ -123,7 +123,7 @@ public class Marker extends Annotation {
|
||||
*/
|
||||
public void setPosition(LatLng position) {
|
||||
this.position = position;
|
||||
MapLibreMap map = getMapboxMap();
|
||||
MapLibreMap map = getMapLibreMap();
|
||||
if (map != null) {
|
||||
map.updateMarker(this);
|
||||
}
|
||||
@@ -148,7 +148,7 @@ public class Marker extends Annotation {
|
||||
public void setIcon(@Nullable Icon icon) {
|
||||
this.icon = icon;
|
||||
this.iconId = icon != null ? icon.getId() : null;
|
||||
MapLibreMap map = getMapboxMap();
|
||||
MapLibreMap map = getMapLibreMap();
|
||||
if (map != null) {
|
||||
map.updateMarker(this);
|
||||
}
|
||||
@@ -196,7 +196,7 @@ public class Marker extends Annotation {
|
||||
if (mapView.getContext() != null) {
|
||||
infoWindow.adaptDefaultMarker(this, maplibreMap, mapView);
|
||||
}
|
||||
MapLibreMap map = getMapboxMap();
|
||||
MapLibreMap map = getMapLibreMap();
|
||||
if (map != null) {
|
||||
map.updateMarker(this);
|
||||
}
|
||||
@@ -208,15 +208,15 @@ public class Marker extends Annotation {
|
||||
* Do not use this method, used internally by the SDK. Use {@link MapLibreMap#selectMarker(Marker)}
|
||||
* if you want to programmatically display the markers info window.
|
||||
*
|
||||
* @param maplibreMap The hosting mapbox map.
|
||||
* @param maplibreMap The hosting MapLibreMap.
|
||||
* @param mapView The hosting map view.
|
||||
* @return The info window that was shown.
|
||||
*/
|
||||
@Nullable
|
||||
public InfoWindow showInfoWindow(@NonNull MapLibreMap maplibreMap, @NonNull MapView mapView) {
|
||||
setMapboxMap(maplibreMap);
|
||||
setMapLibreMap(maplibreMap);
|
||||
setMapView(mapView);
|
||||
MapLibreMap.InfoWindowAdapter infoWindowAdapter = getMapboxMap().getInfoWindowAdapter();
|
||||
MapLibreMap.InfoWindowAdapter infoWindowAdapter = getMapLibreMap().getInfoWindowAdapter();
|
||||
if (infoWindowAdapter != null) {
|
||||
// end developer is using a custom InfoWindowAdapter
|
||||
View content = infoWindowAdapter.getInfoWindow(this);
|
||||
@@ -244,7 +244,7 @@ public class Marker extends Annotation {
|
||||
@Nullable
|
||||
private InfoWindow getInfoWindow(@NonNull MapView mapView) {
|
||||
if (infoWindow == null && mapView.getContext() != null) {
|
||||
infoWindow = new InfoWindow(mapView, R.layout.maplibre_infowindow_content, getMapboxMap());
|
||||
infoWindow = new InfoWindow(mapView, R.layout.maplibre_infowindow_content, getMapLibreMap());
|
||||
}
|
||||
return infoWindow;
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ public final class Polygon extends BasePointCollection {
|
||||
|
||||
@Override
|
||||
void update() {
|
||||
MapLibreMap maplibreMap = getMapboxMap();
|
||||
MapLibreMap maplibreMap = getMapLibreMap();
|
||||
if (maplibreMap != null) {
|
||||
maplibreMap.updatePolygon(this);
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ public final class Polyline extends BasePointCollection {
|
||||
|
||||
@Override
|
||||
void update() {
|
||||
MapLibreMap maplibreMap = getMapboxMap();
|
||||
MapLibreMap maplibreMap = getMapLibreMap();
|
||||
if (maplibreMap != null) {
|
||||
maplibreMap.updatePolyline(this);
|
||||
}
|
||||
|
||||
@@ -365,54 +365,6 @@ object CameraUpdateFactory {
|
||||
}
|
||||
}
|
||||
|
||||
/* This class 1. Does not seem to be used 2. The code that calculates targetPoint seems to be a bit suspicious.
|
||||
commenting out for now.
|
||||
*/
|
||||
/*
|
||||
internal class CameraMoveUpdate(private val x: Float, private val y: Float) : CameraUpdate {
|
||||
override fun getCameraPosition(mapboxMap: MapboxMap): CameraPosition {
|
||||
val uiSettings = mapboxMap.uiSettings
|
||||
val projection = mapboxMap.projection
|
||||
// Calculate the new center point
|
||||
val viewPortWidth = uiSettings.width
|
||||
val viewPortHeight = uiSettings.height
|
||||
val padding = mapboxMap.cameraPosition.padding!!
|
||||
|
||||
// we inverse the map padding, is reapplied when using moveTo/easeTo or animateTo
|
||||
val targetPoint = PointF((viewPortWidth - padding[0].toFloat() + padding[1].toFloat()) / 2 + x,
|
||||
(viewPortHeight + padding[1].toFloat() - padding[3].toFloat()) / 2 + y)
|
||||
val latLng = projection.fromScreenLocation(targetPoint)
|
||||
val previousPosition = mapboxMap.cameraPosition
|
||||
return CameraPosition.Builder().target(latLng).zoom(previousPosition.zoom).tilt(previousPosition.tilt).bearing(previousPosition.bearing).build()
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) {
|
||||
return true
|
||||
}
|
||||
if (other == null || javaClass != other.javaClass) {
|
||||
return false
|
||||
}
|
||||
val that = other as CameraMoveUpdate
|
||||
return if (java.lang.Float.compare(that.x, x) != 0) {
|
||||
false
|
||||
} else {
|
||||
that.y.compareTo(y) == 0
|
||||
}
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = if (x != +0.0f) java.lang.Float.floatToIntBits(x) else 0
|
||||
result = 31 * result + if (y != +0.0f) java.lang.Float.floatToIntBits(y) else 0
|
||||
return result
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return ("CameraMoveUpdate{" + "x=" + x + ", y=" + y + '}')
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
class ZoomUpdate : CameraUpdate {
|
||||
@IntDef(ZOOM_IN, ZOOM_OUT, ZOOM_BY, ZOOM_TO, ZOOM_TO_POINT)
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
|
||||
@@ -190,9 +190,9 @@ public class MapLibreConstants {
|
||||
public static final float ZOOM_RATE = 0.65f;
|
||||
|
||||
/**
|
||||
* Fragment Argument Key for MapboxMapOptions
|
||||
* Fragment Argument Key for MapLibreMapOptions
|
||||
*/
|
||||
public static final String FRAG_ARG_MAPLIBREMAPOPTIONS = "MapboxMapOptions";
|
||||
public static final String FRAG_ARG_MAPLIBREMAPOPTIONS = "MapLibreMapOptions";
|
||||
|
||||
/**
|
||||
* Layer Id of annotations layer
|
||||
|
||||
@@ -19,7 +19,7 @@ import androidx.annotation.NonNull;
|
||||
public class MapLibreConfigurationException extends RuntimeException {
|
||||
|
||||
/**
|
||||
* Creates a MapLibre configuration exception thrown by MapboxMap when the SDK hasn't been properly initialised.
|
||||
* Creates a MapLibre configuration exception thrown by MapLibreMap when the SDK hasn't been properly initialised.
|
||||
*/
|
||||
public MapLibreConfigurationException() {
|
||||
super("\nUsing MapView requires calling MapLibre.getInstance(Context context, String apiKey, "
|
||||
@@ -27,7 +27,7 @@ public class MapLibreConfigurationException extends RuntimeException {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a MapLibre configuration exception thrown by MapboxMap when the SDK hasn't been properly initialised.
|
||||
* Creates a MapLibre configuration exception thrown by MapLibreMap when the SDK hasn't been properly initialised.
|
||||
*/
|
||||
public MapLibreConfigurationException(@NonNull String message) {
|
||||
super(message);
|
||||
|
||||
@@ -75,8 +75,8 @@ class AnnotationManager {
|
||||
this.shapeAnnotations = shapeAnnotations;
|
||||
}
|
||||
|
||||
// TODO refactor MapboxMap out for Projection and Transform
|
||||
// Requires removing MapboxMap from Annotations by using Peer model from #6912
|
||||
// TODO refactor MapLibreMap out for Projection and Transform
|
||||
// Requires removing MapLibreMap from Annotations by using Peer model from #6912
|
||||
@NonNull
|
||||
AnnotationManager bind(MapLibreMap maplibreMap) {
|
||||
this.maplibreMap = maplibreMap;
|
||||
|
||||
@@ -211,7 +211,7 @@ public final class MapFragment extends Fragment implements OnMapReadyCallback {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a callback object which will be triggered when the MapboxMap instance is ready to be used.
|
||||
* Sets a callback object which will be triggered when the MapLibreMap instance is ready to be used.
|
||||
*
|
||||
* @param onMapReadyCallback The callback to be invoked.
|
||||
*/
|
||||
|
||||
@@ -52,13 +52,13 @@ import java.util.List;
|
||||
* you must obtain one from the getMapAsync() method on a MapFragment or MapView that you have
|
||||
* added to your application.
|
||||
* <p>
|
||||
* Note: Similar to a View object, a MapboxMap should only be read and modified from the main thread.
|
||||
* Note: Similar to a View object, a MapLibreMap should only be read and modified from the main thread.
|
||||
* </p>
|
||||
*/
|
||||
@UiThread
|
||||
public final class MapLibreMap {
|
||||
|
||||
private static final String TAG = "Mbgl-MapboxMap";
|
||||
private static final String TAG = "Mbgl-MapLibreMap";
|
||||
|
||||
private final NativeMap nativeMapView;
|
||||
private final UiSettings uiSettings;
|
||||
@@ -303,7 +303,7 @@ public final class MapLibreMap {
|
||||
* Set the tile pre-fetching zoom delta. Pre-fetching makes sure that a low-resolution
|
||||
* tile at the (current_zoom_level - delta) is rendered as soon as possible at the
|
||||
* expense of a little bandwidth.
|
||||
* Note: This operation will override the MapboxMapOptions#setPrefetchesTiles(boolean)
|
||||
* Note: This operation will override the MapLibreMapOptions#setPrefetchesTiles(boolean)
|
||||
* Setting zoom delta to 0 will disable pre-fetching.
|
||||
* Default zoom delta is 4.
|
||||
*
|
||||
|
||||
@@ -29,9 +29,9 @@ import java.util.Arrays;
|
||||
/**
|
||||
* Defines configuration MapLibreMapOptions for a MapLibreMap. These options can be used when adding a
|
||||
* map to your application programmatically (as opposed to via XML). If you are using a MapFragment,
|
||||
* you can pass these options in using the static factory method newInstance(MapboxMapOptions).
|
||||
* you can pass these options in using the static factory method newInstance(MapLibreMapOptions).
|
||||
* If you are using a MapView, you can pass these options in using the constructor
|
||||
* MapView(Context, MapboxMapOptions). If you add a map using XML, then you can apply these options
|
||||
* MapView(Context, MapLibreMapOptions). If you add a map using XML, then you can apply these options
|
||||
* using custom XML tags.
|
||||
*/
|
||||
public class MapLibreMapOptions implements Parcelable {
|
||||
@@ -95,7 +95,7 @@ public class MapLibreMapOptions implements Parcelable {
|
||||
private boolean crossSourceCollisions = true;
|
||||
|
||||
/**
|
||||
* Creates a new MapboxMapOptions object.
|
||||
* Creates a new MapLibreMapOptions object.
|
||||
*
|
||||
* @deprecated Use {@link #createFromAttributes(Context, AttributeSet)} instead.
|
||||
*/
|
||||
@@ -154,10 +154,10 @@ public class MapLibreMapOptions implements Parcelable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a default MapboxMapsOptions from a given context.
|
||||
* Creates a default MapLibreMapsOptions from a given context.
|
||||
*
|
||||
* @param context Context related to a map view.
|
||||
* @return the MapboxMapOptions created from attributes
|
||||
* @return the MapLibreMapOptions created from attributes
|
||||
*/
|
||||
@NonNull
|
||||
public static MapLibreMapOptions createFromAttributes(@NonNull Context context) {
|
||||
@@ -165,11 +165,11 @@ public class MapLibreMapOptions implements Parcelable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a MapboxMapsOptions from the attribute set.
|
||||
* Creates a MapLibreMapsOptions from the attribute set.
|
||||
*
|
||||
* @param context Context related to a map view.
|
||||
* @param attrs Attributeset containing configuration
|
||||
* @return the MapboxMapOptions created from attributes
|
||||
* @return the MapLibreMapOptions created from attributes
|
||||
*/
|
||||
@NonNull
|
||||
public static MapLibreMapOptions createFromAttributes(@NonNull Context context, @Nullable AttributeSet attrs) {
|
||||
@@ -701,7 +701,7 @@ public class MapLibreMapOptions implements Parcelable {
|
||||
* Set the tile pre-fetching zoom delta. Pre-fetching makes sure that a low-resolution
|
||||
* tile at the (current_zoom_level - delta) is rendered as soon as possible at the
|
||||
* expense of a little bandwidth.
|
||||
* Note: This operation will override the MapboxMapOptions#setPrefetchesTiles(boolean)
|
||||
* Note: This operation will override the MapLibreMapOptions#setPrefetchesTiles(boolean)
|
||||
* Setting zoom delta to 0 will disable pre-fetching.
|
||||
* Default zoom delta is 4.
|
||||
*
|
||||
|
||||
@@ -122,7 +122,7 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback {
|
||||
@UiThread
|
||||
public MapView(@NonNull Context context, @Nullable MapLibreMapOptions options) {
|
||||
super(context);
|
||||
Timber.d("MapView constructed with context and MapboxMapOptions");
|
||||
Timber.d("MapView constructed with context and MapLibreMapOptions");
|
||||
initialize(context, options == null ? MapLibreMapOptions.createFromAttributes(context) : options);
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback {
|
||||
// callback for focal point invalidation
|
||||
focalInvalidator.addListener(createFocalPointChangeListener());
|
||||
|
||||
// setup components for MapboxMap creation
|
||||
// setup components for MapLibreMap creation
|
||||
Projection proj = new Projection(nativeMapView, this);
|
||||
UiSettings uiSettings = new UiSettings(proj, focalInvalidator, getPixelRatio(), this);
|
||||
LongSparseArray<Annotation> annotationsArray = new LongSparseArray<>();
|
||||
@@ -169,7 +169,7 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback {
|
||||
annotations, markers, polygons, polylines, shapeAnnotations);
|
||||
Transform transform = new Transform(this, nativeMapView, cameraDispatcher);
|
||||
|
||||
// MapboxMap
|
||||
// MapLibreMap
|
||||
List<MapLibreMap.OnDeveloperAnimationListener> developerAnimationListeners = new ArrayList<>();
|
||||
maplibreMap = new MapLibreMap(nativeMapView, transform, uiSettings, proj, registerTouchListener, cameraDispatcher,
|
||||
developerAnimationListeners);
|
||||
@@ -193,7 +193,7 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback {
|
||||
// notify Map object about current connectivity state
|
||||
nativeMapView.setReachability(MapLibre.isConnected());
|
||||
|
||||
// initialise MapboxMap
|
||||
// initialise MapLibreMap
|
||||
if (savedInstanceState == null) {
|
||||
maplibreMap.initialise(context, maplibreMapOptions);
|
||||
} else {
|
||||
@@ -226,7 +226,7 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback {
|
||||
attrView.setFocusable(true);
|
||||
attrView.setContentDescription(getResources().getString(R.string.maplibre_attributionsIconContentDescription));
|
||||
attrView.setImageDrawable(BitmapUtils.getDrawableFromRes(getContext(), R.drawable.maplibre_info_bg_selector));
|
||||
// inject widgets with MapboxMap
|
||||
// inject widgets with MapLibreMap
|
||||
attrView.setOnClickListener(attributionClickListener = new AttributionClickListener(getContext(), maplibreMap));
|
||||
return attrView;
|
||||
}
|
||||
@@ -1147,11 +1147,11 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
MapLibreMap getMapboxMap() {
|
||||
MapLibreMap getMapLibreMap() {
|
||||
return maplibreMap;
|
||||
}
|
||||
|
||||
void setMapboxMap(MapLibreMap maplibreMap) {
|
||||
void setMapLibreMap(MapLibreMap maplibreMap) {
|
||||
this.maplibreMap = maplibreMap;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ class MarkerContainer implements Markers {
|
||||
public Marker addBy(@NonNull BaseMarkerOptions markerOptions, @NonNull MapLibreMap maplibreMap) {
|
||||
Marker marker = prepareMarker(markerOptions);
|
||||
long id = nativeMapView != null ? nativeMapView.addMarker(marker) : 0;
|
||||
marker.setMapboxMap(maplibreMap);
|
||||
marker.setMapLibreMap(maplibreMap);
|
||||
marker.setId(id);
|
||||
annotations.put(id, marker);
|
||||
return marker;
|
||||
@@ -57,7 +57,7 @@ class MarkerContainer implements Markers {
|
||||
long[] ids = nativeMapView.addMarkers(markers);
|
||||
for (int i = 0; i < ids.length; i++) {
|
||||
Marker createdMarker = markers.get(i);
|
||||
createdMarker.setMapboxMap(maplibreMap);
|
||||
createdMarker.setMapLibreMap(maplibreMap);
|
||||
createdMarker.setId(ids[i]);
|
||||
annotations.put(ids[i], createdMarker);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import androidx.annotation.NonNull;
|
||||
* Interface definition for a callback to be invoked when the map is ready to be used.
|
||||
* <p>
|
||||
* Once an instance of this interface is set on a {@link MapFragment} or {@link MapView} object,
|
||||
* the onMapReady(MapboxMap) method is triggered when the map is ready to be used and provides an instance of
|
||||
* the onMapReady(MapLibreMap) method is triggered when the map is ready to be used and provides an instance of
|
||||
* {@link MapLibreMap}.
|
||||
* </p>
|
||||
*/
|
||||
@@ -15,7 +15,7 @@ public interface OnMapReadyCallback {
|
||||
/**
|
||||
* Called when the map is ready to be used.
|
||||
*
|
||||
* @param maplibreMap An instance of MapboxMap associated with the {@link MapFragment} or
|
||||
* @param maplibreMap An instance of MapLibreMap associated with the {@link MapFragment} or
|
||||
* {@link MapView} that defines the callback.
|
||||
*/
|
||||
void onMapReady(@NonNull MapLibreMap maplibreMap);
|
||||
|
||||
@@ -30,7 +30,7 @@ class PolygonContainer implements Polygons {
|
||||
if (!polygon.getPoints().isEmpty()) {
|
||||
long id = nativeMap != null ? nativeMap.addPolygon(polygon) : 0;
|
||||
polygon.setId(id);
|
||||
polygon.setMapboxMap(maplibreMap);
|
||||
polygon.setMapLibreMap(maplibreMap);
|
||||
annotations.put(id, polygon);
|
||||
}
|
||||
return polygon;
|
||||
@@ -54,7 +54,7 @@ class PolygonContainer implements Polygons {
|
||||
long[] ids = nativeMap.addPolygons(polygons);
|
||||
for (int i = 0; i < ids.length; i++) {
|
||||
polygon = polygons.get(i);
|
||||
polygon.setMapboxMap(maplibreMap);
|
||||
polygon.setMapLibreMap(maplibreMap);
|
||||
polygon.setId(ids[i]);
|
||||
annotations.put(ids[i], polygon);
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ class PolylineContainer implements Polylines {
|
||||
Polyline polyline = polylineOptions.getPolyline();
|
||||
if (!polyline.getPoints().isEmpty()) {
|
||||
long id = nativeMap != null ? nativeMap.addPolyline(polyline) : 0;
|
||||
polyline.setMapboxMap(maplibreMap);
|
||||
polyline.setMapLibreMap(maplibreMap);
|
||||
polyline.setId(id);
|
||||
annotations.put(id, polyline);
|
||||
}
|
||||
@@ -53,7 +53,7 @@ class PolylineContainer implements Polylines {
|
||||
long[] ids = nativeMap.addPolylines(polylines);
|
||||
for (int i = 0; i < ids.length; i++) {
|
||||
Polyline polylineCreated = polylines.get(i);
|
||||
polylineCreated.setMapboxMap(maplibreMap);
|
||||
polylineCreated.setMapLibreMap(maplibreMap);
|
||||
polylineCreated.setId(ids[i]);
|
||||
annotations.put(ids[i], polylineCreated);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ import java.util.Map;
|
||||
* The proxy object for current map style.
|
||||
* <p>
|
||||
* To create new instances of this object, create a new instance using a {@link Builder} and load the style with
|
||||
* MapboxMap. This object is returned from {@link MapLibreMap#getStyle()} once the style
|
||||
* MapLibreMap. This object is returned from {@link MapLibreMap#getStyle()} once the style
|
||||
* has been loaded by underlying map.
|
||||
* </p>
|
||||
*/
|
||||
@@ -814,7 +814,7 @@ public class Style {
|
||||
* <p>
|
||||
* 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 {@link MapView.OnDidFinishLoadingStyleListener}
|
||||
* callback or provide an {@link OnStyleLoaded} callback when setting the style on MapboxMap.
|
||||
* callback or provide an {@link OnStyleLoaded} callback when setting the style on MapLibreMap.
|
||||
* </p>
|
||||
* 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 and {@link MapView.OnDidFailLoadingMapListener} callback
|
||||
|
||||
@@ -206,7 +206,7 @@ public class SupportMapFragment extends Fragment implements OnMapReadyCallback {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a callback object which will be triggered when the MapboxMap instance is ready to be used.
|
||||
* Sets a callback object which will be triggered when the MapLibreMap instance is ready to be used.
|
||||
*
|
||||
* @param onMapReadyCallback The callback to be invoked.
|
||||
*/
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.maplibre.android.utils.BitmapUtils;
|
||||
import org.maplibre.android.utils.ColorUtils;
|
||||
|
||||
/**
|
||||
* Settings for the user interface of a MapboxMap. To obtain this interface, call getUiSettings().
|
||||
* Settings for the user interface of a MapLibreMap. To obtain this interface, call getUiSettings().
|
||||
*/
|
||||
public final class UiSettings {
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ interface OfflineRegionDefinition : Parcelable {
|
||||
* Defaults to `true`
|
||||
*
|
||||
* @return true if offline region will include ideographic glyphs
|
||||
* @see MapboxMapOptions.localIdeographFontFamily
|
||||
* @see MapLibreMapOptions.localIdeographFontFamily
|
||||
*/
|
||||
val includeIdeographs: Boolean
|
||||
|
||||
|
||||
@@ -3008,7 +3008,7 @@ public class Expression {
|
||||
* </p>
|
||||
* <pre>
|
||||
* {@code
|
||||
* mapboxMap.getStyle().addLayer(new SymbolLayer("layer-id", "source-id")
|
||||
* maplibreMap.getStyle().addLayer(new SymbolLayer("layer-id", "source-id")
|
||||
* .withProperties(
|
||||
* textField(
|
||||
* switchCase(
|
||||
@@ -3039,7 +3039,7 @@ public class Expression {
|
||||
* </p>
|
||||
* <pre>
|
||||
* {@code
|
||||
* mapboxMap.getStyle().addLayer(new SymbolLayer("layer-id", "source-id")
|
||||
* maplibreMap.getStyle().addLayer(new SymbolLayer("layer-id", "source-id")
|
||||
* .withProperties(
|
||||
* textField(
|
||||
* switchCase(
|
||||
|
||||
@@ -18,7 +18,7 @@ public class CustomLayer extends Layer {
|
||||
/**
|
||||
* Triggers map re-paint.
|
||||
*
|
||||
* @deprecated Use {@link MapboxMap#triggerRepaint()} instead.
|
||||
* @deprecated Use {@link MapLibreMap#triggerRepaint()} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
@Keep
|
||||
|
||||
@@ -84,7 +84,7 @@ public abstract class Source {
|
||||
* Set the tile pre-fetching zoom delta for current source. Pre-fetching makes sure that a low-resolution
|
||||
* tile at the (current_zoom_level - delta) is rendered as soon as possible at the
|
||||
* expense of a little bandwidth.
|
||||
* If delta has not been set or set to null, it will use the value in MapboxMap instance.
|
||||
* If delta has not been set or set to null, it will use the value in MapLibreMap instance.
|
||||
*
|
||||
* @param delta zoom delta
|
||||
*/
|
||||
|
||||
@@ -21,9 +21,9 @@ import org.maplibre.android.maps.MapLibreMapOptions;
|
||||
public class MapFragmentUtils {
|
||||
|
||||
/**
|
||||
* Convert MapboxMapOptions to a bundle of fragment arguments.
|
||||
* Convert MapLibreMapOptions to a bundle of fragment arguments.
|
||||
*
|
||||
* @param options The MapboxMapOptions to convert
|
||||
* @param options The MapLibreMapOptions to convert
|
||||
* @return a bundle of converted fragment arguments
|
||||
*/
|
||||
@NonNull
|
||||
@@ -34,11 +34,11 @@ public class MapFragmentUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a bundle of fragment arguments to MapboxMapOptions.
|
||||
* Convert a bundle of fragment arguments to MapLibreMapOptions.
|
||||
*
|
||||
* @param context The context of the activity hosting the fragment
|
||||
* @param args The fragment arguments
|
||||
* @return converted MapboxMapOptions
|
||||
* @return converted MapLibreMapOptions
|
||||
*/
|
||||
@Nullable
|
||||
public static MapLibreMapOptions resolveArgs(@NonNull Context context, @Nullable Bundle args) {
|
||||
|
||||
@@ -31,7 +31,7 @@ class AnnotationTest {
|
||||
@Test
|
||||
fun testRemove() {
|
||||
annotation!!.id = 1
|
||||
annotation!!.setMapboxMap(maplibreMap)
|
||||
annotation!!.setMapLibreMap(maplibreMap)
|
||||
annotation!!.remove()
|
||||
Mockito.verify(maplibreMap, Mockito.times(1)).removeAnnotation(
|
||||
annotation!!
|
||||
@@ -39,7 +39,7 @@ class AnnotationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testRemoveUnboundMapboxMap() {
|
||||
fun testRemoveUnboundMapLibreMap() {
|
||||
annotation!!.id = 1
|
||||
annotation!!.remove()
|
||||
Mockito.verify(maplibreMap, Mockito.times(0)).removeAnnotation(
|
||||
|
||||
@@ -28,7 +28,7 @@ import org.maplibre.android.testapp.activity.EspressoTest
|
||||
* This test is responsible for testing the public API.
|
||||
*
|
||||
*
|
||||
* Methods executed on MapboxMap are called from a ViewAction to ensure correct synchronisation
|
||||
* Methods executed on MapLibreMap are called from a ViewAction to ensure correct synchronisation
|
||||
* with the application UI-thread.
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -15,7 +15,7 @@ class TransformTest : EspressoTest() {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun mapboxMapScrollByWithPadding() {
|
||||
fun maplibreMapScrollByWithPadding() {
|
||||
validateTestSetup()
|
||||
invoke(maplibreMap) { _: UiController, maplibreMap: MapLibreMap ->
|
||||
maplibreMap.moveCamera(initialCameraUpdate)
|
||||
|
||||
@@ -25,22 +25,22 @@ public class MarkerTest extends EspressoTest {
|
||||
@Ignore
|
||||
public void addMarkerTest() {
|
||||
validateTestSetup();
|
||||
MapLibreMapAction.invoke(maplibreMap, (uiController, mapboxMap) -> {
|
||||
assertEquals("Markers should be empty", 0, mapboxMap.getMarkers().size());
|
||||
MapLibreMapAction.invoke(maplibreMap, (uiController, maplibreMap) -> {
|
||||
assertEquals("Markers should be empty", 0, maplibreMap.getMarkers().size());
|
||||
|
||||
MarkerOptions options = new MarkerOptions();
|
||||
options.setPosition(new LatLng());
|
||||
options.setSnippet(TestConstants.TEXT_MARKER_SNIPPET);
|
||||
options.setTitle(TestConstants.TEXT_MARKER_TITLE);
|
||||
marker = mapboxMap.addMarker(options);
|
||||
marker = maplibreMap.addMarker(options);
|
||||
|
||||
assertEquals("Markers size should be 1, ", 1, mapboxMap.getMarkers().size());
|
||||
assertEquals("Markers size should be 1, ", 1, maplibreMap.getMarkers().size());
|
||||
assertEquals("Marker id should be 0", 0, marker.getId());
|
||||
assertEquals("Marker target should match", new LatLng(), marker.getPosition());
|
||||
assertEquals("Marker snippet should match", TestConstants.TEXT_MARKER_SNIPPET, marker.getSnippet());
|
||||
assertEquals("Marker target should match", TestConstants.TEXT_MARKER_TITLE, marker.getTitle());
|
||||
mapboxMap.clear();
|
||||
assertEquals("Markers should be empty", 0, mapboxMap.getMarkers().size());
|
||||
maplibreMap.clear();
|
||||
assertEquals("Markers should be empty", 0, maplibreMap.getMarkers().size());
|
||||
});
|
||||
}
|
||||
|
||||
@@ -48,13 +48,13 @@ public class MarkerTest extends EspressoTest {
|
||||
@Ignore
|
||||
public void showInfoWindowTest() {
|
||||
validateTestSetup();
|
||||
invoke(maplibreMap, (uiController, mapboxMap) -> {
|
||||
invoke(maplibreMap, (uiController, maplibreMap) -> {
|
||||
final MarkerOptions options = new MarkerOptions();
|
||||
options.setPosition(new LatLng());
|
||||
options.setSnippet(TestConstants.TEXT_MARKER_SNIPPET);
|
||||
options.setTitle(TestConstants.TEXT_MARKER_TITLE);
|
||||
marker = mapboxMap.addMarker(options);
|
||||
mapboxMap.selectMarker(marker);
|
||||
marker = maplibreMap.addMarker(options);
|
||||
maplibreMap.selectMarker(marker);
|
||||
});
|
||||
onView(withText(TestConstants.TEXT_MARKER_TITLE)).check(matches(isDisplayed()));
|
||||
onView(withText(TestConstants.TEXT_MARKER_SNIPPET)).check(matches(isDisplayed()));
|
||||
|
||||
@@ -19,12 +19,12 @@ public class PolygonTest extends EspressoTest {
|
||||
@Ignore
|
||||
public void addPolygonTest() {
|
||||
validateTestSetup();
|
||||
invoke(maplibreMap, (uiController, mapboxMap) -> {
|
||||
invoke(maplibreMap, (uiController, maplibreMap) -> {
|
||||
LatLng latLngOne = new LatLng();
|
||||
LatLng latLngTwo = new LatLng(1, 0);
|
||||
LatLng latLngThree = new LatLng(1, 1);
|
||||
|
||||
assertEquals("Polygons should be empty", 0, mapboxMap.getPolygons().size());
|
||||
assertEquals("Polygons should be empty", 0, maplibreMap.getPolygons().size());
|
||||
|
||||
final PolygonOptions options = new PolygonOptions();
|
||||
options.strokeColor(Color.BLUE);
|
||||
@@ -32,15 +32,15 @@ public class PolygonTest extends EspressoTest {
|
||||
options.add(latLngOne);
|
||||
options.add(latLngTwo);
|
||||
options.add(latLngThree);
|
||||
Polygon polygon = mapboxMap.addPolygon(options);
|
||||
Polygon polygon = maplibreMap.addPolygon(options);
|
||||
|
||||
assertEquals("Polygons should be 1", 1, mapboxMap.getPolygons().size());
|
||||
assertEquals("Polygons should be 1", 1, maplibreMap.getPolygons().size());
|
||||
assertEquals("Polygon id should be 0", 0, polygon.getId());
|
||||
assertEquals("Polygon points size should match", 3, polygon.getPoints().size());
|
||||
assertEquals("Polygon stroke color should match", Color.BLUE, polygon.getStrokeColor());
|
||||
assertEquals("Polygon target should match", Color.RED, polygon.getFillColor());
|
||||
mapboxMap.clear();
|
||||
assertEquals("Polygons should be empty", 0, mapboxMap.getPolygons().size());
|
||||
maplibreMap.clear();
|
||||
assertEquals("Polygons should be empty", 0, maplibreMap.getPolygons().size());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,24 +19,24 @@ public class PolylineTest extends EspressoTest {
|
||||
@Ignore
|
||||
public void addPolylineTest() {
|
||||
validateTestSetup();
|
||||
invoke(maplibreMap, (uiController, mapboxMap) -> {
|
||||
invoke(maplibreMap, (uiController, maplibreMap) -> {
|
||||
LatLng latLngOne = new LatLng();
|
||||
LatLng latLngTwo = new LatLng(1, 0);
|
||||
|
||||
assertEquals("Polygons should be empty", 0, mapboxMap.getPolygons().size());
|
||||
assertEquals("Polygons should be empty", 0, maplibreMap.getPolygons().size());
|
||||
|
||||
final PolylineOptions options = new PolylineOptions();
|
||||
options.color(Color.BLUE);
|
||||
options.add(latLngOne);
|
||||
options.add(latLngTwo);
|
||||
Polyline polyline = mapboxMap.addPolyline(options);
|
||||
Polyline polyline = maplibreMap.addPolyline(options);
|
||||
|
||||
assertEquals("Polylines should be 1", 1, mapboxMap.getPolylines().size());
|
||||
assertEquals("Polylines should be 1", 1, maplibreMap.getPolylines().size());
|
||||
assertEquals("Polyline id should be 0", 0, polyline.getId());
|
||||
assertEquals("Polyline points size should match", 2, polyline.getPoints().size());
|
||||
assertEquals("Polyline stroke color should match", Color.BLUE, polyline.getColor());
|
||||
mapboxMap.clear();
|
||||
assertEquals("Polyline should be empty", 0, mapboxMap.getPolylines().size());
|
||||
maplibreMap.clear();
|
||||
assertEquals("Polyline should be empty", 0, maplibreMap.getPolylines().size());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,24 +38,24 @@ public abstract class CameraTest extends BaseTest {
|
||||
@Test
|
||||
public void testToCameraPositionTarget() throws InterruptedException {
|
||||
validateTestSetup();
|
||||
invoke(maplibreMap, (uiController, mapboxMap) -> {
|
||||
invoke(maplibreMap, (uiController, maplibreMap) -> {
|
||||
float zoom = 1.0f;
|
||||
LatLng moveTarget = new LatLng(1, 1);
|
||||
CameraPosition initialPosition = new CameraPosition.Builder().target(
|
||||
new LatLng()).zoom(zoom).bearing(0).tilt(0).padding(new double[4]).build();
|
||||
CameraPosition cameraPosition = mapboxMap.getCameraPosition();
|
||||
CameraPosition cameraPosition = maplibreMap.getCameraPosition();
|
||||
assertEquals("Default camera position should match default", cameraPosition, initialPosition);
|
||||
|
||||
executeCameraMovement(CameraUpdateFactory.newLatLng(moveTarget), new MapLibreMap.CancelableCallback() {
|
||||
@Override
|
||||
public void onCancel() {
|
||||
verifyCameraPosition(mapboxMap, moveTarget, zoom, 0, 0, new double[4]);
|
||||
verifyCameraPosition(maplibreMap, moveTarget, zoom, 0, 0, new double[4]);
|
||||
latch.countDown();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
verifyCameraPosition(mapboxMap, moveTarget, zoom, 0, 0, new double[4]);
|
||||
verifyCameraPosition(maplibreMap, moveTarget, zoom, 0, 0, new double[4]);
|
||||
latch.countDown();
|
||||
}
|
||||
});
|
||||
@@ -69,7 +69,7 @@ public abstract class CameraTest extends BaseTest {
|
||||
@Test
|
||||
public void testToCameraPositionTargetZoom() throws InterruptedException {
|
||||
validateTestSetup();
|
||||
invoke(maplibreMap, (uiController, mapboxMap) -> {
|
||||
invoke(maplibreMap, (uiController, maplibreMap) -> {
|
||||
final float moveZoom = 15.5f;
|
||||
final LatLng moveTarget = new LatLng(1.0000000001, 1.0000000003);
|
||||
|
||||
@@ -77,13 +77,13 @@ public abstract class CameraTest extends BaseTest {
|
||||
new MapLibreMap.CancelableCallback() {
|
||||
@Override
|
||||
public void onCancel() {
|
||||
verifyCameraPosition(mapboxMap, moveTarget, moveZoom, 0, 0, new double[4]);
|
||||
verifyCameraPosition(maplibreMap, moveTarget, moveZoom, 0, 0, new double[4]);
|
||||
latch.countDown();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
verifyCameraPosition(mapboxMap, moveTarget, moveZoom, 0, 0, new double[4]);
|
||||
verifyCameraPosition(maplibreMap, moveTarget, moveZoom, 0, 0, new double[4]);
|
||||
latch.countDown();
|
||||
}
|
||||
});
|
||||
@@ -97,7 +97,7 @@ public abstract class CameraTest extends BaseTest {
|
||||
@Test
|
||||
public void testToCameraPosition() throws InterruptedException {
|
||||
validateTestSetup();
|
||||
invoke(maplibreMap, (uiController, mapboxMap) -> {
|
||||
invoke(maplibreMap, (uiController, maplibreMap) -> {
|
||||
final LatLng moveTarget = new LatLng(1.0000000001, 1.0000000003);
|
||||
final float moveZoom = 15.5f;
|
||||
final float moveTilt = 45.5f;
|
||||
@@ -115,13 +115,13 @@ public abstract class CameraTest extends BaseTest {
|
||||
new MapLibreMap.CancelableCallback() {
|
||||
@Override
|
||||
public void onCancel() {
|
||||
verifyCameraPosition(mapboxMap, moveTarget, moveZoom, moveBearing, moveTilt, movePadding);
|
||||
verifyCameraPosition(maplibreMap, moveTarget, moveZoom, moveBearing, moveTilt, movePadding);
|
||||
latch.countDown();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
verifyCameraPosition(mapboxMap, moveTarget, moveZoom, moveBearing, moveTilt, movePadding);
|
||||
verifyCameraPosition(maplibreMap, moveTarget, moveZoom, moveBearing, moveTilt, movePadding);
|
||||
latch.countDown();
|
||||
}
|
||||
});
|
||||
@@ -135,7 +135,7 @@ public abstract class CameraTest extends BaseTest {
|
||||
@Test
|
||||
public void testToBounds() throws InterruptedException {
|
||||
validateTestSetup();
|
||||
invoke(maplibreMap, (uiController, mapboxMap) -> {
|
||||
invoke(maplibreMap, (uiController, maplibreMap) -> {
|
||||
final LatLng centerBounds = new LatLng(1, 1);
|
||||
LatLng cornerOne = new LatLng();
|
||||
LatLng cornerTwo = new LatLng(2, 2);
|
||||
@@ -147,13 +147,13 @@ public abstract class CameraTest extends BaseTest {
|
||||
new MapLibreMap.CancelableCallback() {
|
||||
@Override
|
||||
public void onCancel() {
|
||||
verifyCameraPosition(mapboxMap, centerBounds, mapboxMap.getCameraPosition().zoom, 0, 0, new double[4]);
|
||||
verifyCameraPosition(maplibreMap, centerBounds, maplibreMap.getCameraPosition().zoom, 0, 0, new double[4]);
|
||||
latch.countDown();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
verifyCameraPosition(mapboxMap, centerBounds, mapboxMap.getCameraPosition().zoom, 0, 0, new double[4]);
|
||||
verifyCameraPosition(maplibreMap, centerBounds, maplibreMap.getCameraPosition().zoom, 0, 0, new double[4]);
|
||||
latch.countDown();
|
||||
}
|
||||
});
|
||||
@@ -167,19 +167,19 @@ public abstract class CameraTest extends BaseTest {
|
||||
@Test
|
||||
public void testToZoomIn() throws InterruptedException {
|
||||
validateTestSetup();
|
||||
invoke(maplibreMap, (uiController, mapboxMap) -> {
|
||||
invoke(maplibreMap, (uiController, maplibreMap) -> {
|
||||
float zoom = 1.0f;
|
||||
|
||||
executeCameraMovement(CameraUpdateFactory.zoomIn(), new MapLibreMap.CancelableCallback() {
|
||||
@Override
|
||||
public void onCancel() {
|
||||
verifyCameraPosition(mapboxMap, mapboxMap.getCameraPosition().target, zoom + 1, 0, 0, new double[4]);
|
||||
verifyCameraPosition(maplibreMap, maplibreMap.getCameraPosition().target, zoom + 1, 0, 0, new double[4]);
|
||||
latch.countDown();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
verifyCameraPosition(mapboxMap, mapboxMap.getCameraPosition().target, zoom + 1, 0, 0, new double[4]);
|
||||
verifyCameraPosition(maplibreMap, maplibreMap.getCameraPosition().target, zoom + 1, 0, 0, new double[4]);
|
||||
latch.countDown();
|
||||
}
|
||||
});
|
||||
@@ -194,18 +194,18 @@ public abstract class CameraTest extends BaseTest {
|
||||
public void testToZoomOut() throws InterruptedException {
|
||||
float zoom = 10.0f;
|
||||
validateTestSetup();
|
||||
invoke(maplibreMap, (uiController, mapboxMap) ->
|
||||
invoke(maplibreMap, (uiController, maplibreMap) ->
|
||||
executeCameraMovement(CameraUpdateFactory.newLatLngZoom(new LatLng(), zoom),
|
||||
new MapLibreMap.CancelableCallback() {
|
||||
@Override
|
||||
public void onCancel() {
|
||||
verifyCameraPosition(mapboxMap, mapboxMap.getCameraPosition().target, zoom, 0, 0, new double[4]);
|
||||
verifyCameraPosition(maplibreMap, maplibreMap.getCameraPosition().target, zoom, 0, 0, new double[4]);
|
||||
latch.countDown();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
verifyCameraPosition(mapboxMap, mapboxMap.getCameraPosition().target, zoom, 0, 0, new double[4]);
|
||||
verifyCameraPosition(maplibreMap, maplibreMap.getCameraPosition().target, zoom, 0, 0, new double[4]);
|
||||
latch.countDown();
|
||||
}
|
||||
})
|
||||
@@ -217,17 +217,17 @@ public abstract class CameraTest extends BaseTest {
|
||||
|
||||
latch = new CountDownLatch(1);
|
||||
|
||||
invoke(maplibreMap, (uiController, mapboxMap) -> {
|
||||
invoke(maplibreMap, (uiController, maplibreMap) -> {
|
||||
executeCameraMovement(CameraUpdateFactory.zoomOut(), new MapLibreMap.CancelableCallback() {
|
||||
@Override
|
||||
public void onCancel() {
|
||||
verifyCameraPosition(mapboxMap, mapboxMap.getCameraPosition().target, zoom - 1, 0, 0, new double[4]);
|
||||
verifyCameraPosition(maplibreMap, maplibreMap.getCameraPosition().target, zoom - 1, 0, 0, new double[4]);
|
||||
latch.countDown();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
verifyCameraPosition(mapboxMap, mapboxMap.getCameraPosition().target, zoom - 1, 0, 0, new double[4]);
|
||||
verifyCameraPosition(maplibreMap, maplibreMap.getCameraPosition().target, zoom - 1, 0, 0, new double[4]);
|
||||
latch.countDown();
|
||||
}
|
||||
});
|
||||
@@ -241,20 +241,20 @@ public abstract class CameraTest extends BaseTest {
|
||||
@Test
|
||||
public void testToZoomBy() throws InterruptedException {
|
||||
validateTestSetup();
|
||||
invoke(maplibreMap, (uiController, mapboxMap) -> {
|
||||
invoke(maplibreMap, (uiController, maplibreMap) -> {
|
||||
float zoom = 1.0f;
|
||||
final float zoomBy = 2.45f;
|
||||
|
||||
executeCameraMovement(CameraUpdateFactory.zoomBy(zoomBy), new MapLibreMap.CancelableCallback() {
|
||||
@Override
|
||||
public void onCancel() {
|
||||
verifyCameraPosition(mapboxMap, mapboxMap.getCameraPosition().target, zoom + zoomBy, 0, 0, new double[4]);
|
||||
verifyCameraPosition(maplibreMap, maplibreMap.getCameraPosition().target, zoom + zoomBy, 0, 0, new double[4]);
|
||||
latch.countDown();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
verifyCameraPosition(mapboxMap, mapboxMap.getCameraPosition().target, zoom + zoomBy, 0, 0, new double[4]);
|
||||
verifyCameraPosition(maplibreMap, maplibreMap.getCameraPosition().target, zoom + zoomBy, 0, 0, new double[4]);
|
||||
latch.countDown();
|
||||
}
|
||||
});
|
||||
@@ -268,19 +268,19 @@ public abstract class CameraTest extends BaseTest {
|
||||
@Test
|
||||
public void testToZoomTo() throws InterruptedException {
|
||||
validateTestSetup();
|
||||
invoke(maplibreMap, (uiController, mapboxMap) -> {
|
||||
invoke(maplibreMap, (uiController, maplibreMap) -> {
|
||||
final float zoomTo = 2.45f;
|
||||
|
||||
executeCameraMovement(CameraUpdateFactory.zoomTo(zoomTo), new MapLibreMap.CancelableCallback() {
|
||||
@Override
|
||||
public void onCancel() {
|
||||
verifyCameraPosition(mapboxMap, mapboxMap.getCameraPosition().target, zoomTo, 0, 0, new double[4]);
|
||||
verifyCameraPosition(maplibreMap, maplibreMap.getCameraPosition().target, zoomTo, 0, 0, new double[4]);
|
||||
latch.countDown();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
verifyCameraPosition(mapboxMap, mapboxMap.getCameraPosition().target, zoomTo, 0, 0, new double[4]);
|
||||
verifyCameraPosition(maplibreMap, maplibreMap.getCameraPosition().target, zoomTo, 0, 0, new double[4]);
|
||||
latch.countDown();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -123,7 +123,7 @@ public class GeoJsonConversionTest extends EspressoTest {
|
||||
@Test
|
||||
public void testNegativeNumberPropertyConversion() {
|
||||
validateTestSetup();
|
||||
onView(isRoot()).perform(new MapLibreMapAction((uiController, mapboxMap) -> {
|
||||
onView(isRoot()).perform(new MapLibreMapAction((uiController, maplibreMap) -> {
|
||||
LatLng latLng = new LatLng();
|
||||
Feature feature = Feature.fromGeometry(Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude()));
|
||||
|
||||
@@ -133,18 +133,18 @@ public class GeoJsonConversionTest extends EspressoTest {
|
||||
feature.addProperty("property", foregroundJsonArray);
|
||||
|
||||
GeoJsonSource source = new GeoJsonSource("source", feature);
|
||||
mapboxMap.getStyle().addSource(source);
|
||||
maplibreMap.getStyle().addSource(source);
|
||||
|
||||
SymbolLayer layer = new SymbolLayer("layer", "source")
|
||||
.withProperties(
|
||||
PropertyFactory.iconOffset(Expression.get("property")),
|
||||
PropertyFactory.iconImage("zoo-15")
|
||||
);
|
||||
mapboxMap.getStyle().addLayer(layer);
|
||||
maplibreMap.getStyle().addLayer(layer);
|
||||
|
||||
TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
|
||||
|
||||
assertFalse(mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng)).isEmpty());
|
||||
assertFalse(maplibreMap.queryRenderedFeatures(maplibreMap.getProjection().toScreenLocation(latLng)).isEmpty());
|
||||
}, maplibreMap));
|
||||
}
|
||||
}
|
||||
@@ -28,12 +28,12 @@ public class LatLngBoundsTest extends BaseTest {
|
||||
public void testLatLngBounds() {
|
||||
// regression test for #9322
|
||||
validateTestSetup();
|
||||
MapLibreMapAction.invoke(maplibreMap, (uiController, mapboxMap) -> {
|
||||
MapLibreMapAction.invoke(maplibreMap, (uiController, maplibreMap) -> {
|
||||
LatLngBounds bounds = new LatLngBounds.Builder()
|
||||
.include(new LatLng(48.8589506, 2.2773457))
|
||||
.include(new LatLng(47.2383171, -1.6309316))
|
||||
.build();
|
||||
mapboxMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 0));
|
||||
maplibreMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 0));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -41,23 +41,23 @@ public class LatLngBoundsTest extends BaseTest {
|
||||
public void testLatLngBoundsBearing() {
|
||||
// regression test for #12549
|
||||
validateTestSetup();
|
||||
MapLibreMapAction.invoke(maplibreMap, (uiController, mapboxMap) -> {
|
||||
MapLibreMapAction.invoke(maplibreMap, (uiController, maplibreMap) -> {
|
||||
LatLngBounds bounds = new LatLngBounds.Builder()
|
||||
.include(new LatLng(48.8589506, 2.2773457))
|
||||
.include(new LatLng(47.2383171, -1.6309316))
|
||||
.build();
|
||||
mapboxMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 0));
|
||||
mapboxMap.moveCamera(CameraUpdateFactory.bearingTo(MAP_BEARING));
|
||||
maplibreMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 0));
|
||||
maplibreMap.moveCamera(CameraUpdateFactory.bearingTo(MAP_BEARING));
|
||||
assertEquals(
|
||||
"Initial bearing should match for latlngbounds",
|
||||
mapboxMap.getCameraPosition().bearing,
|
||||
maplibreMap.getCameraPosition().bearing,
|
||||
MAP_BEARING,
|
||||
TestConstants.BEARING_DELTA
|
||||
);
|
||||
|
||||
mapboxMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 0));
|
||||
maplibreMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 0));
|
||||
assertEquals("Bearing should match after resetting latlngbounds",
|
||||
mapboxMap.getCameraPosition().bearing,
|
||||
maplibreMap.getCameraPosition().bearing,
|
||||
MAP_BEARING,
|
||||
TestConstants.BEARING_DELTA);
|
||||
});
|
||||
|
||||
@@ -32,8 +32,8 @@ public class CompassViewTest extends EspressoTest {
|
||||
@Ignore("No explanation given")
|
||||
public void testVisible() {
|
||||
validateTestSetup();
|
||||
invoke(maplibreMap, (uiController, mapboxMap) -> {
|
||||
mapboxMap.moveCamera(CameraUpdateFactory.newCameraPosition(
|
||||
invoke(maplibreMap, (uiController, maplibreMap) -> {
|
||||
maplibreMap.moveCamera(CameraUpdateFactory.newCameraPosition(
|
||||
new CameraPosition.Builder()
|
||||
.bearing(45)
|
||||
.zoom(1)
|
||||
@@ -49,7 +49,7 @@ public class CompassViewTest extends EspressoTest {
|
||||
@Ignore("No explanation given")
|
||||
public void testClick() {
|
||||
validateTestSetup();
|
||||
invoke(maplibreMap, (uiController, mapboxMap) -> mapboxMap.moveCamera(CameraUpdateFactory.newCameraPosition(
|
||||
invoke(maplibreMap, (uiController, maplibreMap) -> maplibreMap.moveCamera(CameraUpdateFactory.newCameraPosition(
|
||||
new CameraPosition.Builder()
|
||||
.bearing(45)
|
||||
.zoom(1)
|
||||
@@ -59,8 +59,8 @@ public class CompassViewTest extends EspressoTest {
|
||||
onView(withTagValue(is("compassView"))).perform(click());
|
||||
WaitAction.invoke(500);
|
||||
onView(withTagValue(is("compassView"))).check(matches(not(isDisplayed())));
|
||||
invoke(maplibreMap, (uiController, mapboxMap) -> {
|
||||
CameraPosition cameraPosition = mapboxMap.getCameraPosition();
|
||||
invoke(maplibreMap, (uiController, maplibreMap) -> {
|
||||
CameraPosition cameraPosition = maplibreMap.getCameraPosition();
|
||||
assertEquals("Camera bearing should face north, ", 0, cameraPosition.bearing, TestConstants.BEARING_DELTA);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -40,10 +40,10 @@ class CustomGeometrySourceTest : BaseTest() {
|
||||
@Test
|
||||
fun threadsShutdownWhenSourceRemovedTest() {
|
||||
validateTestSetup()
|
||||
invoke(maplibreMap) { uiController, mapboxMap ->
|
||||
mapboxMap.style!!.removeLayer(ID_GRID_LAYER)
|
||||
invoke(maplibreMap) { uiController, maplibreMap ->
|
||||
maplibreMap.style!!.removeLayer(ID_GRID_LAYER)
|
||||
TestingAsyncUtils.waitForLayer(uiController, mapView)
|
||||
mapboxMap.style!!.removeSource(ID_GRID_SOURCE)
|
||||
maplibreMap.style!!.removeSource(ID_GRID_SOURCE)
|
||||
TestingAsyncUtils.waitForLayer(uiController, mapView)
|
||||
Assert.assertTrue(
|
||||
"There should be no threads running when the source is removed.",
|
||||
@@ -57,13 +57,13 @@ class CustomGeometrySourceTest : BaseTest() {
|
||||
@Test
|
||||
fun threadsRestartedWhenSourceReAddedTest() {
|
||||
validateTestSetup()
|
||||
invoke(maplibreMap) { uiController, mapboxMap ->
|
||||
mapboxMap.style!!.removeLayer((rule.activity as GridSourceActivity).layer!!)
|
||||
invoke(maplibreMap) { uiController, maplibreMap ->
|
||||
maplibreMap.style!!.removeLayer((rule.activity as GridSourceActivity).layer!!)
|
||||
TestingAsyncUtils.waitForLayer(uiController, mapView)
|
||||
mapboxMap.style!!.removeSource(ID_GRID_SOURCE)
|
||||
maplibreMap.style!!.removeSource(ID_GRID_SOURCE)
|
||||
TestingAsyncUtils.waitForLayer(uiController, mapView)
|
||||
mapboxMap.style!!.addSource((rule.activity as GridSourceActivity).source!!)
|
||||
mapboxMap.style!!.addLayer((rule.activity as GridSourceActivity).layer!!)
|
||||
maplibreMap.style!!.addSource((rule.activity as GridSourceActivity).source!!)
|
||||
maplibreMap.style!!.addLayer((rule.activity as GridSourceActivity).layer!!)
|
||||
TestingAsyncUtils.waitForLayer(uiController, mapView)
|
||||
Assert.assertTrue(
|
||||
"Threads should be restarted when the source is re-added to the map.",
|
||||
@@ -77,9 +77,9 @@ class CustomGeometrySourceTest : BaseTest() {
|
||||
@Test
|
||||
fun sourceZoomDeltaTest() {
|
||||
validateTestSetup()
|
||||
invoke(maplibreMap) { uiController, mapboxMap ->
|
||||
mapboxMap.prefetchZoomDelta = 3
|
||||
mapboxMap.style!!.getSource(ID_GRID_SOURCE)!!.let {
|
||||
invoke(maplibreMap) { uiController, maplibreMap ->
|
||||
maplibreMap.prefetchZoomDelta = 3
|
||||
maplibreMap.style!!.getSource(ID_GRID_SOURCE)!!.let {
|
||||
assertNull(it.prefetchZoomDelta)
|
||||
it.prefetchZoomDelta = 5
|
||||
assertNotNull(it.prefetchZoomDelta)
|
||||
@@ -93,8 +93,8 @@ class CustomGeometrySourceTest : BaseTest() {
|
||||
@Test
|
||||
fun isVolatileTest() {
|
||||
validateTestSetup()
|
||||
invoke(maplibreMap) { uiController, mapboxMap ->
|
||||
mapboxMap.style!!.getSource(ID_GRID_SOURCE)!!.let {
|
||||
invoke(maplibreMap) { uiController, maplibreMap ->
|
||||
maplibreMap.style!!.getSource(ID_GRID_SOURCE)!!.let {
|
||||
assertFalse(it.isVolatile)
|
||||
it.isVolatile = true
|
||||
assertTrue(it.isVolatile)
|
||||
@@ -105,8 +105,8 @@ class CustomGeometrySourceTest : BaseTest() {
|
||||
@Test
|
||||
fun minimumTileUpdateIntervalTest() {
|
||||
validateTestSetup()
|
||||
invoke(maplibreMap) { uiController, mapboxMap ->
|
||||
mapboxMap.style!!.getSource(ID_GRID_SOURCE)!!.let {
|
||||
invoke(maplibreMap) { uiController, maplibreMap ->
|
||||
maplibreMap.style!!.getSource(ID_GRID_SOURCE)!!.let {
|
||||
assertEquals(0, it.minimumTileUpdateInterval)
|
||||
it.minimumTileUpdateInterval = 1000
|
||||
assertEquals(1000, it.minimumTileUpdateInterval)
|
||||
|
||||
@@ -78,7 +78,7 @@ public class ExpressionTest extends EspressoTest {
|
||||
setupStyle();
|
||||
Timber.i("camera function");
|
||||
|
||||
invoke(maplibreMap, (uiController, mapboxMap) -> {
|
||||
invoke(maplibreMap, (uiController, maplibreMap) -> {
|
||||
// create color expression
|
||||
Expression inputExpression = rgba(255.0f, 0.0f, 0.0f, 1.0f);
|
||||
|
||||
@@ -101,7 +101,7 @@ public class ExpressionTest extends EspressoTest {
|
||||
setupStyle();
|
||||
Timber.i("camera function");
|
||||
|
||||
invoke(maplibreMap, (uiController, mapboxMap) -> {
|
||||
invoke(maplibreMap, (uiController, maplibreMap) -> {
|
||||
// create get expression
|
||||
Expression inputExpression = get("fill");
|
||||
|
||||
@@ -127,7 +127,7 @@ public class ExpressionTest extends EspressoTest {
|
||||
setupStyle();
|
||||
Timber.i("camera function");
|
||||
|
||||
invoke(maplibreMap, (uiController, mapboxMap) -> {
|
||||
invoke(maplibreMap, (uiController, maplibreMap) -> {
|
||||
// create camera function expression
|
||||
Expression inputExpression = interpolate(
|
||||
exponential(0.5f), zoom(),
|
||||
@@ -155,7 +155,7 @@ public class ExpressionTest extends EspressoTest {
|
||||
setupStyle();
|
||||
Timber.i("camera function");
|
||||
|
||||
invoke(maplibreMap, (uiController, mapboxMap) -> {
|
||||
invoke(maplibreMap, (uiController, maplibreMap) -> {
|
||||
// create camera function expression
|
||||
Expression inputExpression = toColor(get("fill"));
|
||||
|
||||
@@ -178,7 +178,7 @@ public class ExpressionTest extends EspressoTest {
|
||||
setupStyle();
|
||||
Timber.i("camera function");
|
||||
|
||||
invoke(maplibreMap, (uiController, mapboxMap) -> {
|
||||
invoke(maplibreMap, (uiController, maplibreMap) -> {
|
||||
// create camera function expression
|
||||
Expression inputExpression = step(zoom(),
|
||||
rgba(255.0f, 255.0f, 255.0f, 1.0f),
|
||||
@@ -211,7 +211,7 @@ public class ExpressionTest extends EspressoTest {
|
||||
public void testLiteralProperty() {
|
||||
validateTestSetup();
|
||||
setupStyle();
|
||||
invoke(maplibreMap, (uiController, mapboxMap) -> {
|
||||
invoke(maplibreMap, (uiController, maplibreMap) -> {
|
||||
layer.setProperties(
|
||||
fillColor(literal("#4286f4"))
|
||||
);
|
||||
@@ -222,7 +222,7 @@ public class ExpressionTest extends EspressoTest {
|
||||
public void testLiteralMatchExpression() {
|
||||
validateTestSetup();
|
||||
setupStyle();
|
||||
invoke(maplibreMap, (uiController, mapboxMap) -> {
|
||||
invoke(maplibreMap, (uiController, maplibreMap) -> {
|
||||
Expression expression = match(literal("something"), literal(0f),
|
||||
stop("1", get("1")),
|
||||
stop("2", get("2")),
|
||||
@@ -240,7 +240,7 @@ public class ExpressionTest extends EspressoTest {
|
||||
@Test
|
||||
public void testCollatorExpression() {
|
||||
validateTestSetup();
|
||||
invoke(maplibreMap, (uiController, mapboxMap) -> {
|
||||
invoke(maplibreMap, (uiController, maplibreMap) -> {
|
||||
LatLng latLng = new LatLng(51, 17);
|
||||
|
||||
Expression expression1 = eq(literal("Łukasz"), literal("lukasz"), collator(true, true));
|
||||
@@ -249,7 +249,7 @@ public class ExpressionTest extends EspressoTest {
|
||||
Expression expression3 = eq(literal("Łukasz"), literal("lukasz"), collator(literal(false), eq(literal(2),
|
||||
literal(1))));
|
||||
|
||||
mapboxMap.getStyle()
|
||||
maplibreMap.getStyle()
|
||||
.addSource(new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())));
|
||||
Layer layer = new CircleLayer("layer", "source")
|
||||
.withProperties(circleColor(
|
||||
@@ -258,9 +258,9 @@ public class ExpressionTest extends EspressoTest {
|
||||
literal(ColorUtils.colorToRgbaString(Color.RED))
|
||||
)
|
||||
));
|
||||
mapboxMap.getStyle().addLayer(layer);
|
||||
maplibreMap.getStyle().addLayer(layer);
|
||||
TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
|
||||
assertFalse(mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer")
|
||||
assertFalse(maplibreMap.queryRenderedFeatures(maplibreMap.getProjection().toScreenLocation(latLng), "layer")
|
||||
.isEmpty());
|
||||
|
||||
layer.setProperties(circleColor(
|
||||
@@ -270,7 +270,7 @@ public class ExpressionTest extends EspressoTest {
|
||||
)
|
||||
));
|
||||
TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
|
||||
assertFalse(mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer")
|
||||
assertFalse(maplibreMap.queryRenderedFeatures(maplibreMap.getProjection().toScreenLocation(latLng), "layer")
|
||||
.isEmpty());
|
||||
|
||||
layer.setProperties(circleColor(
|
||||
@@ -280,7 +280,7 @@ public class ExpressionTest extends EspressoTest {
|
||||
)
|
||||
));
|
||||
TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
|
||||
assertFalse(mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer")
|
||||
assertFalse(maplibreMap.queryRenderedFeatures(maplibreMap.getProjection().toScreenLocation(latLng), "layer")
|
||||
.isEmpty());
|
||||
});
|
||||
}
|
||||
@@ -288,12 +288,12 @@ public class ExpressionTest extends EspressoTest {
|
||||
@Test
|
||||
public void testConstFormatExpression() {
|
||||
validateTestSetup();
|
||||
invoke(maplibreMap, (uiController, mapboxMap) -> {
|
||||
invoke(maplibreMap, (uiController, maplibreMap) -> {
|
||||
LatLng latLng = new LatLng(51, 17);
|
||||
mapboxMap.getStyle()
|
||||
maplibreMap.getStyle()
|
||||
.addSource(new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())));
|
||||
SymbolLayer layer = new SymbolLayer("layer", "source");
|
||||
mapboxMap.getStyle().addLayer(layer);
|
||||
maplibreMap.getStyle().addLayer(layer);
|
||||
|
||||
Expression expression = format(
|
||||
formatEntry("test")
|
||||
@@ -301,7 +301,7 @@ public class ExpressionTest extends EspressoTest {
|
||||
layer.setProperties(textField(expression));
|
||||
TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
|
||||
|
||||
assertFalse(mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer")
|
||||
assertFalse(maplibreMap.queryRenderedFeatures(maplibreMap.getProjection().toScreenLocation(latLng), "layer")
|
||||
.isEmpty());
|
||||
assertNull(layer.getTextField().getExpression());
|
||||
assertEquals(new Formatted(new FormattedSection("test")), layer.getTextField().getValue());
|
||||
@@ -311,12 +311,12 @@ public class ExpressionTest extends EspressoTest {
|
||||
@Test
|
||||
public void testConstFormatExpressionFontScaleParam() {
|
||||
validateTestSetup();
|
||||
invoke(maplibreMap, (uiController, mapboxMap) -> {
|
||||
invoke(maplibreMap, (uiController, maplibreMap) -> {
|
||||
LatLng latLng = new LatLng(51, 17);
|
||||
mapboxMap.getStyle()
|
||||
maplibreMap.getStyle()
|
||||
.addSource(new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())));
|
||||
SymbolLayer layer = new SymbolLayer("layer", "source");
|
||||
mapboxMap.getStyle().addLayer(layer);
|
||||
maplibreMap.getStyle().addLayer(layer);
|
||||
|
||||
Expression expression = format(
|
||||
formatEntry("test", formatFontScale(1.75))
|
||||
@@ -324,7 +324,7 @@ public class ExpressionTest extends EspressoTest {
|
||||
layer.setProperties(textField(expression));
|
||||
TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
|
||||
|
||||
assertFalse(mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer")
|
||||
assertFalse(maplibreMap.queryRenderedFeatures(maplibreMap.getProjection().toScreenLocation(latLng), "layer")
|
||||
.isEmpty());
|
||||
assertNull(layer.getTextField().getExpression());
|
||||
assertEquals(new Formatted(new FormattedSection("test", 1.75)), layer.getTextField().getValue());
|
||||
@@ -334,12 +334,12 @@ public class ExpressionTest extends EspressoTest {
|
||||
@Test
|
||||
public void testConstFormatExpressionTextFontParam() {
|
||||
validateTestSetup();
|
||||
invoke(maplibreMap, (uiController, mapboxMap) -> {
|
||||
invoke(maplibreMap, (uiController, maplibreMap) -> {
|
||||
LatLng latLng = new LatLng(51, 17);
|
||||
mapboxMap.getStyle()
|
||||
maplibreMap.getStyle()
|
||||
.addSource(new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())));
|
||||
SymbolLayer layer = new SymbolLayer("layer", "source");
|
||||
mapboxMap.getStyle().addLayer(layer);
|
||||
maplibreMap.getStyle().addLayer(layer);
|
||||
|
||||
Expression expression = format(
|
||||
formatEntry(
|
||||
@@ -351,7 +351,7 @@ public class ExpressionTest extends EspressoTest {
|
||||
TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
|
||||
|
||||
assertFalse(
|
||||
mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer").isEmpty()
|
||||
maplibreMap.queryRenderedFeatures(maplibreMap.getProjection().toScreenLocation(latLng), "layer").isEmpty()
|
||||
);
|
||||
assertNull(layer.getTextField().getExpression());
|
||||
assertEquals(new Formatted(
|
||||
@@ -364,12 +364,12 @@ public class ExpressionTest extends EspressoTest {
|
||||
@Test
|
||||
public void testConstFormatExpressionTextColorParam() {
|
||||
validateTestSetup();
|
||||
invoke(maplibreMap, (uiController, mapboxMap) -> {
|
||||
invoke(maplibreMap, (uiController, maplibreMap) -> {
|
||||
LatLng latLng = new LatLng(51, 17);
|
||||
mapboxMap.getStyle()
|
||||
maplibreMap.getStyle()
|
||||
.addSource(new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())));
|
||||
SymbolLayer layer = new SymbolLayer("layer", "source");
|
||||
mapboxMap.getStyle().addLayer(layer);
|
||||
maplibreMap.getStyle().addLayer(layer);
|
||||
|
||||
Expression expression = format(
|
||||
formatEntry(
|
||||
@@ -381,7 +381,7 @@ public class ExpressionTest extends EspressoTest {
|
||||
TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
|
||||
|
||||
assertFalse(
|
||||
mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer").isEmpty()
|
||||
maplibreMap.queryRenderedFeatures(maplibreMap.getProjection().toScreenLocation(latLng), "layer").isEmpty()
|
||||
);
|
||||
assertNull(layer.getTextField().getExpression());
|
||||
assertEquals(new Formatted(
|
||||
@@ -393,12 +393,12 @@ public class ExpressionTest extends EspressoTest {
|
||||
@Test
|
||||
public void testConstFormatExpressionAllParams() {
|
||||
validateTestSetup();
|
||||
invoke(maplibreMap, (uiController, mapboxMap) -> {
|
||||
invoke(maplibreMap, (uiController, maplibreMap) -> {
|
||||
LatLng latLng = new LatLng(51, 17);
|
||||
mapboxMap.getStyle()
|
||||
maplibreMap.getStyle()
|
||||
.addSource(new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())));
|
||||
SymbolLayer layer = new SymbolLayer("layer", "source");
|
||||
mapboxMap.getStyle().addLayer(layer);
|
||||
maplibreMap.getStyle().addLayer(layer);
|
||||
|
||||
Expression expression = format(
|
||||
formatEntry(
|
||||
@@ -412,7 +412,7 @@ public class ExpressionTest extends EspressoTest {
|
||||
TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
|
||||
|
||||
assertFalse(
|
||||
mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer").isEmpty()
|
||||
maplibreMap.queryRenderedFeatures(maplibreMap.getProjection().toScreenLocation(latLng), "layer").isEmpty()
|
||||
);
|
||||
assertNull(layer.getTextField().getExpression());
|
||||
assertEquals(new Formatted(
|
||||
@@ -427,12 +427,12 @@ public class ExpressionTest extends EspressoTest {
|
||||
@Test
|
||||
public void testConstFormatExpressionMultipleInputs() {
|
||||
validateTestSetup();
|
||||
invoke(maplibreMap, (uiController, mapboxMap) -> {
|
||||
invoke(maplibreMap, (uiController, maplibreMap) -> {
|
||||
LatLng latLng = new LatLng(51, 17);
|
||||
mapboxMap.getStyle()
|
||||
maplibreMap.getStyle()
|
||||
.addSource(new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())));
|
||||
SymbolLayer layer = new SymbolLayer("layer", "source");
|
||||
mapboxMap.getStyle().addLayer(layer);
|
||||
maplibreMap.getStyle().addLayer(layer);
|
||||
|
||||
Expression expression = format(
|
||||
formatEntry(
|
||||
@@ -448,7 +448,7 @@ public class ExpressionTest extends EspressoTest {
|
||||
TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
|
||||
|
||||
assertFalse(
|
||||
mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer")
|
||||
maplibreMap.queryRenderedFeatures(maplibreMap.getProjection().toScreenLocation(latLng), "layer")
|
||||
.isEmpty()
|
||||
);
|
||||
assertNull(layer.getTextField().getExpression());
|
||||
@@ -464,15 +464,15 @@ public class ExpressionTest extends EspressoTest {
|
||||
@Test
|
||||
public void testVariableFormatExpression() {
|
||||
validateTestSetup();
|
||||
invoke(maplibreMap, (uiController, mapboxMap) -> {
|
||||
invoke(maplibreMap, (uiController, maplibreMap) -> {
|
||||
LatLng latLng = new LatLng(51, 17);
|
||||
Feature feature = Feature.fromGeometry(Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude()));
|
||||
feature.addStringProperty("test_property", "test");
|
||||
feature.addNumberProperty("test_property_number", 1.5);
|
||||
feature.addStringProperty("test_property_color", "green");
|
||||
mapboxMap.getStyle().addSource(new GeoJsonSource("source", feature));
|
||||
maplibreMap.getStyle().addSource(new GeoJsonSource("source", feature));
|
||||
SymbolLayer layer = new SymbolLayer("layer", "source");
|
||||
mapboxMap.getStyle().addLayer(layer);
|
||||
maplibreMap.getStyle().addLayer(layer);
|
||||
|
||||
Expression expression = format(
|
||||
formatEntry(
|
||||
@@ -485,7 +485,7 @@ public class ExpressionTest extends EspressoTest {
|
||||
layer.setProperties(textField(expression));
|
||||
TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
|
||||
|
||||
assertFalse(mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer")
|
||||
assertFalse(maplibreMap.queryRenderedFeatures(maplibreMap.getProjection().toScreenLocation(latLng), "layer")
|
||||
.isEmpty());
|
||||
assertEquals(expression, layer.getTextField().getExpression());
|
||||
assertNull(layer.getTextField().getValue());
|
||||
@@ -495,15 +495,15 @@ public class ExpressionTest extends EspressoTest {
|
||||
@Test
|
||||
public void testVariableFormatExpressionMultipleInputs() {
|
||||
validateTestSetup();
|
||||
invoke(maplibreMap, (uiController, mapboxMap) -> {
|
||||
invoke(maplibreMap, (uiController, maplibreMap) -> {
|
||||
LatLng latLng = new LatLng(51, 17);
|
||||
Feature feature = Feature.fromGeometry(Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude()));
|
||||
feature.addStringProperty("test_property", "test");
|
||||
feature.addNumberProperty("test_property_number", 1.5);
|
||||
feature.addStringProperty("test_property_color", "rgba(0, 255, 0, 1)");
|
||||
mapboxMap.getStyle().addSource(new GeoJsonSource("source", feature));
|
||||
maplibreMap.getStyle().addSource(new GeoJsonSource("source", feature));
|
||||
SymbolLayer layer = new SymbolLayer("layer", "source");
|
||||
mapboxMap.getStyle().addLayer(layer);
|
||||
maplibreMap.getStyle().addLayer(layer);
|
||||
|
||||
Expression expression = format(
|
||||
formatEntry(
|
||||
@@ -517,7 +517,7 @@ public class ExpressionTest extends EspressoTest {
|
||||
layer.setProperties(textField(expression), textColor("rgba(128, 0, 0, 1)"));
|
||||
TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
|
||||
|
||||
assertFalse(mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer")
|
||||
assertFalse(maplibreMap.queryRenderedFeatures(maplibreMap.getProjection().toScreenLocation(latLng), "layer")
|
||||
.isEmpty());
|
||||
assertEquals(expression, layer.getTextField().getExpression());
|
||||
assertNull(layer.getTextField().getValue());
|
||||
@@ -527,17 +527,17 @@ public class ExpressionTest extends EspressoTest {
|
||||
@Test
|
||||
public void testFormatExpressionPlainTextCoercion() {
|
||||
validateTestSetup();
|
||||
invoke(maplibreMap, (uiController, mapboxMap) -> {
|
||||
invoke(maplibreMap, (uiController, maplibreMap) -> {
|
||||
LatLng latLng = new LatLng(51, 17);
|
||||
mapboxMap.getStyle()
|
||||
maplibreMap.getStyle()
|
||||
.addSource(new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())));
|
||||
SymbolLayer layer = new SymbolLayer("layer", "source");
|
||||
mapboxMap.getStyle().addLayer(layer);
|
||||
maplibreMap.getStyle().addLayer(layer);
|
||||
|
||||
layer.setProperties(textField("test"));
|
||||
TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
|
||||
|
||||
assertFalse(mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer")
|
||||
assertFalse(maplibreMap.queryRenderedFeatures(maplibreMap.getProjection().toScreenLocation(latLng), "layer")
|
||||
.isEmpty());
|
||||
assertNull(layer.getTextField().getExpression());
|
||||
assertEquals(new Formatted(
|
||||
@@ -548,12 +548,12 @@ public class ExpressionTest extends EspressoTest {
|
||||
@Test
|
||||
public void testTextFieldFormattedArgument() {
|
||||
validateTestSetup();
|
||||
invoke(maplibreMap, (uiController, mapboxMap) -> {
|
||||
invoke(maplibreMap, (uiController, maplibreMap) -> {
|
||||
LatLng latLng = new LatLng(51, 17);
|
||||
mapboxMap.getStyle()
|
||||
maplibreMap.getStyle()
|
||||
.addSource(new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())));
|
||||
SymbolLayer layer = new SymbolLayer("layer", "source");
|
||||
mapboxMap.getStyle().addLayer(layer);
|
||||
maplibreMap.getStyle().addLayer(layer);
|
||||
|
||||
Formatted formatted = new Formatted(
|
||||
new FormattedSection("test", 1.5),
|
||||
@@ -564,7 +564,7 @@ public class ExpressionTest extends EspressoTest {
|
||||
layer.setProperties(textField(formatted), textColor("rgba(128,0,0,1)"));
|
||||
TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
|
||||
|
||||
assertFalse(mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer")
|
||||
assertFalse(maplibreMap.queryRenderedFeatures(maplibreMap.getProjection().toScreenLocation(latLng), "layer")
|
||||
.isEmpty());
|
||||
assertNull(layer.getTextField().getExpression());
|
||||
assertEquals(formatted, layer.getTextField().getValue());
|
||||
@@ -574,12 +574,12 @@ public class ExpressionTest extends EspressoTest {
|
||||
@Test
|
||||
public void testNumberFormatCurrencyExpression() {
|
||||
validateTestSetup();
|
||||
invoke(maplibreMap, (uiController, mapboxMap) -> {
|
||||
invoke(maplibreMap, (uiController, maplibreMap) -> {
|
||||
LatLng latLng = new LatLng(51, 17);
|
||||
mapboxMap.getStyle()
|
||||
maplibreMap.getStyle()
|
||||
.addSource(new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())));
|
||||
SymbolLayer layer = new SymbolLayer("layer", "source");
|
||||
mapboxMap.getStyle().addLayer(layer);
|
||||
maplibreMap.getStyle().addLayer(layer);
|
||||
|
||||
layer.setProperties(
|
||||
textField(
|
||||
@@ -588,8 +588,8 @@ public class ExpressionTest extends EspressoTest {
|
||||
);
|
||||
TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
|
||||
|
||||
assertFalse(mapboxMap.queryRenderedFeatures(
|
||||
mapboxMap.getProjection().toScreenLocation(latLng), "layer").isEmpty()
|
||||
assertFalse(maplibreMap.queryRenderedFeatures(
|
||||
maplibreMap.getProjection().toScreenLocation(latLng), "layer").isEmpty()
|
||||
);
|
||||
assertNull(layer.getTextField().getExpression());
|
||||
assertEquals("$12.35", layer.getTextField().getValue().getFormattedSections()[0].getText());
|
||||
@@ -599,12 +599,12 @@ public class ExpressionTest extends EspressoTest {
|
||||
@Test
|
||||
public void testNumberFormatMaxExpression() {
|
||||
validateTestSetup();
|
||||
invoke(maplibreMap, (uiController, mapboxMap) -> {
|
||||
invoke(maplibreMap, (uiController, maplibreMap) -> {
|
||||
LatLng latLng = new LatLng(51, 17);
|
||||
mapboxMap.getStyle()
|
||||
maplibreMap.getStyle()
|
||||
.addSource(new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())));
|
||||
SymbolLayer layer = new SymbolLayer("layer", "source");
|
||||
mapboxMap.getStyle().addLayer(layer);
|
||||
maplibreMap.getStyle().addLayer(layer);
|
||||
|
||||
layer.setProperties(
|
||||
textField(
|
||||
@@ -613,8 +613,8 @@ public class ExpressionTest extends EspressoTest {
|
||||
);
|
||||
TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
|
||||
|
||||
assertFalse(mapboxMap.queryRenderedFeatures(
|
||||
mapboxMap.getProjection().toScreenLocation(latLng), "layer").isEmpty()
|
||||
assertFalse(maplibreMap.queryRenderedFeatures(
|
||||
maplibreMap.getProjection().toScreenLocation(latLng), "layer").isEmpty()
|
||||
);
|
||||
assertNull(layer.getTextField().getExpression());
|
||||
assertEquals("12.34568", layer.getTextField().getValue().getFormattedSections()[0].getText());
|
||||
@@ -624,12 +624,12 @@ public class ExpressionTest extends EspressoTest {
|
||||
@Test
|
||||
public void testNumberFormatMinExpression() {
|
||||
validateTestSetup();
|
||||
invoke(maplibreMap, (uiController, mapboxMap) -> {
|
||||
invoke(maplibreMap, (uiController, maplibreMap) -> {
|
||||
LatLng latLng = new LatLng(51, 17);
|
||||
mapboxMap.getStyle()
|
||||
maplibreMap.getStyle()
|
||||
.addSource(new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())));
|
||||
SymbolLayer layer = new SymbolLayer("layer", "source");
|
||||
mapboxMap.getStyle().addLayer(layer);
|
||||
maplibreMap.getStyle().addLayer(layer);
|
||||
|
||||
layer.setProperties(
|
||||
textField(
|
||||
@@ -638,8 +638,8 @@ public class ExpressionTest extends EspressoTest {
|
||||
);
|
||||
TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
|
||||
|
||||
assertFalse(mapboxMap.queryRenderedFeatures(
|
||||
mapboxMap.getProjection().toScreenLocation(latLng), "layer").isEmpty()
|
||||
assertFalse(maplibreMap.queryRenderedFeatures(
|
||||
maplibreMap.getProjection().toScreenLocation(latLng), "layer").isEmpty()
|
||||
);
|
||||
assertNull(layer.getTextField().getExpression());
|
||||
assertEquals("12", layer.getTextField().getValue().getFormattedSections()[0].getText());
|
||||
@@ -649,12 +649,12 @@ public class ExpressionTest extends EspressoTest {
|
||||
@Test
|
||||
public void testNumberFormatLocaleExpression() {
|
||||
validateTestSetup();
|
||||
invoke(maplibreMap, (uiController, mapboxMap) -> {
|
||||
invoke(maplibreMap, (uiController, maplibreMap) -> {
|
||||
LatLng latLng = new LatLng(51, 17);
|
||||
mapboxMap.getStyle()
|
||||
maplibreMap.getStyle()
|
||||
.addSource(new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())));
|
||||
SymbolLayer layer = new SymbolLayer("layer", "source");
|
||||
mapboxMap.getStyle().addLayer(layer);
|
||||
maplibreMap.getStyle().addLayer(layer);
|
||||
|
||||
layer.setProperties(
|
||||
textField(
|
||||
@@ -664,8 +664,8 @@ public class ExpressionTest extends EspressoTest {
|
||||
);
|
||||
TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
|
||||
|
||||
assertFalse(mapboxMap.queryRenderedFeatures(
|
||||
mapboxMap.getProjection().toScreenLocation(latLng), "layer").isEmpty()
|
||||
assertFalse(maplibreMap.queryRenderedFeatures(
|
||||
maplibreMap.getProjection().toScreenLocation(latLng), "layer").isEmpty()
|
||||
);
|
||||
assertNull(layer.getTextField().getExpression());
|
||||
assertEquals("12,0", layer.getTextField().getValue().getFormattedSections()[0].getText());
|
||||
@@ -675,7 +675,7 @@ public class ExpressionTest extends EspressoTest {
|
||||
@Test
|
||||
public void testNumberFormatNonConstantExpression() {
|
||||
validateTestSetup();
|
||||
invoke(maplibreMap, (uiController, mapboxMap) -> {
|
||||
invoke(maplibreMap, (uiController, maplibreMap) -> {
|
||||
LatLng latLng = new LatLng(51, 17);
|
||||
Feature feature = Feature.fromGeometry(Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude()));
|
||||
feature.addNumberProperty("number_value", 12.345678);
|
||||
@@ -684,9 +684,9 @@ public class ExpressionTest extends EspressoTest {
|
||||
feature.addNumberProperty("min_value", 1);
|
||||
|
||||
|
||||
mapboxMap.getStyle().addSource(new GeoJsonSource("source", feature));
|
||||
maplibreMap.getStyle().addSource(new GeoJsonSource("source", feature));
|
||||
SymbolLayer layer = new SymbolLayer("layer", "source");
|
||||
mapboxMap.getStyle().addLayer(layer);
|
||||
maplibreMap.getStyle().addLayer(layer);
|
||||
|
||||
Expression numberFormatExpression = numberFormat(
|
||||
number(number(get("number_value"))),
|
||||
@@ -698,8 +698,8 @@ public class ExpressionTest extends EspressoTest {
|
||||
layer.setProperties(textField(numberFormatExpression));
|
||||
TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
|
||||
|
||||
assertFalse(mapboxMap.queryRenderedFeatures(
|
||||
mapboxMap.getProjection().toScreenLocation(latLng), "layer").isEmpty()
|
||||
assertFalse(maplibreMap.queryRenderedFeatures(
|
||||
maplibreMap.getProjection().toScreenLocation(latLng), "layer").isEmpty()
|
||||
);
|
||||
|
||||
assertNotNull(layer.getTextField().getExpression());
|
||||
@@ -741,14 +741,14 @@ public class ExpressionTest extends EspressoTest {
|
||||
@Test
|
||||
public void testDoubleConversion() {
|
||||
validateTestSetup();
|
||||
invoke(maplibreMap, (uiController, mapboxMap) -> {
|
||||
invoke(maplibreMap, (uiController, maplibreMap) -> {
|
||||
LatLng latLng = new LatLng(51, 17);
|
||||
mapboxMap.getStyle().addSource(
|
||||
maplibreMap.getStyle().addSource(
|
||||
new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude()))
|
||||
);
|
||||
|
||||
CircleLayer layer = new CircleLayer("layer", "source");
|
||||
mapboxMap.getStyle().addLayer(layer);
|
||||
maplibreMap.getStyle().addLayer(layer);
|
||||
|
||||
Expression input = interpolate(
|
||||
exponential(0.5f), zoom(),
|
||||
@@ -764,15 +764,15 @@ public class ExpressionTest extends EspressoTest {
|
||||
}
|
||||
|
||||
private void setupStyle() {
|
||||
invoke(maplibreMap, (uiController, mapboxMap) -> {
|
||||
invoke(maplibreMap, (uiController, maplibreMap) -> {
|
||||
// Add a source
|
||||
Source source;
|
||||
source = new GeoJsonSource("amsterdam-parks-source",
|
||||
ResourceUtils.readRawResource(rule.getActivity(), R.raw.amsterdam));
|
||||
mapboxMap.getStyle().addSource(source);
|
||||
maplibreMap.getStyle().addSource(source);
|
||||
|
||||
// Add a fill layer
|
||||
mapboxMap.getStyle().addLayer(layer = new FillLayer("amsterdam-parks-layer", source.getId())
|
||||
maplibreMap.getStyle().addLayer(layer = new FillLayer("amsterdam-parks-layer", source.getId())
|
||||
.withProperties(
|
||||
fillColor(rgba(0.0f, 0.0f, 0.0f, 0.5f)),
|
||||
fillOutlineColor(rgb(0, 0, 255)),
|
||||
|
||||
@@ -38,44 +38,44 @@ public class GeoJsonSourceTests extends EspressoTest {
|
||||
@Test
|
||||
public void testFeatureCollection() {
|
||||
validateTestSetup();
|
||||
MapLibreMapAction.invoke(maplibreMap, (uiController, mapboxMap) -> {
|
||||
MapLibreMapAction.invoke(maplibreMap, (uiController, maplibreMap) -> {
|
||||
GeoJsonSource source = null;
|
||||
source = new GeoJsonSource("source", FeatureCollection
|
||||
.fromJson(ResourceUtils.readRawResource(rule.getActivity(), R.raw.test_feature_collection)));
|
||||
mapboxMap.getStyle().addSource(source);
|
||||
mapboxMap.getStyle().addLayer(new CircleLayer("layer", source.getId()));
|
||||
maplibreMap.getStyle().addSource(source);
|
||||
maplibreMap.getStyle().addLayer(new CircleLayer("layer", source.getId()));
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPointGeometry() {
|
||||
validateTestSetup();
|
||||
MapLibreMapAction.invoke(maplibreMap, (uiController, mapboxMap) -> {
|
||||
MapLibreMapAction.invoke(maplibreMap, (uiController, maplibreMap) -> {
|
||||
GeoJsonSource source = new GeoJsonSource("source", Point.fromLngLat(0d, 0d));
|
||||
mapboxMap.getStyle().addSource(source);
|
||||
mapboxMap.getStyle().addLayer(new CircleLayer("layer", source.getId()));
|
||||
maplibreMap.getStyle().addSource(source);
|
||||
maplibreMap.getStyle().addLayer(new CircleLayer("layer", source.getId()));
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFeatureProperties() {
|
||||
validateTestSetup();
|
||||
MapLibreMapAction.invoke(maplibreMap, (uiController, mapboxMap) -> {
|
||||
MapLibreMapAction.invoke(maplibreMap, (uiController, maplibreMap) -> {
|
||||
GeoJsonSource source = null;
|
||||
source = new GeoJsonSource("source",
|
||||
ResourceUtils.readRawResource(rule.getActivity(), R.raw.test_feature_properties));
|
||||
mapboxMap.getStyle().addSource(source);
|
||||
mapboxMap.getStyle().addLayer(new CircleLayer("layer", source.getId()));
|
||||
maplibreMap.getStyle().addSource(source);
|
||||
maplibreMap.getStyle().addLayer(new CircleLayer("layer", source.getId()));
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateCoalescing() {
|
||||
validateTestSetup();
|
||||
MapLibreMapAction.invoke(maplibreMap, (uiController, mapboxMap) -> {
|
||||
MapLibreMapAction.invoke(maplibreMap, (uiController, maplibreMap) -> {
|
||||
GeoJsonSource source = new GeoJsonSource("source");
|
||||
mapboxMap.getStyle().addSource(source);
|
||||
mapboxMap.getStyle().addLayer(new CircleLayer("layer", source.getId()));
|
||||
maplibreMap.getStyle().addSource(source);
|
||||
maplibreMap.getStyle().addLayer(new CircleLayer("layer", source.getId()));
|
||||
|
||||
source.setGeoJson(Point.fromLngLat(0, 0));
|
||||
source.setGeoJson(Point.fromLngLat(-25, -25));
|
||||
@@ -83,8 +83,8 @@ public class GeoJsonSourceTests extends EspressoTest {
|
||||
|
||||
source.setGeoJson(Point.fromLngLat(20, 55));
|
||||
TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
|
||||
assertEquals(1, mapboxMap.queryRenderedFeatures(
|
||||
mapboxMap.getProjection().toScreenLocation(
|
||||
assertEquals(1, maplibreMap.queryRenderedFeatures(
|
||||
maplibreMap.getProjection().toScreenLocation(
|
||||
new LatLng(55, 20)), "layer").size());
|
||||
});
|
||||
}
|
||||
@@ -93,13 +93,13 @@ public class GeoJsonSourceTests extends EspressoTest {
|
||||
public void testClearCollectionDuringConversion() {
|
||||
// https://github.com/mapbox/mapbox-gl-native/issues/14565
|
||||
validateTestSetup();
|
||||
MapLibreMapAction.invoke(maplibreMap, (uiController, mapboxMap) -> {
|
||||
MapLibreMapAction.invoke(maplibreMap, (uiController, maplibreMap) -> {
|
||||
for (int j = 0; j < 1000; j++) {
|
||||
List<Feature> features = new ArrayList<>();
|
||||
for (int i = 0; i < 100; i++) {
|
||||
features.add(Feature.fromGeometry(Point.fromLngLat(0, 0)));
|
||||
}
|
||||
mapboxMap.getStyle().addSource(new GeoJsonSource("source" + j, FeatureCollection.fromFeatures(features)));
|
||||
maplibreMap.getStyle().addSource(new GeoJsonSource("source" + j, FeatureCollection.fromFeatures(features)));
|
||||
features.clear();
|
||||
}
|
||||
});
|
||||
@@ -142,16 +142,16 @@ public class GeoJsonSourceTests extends EspressoTest {
|
||||
|
||||
protected void testFeatureFromResource(final @RawRes int resource) {
|
||||
validateTestSetup();
|
||||
MapLibreMapAction.invoke(maplibreMap, (uiController, mapboxMap) -> {
|
||||
MapLibreMapAction.invoke(maplibreMap, (uiController, maplibreMap) -> {
|
||||
GeoJsonSource source = new GeoJsonSource("source");
|
||||
mapboxMap.getStyle().addSource(source);
|
||||
maplibreMap.getStyle().addSource(source);
|
||||
Layer layer = new CircleLayer("layer", source.getId());
|
||||
mapboxMap.getStyle().addLayer(layer);
|
||||
maplibreMap.getStyle().addLayer(layer);
|
||||
|
||||
source.setGeoJson(Feature.fromJson(ResourceUtils.readRawResource(rule.getActivity(), resource)));
|
||||
|
||||
mapboxMap.getStyle().removeLayer(layer);
|
||||
mapboxMap.getStyle().removeSource(source);
|
||||
maplibreMap.getStyle().removeLayer(layer);
|
||||
maplibreMap.getStyle().removeSource(source);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -25,21 +25,21 @@ class ImageTest : EspressoTest() {
|
||||
@Test
|
||||
fun testAddGetImage() {
|
||||
validateTestSetup()
|
||||
MapLibreMapAction.invoke(maplibreMap) { uiController, mapboxMap ->
|
||||
MapLibreMapAction.invoke(maplibreMap) { uiController, maplibreMap ->
|
||||
val drawable = rule.activity.resources.getDrawable(R.drawable.ic_launcher_round)
|
||||
assertTrue(drawable is BitmapDrawable)
|
||||
|
||||
val bitmapSet = (drawable as BitmapDrawable).bitmap
|
||||
mapboxMap.style!!.addImage(IMAGE_ID, bitmapSet)
|
||||
maplibreMap.style!!.addImage(IMAGE_ID, bitmapSet)
|
||||
|
||||
// adding an image requires converting the image with an asynctask
|
||||
uiController.loopMainThreadForAtLeast(200)
|
||||
|
||||
val bitmapGet = mapboxMap.style!!.getImage(IMAGE_ID)
|
||||
val bitmapGet = maplibreMap.style!!.getImage(IMAGE_ID)
|
||||
assertTrue(bitmapGet!!.similarTo(bitmapSet))
|
||||
|
||||
mapboxMap.style!!.removeImage(IMAGE_ID)
|
||||
assertNull(mapboxMap.style!!.getImage(IMAGE_ID))
|
||||
maplibreMap.style!!.removeImage(IMAGE_ID)
|
||||
assertNull(maplibreMap.style!!.getImage(IMAGE_ID))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,35 +183,35 @@ public class RuntimeStyleTests extends EspressoTest {
|
||||
@Test
|
||||
public void testAddRemoveSource() {
|
||||
validateTestSetup();
|
||||
invoke(maplibreMap, (uiController, mapboxMap) -> {
|
||||
mapboxMap.getStyle().addSource(new VectorSource("my-source", "maptiler://sources/hillshades"));
|
||||
mapboxMap.getStyle().removeSource("my-source");
|
||||
invoke(maplibreMap, (uiController, maplibreMap) -> {
|
||||
maplibreMap.getStyle().addSource(new VectorSource("my-source", "maptiler://sources/hillshades"));
|
||||
maplibreMap.getStyle().removeSource("my-source");
|
||||
|
||||
// Add initial source
|
||||
mapboxMap.getStyle().addSource(new VectorSource("my-source", "maptiler://sources/hillshades"));
|
||||
maplibreMap.getStyle().addSource(new VectorSource("my-source", "maptiler://sources/hillshades"));
|
||||
|
||||
// Remove
|
||||
boolean removeOk = mapboxMap.getStyle().removeSource("my-source");
|
||||
boolean removeOk = maplibreMap.getStyle().removeSource("my-source");
|
||||
assertTrue(removeOk);
|
||||
assertNull(mapboxMap.getStyle().getLayer("my-source"));
|
||||
assertNull(maplibreMap.getStyle().getLayer("my-source"));
|
||||
|
||||
// Add
|
||||
Source source = new VectorSource("my-source", "maptiler://sources/hillshades");
|
||||
mapboxMap.getStyle().addSource(source);
|
||||
maplibreMap.getStyle().addSource(source);
|
||||
|
||||
// Remove, preserving the reference
|
||||
mapboxMap.getStyle().removeSource(source);
|
||||
maplibreMap.getStyle().removeSource(source);
|
||||
|
||||
// Re-add the reference...
|
||||
mapboxMap.getStyle().addSource(source);
|
||||
maplibreMap.getStyle().addSource(source);
|
||||
|
||||
// Ensure it's there
|
||||
Assert.assertNotNull(mapboxMap.getStyle().getSource(source.getId()));
|
||||
Assert.assertNotNull(maplibreMap.getStyle().getSource(source.getId()));
|
||||
|
||||
// Test adding a duplicate source
|
||||
try {
|
||||
Source source2 = new VectorSource("my-source", "maptiler://sources/hillshades");
|
||||
mapboxMap.getStyle().addSource(source2);
|
||||
maplibreMap.getStyle().addSource(source2);
|
||||
fail("Should not have been allowed to add a source with a duplicate id");
|
||||
} catch (CannotAddSourceException cannotAddSourceException) {
|
||||
// OK
|
||||
@@ -223,9 +223,9 @@ public class RuntimeStyleTests extends EspressoTest {
|
||||
@Test
|
||||
public void testVectorSourceUrlGetter() {
|
||||
validateTestSetup();
|
||||
invoke(maplibreMap, (uiController, mapboxMap) -> {
|
||||
invoke(maplibreMap, (uiController, maplibreMap) -> {
|
||||
VectorSource source = new VectorSource("my-source", "maptiler://sources/hillshades");
|
||||
mapboxMap.getStyle().addSource(source);
|
||||
maplibreMap.getStyle().addSource(source);
|
||||
assertEquals("maptiler://sources/hillshades", source.getUri());
|
||||
});
|
||||
}
|
||||
@@ -233,9 +233,9 @@ public class RuntimeStyleTests extends EspressoTest {
|
||||
@Test
|
||||
public void testRasterSourceUrlGetter() {
|
||||
validateTestSetup();
|
||||
invoke(maplibreMap, (uiController, mapboxMap) -> {
|
||||
invoke(maplibreMap, (uiController, maplibreMap) -> {
|
||||
RasterSource source = new RasterSource("my-source", "maptiler://sources/hillshades");
|
||||
mapboxMap.getStyle().addSource(source);
|
||||
maplibreMap.getStyle().addSource(source);
|
||||
assertEquals("maptiler://sources/hillshades", source.getUri());
|
||||
});
|
||||
}
|
||||
@@ -243,9 +243,9 @@ public class RuntimeStyleTests extends EspressoTest {
|
||||
@Test
|
||||
public void testGeoJsonSourceUrlGetter() {
|
||||
validateTestSetup();
|
||||
invoke(maplibreMap, (uiController, mapboxMap) -> {
|
||||
invoke(maplibreMap, (uiController, maplibreMap) -> {
|
||||
GeoJsonSource source = new GeoJsonSource("my-source");
|
||||
mapboxMap.getStyle().addSource(source);
|
||||
maplibreMap.getStyle().addSource(source);
|
||||
assertNull(source.getUri());
|
||||
source.setUri("http://mapbox.com/my-file.json");
|
||||
assertEquals("http://mapbox.com/my-file.json", source.getUri());
|
||||
@@ -271,28 +271,28 @@ public class RuntimeStyleTests extends EspressoTest {
|
||||
|
||||
@Test
|
||||
public void testRemoveNonExistingSource() {
|
||||
invoke(maplibreMap, (uiController, mapboxMap) -> mapboxMap.getStyle().removeSource("source"));
|
||||
invoke(maplibreMap, (uiController, maplibreMap) -> maplibreMap.getStyle().removeSource("source"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoveNonExistingLayer() {
|
||||
invoke(maplibreMap, (uiController, mapboxMap) -> {
|
||||
assertFalse(mapboxMap.getStyle().removeLayer("layer"));
|
||||
assertFalse(mapboxMap.getStyle().removeLayerAt(mapboxMap.getStyle().getLayers().size() + 1));
|
||||
assertFalse(mapboxMap.getStyle().removeLayerAt(-1));
|
||||
invoke(maplibreMap, (uiController, maplibreMap) -> {
|
||||
assertFalse(maplibreMap.getStyle().removeLayer("layer"));
|
||||
assertFalse(maplibreMap.getStyle().removeLayerAt(maplibreMap.getStyle().getLayers().size() + 1));
|
||||
assertFalse(maplibreMap.getStyle().removeLayerAt(-1));
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoveExistingLayer() {
|
||||
invoke(maplibreMap, (uiController, mapboxMap) -> {
|
||||
Layer firstLayer = mapboxMap.getStyle().getLayers().get(0);
|
||||
assertTrue(mapboxMap.getStyle().removeLayer(firstLayer));
|
||||
invoke(maplibreMap, (uiController, maplibreMap) -> {
|
||||
Layer firstLayer = maplibreMap.getStyle().getLayers().get(0);
|
||||
assertTrue(maplibreMap.getStyle().removeLayer(firstLayer));
|
||||
|
||||
firstLayer = mapboxMap.getStyle().getLayers().get(0);
|
||||
assertTrue(mapboxMap.getStyle().removeLayer(firstLayer.getId()));
|
||||
firstLayer = maplibreMap.getStyle().getLayers().get(0);
|
||||
assertTrue(maplibreMap.getStyle().removeLayer(firstLayer.getId()));
|
||||
|
||||
assertTrue(mapboxMap.getStyle().removeLayerAt(0));
|
||||
assertTrue(maplibreMap.getStyle().removeLayerAt(0));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ class JsonApiActivity : AppCompatActivity() {
|
||||
// Declare a variable for MapView
|
||||
private lateinit var mapView: MapView
|
||||
|
||||
// Declare a variable for MapboxMap
|
||||
// Declare a variable for MapLibreMap
|
||||
private lateinit var maplibreMap: MapLibreMap
|
||||
/* ANCHOR_END: top */
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ import org.maplibre.android.testapp.R
|
||||
* Test activity showcasing using the MapFragment API using SDK Fragments.
|
||||
*
|
||||
*
|
||||
* Uses MapboxMapOptions to initialise the Fragment.
|
||||
* Uses MapLibreMapOptions to initialise the Fragment.
|
||||
*
|
||||
*/
|
||||
class MapFragmentActivity :
|
||||
|
||||
@@ -113,7 +113,7 @@ class NestedViewPagerActivity : AppCompatActivity() {
|
||||
0 -> {
|
||||
options.camera(CameraPosition.Builder().target(LatLng(34.920526, 102.634774)).zoom(3.0).build())
|
||||
val fragment = SupportMapFragment.newInstance(options)
|
||||
fragment.getMapAsync { mapboxMap -> mapboxMap.setStyle(Style.getPredefinedStyle("Streets")) }
|
||||
fragment.getMapAsync { maplibreMap -> maplibreMap.setStyle(Style.getPredefinedStyle("Streets")) }
|
||||
return fragment
|
||||
}
|
||||
1 -> {
|
||||
@@ -122,7 +122,7 @@ class NestedViewPagerActivity : AppCompatActivity() {
|
||||
2 -> {
|
||||
options.camera(CameraPosition.Builder().target(LatLng(62.326440, 92.764913)).zoom(3.0).build())
|
||||
val fragment = SupportMapFragment.newInstance(options)
|
||||
fragment.getMapAsync { mapboxMap -> mapboxMap.setStyle(Style.getPredefinedStyle("Pastel")) }
|
||||
fragment.getMapAsync { maplibreMap -> maplibreMap.setStyle(Style.getPredefinedStyle("Pastel")) }
|
||||
return fragment
|
||||
}
|
||||
3 -> {
|
||||
@@ -131,7 +131,7 @@ class NestedViewPagerActivity : AppCompatActivity() {
|
||||
4 -> {
|
||||
options.camera(CameraPosition.Builder().target(LatLng(-25.007786, 133.623852)).zoom(3.0).build())
|
||||
val fragment = SupportMapFragment.newInstance(options)
|
||||
fragment.getMapAsync { mapboxMap -> mapboxMap.setStyle(Style.getPredefinedStyle("Satellite Hybrid")) }
|
||||
fragment.getMapAsync { maplibreMap -> maplibreMap.setStyle(Style.getPredefinedStyle("Satellite Hybrid")) }
|
||||
return fragment
|
||||
}
|
||||
5 -> {
|
||||
|
||||
@@ -14,7 +14,7 @@ import org.maplibre.android.testapp.R
|
||||
* Test activity showcasing using the MapFragment API using Support Library Fragments.
|
||||
*
|
||||
*
|
||||
* Uses MapboxMapOptions to initialise the Fragment.
|
||||
* Uses MapLibreMapOptions to initialise the Fragment.
|
||||
*
|
||||
*/
|
||||
class SupportMapFragmentActivity :
|
||||
|
||||
@@ -20,7 +20,7 @@ import org.maplibre.android.testapp.utils.IconUtils
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* Test activity showcasing how to dynamically update InfoWindow when Using an MapboxMap.InfoWindowAdapter.
|
||||
* Test activity showcasing how to dynamically update InfoWindow when Using an MapLibreMap.InfoWindowAdapter.
|
||||
*/
|
||||
class DynamicInfoWindowAdapterActivity : AppCompatActivity(), OnMapReadyCallback {
|
||||
private lateinit var maplibreMap: MapLibreMap
|
||||
|
||||
@@ -56,8 +56,8 @@ open class DebugModeActivity : AppCompatActivity(), OnMapReadyCallback, OnFpsCha
|
||||
}
|
||||
|
||||
private fun setupMapView(savedInstanceState: Bundle?) {
|
||||
val mapboxMapOptions = setupMapboxMapOptions()
|
||||
mapView = MapView(this, mapboxMapOptions)
|
||||
val maplibreMapOptions = setupMapLibreMapOptions()
|
||||
mapView = MapView(this, maplibreMapOptions)
|
||||
(findViewById<View>(R.id.coordinator_layout) as ViewGroup).addView(mapView, 0)
|
||||
mapView.addOnDidFinishLoadingStyleListener {
|
||||
if (maplibreMap != null) {
|
||||
@@ -70,7 +70,7 @@ open class DebugModeActivity : AppCompatActivity(), OnMapReadyCallback, OnFpsCha
|
||||
mapView.addOnDidFinishLoadingStyleListener { Timber.d("Style loaded") }
|
||||
}
|
||||
|
||||
protected open fun setupMapboxMapOptions(): MapLibreMapOptions {
|
||||
protected open fun setupMapLibreMapOptions(): MapLibreMapOptions {
|
||||
return MapLibreMapOptions.createFromAttributes(this, null)
|
||||
}
|
||||
|
||||
|
||||
@@ -143,9 +143,9 @@ open class GLSurfaceRecyclerViewActivity : AppCompatActivity() {
|
||||
}
|
||||
|
||||
fun bind(mapItem: MapItem) {
|
||||
mapView.getMapAsync { mapboxMap ->
|
||||
mapboxMap.setStyle(mapItem.style) {
|
||||
mapboxMap.snapshot { }
|
||||
mapView.getMapAsync { maplibreMap ->
|
||||
maplibreMap.setStyle(mapItem.style) {
|
||||
maplibreMap.snapshot { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,10 +66,10 @@ class DraggableMarkerActivity : AppCompatActivity() {
|
||||
|
||||
mapView = binding.mapView
|
||||
mapView.onCreate(savedInstanceState)
|
||||
mapView.getMapAsync { mapboxMap ->
|
||||
this.maplibreMap = mapboxMap
|
||||
mapView.getMapAsync { maplibreMap ->
|
||||
this.maplibreMap = maplibreMap
|
||||
|
||||
mapboxMap.setStyle(
|
||||
maplibreMap.setStyle(
|
||||
Style.Builder()
|
||||
.fromUri(Style.getPredefinedStyle("Streets"))
|
||||
.withImage(markerImageId, IconFactory.getInstance(this).defaultMarker().bitmap)
|
||||
@@ -83,16 +83,16 @@ class DraggableMarkerActivity : AppCompatActivity() {
|
||||
addMarker(LatLng(51.514886, -0.112589))
|
||||
|
||||
// Initial camera position
|
||||
mapboxMap.moveCamera(
|
||||
maplibreMap.moveCamera(
|
||||
CameraUpdateFactory.newLatLngZoom(
|
||||
LatLng(45.0, 8.0),
|
||||
3.0
|
||||
)
|
||||
)
|
||||
|
||||
mapboxMap.addOnMapClickListener {
|
||||
maplibreMap.addOnMapClickListener {
|
||||
// Adding a marker on map click
|
||||
val features = mapboxMap.queryRenderedSymbols(it, layerId)
|
||||
val features = maplibreMap.queryRenderedSymbols(it, layerId)
|
||||
if (features.isEmpty()) {
|
||||
addMarker(it)
|
||||
} else {
|
||||
@@ -110,7 +110,7 @@ class DraggableMarkerActivity : AppCompatActivity() {
|
||||
|
||||
draggableSymbolsManager = DraggableSymbolsManager(
|
||||
mapView,
|
||||
mapboxMap,
|
||||
maplibreMap,
|
||||
featureCollection,
|
||||
source,
|
||||
layerId,
|
||||
@@ -175,7 +175,7 @@ class DraggableMarkerActivity : AppCompatActivity() {
|
||||
* we still need to listen for move gesture events which map won't be able to provide anymore.
|
||||
*
|
||||
* @param mapView the mapView
|
||||
* @param maplibreMap the mapboxMap
|
||||
* @param maplibreMap the maplibreMap
|
||||
* @param symbolsCollection the collection that contains all the symbols that we want to be draggable
|
||||
* @param symbolsSource the source that contains the [symbolsCollection]
|
||||
* @param symbolsLayerId the ID of the layer that the symbols are displayed on
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.io.FileWriter
|
||||
import java.lang.ref.WeakReference
|
||||
|
||||
/**
|
||||
* Test activity showcasing how to use a file:// resource for the style.json and how to use MapboxMap#setStyleJson.
|
||||
* Test activity showcasing how to use a file:// resource for the style.json and how to use MapLibreMap#setStyleJson.
|
||||
*/
|
||||
class StyleFileActivity : AppCompatActivity() {
|
||||
private lateinit var maplibreMap: MapLibreMap
|
||||
@@ -83,8 +83,8 @@ class StyleFileActivity : AppCompatActivity() {
|
||||
override fun onPostExecute(json: String) {
|
||||
super.onPostExecute(json)
|
||||
Timber.d("Read json, %s", json)
|
||||
val mapboxMap = maplibreMap.get()
|
||||
mapboxMap?.setStyle(Style.Builder().fromJson(json))
|
||||
val maplibreMap = maplibreMap.get()
|
||||
maplibreMap?.setStyle(Style.Builder().fromJson(json))
|
||||
}
|
||||
|
||||
init {
|
||||
@@ -127,8 +127,8 @@ class StyleFileActivity : AppCompatActivity() {
|
||||
|
||||
override fun onPostExecute(result: Long) {
|
||||
// Actual file:// usage
|
||||
val mapboxMap = maplibreMap.get()
|
||||
mapboxMap?.setStyle(
|
||||
val maplibreMap = maplibreMap.get()
|
||||
maplibreMap?.setStyle(
|
||||
Style.Builder().fromUri("file://" + cacheStyleFile!!.absolutePath)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ class SymbolGeneratorActivity : AppCompatActivity(), OnMapReadyCallback {
|
||||
* Utility class to generate Bitmaps for Symbol.
|
||||
*
|
||||
*
|
||||
* Bitmaps can be added to the map with [com.mapbox.mapboxsdk.maps.MapboxMap.addImage]
|
||||
* Bitmaps can be added to the map with [org.maplibre.android.maps.Style.addImage]
|
||||
*
|
||||
*/
|
||||
private object SymbolGenerator {
|
||||
|
||||
@@ -9,10 +9,10 @@ import org.maplibre.android.testapp.utils.NavUtils
|
||||
* Test activity showcasing the different debug modes and allows to cycle between the default map styles.
|
||||
*/
|
||||
class TextureViewDebugModeActivity : DebugModeActivity(), OnMapReadyCallback {
|
||||
override fun setupMapboxMapOptions(): MapLibreMapOptions {
|
||||
val mapboxMapOptions = super.setupMapboxMapOptions()
|
||||
mapboxMapOptions.textureMode(true)
|
||||
return mapboxMapOptions
|
||||
override fun setupMapLibreMapOptions(): MapLibreMapOptions {
|
||||
val maplibreMapOptions = super.setupMapLibreMapOptions()
|
||||
maplibreMapOptions.textureMode(true)
|
||||
return maplibreMapOptions
|
||||
}
|
||||
|
||||
override fun onBackPressed() {
|
||||
|
||||
@@ -39,9 +39,9 @@ class PhysicalUnitCircleActivity : AppCompatActivity(), SeekBar.OnSeekBarChangeL
|
||||
binding = ActivityPhysicalCircleBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
binding.mapView.onCreate(savedInstanceState)
|
||||
binding.mapView.getMapAsync { mapboxMap ->
|
||||
binding.mapView.getMapAsync { maplibreMap ->
|
||||
|
||||
mapboxMap.cameraPosition = CameraPosition.Builder()
|
||||
maplibreMap.cameraPosition = CameraPosition.Builder()
|
||||
.target(LatLng(LATITUDE, LONGITUDE))
|
||||
.zoom(ZOOM)
|
||||
.build()
|
||||
@@ -59,7 +59,7 @@ class PhysicalUnitCircleActivity : AppCompatActivity(), SeekBar.OnSeekBarChangeL
|
||||
binding.stepsBar.setOnSeekBarChangeListener(this)
|
||||
binding.radiusBar.setOnSeekBarChangeListener(this)
|
||||
|
||||
mapboxMap.setStyle(
|
||||
maplibreMap.setStyle(
|
||||
Style.Builder()
|
||||
.fromUri(Style.getPredefinedStyle("Satellite Hybrid"))
|
||||
.withLayer(
|
||||
|
||||
Reference in New Issue
Block a user