Skip to content

Commit

Permalink
Move BRCMapView to RMMapView+iBurn category
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisballinger committed Jul 31, 2014
1 parent 5920c61 commit b0b71eb
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 53 deletions.
12 changes: 6 additions & 6 deletions iBurn.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
6322830119881DDE009E472B /* BRCDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6322830019881DDE009E472B /* BRCDetailViewController.m */; };
6322830519881F41009E472B /* BRCDetailCellInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 6322830419881F41009E472B /* BRCDetailCellInfo.m */; };
6322830B19882153009E472B /* BRCRelationshipDetailInfoCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 6322830A19882153009E472B /* BRCRelationshipDetailInfoCell.m */; };
6322830F19898389009E472B /* BRCMapView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6322830E19898389009E472B /* BRCMapView.m */; };
63228312198987D0009E472B /* BRCAnnotation.m in Sources */ = {isa = PBXBuildFile; fileRef = 63228311198987D0009E472B /* BRCAnnotation.m */; };
632283151989AF92009E472B /* BRCBaseMapViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 632283141989AF92009E472B /* BRCBaseMapViewController.m */; };
6322831B1989B139009E472B /* BRCDetailMapViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6322831A1989B139009E472B /* BRCDetailMapViewController.m */; };
Expand All @@ -29,6 +28,7 @@
D92562C6198876C400ED6B50 /* BRCEventObjectTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D92562C5198876C400ED6B50 /* BRCEventObjectTableViewCell.m */; };
D92562C81988771400ED6B50 /* BRCEventObjectTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = D92562C71988771400ED6B50 /* BRCEventObjectTableViewCell.xib */; };
D92562CC1988929A00ED6B50 /* BRCLocationManager.m in Sources */ = {isa = PBXBuildFile; fileRef = D92562CB1988929A00ED6B50 /* BRCLocationManager.m */; };
D92562CF198A20D600ED6B50 /* RMMapView+iBurn.m in Sources */ = {isa = PBXBuildFile; fileRef = D92562CE198A20D600ED6B50 /* RMMapView+iBurn.m */; };
D994155719871D1500D245C7 /* BRCFilteredTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D994155619871D1500D245C7 /* BRCFilteredTableViewController.m */; };
D994156119871E8400D245C7 /* BRCEventsTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D994156019871E8400D245C7 /* BRCEventsTableViewController.m */; };
D99415641987222800D245C7 /* BRCDataObject.m in Sources */ = {isa = PBXBuildFile; fileRef = D99415631987222800D245C7 /* BRCDataObject.m */; };
Expand All @@ -52,8 +52,6 @@
6322830419881F41009E472B /* BRCDetailCellInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BRCDetailCellInfo.m; sourceTree = "<group>"; };
6322830919882153009E472B /* BRCRelationshipDetailInfoCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BRCRelationshipDetailInfoCell.h; sourceTree = "<group>"; };
6322830A19882153009E472B /* BRCRelationshipDetailInfoCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BRCRelationshipDetailInfoCell.m; sourceTree = "<group>"; };
6322830D19898389009E472B /* BRCMapView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BRCMapView.h; sourceTree = "<group>"; };
6322830E19898389009E472B /* BRCMapView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BRCMapView.m; sourceTree = "<group>"; };
63228310198987D0009E472B /* BRCAnnotation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BRCAnnotation.h; sourceTree = "<group>"; };
63228311198987D0009E472B /* BRCAnnotation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BRCAnnotation.m; sourceTree = "<group>"; };
632283131989AF92009E472B /* BRCBaseMapViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BRCBaseMapViewController.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -84,6 +82,8 @@
D92562C71988771400ED6B50 /* BRCEventObjectTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = BRCEventObjectTableViewCell.xib; sourceTree = "<group>"; };
D92562CA1988929A00ED6B50 /* BRCLocationManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BRCLocationManager.h; sourceTree = "<group>"; };
D92562CB1988929A00ED6B50 /* BRCLocationManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BRCLocationManager.m; sourceTree = "<group>"; };
D92562CD198A20D600ED6B50 /* RMMapView+iBurn.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "RMMapView+iBurn.h"; sourceTree = "<group>"; };
D92562CE198A20D600ED6B50 /* RMMapView+iBurn.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "RMMapView+iBurn.m"; sourceTree = "<group>"; };
D994155519871D1500D245C7 /* BRCFilteredTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BRCFilteredTableViewController.h; sourceTree = "<group>"; };
D994155619871D1500D245C7 /* BRCFilteredTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BRCFilteredTableViewController.m; sourceTree = "<group>"; };
D994155F19871E8400D245C7 /* BRCEventsTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BRCEventsTableViewController.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -142,8 +142,8 @@
6322830C1989836F009E472B /* MapClasses */ = {
isa = PBXGroup;
children = (
6322830D19898389009E472B /* BRCMapView.h */,
6322830E19898389009E472B /* BRCMapView.m */,
D92562CD198A20D600ED6B50 /* RMMapView+iBurn.h */,
D92562CE198A20D600ED6B50 /* RMMapView+iBurn.m */,
63228310198987D0009E472B /* BRCAnnotation.h */,
63228311198987D0009E472B /* BRCAnnotation.m */,
);
Expand Down Expand Up @@ -409,9 +409,9 @@
63228312198987D0009E472B /* BRCAnnotation.m in Sources */,
D994157F1987399F00D245C7 /* BRCEventTime.m in Sources */,
63CE2A681987140F00F65B01 /* BRCAppDelegate.m in Sources */,
6322830F19898389009E472B /* BRCMapView.m in Sources */,
D92562C219886EBF00ED6B50 /* BRCDataObjectTableViewCell.m in Sources */,
D92562CC1988929A00ED6B50 /* BRCLocationManager.m in Sources */,
D92562CF198A20D600ED6B50 /* RMMapView+iBurn.m in Sources */,
63D270F91987159A00204954 /* BRCMapViewController.m in Sources */,
632283151989AF92009E472B /* BRCBaseMapViewController.m in Sources */,
D994156B198726B600D245C7 /* BRCCampObject.m in Sources */,
Expand Down
7 changes: 2 additions & 5 deletions iBurn/BRCBaseMapViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,12 @@
//

#import <UIKit/UIKit.h>
#import "RMMapViewDelegate.h"

@class BRCMapView;
#import "RMMapView.h"

@interface BRCBaseMapViewController : UIViewController <RMMapViewDelegate>

//This viewController is the base for the main map viewController as well as the detail mapViewController


@property (nonatomic, strong) BRCMapView *mapView;
@property (nonatomic, strong) RMMapView *mapView;

@end
6 changes: 3 additions & 3 deletions iBurn/BRCBaseMapViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//

#import "BRCBaseMapViewController.h"
#import "BRCMapView.h"
#import "RMMapView+iBurn.h"
#import <Mapbox-iOS-SDK/Mapbox.h>

@implementation BRCBaseMapViewController
Expand All @@ -16,7 +16,7 @@ @implementation BRCBaseMapViewController
- (void)viewDidLoad
{
[super viewDidLoad];
self.mapView = [BRCMapView defaultMapViewWithFrame:self.view.bounds];
self.mapView = [RMMapView brc_defaultMapViewWithFrame:self.view.bounds];
self.mapView.delegate = self;

self.mapView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
Expand All @@ -25,7 +25,7 @@ - (void)viewDidLoad
RMUserTrackingBarButtonItem *userTrackingBarButtonItem = [[RMUserTrackingBarButtonItem alloc] initWithMapView:self.mapView];
self.navigationItem.rightBarButtonItem = userTrackingBarButtonItem;

[self.mapView zoomToFullTileSourceAnimated:NO];
[self.mapView brc_zoomToFullTileSourceAnimated:NO];
}

@end
1 change: 0 additions & 1 deletion iBurn/BRCDetailMapViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#import "BRCDetailMapViewController.h"
#import "BRCDataObject.h"
#import "BRCAnnotation.h"
#import "BRCMapView.h"
@interface BRCDetailMapViewController ()

@property (nonatomic, strong) BRCDataObject *dataObject;
Expand Down
9 changes: 4 additions & 5 deletions iBurn/BRCDetailViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#import "BRCDataObject.h"
#import "BRCDatabaseManager.h"
#import <MessageUI/MessageUI.h>
#import "BRCMapView.h"
#import "RMMapView+iBurn.h"
#import "BRCAnnotation.h"
#import "RMUserLocation.h"

Expand All @@ -28,7 +28,7 @@ @interface BRCDetailViewController () <UITableViewDataSource, UITableViewDelegat

@property (nonatomic, strong) UIBarButtonItem *favoriteBarButtonItem;

@property (nonatomic, strong) BRCMapView *mapView;
@property (nonatomic, strong) RMMapView *mapView;

@end

Expand Down Expand Up @@ -80,8 +80,7 @@ - (void)viewDidLoad
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
[self.mapView zoomToIncludeCoordinate:self.dataObject.location.coordinate andCoordinate:self.mapView.userLocation.location.coordinate animated:animated];

[self.mapView brc_zoomToIncludeCoordinate:self.dataObject.location.coordinate andCoordinate:self.mapView.userLocation.location.coordinate animated:animated];
}

