Skip to content

Commit f8478ef

Browse files
committed
chore: workking things a bit
1 parent 1624275 commit f8478ef

File tree

1 file changed

+74
-1
lines changed

1 file changed

+74
-1
lines changed

src/mapbox.ios.ts

Lines changed: 74 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2874,8 +2874,81 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
28742874

28752875
// ---------------------------------------------------------------------
28762876

2877-
addGeoJsonClustered(options: AddGeoJsonClusteredOptions, nativeMap?): Promise<void> {
2877+
addGeoJsonClustered(options: AddGeoJsonClusteredOptions, nativeMapViewInstance?): Promise<void> {
28782878
throw new Error('Method not implemented.');
2879+
// return new Promise((resolve, reject) => {
2880+
// const theMap: MGLMapView = nativeMapViewInstance || this._mapboxViewInstance;
2881+
// try {
2882+
// const source = MGLShapeSource.alloc().initWithIdentifierURLOptions(options.name, NSURL.URLWithString(options.data), null);
2883+
// theMap.style.addSource(source);
2884+
2885+
// const layers = [];
2886+
// if (options.clusters) {
2887+
// for (let i = 0; i < options.clusters.length; i++) {
2888+
// // TODO also allow Color object
2889+
// layers.push([options.clusters[i].points, new Color(options.clusters[i].color).ios]);
2890+
// }
2891+
// } else {
2892+
// layers.push([150, new Color('red').ios]);
2893+
// layers.push([20, new Color('green').ios]);
2894+
// layers.push([0, new Color('blue').ios]);
2895+
// }
2896+
2897+
// const unclustered = MGLCircleStyleLayer.alloc().initWithIdentifierSource(options.name, source);
2898+
// unclustered.circleColor = NSExpression.expressionWithFormatArgumentArray('%@', new Color('red').ios);
2899+
// unclustered.circleRadius = NSExpression.expressionWithFormatArgumentArray('16', null);
2900+
// unclustered.circleBlur = NSExpression.expressionWithFormatArgumentArray('0.2', null);
2901+
// // unclustered.setFilter(com.mapbox.mapboxsdk.style.expressions.Expression.neq(com.mapbox.mapboxsdk.style.expressions.Expression.get('cluster'), true));
2902+
// // theMap.style.addLayer(unclustered); // , "building");
2903+
2904+
// for (let i = 0; i < layers.length; i++) {
2905+
// // Add some nice circles
2906+
// const circles = MGLCircleStyleLayer.alloc().initWithIdentifierSource(options.name, source);
2907+
// const circles = new com.mapbox.mapboxsdk.style.layers.CircleLayer('cluster-' + i, options.name);
2908+
// // circles.setProperties([
2909+
// // // com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconImage("icon")
2910+
// // com.mapbox.mapboxsdk.style.layers.PropertyFactory.circleColor(layers[i][1]),
2911+
// // com.mapbox.mapboxsdk.style.layers.PropertyFactory.circleRadius(new java.lang.Float(22.0)),
2912+
// // com.mapbox.mapboxsdk.style.layers.PropertyFactory.circleBlur(new java.lang.Float(0.2)),
2913+
// // ]);
2914+
2915+
// // const pointCount = com.mapbox.mapboxsdk.style.expressions.Expression.toNumber(com.mapbox.mapboxsdk.style.expressions.Expression.get('point_count'));
2916+
// // if (i === 0) {
2917+
// // circles.setFilter(
2918+
// // com.mapbox.mapboxsdk.style.expressions.Expression.gte(pointCount, com.mapbox.mapboxsdk.style.expressions.Expression.literal(java.lang.Integer.valueOf(layers[i][0])))
2919+
// // );
2920+
// // } else {
2921+
// // circles.setFilter(
2922+
// // com.mapbox.mapboxsdk.style.expressions.Expression.all([
2923+
// // com.mapbox.mapboxsdk.style.expressions.Expression.gte(pointCount, com.mapbox.mapboxsdk.style.expressions.Expression.literal(java.lang.Integer.valueOf(layers[i][0]))),
2924+
// // com.mapbox.mapboxsdk.style.expressions.Expression.lt(
2925+
// // pointCount,
2926+
// // com.mapbox.mapboxsdk.style.expressions.Expression.literal(java.lang.Integer.valueOf(layers[i - 1][0]))
2927+
// // ),
2928+
// // ])
2929+
// // );
2930+
// // }
2931+
2932+
// // this._mapboxMapInstance.getStyle().addLayer(circles); // , "building");
2933+
// }
2934+
2935+
// // // Add the count labels (note that this doesn't show.. #sad)
2936+
// // const count = new com.mapbox.mapboxsdk.style.layers.SymbolLayer('count', options.name);
2937+
// // count.setProperties([
2938+
// // com.mapbox.mapboxsdk.style.layers.PropertyFactory.textField(com.mapbox.mapboxsdk.style.expressions.Expression.get('point_count')),
2939+
// // com.mapbox.mapboxsdk.style.layers.PropertyFactory.textSize(new java.lang.Float(12.0)),
2940+
// // com.mapbox.mapboxsdk.style.layers.PropertyFactory.textColor(new Color('white').android),
2941+
// // ]);
2942+
// // this._mapboxMapInstance.getStyle().addLayer(count);
2943+
2944+
// resolve();
2945+
// } catch (ex) {
2946+
// if (Trace.isEnabled()) {
2947+
// CLog(CLogTypes.info, 'Error in mapbox.addGeoJsonClustered: ' + ex);
2948+
// }
2949+
// reject(ex);
2950+
// }
2951+
// });
28792952
}
28802953

28812954
/**

0 commit comments

Comments
 (0)