Skip to content

Commit

Permalink
Removing low-level QRF and QSF with Featuresets (#2860)
Browse files Browse the repository at this point in the history
Co-authored-by: Kiryl Dzehtsiarenka <kiryl.dzehtsiarenka@mapbox.com>
Co-authored-by: Alex Morozov <aleksandr.morozov@mapbox.com>
  • Loading branch information
3 people authored Nov 22, 2024
1 parent 5261d64 commit e59cdde
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 152 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Mapbox welcomes participation and contributions from everyone.
# main
## Breaking changes ⚠️
* Expose Geofencing with `com.mapbox.annotation.MapboxExperimental` annotation.
* Remove experimental `MapboxMap.queryRenderedFeatures` and `MapboxMap.querySourceFeatures` that used `FeaturesetQueryTarget` as an argument.

## Features ✨ and improvements 🏁
* Introduce experimental `FillExtrusionLayer.fillExtrusionBaseAlignment` and `FillExtrusionLayer.fillExtrusionHeightAlignment` APIs to control the behavior of fill extrusion base over terrain and the behavior of fill extrusion height over terrain respectively.
Expand Down
4 changes: 0 additions & 4 deletions maps-sdk/api/Release/metalava.txt
Original file line number Diff line number Diff line change
Expand Up @@ -251,11 +251,7 @@ package com.mapbox.maps {
method @com.mapbox.maps.MapboxExperimental public <FF extends com.mapbox.maps.interactions.FeaturesetFeature<?>> com.mapbox.common.Cancelable queryRenderedFeatures(com.mapbox.maps.interactions.TypedFeaturesetDescriptor<?,FF> descriptor, com.mapbox.maps.RenderedQueryGeometry? geometry = null, com.mapbox.bindgen.Value? filter = null, com.mapbox.maps.interactions.QueryRenderedFeaturesetFeaturesCallback<FF> callback);
method @com.mapbox.maps.MapboxExperimental public <FF extends com.mapbox.maps.interactions.FeaturesetFeature<?>> com.mapbox.common.Cancelable queryRenderedFeatures(com.mapbox.maps.interactions.TypedFeaturesetDescriptor<?,FF> descriptor, com.mapbox.maps.RenderedQueryGeometry? geometry = null, com.mapbox.maps.interactions.QueryRenderedFeaturesetFeaturesCallback<FF> callback);
method @com.mapbox.maps.MapboxExperimental public <FF extends com.mapbox.maps.interactions.FeaturesetFeature<?>> com.mapbox.common.Cancelable queryRenderedFeatures(com.mapbox.maps.interactions.TypedFeaturesetDescriptor<?,FF> descriptor, com.mapbox.maps.interactions.QueryRenderedFeaturesetFeaturesCallback<FF> callback);
method @com.mapbox.maps.MapboxDelicateApi @com.mapbox.maps.MapboxExperimental public com.mapbox.common.Cancelable queryRenderedFeatures(com.mapbox.maps.RenderedQueryGeometry geometry, java.util.List<com.mapbox.maps.FeaturesetQueryTarget> targets, com.mapbox.maps.QueryRenderedFeaturesCallback callback);
method public com.mapbox.common.Cancelable querySourceFeatures(String sourceId, com.mapbox.maps.SourceQueryOptions options, com.mapbox.maps.QuerySourceFeaturesCallback callback);
method @com.mapbox.maps.MapboxExperimental public com.mapbox.common.Cancelable querySourceFeatures(com.mapbox.maps.interactions.TypedFeaturesetDescriptor<?,?> descriptor, com.mapbox.bindgen.Value? filter = null, Long? tag = null, com.mapbox.maps.QuerySourceFeaturesCallback callback);
method @com.mapbox.maps.MapboxExperimental public com.mapbox.common.Cancelable querySourceFeatures(com.mapbox.maps.interactions.TypedFeaturesetDescriptor<?,?> descriptor, com.mapbox.bindgen.Value? filter = null, com.mapbox.maps.QuerySourceFeaturesCallback callback);
method @com.mapbox.maps.MapboxExperimental public com.mapbox.common.Cancelable querySourceFeatures(com.mapbox.maps.interactions.TypedFeaturesetDescriptor<?,?> descriptor, com.mapbox.maps.QuerySourceFeaturesCallback callback);
method public void reduceMemoryUse();
method public com.mapbox.common.Cancelable removeFeatureState(String sourceId, String? sourceLayerId = null, String featureId, String? stateKey = null, com.mapbox.maps.FeatureStateOperationCallback callback);
method public com.mapbox.common.Cancelable removeFeatureState(String sourceId, String? sourceLayerId = null, String featureId, com.mapbox.maps.FeatureStateOperationCallback callback);
Expand Down
5 changes: 0 additions & 5 deletions maps-sdk/api/maps-sdk.api
Original file line number Diff line number Diff line change
Expand Up @@ -257,16 +257,11 @@ public final class com/mapbox/maps/MapboxMap : com/mapbox/maps/MapboxStyleManage
public fun project (Lcom/mapbox/geojson/Point;D)Lcom/mapbox/maps/MercatorCoordinate;
public fun projectedMetersForCoordinate (Lcom/mapbox/geojson/Point;)Lcom/mapbox/maps/ProjectedMeters;
public fun queryRenderedFeatures (Lcom/mapbox/maps/RenderedQueryGeometry;Lcom/mapbox/maps/RenderedQueryOptions;Lcom/mapbox/maps/QueryRenderedFeaturesCallback;)Lcom/mapbox/common/Cancelable;
public final fun queryRenderedFeatures (Lcom/mapbox/maps/RenderedQueryGeometry;Ljava/util/List;Lcom/mapbox/maps/QueryRenderedFeaturesCallback;)Lcom/mapbox/common/Cancelable;
public final fun queryRenderedFeatures (Lcom/mapbox/maps/interactions/TypedFeaturesetDescriptor;Lcom/mapbox/maps/RenderedQueryGeometry;Lcom/mapbox/bindgen/Value;Lcom/mapbox/maps/interactions/QueryRenderedFeaturesetFeaturesCallback;)Lcom/mapbox/common/Cancelable;
public final fun queryRenderedFeatures (Lcom/mapbox/maps/interactions/TypedFeaturesetDescriptor;Lcom/mapbox/maps/RenderedQueryGeometry;Lcom/mapbox/maps/interactions/QueryRenderedFeaturesetFeaturesCallback;)Lcom/mapbox/common/Cancelable;
public final fun queryRenderedFeatures (Lcom/mapbox/maps/interactions/TypedFeaturesetDescriptor;Lcom/mapbox/maps/interactions/QueryRenderedFeaturesetFeaturesCallback;)Lcom/mapbox/common/Cancelable;
public static synthetic fun queryRenderedFeatures$default (Lcom/mapbox/maps/MapboxMap;Lcom/mapbox/maps/interactions/TypedFeaturesetDescriptor;Lcom/mapbox/maps/RenderedQueryGeometry;Lcom/mapbox/bindgen/Value;Lcom/mapbox/maps/interactions/QueryRenderedFeaturesetFeaturesCallback;ILjava/lang/Object;)Lcom/mapbox/common/Cancelable;
public final fun querySourceFeatures (Lcom/mapbox/maps/interactions/TypedFeaturesetDescriptor;Lcom/mapbox/bindgen/Value;Lcom/mapbox/maps/QuerySourceFeaturesCallback;)Lcom/mapbox/common/Cancelable;
public final fun querySourceFeatures (Lcom/mapbox/maps/interactions/TypedFeaturesetDescriptor;Lcom/mapbox/bindgen/Value;Ljava/lang/Long;Lcom/mapbox/maps/QuerySourceFeaturesCallback;)Lcom/mapbox/common/Cancelable;
public final fun querySourceFeatures (Lcom/mapbox/maps/interactions/TypedFeaturesetDescriptor;Lcom/mapbox/maps/QuerySourceFeaturesCallback;)Lcom/mapbox/common/Cancelable;
public fun querySourceFeatures (Ljava/lang/String;Lcom/mapbox/maps/SourceQueryOptions;Lcom/mapbox/maps/QuerySourceFeaturesCallback;)Lcom/mapbox/common/Cancelable;
public static synthetic fun querySourceFeatures$default (Lcom/mapbox/maps/MapboxMap;Lcom/mapbox/maps/interactions/TypedFeaturesetDescriptor;Lcom/mapbox/bindgen/Value;Ljava/lang/Long;Lcom/mapbox/maps/QuerySourceFeaturesCallback;ILjava/lang/Object;)Lcom/mapbox/common/Cancelable;
public final fun reduceMemoryUse ()V
public final fun removeFeatureState (Lcom/mapbox/maps/interactions/FeaturesetFeature;)Lcom/mapbox/common/Cancelable;
public final fun removeFeatureState (Lcom/mapbox/maps/interactions/FeaturesetFeature;Lcom/mapbox/maps/interactions/FeatureStateKey;)Lcom/mapbox/common/Cancelable;
Expand Down
59 changes: 0 additions & 59 deletions maps-sdk/src/main/java/com/mapbox/maps/MapboxMap.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2672,65 +2672,6 @@ class MapboxMap :
}
}

