/samples/MapTestbedTwoMaps/Classes/MainViewController.m

http://github.com/route-me/route-me · Objective C · 86 lines · 50 code · 22 blank · 14 comment · 1 complexity · 426a3a82f8796335eb96c49b124b83a1 MD5 · raw file

  1. //
  2. // MainViewController.m
  3. // MapTestbed : Diagnostic map
  4. //
  5. #import "MainViewController.h"
  6. #import "MapTestbedTwoMapsAppDelegate.h"
  7. #import "RMMapContents.h"
  8. #import "RMCloudMadeMapSource.h"
  9. #import "RMVirtualEarthSource.h"
  10. #import "MainView.h"
  11. @implementation MainViewController
  12. @synthesize upperMapView;
  13. @synthesize lowerMapView;
  14. - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
  15. if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
  16. // Custom initialization
  17. }
  18. return self;
  19. }
  20. // Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
  21. - (void)viewDidLoad {
  22. LogMethod();
  23. [super viewDidLoad];
  24. CLLocationCoordinate2D center;
  25. center.latitude = 47.592;
  26. center.longitude = -122.333;
  27. [upperMapView setDelegate:self];
  28. RMMapContents *upperMapContents = [[RMMapContents alloc] initWithView:upperMapView
  29. tilesource:[[[RMVirtualEarthSource alloc] initWithHybridThemeUsingAccessKey:@"invalidKey"] autorelease]];
  30. [upperMapView setNeedsLayout];
  31. [upperMapView setNeedsDisplay];
  32. [upperMapView moveToLatLong:center];
  33. [lowerMapView setDelegate:self];
  34. RMMapContents *lowerMapContents = [[RMMapContents alloc] initWithView:lowerMapView
  35. tilesource:[[[RMCloudMadeMapSource alloc] initWithAccessKey:@"0199bdee456e59ce950b0156029d6934" styleNumber:7] autorelease]];
  36. [lowerMapView setNeedsDisplay];
  37. [lowerMapView moveToLatLong:center];
  38. NSLog(@"%@ %@", upperMapContents, lowerMapContents);
  39. }
  40. /*
  41. // Override to allow orientations other than the default portrait orientation.
  42. - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
  43. // Return YES for supported orientations
  44. return (interfaceOrientation == UIInterfaceOrientationPortrait);
  45. }
  46. */
  47. - (void)didReceiveMemoryWarning {
  48. [super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview
  49. // Release anything that's not essential, such as cached data
  50. }
  51. - (void)viewDidAppear:(BOOL)animated {
  52. }
  53. - (void)dealloc {
  54. self.upperMapView = nil;
  55. self.lowerMapView = nil;
  56. [super dealloc];
  57. }
  58. #pragma mark -
  59. #pragma mark Delegate methods
  60. - (void) afterMapMove: (RMMapView*) map {
  61. }
  62. - (void) afterMapZoom: (RMMapView*) map byFactor: (float) zoomFactor near:(CGPoint) center {
  63. }
  64. @end