From df1d63a2290269911a796bcdd8cbb31f9cb44251 Mon Sep 17 00:00:00 2001 From: Jason Wray Date: Sat, 21 May 2016 14:32:48 -0400 Subject: [PATCH] [ios] Remove custom style layer example --- platform/ios/app/MBXViewController.m | 80 +--------------------------- 1 file changed, 1 insertion(+), 79 deletions(-) diff --git a/platform/ios/app/MBXViewController.m b/platform/ios/app/MBXViewController.m index 7236e7be9..290a86aae 100644 --- a/platform/ios/app/MBXViewController.m +++ b/platform/ios/app/MBXViewController.m @@ -7,8 +7,6 @@ #import -#import -#import #import static const CLLocationCoordinate2D WorldTourDestinations[] = { @@ -42,7 +40,6 @@ static NSString * const MBXViewControllerAnnotationViewReuseIdentifer = @"MBXVie @implementation MBXViewController { BOOL _isTouringWorld; - BOOL _isShowingCustomStyleLayer; } #pragma mark - Setup @@ -191,9 +188,6 @@ static NSString * const MBXViewControllerAnnotationViewReuseIdentifer = @"MBXVie @"Start World Tour", @"Add Custom Callout Point", @"Remove Annotations", - (_isShowingCustomStyleLayer - ? @"Hide Custom Style Layer" - : @"Show Custom Style Layer"), @"Print Telemetry Logfile", @"Delete Telemetry Logfile", nil]; @@ -319,22 +313,11 @@ static NSString * const MBXViewControllerAnnotationViewReuseIdentifer = @"MBXVie [self.mapView removeAnnotations:self.mapView.annotations]; } else if (buttonIndex == actionSheet.firstOtherButtonIndex + 13) - { - if (_isShowingCustomStyleLayer) - { - [self removeCustomStyleLayer]; - } - else - { - [self insertCustomStyleLayer]; - } - } - else if (buttonIndex == actionSheet.firstOtherButtonIndex + 14) { NSString *fileContents = [NSString stringWithContentsOfFile:[self telemetryDebugLogfilePath] encoding:NSUTF8StringEncoding error:nil]; NSLog(@"%@", fileContents); } - else if (buttonIndex == actionSheet.firstOtherButtonIndex + 15) + else if (buttonIndex == actionSheet.firstOtherButtonIndex + 14) { NSString *filePath = [self telemetryDebugLogfilePath]; if ([[NSFileManager defaultManager] isDeletableFileAtPath:filePath]) { @@ -389,67 +372,6 @@ static NSString * const MBXViewControllerAnnotationViewReuseIdentifer = @"MBXVie }); } -- (void)insertCustomStyleLayer -{ - _isShowingCustomStyleLayer = YES; - - static const GLchar *vertexShaderSource = "attribute vec2 a_pos; void main() { gl_Position = vec4(a_pos, 0, 1); }"; - static const GLchar *fragmentShaderSource = "void main() { gl_FragColor = vec4(0, 1, 0, 1); }"; - - __block GLuint program = 0; - __block GLuint vertexShader = 0; - __block GLuint fragmentShader = 0; - __block GLuint buffer = 0; - __block GLuint a_pos = 0; - [self.mapView insertCustomStyleLayerWithIdentifier:@"mbx-custom" preparationHandler:^{ - program = glCreateProgram(); - vertexShader = glCreateShader(GL_VERTEX_SHADER); - fragmentShader = glCreateShader(GL_FRAGMENT_SHADER); - - glShaderSource(vertexShader, 1, &vertexShaderSource, NULL); - glCompileShader(vertexShader); - glAttachShader(program, vertexShader); - glShaderSource(fragmentShader, 1, &fragmentShaderSource, NULL); - glCompileShader(fragmentShader); - glAttachShader(program, fragmentShader); - glLinkProgram(program); - a_pos = glGetAttribLocation(program, "a_pos"); - - GLfloat background[] = { -1,-1, 1,-1, -1,1, 1,1 }; - glGenBuffers(1, &buffer); - glBindBuffer(GL_ARRAY_BUFFER, buffer); - glBufferData(GL_ARRAY_BUFFER, 8 * sizeof(GLfloat), background, GL_STATIC_DRAW); - } drawingHandler:^(__unused CGSize size, - __unused CLLocationCoordinate2D centerCoordinate, - __unused double zoomLevel, - __unused CLLocationDirection direction, - __unused CGFloat pitch, - __unused CGFloat perspectiveSkew) { - glUseProgram(program); - glBindBuffer(GL_ARRAY_BUFFER, buffer); - glEnableVertexAttribArray(a_pos); - glVertexAttribPointer(a_pos, 2, GL_FLOAT, GL_FALSE, 0, NULL); - glDisable(GL_STENCIL_TEST); - glDisable(GL_DEPTH_TEST); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); - } completionHandler:^{ - if (program) { - glDeleteBuffers(1, &buffer); - glDetachShader(program, vertexShader); - glDetachShader(program, fragmentShader); - glDeleteShader(vertexShader); - glDeleteShader(fragmentShader); - glDeleteProgram(program); - } - } belowStyleLayerWithIdentifier:@"housenum-label"]; -} - -- (void)removeCustomStyleLayer -{ - _isShowingCustomStyleLayer = NO; - [self.mapView removeCustomStyleLayerWithIdentifier:@"mbx-custom"]; -} - - (void)presentAnnotationWithCustomCallout { [self.mapView removeAnnotations:self.mapView.annotations];