/**
* Queries the map for rendered features.
*
* Note: this is considered to be low-level API and should not be used in majority of use-cases.
* Instead consider using [ClickInteraction], [LongClickInteraction] to interact with map elements or
* overloaded [queryRenderedFeatures] that takes a single [TypedFeaturesetDescriptor] as an argument and returns
* a single [FeaturesetFeature] implementation in the callback.
*
* @param geometry The `screen pixel coordinates` (point, line string or box) to query for rendered features.
* @param targets An array of [FeaturesetQueryTarget] used to filter and query features.
* @param callback The `query features callback` called when the query operation completes.
*
* @return A `cancelable` object that could be used to cancel the pending query.
*/
@MapboxExperimental
@MapboxDelicateApi
fun queryRenderedFeatures(
geometry: RenderedQueryGeometry,
targets: List<FeaturesetQueryTarget>,
callback: QueryRenderedFeaturesCallback,
): Cancelable {
checkNativeMap("queryRenderedFeatures")
return nativeMap.queryRenderedFeatures(
geometry,
targets,
callback
)
}

/**
* Queries the map for source features.
*
* @param descriptor [TypedFeaturesetDescriptor] object representing either a featureset or a single layer.
* @param filter an optional global filter.
* @param tag an optional identifier.
* @param callback The callback called when the query completes.
* @return A `cancelable` object that could be used to cancel the pending query.
*
* Note: In order to get expected results, the corresponding source needs to be in use and the query shall be made after the corresponding source data is loaded.
*/
@MapboxExperimental
@JvmOverloads
fun querySourceFeatures(
descriptor: TypedFeaturesetDescriptor<*, *>,
filter: Value? = null,
tag: Long? = null,
callback: QuerySourceFeaturesCallback,
): Cancelable {
checkNativeMap("querySourceFeatures")
return nativeMap.querySourceFeatures(
FeaturesetQueryTarget(
descriptor.toFeaturesetDescriptor(),
filter,
tag
),
callback
)
}

