use of com.mapbox.rctmgl.events.AndroidCallbackEvent in project maps by rnmapbox.
the class RCTMGLShapeSource method getClusterLeavesById.
// Deprecated. Will be removed in 9+ ver.
public void getClusterLeavesById(String callbackID, int clusterId, int number, int offset) {
if (mSource == null) {
WritableMap payload = new WritableNativeMap();
payload.putString("error", "source is not yet loaded");
AndroidCallbackEvent event = new AndroidCallbackEvent(this, callbackID, payload);
mManager.handleEvent(event);
return;
}
Feature clusterFeature = mSource.querySourceFeatures(Expression.eq(Expression.get("cluster_id"), clusterId)).get(0);
FeatureCollection leaves = mSource.getClusterLeaves(clusterFeature, number, offset);
WritableMap payload = new WritableNativeMap();
payload.putString("data", leaves.toJson());
AndroidCallbackEvent event = new AndroidCallbackEvent(this, callbackID, payload);
mManager.handleEvent(event);
}
use of com.mapbox.rctmgl.events.AndroidCallbackEvent in project maps by rnmapbox.
the class RCTMGLShapeSource method getClusterLeaves.
public void getClusterLeaves(String callbackID, String featureJSON, int number, int offset) {
if (mSource == null) {
WritableMap payload = new WritableNativeMap();
payload.putString("error", "source is not yet loaded");
AndroidCallbackEvent event = new AndroidCallbackEvent(this, callbackID, payload);
mManager.handleEvent(event);
return;
}
Feature clusterFeature = Feature.fromJson(featureJSON);
FeatureCollection leaves = mSource.getClusterLeaves(clusterFeature, number, offset);
WritableMap payload = new WritableNativeMap();
payload.putString("data", leaves.toJson());
AndroidCallbackEvent event = new AndroidCallbackEvent(this, callbackID, payload);
mManager.handleEvent(event);
}
use of com.mapbox.rctmgl.events.AndroidCallbackEvent in project maps by rnmapbox.
the class RCTMGLVectorSource method querySourceFeatures.
public void querySourceFeatures(String callbackID, @Size(min = 1) List<String> layerIDs, @Nullable Expression filter) {
if (mSource == null) {
WritableMap payload = new WritableNativeMap();
payload.putString("error", "source is not yet loaded");
AndroidCallbackEvent event = new AndroidCallbackEvent(this, callbackID, payload);
mManager.handleEvent(event);
return;
}
List<Feature> features = mSource.querySourceFeatures(layerIDs.toArray(new String[layerIDs.size()]), filter);
WritableMap payload = new WritableNativeMap();
payload.putString("data", FeatureCollection.fromFeatures(features).toJson());
AndroidCallbackEvent event = new AndroidCallbackEvent(this, callbackID, payload);
mManager.handleEvent(event);
}
use of com.mapbox.rctmgl.events.AndroidCallbackEvent in project maps by rnmapbox.
the class RCTMGLShapeSource method callbackError.
private void callbackError(String callbackID, String error, String where) {
WritableMap payload = new WritableNativeMap();
payload.putString("error", where + ": " + error);
AndroidCallbackEvent event = new AndroidCallbackEvent(this, callbackID, payload);
mManager.handleEvent(event);
}
Aggregations