- (UIImage *)currentStarImage
Expand Down Expand Up @@ -122,7 +121,7 @@ - (BRCDetailCellInfo *)cellInfoForIndexPath:(NSInteger)section
- (void)setupMapViewWithObject:(BRCDataObject *)dataObject
{
if (dataObject.location) {
self.mapView = [BRCMapView defaultMapViewWithFrame:CGRectMake(0, 0, 10, 250)];
self.mapView = [RMMapView brc_defaultMapViewWithFrame:CGRectMake(0, 0, 10, 250)];
self.mapView.delegate = self;
RMAnnotation *annotation = [BRCAnnotation annotationWithMapView:self.mapView dataObject:dataObject];
[self.mapView addAnnotation:annotation];
Expand Down
23 changes: 0 additions & 23 deletions iBurn/BRCMapView.h

This file was deleted.

1 change: 0 additions & 1 deletion iBurn/BRCMapViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#import "BRCMapViewController.h"
#import "BRCDatabaseManager.h"
#import "BRCArtObject.h"
#import "BRCMapView.h"
#import "BRCAnnotation.h"
#import "BRCEventObject.h"
#import "BRCDetailViewController.h"
Expand Down
21 changes: 21 additions & 0 deletions iBurn/RMMapView+iBurn.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//
// RMMapView+iBurn.h
// iBurn
//
// Created by Christopher Ballinger on 7/30/14.
// Copyright (c) 2014 Burning Man Earth. All rights reserved.
//

#import "RMMapView.h"

@class RMMBTilesSource;

@interface RMMapView (iBurn)

- (void)brc_zoomToFullTileSourceAnimated:(BOOL)animated;
- (void)brc_zoomToIncludeCoordinate:(CLLocationCoordinate2D)coordinate1 andCoordinate:(CLLocationCoordinate2D)coordinate2 animated:(BOOL)animated;

+ (instancetype)brc_defaultMapViewWithFrame:(CGRect)frame;
+ (RMMBTilesSource *)brc_defaultTileSource;

@end
19 changes: 10 additions & 9 deletions iBurn/BRCMapView.m → iBurn/RMMapView+iBurn.m
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
//
// BRCMapView.m
// RMMapView+iBurn.m
// iBurn
//
// Created by David Chiles on 7/30/14.
// Created by Christopher Ballinger on 7/30/14.
// Copyright (c) 2014 Burning Man Earth. All rights reserved.
//

#import "BRCMapView.h"
#import "RMMapView+iBurn.h"
#import "RMMBTilesSource.h"

@implementation BRCMapView
@implementation RMMapView (iBurn)


static NSString *const kBRCBundledTileSourceName = @"iburn";

- (void)zoomToFullTileSourceAnimated:(BOOL)animated
- (void)brc_zoomToFullTileSourceAnimated:(BOOL)animated
{
RMSphericalTrapezium bounds = [self.tileSource latitudeLongitudeBoundingBox];
[self zoomWithLatitudeLongitudeBoundsSouthWest:bounds.southWest northEast:bounds.northEast animated:animated];
}

- (void)zoomToIncludeCoordinate:(CLLocationCoordinate2D)coordinate1 andCoordinate:(CLLocationCoordinate2D)coordinate2 animated:(BOOL)animated
- (void)brc_zoomToIncludeCoordinate:(CLLocationCoordinate2D)coordinate1 andCoordinate:(CLLocationCoordinate2D)coordinate2 animated:(BOOL)animated
{
BOOL coordinate1InBounds = [[self class] isCoordinate:coordinate1 inBounds:[self.tileSource latitudeLongitudeBoundingBox]];
BOOL coordinate2InBounds = [[self class] isCoordinate:coordinate2 inBounds:[self.tileSource latitudeLongitudeBoundingBox]];
Expand Down Expand Up @@ -56,14 +57,14 @@ + (BOOL)isCoordinate:(CLLocationCoordinate2D)coordinate inBounds:(RMSphericalTra
}


+ (RMMBTilesSource *)defaultTileSource
+ (RMMBTilesSource *)brc_defaultTileSource
{
return [[RMMBTilesSource alloc] initWithTileSetResource:kBRCBundledTileSourceName ofType:@"mbtiles"];
}

+ (instancetype)defaultMapViewWithFrame:(CGRect)frame
+ (instancetype)brc_defaultMapViewWithFrame:(CGRect)frame
{
BRCMapView *mapView = [[BRCMapView alloc] initWithFrame:frame andTilesource:[self defaultTileSource]];
RMMapView *mapView = [[RMMapView alloc] initWithFrame:frame andTilesource:[self brc_defaultTileSource]];
mapView.adjustTilesForRetinaDisplay = YES;
mapView.hideAttribution = YES;
mapView.showLogoBug = NO;
Expand Down

0 comments on commit b0b71eb

Please sign in to comment.