/**
* A convenience object to access MapboxMap's static utilities.
*/
Expand Down
7 changes: 0 additions & 7 deletions maps-sdk/src/main/java/com/mapbox/maps/NativeMapImpl.kt
Original file line number Diff line number Diff line change
Expand Up @@ -753,13 +753,6 @@ internal class NativeMapImpl(val map: Map) {
return map.resetFeatureStates(featureset, callback)
}

fun querySourceFeatures(
target: FeaturesetQueryTarget,
callback: QuerySourceFeaturesCallback
): Cancelable {
return map.querySourceFeatures(target, callback)
}

fun queryRenderedFeatures(
geometry: RenderedQueryGeometry,
targets: List<FeaturesetQueryTarget>,
Expand Down
58 changes: 0 additions & 58 deletions maps-sdk/src/test/java/com/mapbox/maps/MapboxMapTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1313,53 +1313,6 @@ class MapboxMapTest {
}
}

@Test
fun querySourceFeaturesTypedFeaturesetDescriptorFromFeatureset() {
val featuresetId = "featuresetId"
val importId = "importId"
val descriptor = TypedFeaturesetDescriptor.Featureset(featuresetId, importId)
val filter = Value.nullValue()
val tag = 0L
mapboxMap.querySourceFeatures(
descriptor = descriptor,
filter = filter,
tag = tag,
) { }
verify {
nativeMap.querySourceFeatures(
FeaturesetQueryTarget(
FeaturesetDescriptor(featuresetId, importId, /* layerId */ null),
filter,
tag,
),
/* callback */ any()
)
}
}

