summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2016-06-05 00:06:31 -0700
committerMinh Nguyễn <mxn@1ec5.org>2016-06-06 16:00:45 -0700
commit654f0156397b68420bc48dfa2d53589ea7c8042e (patch)
tree2a386fc58698253fb9d2585ce9d7fab0d72fd2e5 /platform
parent62149410fa49b7ceb6ae3491a1fcde506e13669b (diff)
downloadqtlocation-mapboxgl-654f0156397b68420bc48dfa2d53589ea7c8042e.tar.gz
[ios] Removed unused annotation image code
Removed unused annotation image code from iosapp, now that bulk-added point annotations are backed by annotation views.
Diffstat (limited to 'platform')
-rw-r--r--platform/ios/app/MBXViewController.m76
1 files changed, 0 insertions, 76 deletions
diff --git a/platform/ios/app/MBXViewController.m b/platform/ios/app/MBXViewController.m
index 6ae3eb98df..8317aee1d9 100644
--- a/platform/ios/app/MBXViewController.m
+++ b/platform/ios/app/MBXViewController.m
@@ -603,82 +603,6 @@ static NSString * const MBXViewControllerAnnotationViewReuseIdentifer = @"MBXVie
return annotationView;
}
-- (MGLAnnotationImage *)mapView:(MGLMapView * __nonnull)mapView imageForAnnotation:(id <MGLAnnotation> __nonnull)annotation
-{
- if ([annotation isKindOfClass:[MBXDroppedPinAnnotation class]]
- || [annotation isKindOfClass:[MBXCustomCalloutAnnotation class]])
- {
- return nil; // use default marker
- }
-
- NSString *title = [(MGLPointAnnotation *)annotation title];
- if (!title.length) return nil;
- NSString *lastTwoCharacters = [title substringFromIndex:title.length - 2];
-
- MGLAnnotationImage *annotationImage = [mapView dequeueReusableAnnotationImageWithIdentifier:lastTwoCharacters];
-
- if ( ! annotationImage)
- {
- UIColor *color;
-
- // make every tenth annotation blue
- if ([lastTwoCharacters hasSuffix:@"0"]) {
- color = [UIColor blueColor];
- } else {
- color = [UIColor redColor];
- }
-
- UIImage *image = [self imageWithText:lastTwoCharacters backgroundColor:color];
- annotationImage = [MGLAnnotationImage annotationImageWithImage:image reuseIdentifier:lastTwoCharacters];
-
- // don't allow touches on blue annotations
- if ([color isEqual:[UIColor blueColor]]) annotationImage.enabled = NO;
- }
-
- return annotationImage;
-}
-
-- (UIImage *)imageWithText:(NSString *)text backgroundColor:(UIColor *)color
-{
- CGRect rect = CGRectMake(0, 0, 20, 15);
-
- UIGraphicsBeginImageContextWithOptions(rect.size, NO, [[UIScreen mainScreen] scale]);
-
- CGContextRef ctx = UIGraphicsGetCurrentContext();
-
- CGContextSetFillColorWithColor(ctx, [[color colorWithAlphaComponent:0.75] CGColor]);
- CGContextFillRect(ctx, rect);
-
- CGContextSetStrokeColorWithColor(ctx, [[UIColor blackColor] CGColor]);
- CGContextStrokeRectWithWidth(ctx, rect, 2);
-
- NSAttributedString *drawString = [[NSAttributedString alloc] initWithString:text attributes:@{
- NSFontAttributeName: [UIFont fontWithName:@"Arial-BoldMT" size:12],
- NSForegroundColorAttributeName: [UIColor whiteColor],
- }];
- CGSize stringSize = drawString.size;
- CGRect stringRect = CGRectMake((rect.size.width - stringSize.width) / 2,
- (rect.size.height - stringSize.height) / 2,
- stringSize.width,
- stringSize.height);
- [drawString drawInRect:stringRect];
-
- UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
- UIGraphicsEndImageContext();
- return image;
-}
-
-- (void)mapView:(MGLMapView *)mapView didDeselectAnnotation:(id<MGLAnnotation>)annotation {
- NSString *title = [(MGLPointAnnotation *)annotation title];
- if ( ! title.length)
- {
- return;
- }
- NSString *lastTwoCharacters = [title substringFromIndex:title.length - 2];
- MGLAnnotationImage *annotationImage = [mapView dequeueReusableAnnotationImageWithIdentifier:lastTwoCharacters];
- annotationImage.image = annotationImage.image ? nil : [self imageWithText:lastTwoCharacters backgroundColor:[UIColor grayColor]];
-}
-
- (BOOL)mapView:(__unused MGLMapView *)mapView annotationCanShowCallout:(__unused id <MGLAnnotation>)annotation
{
return YES;