From 7b92e2a0328aa90974398f39e7054e1cf9c66b3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguye=CC=82=CC=83n?= Date: Wed, 11 Mar 2020 18:46:19 -0700 Subject: [PATCH] [macos] Highlight UC POIs --- platform/macos/app/MapDocument.m | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/platform/macos/app/MapDocument.m b/platform/macos/app/MapDocument.m index 3431f4e25..aca8759e4 100644 --- a/platform/macos/app/MapDocument.m +++ b/platform/macos/app/MapDocument.m @@ -1055,6 +1055,22 @@ NSArray> *MBXFlattenedShapes(NSArray> *sha MGLRasterStyleLayer * imageLayer = [[MGLRasterStyleLayer alloc] initWithIdentifier:@"radar-layer" source:imageSource]; [self.mapView.style addLayer:imageLayer]; + + MGLCircleStyleLayer *ucLayer = [[MGLCircleStyleLayer alloc] initWithIdentifier:@"uc" source:streetsSource]; + ucLayer.sourceLayerIdentifier = @"poi_label"; + ucLayer.predicate = [NSPredicate predicateWithFormat:@"$geometryType = 'Point'"]; + CLLocationCoordinate2D ucCoordinates[] = { + { .latitude = 39.1279, .longitude = -84.5209 }, + { .latitude = 39.1273, .longitude = -84.5112 }, + { .latitude = 39.1355, .longitude = -84.5102 }, + { .latitude = 39.1360, .longitude = -84.5212 }, + { .latitude = 39.1279, .longitude = -84.5209 }, + }; + MGLPolygon *uc = [MGLPolygon polygonWithCoordinates:ucCoordinates count:sizeof(ucCoordinates) / sizeof(ucCoordinates[0])]; + ucLayer.circleOpacity = [NSExpression expressionWithFormat:@"TERNARY(SELF IN %@, 1, 0)", uc]; + ucLayer.circleRadius = [NSExpression expressionForConstantValue:@5]; + ucLayer.circleColor = [NSExpression expressionForConstantValue:NSColor.redColor]; + [self.mapView.style addLayer:ucLayer]; } - (IBAction)dropPin:(NSMenuItem *)sender {