@Test
fun querySourceFeaturesTypedFeaturesetDescriptorFromLayer() {
val layerId = "layerId"
val descriptor = TypedFeaturesetDescriptor.Layer(layerId)
val filter = Value.nullValue()
val tag = 0L
mapboxMap.querySourceFeatures(
descriptor = descriptor,
filter = filter,
tag = tag,
) { }
verify {
nativeMap.querySourceFeatures(
FeaturesetQueryTarget(
FeaturesetDescriptor(/* featuresetId */ null, /* importId */ null, /* layerId */ layerId),
filter,
tag,
),
/* callback */ any()
)
}
}

@Test
fun queryRenderedFeatures() {
val geometry = mockk<RenderedQueryGeometry>()
Expand Down Expand Up @@ -1410,17 +1363,6 @@ class MapboxMapTest {
assertEquals(20.0, geometrySlot.captured.screenBox.max.y, 0.0001)
}

@OptIn(MapboxDelicateApi::class)
@Test
fun queryRenderedFeaturesFromFeaturesetQueryTargets() {
val geometry = mockk<RenderedQueryGeometry>()
val targets = listOf(mockk<FeaturesetQueryTarget>())
mapboxMap.queryRenderedFeatures(geometry, targets) { }
verify {
nativeMap.queryRenderedFeatures(geometry, targets, any())
}
}

@Test
fun getClusterLeavesDefaultParam() {
val feature = mockk<Feature>()
Expand Down
19 changes: 0 additions & 19 deletions maps-sdk/src/test/java/com/mapbox/maps/NativeMapTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -723,16 +723,6 @@ class NativeMapTest {
verify { map.queryRenderedFeatures(geometry, queryOptions, callback) }
}

@Test
fun queryRenderedFeaturesFeaturesetQueryTargets() {
val callback = mockk<QueryRenderedFeaturesCallback>()
val geometry = mockk<RenderedQueryGeometry>()
val featuresetQueryTargets = listOf(mockk<FeaturesetQueryTarget>())
val nativeMap = NativeMapImpl(map)
nativeMap.queryRenderedFeatures(geometry, featuresetQueryTargets, callback)
verify { map.queryRenderedFeatures(geometry, featuresetQueryTargets, callback) }
}

@Test
fun querySourceFeatures() {
val callback = mockk<QuerySourceFeaturesCallback>()
Expand All @@ -742,15 +732,6 @@ class NativeMapTest {
verify { map.querySourceFeatures("foo", queryOptions, callback) }
}

@Test
fun querySourceFeaturesFeaturesetQueryTarget() {
val callback = mockk<QuerySourceFeaturesCallback>()
val featuresetQueryTarget = mockk<FeaturesetQueryTarget>()
val nativeMap = NativeMapImpl(map)
nativeMap.querySourceFeatures(featuresetQueryTarget, callback)
verify { map.querySourceFeatures(featuresetQueryTarget, callback) }
}

@Test
fun queryFeatureExtensions() {
val callback = mockk<QueryFeatureExtensionCallback>()
Expand Down

0 comments on commit e59cdde

Please sign in to comment.