|
|
|
|
@@ -228,36 +228,49 @@ class GeoJsonSource : Source {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Updates the GeoJson with a single feature. The update is performed asynchronously,
|
|
|
|
|
* so the data won't be immediately visible or available to query when this method returns.
|
|
|
|
|
* Updates the GeoJson with a single feature.
|
|
|
|
|
* The update is performed synchronously or asynchronously, based on the source synchronous update flag.
|
|
|
|
|
* In the case of asynchronous updates, the data won't be immediately visible or available to query when this method returns.
|
|
|
|
|
*
|
|
|
|
|
* @param feature the GeoJSON [Feature] to set
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
fun setGeoJson(feature: Feature?) {
|
|
|
|
|
if (detached) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
checkThread()
|
|
|
|
|
nativeSetFeature(feature)
|
|
|
|
|
if (nativeIsUpdateSynchronous()) {
|
|
|
|
|
nativeSetFeatureSync(feature)
|
|
|
|
|
} else {
|
|
|
|
|
nativeSetFeature(feature)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Updates the GeoJson with a single geometry. The update is performed asynchronously,
|
|
|
|
|
* so the data won't be immediately visible or available to query when this method returns.
|
|
|
|
|
* Updates the GeoJson with a single geometry.
|
|
|
|
|
* The update is performed synchronously or asynchronously, based on the source synchronous update flag.
|
|
|
|
|
* In the case of asynchronous updates, the data won't be immediately visible or available to query when this method returns.
|
|
|
|
|
*
|
|
|
|
|
* @param geometry the GeoJSON [Geometry] to set
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
fun setGeoJson(geometry: Geometry?) {
|
|
|
|
|
if (detached) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
checkThread()
|
|
|
|
|
nativeSetGeometry(geometry)
|
|
|
|
|
if (nativeIsUpdateSynchronous()) {
|
|
|
|
|
nativeSetGeometrySync(geometry)
|
|
|
|
|
} else {
|
|
|
|
|
nativeSetGeometry(geometry)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Updates the GeoJson. The update is performed asynchronously,
|
|
|
|
|
* so the data won't be immediately visible or available to query when this method returns.
|
|
|
|
|
* Updates the GeoJson.
|
|
|
|
|
* The update is performed synchronously or asynchronously, based on the source synchronous update flag.
|
|
|
|
|
* In the case of asynchronous updates, the data won't be immediately visible or available to query when this method returns.
|
|
|
|
|
*
|
|
|
|
|
* @param featureCollection the GeoJSON FeatureCollection
|
|
|
|
|
*/
|
|
|
|
|
@@ -266,15 +279,37 @@ class GeoJsonSource : Source {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
checkThread()
|
|
|
|
|
var featureCollection = featureCollection
|
|
|
|
|
if (featureCollection != null && featureCollection.features() != null) {
|
|
|
|
|
val features = featureCollection.features()
|
|
|
|
|
val featuresCopy: List<Feature> = ArrayList(features)
|
|
|
|
|
nativeSetFeatureCollection(FeatureCollection.fromFeatures(featuresCopy))
|
|
|
|
|
featureCollection = FeatureCollection.fromFeatures(featuresCopy)
|
|
|
|
|
}
|
|
|
|
|
if (nativeIsUpdateSynchronous()) {
|
|
|
|
|
nativeSetFeatureCollectionSync(featureCollection)
|
|
|
|
|
} else {
|
|
|
|
|
nativeSetFeatureCollection(featureCollection)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Updates the GeoJson.
|
|
|
|
|
* The update is performed synchronously or asynchronously, based on the source synchronous update flag.
|
|
|
|
|
* In the case of asynchronous updates, the data won't be immediately visible or available to query when this method returns.
|
|
|
|
|
*
|
|
|
|
|
* @param json the raw GeoJson FeatureCollection string
|
|
|
|
|
*/
|
|
|
|
|
fun setGeoJson(json: String) {
|
|
|
|
|
if (detached) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
checkThread()
|
|
|
|
|
if (nativeIsUpdateSynchronous()) {
|
|
|
|
|
nativeSetGeoJsonStringSync(json)
|
|
|
|
|
} else {
|
|
|
|
|
nativeSetGeoJsonString(json)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Updates the GeoJson with a single feature. The update is performed synchronously,
|
|
|
|
|
@@ -282,6 +317,7 @@ class GeoJsonSource : Source {
|
|
|
|
|
*
|
|
|
|
|
* @param feature the GeoJSON [Feature] to set
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated("use {@link GeoJsonOptions#withSynchronousUpdate(Boolean)} to enable synchronous updates on construction")
|
|
|
|
|
fun setGeoJsonSync(feature: Feature?) {
|
|
|
|
|
if (detached) {
|
|
|
|
|
return
|
|
|
|
|
@@ -296,6 +332,7 @@ class GeoJsonSource : Source {
|
|
|
|
|
*
|
|
|
|
|
* @param geometry the GeoJSON [Geometry] to set
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated("use {@link GeoJsonOptions#withSynchronousUpdate(Boolean)} to enable synchronous updates on construction")
|
|
|
|
|
fun setGeoJsonSync(geometry: Geometry?) {
|
|
|
|
|
if (detached) {
|
|
|
|
|
return
|
|
|
|
|
@@ -310,6 +347,7 @@ class GeoJsonSource : Source {
|
|
|
|
|
*
|
|
|
|
|
* @param featureCollection the GeoJSON FeatureCollection
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated("use {@link GeoJsonOptions#withSynchronousUpdate(Boolean)} to enable synchronous updates on construction")
|
|
|
|
|
fun setGeoJsonSync(featureCollection: FeatureCollection?) {
|
|
|
|
|
if (detached) {
|
|
|
|
|
return
|
|
|
|
|
@@ -324,26 +362,13 @@ class GeoJsonSource : Source {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Updates the GeoJson. The update is performed asynchronously,
|
|
|
|
|
* so the data won't be immediately visible or available to query when this method returns.
|
|
|
|
|
*
|
|
|
|
|
* @param json the raw GeoJson FeatureCollection string
|
|
|
|
|
*/
|
|
|
|
|
fun setGeoJson(json: String) {
|
|
|
|
|
if (detached) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
checkThread()
|
|
|
|
|
nativeSetGeoJsonString(json)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Updates the GeoJson. The update is performed synchronously,
|
|
|
|
|
* so the data will be immediately visible and available to query when this method returns.
|
|
|
|
|
*
|
|
|
|
|
* @param json the raw GeoJson FeatureCollection string
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated("use {@link GeoJsonOptions#withSynchronousUpdate(Boolean)} to enable synchronous updates on construction")
|
|
|
|
|
fun setGeoJsonSync(json: String) {
|
|
|
|
|
if (detached) {
|
|
|
|
|
return
|
|
|
|
|
@@ -567,6 +592,9 @@ class GeoJsonSource : Source {
|
|
|
|
|
@Keep
|
|
|
|
|
private external fun nativeGetClusterExpansionZoom(feature: Feature): Int
|
|
|
|
|
|
|
|
|
|
@Keep
|
|
|
|
|
private external fun nativeIsUpdateSynchronous(): Boolean
|
|
|
|
|
|
|
|
|
|
@Keep
|
|
|
|
|
@Throws(Throwable::class)
|
|
|
|
|
protected external fun finalize()
|
|
|
|
|
|