summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorJason Wray <jason@mapbox.com>2016-05-21 14:32:48 -0400
committerJason Wray <jason@mapbox.com>2016-05-23 10:35:14 -0400
commitdf1d63a2290269911a796bcdd8cbb31f9cb44251 (patch)
tree8db75345e368e30f2637a10bd7c2a406f48480cf /platform
parent3ef740c7531db5ef40b9c7f7c263a082a2405f94 (diff)
downloadqtlocation-mapboxgl-df1d63a2290269911a796bcdd8cbb31f9cb44251.tar.gz
[ios] Remove custom style layer example
Diffstat (limited to 'platform')
-rw-r--r--platform/ios/app/MBXViewController.m80
1 files changed, 1 insertions, 79 deletions
diff --git a/platform/ios/app/MBXViewController.m b/platform/ios/app/MBXViewController.m
index 7236e7be9e..290a86aae7 100644
--- a/platform/ios/app/MBXViewController.m
+++ b/platform/ios/app/MBXViewController.m
@@ -7,8 +7,6 @@
#import <Mapbox/Mapbox.h>
-#import <CoreLocation/CoreLocation.h>
-#import <OpenGLES/ES2/gl.h>
#import <objc/runtime.h>
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];
@@ -320,21 +314,10 @@ static NSString * const MBXViewControllerAnnotationViewReuseIdentifer = @"MBXVie
}
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];