-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding the Map Util and the UDP test applications.
- Loading branch information
Showing
141 changed files
with
33,807 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// | ||
// MapKitiPhoneAppDelegate.h | ||
// MapKitiPhone | ||
// | ||
// Created by Matt on 2/17/11. | ||
// Copyright 2011 __MyCompanyName__. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
@interface MapKitiPhoneAppDelegate : NSObject <UIApplicationDelegate> { | ||
UIWindow *window; | ||
IBOutlet UINavigationController *myNavController; | ||
} | ||
|
||
@property (nonatomic, retain) IBOutlet UIWindow *window; | ||
@property (nonatomic, retain) IBOutlet UINavigationController *myNavController; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
// | ||
// MapKitiPhoneAppDelegate.m | ||
// MapKitiPhone | ||
// | ||
// Created by Matt on 2/17/11. | ||
// Copyright 2011 __MyCompanyName__. All rights reserved. | ||
// | ||
|
||
#import "MapKitiPhoneAppDelegate.h" | ||
|
||
@implementation MapKitiPhoneAppDelegate | ||
|
||
@synthesize window; | ||
@synthesize myNavController; | ||
|
||
#pragma mark - | ||
#pragma mark Application lifecycle | ||
|
||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { | ||
|
||
// Override point for customization after application launch. | ||
|
||
// Add the view controller's view to the window and display. | ||
//[self.window addSubview:viewController.view]; | ||
|
||
[self.window addSubview:myNavController.view]; | ||
[self.window makeKeyAndVisible]; | ||
|
||
return YES; | ||
} | ||
|
||
|
||
- (void)applicationWillResignActive:(UIApplication *)application { | ||
/* | ||
Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. | ||
Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. | ||
*/ | ||
} | ||
|
||
|
||
- (void)applicationDidEnterBackground:(UIApplication *)application { | ||
/* | ||
Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. | ||
If your application supports background execution, called instead of applicationWillTerminate: when the user quits. | ||
*/ | ||
} | ||
|
||
|
||
- (void)applicationWillEnterForeground:(UIApplication *)application { | ||
/* | ||
Called as part of transition from the background to the inactive state: here you can undo many of the changes made on entering the background. | ||
*/ | ||
} | ||
|
||
|
||
- (void)applicationDidBecomeActive:(UIApplication *)application { | ||
/* | ||
Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. | ||
*/ | ||
} | ||
|
||
|
||
- (void)applicationWillTerminate:(UIApplication *)application { | ||
/* | ||
Called when the application is about to terminate. | ||
See also applicationDidEnterBackground:. | ||
*/ | ||
} | ||
|
||
#pragma mark - | ||
#pragma mark Memory management | ||
|
||
- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application { | ||
/* | ||
Free up as much memory as possible by purging cached data objects that can be recreated (or reloaded from disk) later. | ||
*/ | ||
} | ||
|
||
|
||
- (void)dealloc { | ||
[myNavController release]; | ||
[window release]; | ||
[super dealloc]; | ||
} | ||
|
||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// | ||
// MapKitiPhoneViewController.h | ||
// MapKitiPhone | ||
// | ||
// Created by Matt on 2/17/11. | ||
// Copyright 2011 __MyCompanyName__. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
#import <MapKit/MapKit.h> | ||
//#import <CommonCrypto/CommonCryptor.h> | ||
|
||
@interface MapKitiPhoneViewController : UIViewController { | ||
IBOutlet MKMapView *mapView; | ||
IBOutlet UISegmentedControl *segControl; | ||
IBOutlet UIBarButtonItem *clearButton; | ||
|
||
UITapGestureRecognizer *myTapRecognizer; | ||
MKPinAnnotationColor myColor; | ||
} | ||
|
||
@property(nonatomic, retain) IBOutlet MKMapView *mapView; | ||
@property(nonatomic, retain) IBOutlet UISegmentedControl *segControl; | ||
@property(nonatomic, retain) IBOutlet UIBarButtonItem *clearButton; | ||
|
||
@property(nonatomic, retain) UITapGestureRecognizer *myTapRecognizer; | ||
@property(nonatomic) MKPinAnnotationColor myColor; | ||
|
||
- (IBAction) changeMarkerType: (id)sender; | ||
- (void) handleSingleTap; | ||
- (IBAction) handleClearButton; | ||
|
||
@end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
// | ||
// MapKitiPhoneViewController.m | ||
// MapKitiPhone | ||
// | ||
// Created by Matt on 2/17/11. | ||
// Copyright 2011 __MyCompanyName__. All rights reserved. | ||
// | ||
|
||
#import "MapKitiPhoneViewController.h" | ||
#import "SettingViewController.h" | ||
|
||
@implementation MapKitiPhoneViewController | ||
|
||
@synthesize mapView; | ||
@synthesize segControl; | ||
@synthesize clearButton; | ||
|
||
@synthesize myTapRecognizer; | ||
@synthesize myColor; | ||
|
||
// The designated initializer. Override to perform setup that is required before the view is loaded. | ||
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { | ||
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; | ||
if (self) { | ||
// Custom initialization | ||
} | ||
return self; | ||
} | ||
|
||
|
||
/* | ||
// Implement loadView to create a view hierarchy programmatically, without using a nib. | ||
- (void)loadView { | ||
} | ||
*/ | ||
|
||
|
||
|
||
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib. | ||
- (void)viewDidLoad { | ||
[super viewDidLoad]; | ||
|
||
UITapGestureRecognizer* myRecog; | ||
myRecog = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleSingleTap)]; | ||
[mapView addGestureRecognizer:myRecog]; | ||
myTapRecognizer = myRecog; | ||
[myRecog release]; | ||
|
||
myColor = MKPinAnnotationColorRed; | ||
|
||
self.title = @"Map View"; | ||
} | ||
|
||
|
||
|
||
/* | ||
// Override to allow orientations other than the default portrait orientation. | ||
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { | ||
// Return YES for supported orientations | ||
return (interfaceOrientation == UIInterfaceOrientationPortrait); | ||
} | ||
*/ | ||
|
||
- (void)didReceiveMemoryWarning { | ||
// Releases the view if it doesn't have a superview. | ||
[super didReceiveMemoryWarning]; | ||
|
||
// Release any cached data, images, etc that aren't in use. | ||
} | ||
|
||
- (void)viewDidUnload { | ||
// Release any retained subviews of the main view. | ||
// e.g. self.myOutlet = nil; | ||
} | ||
|
||
|
||
- (void)dealloc { | ||
[segControl release]; | ||
[mapView release]; | ||
[super dealloc]; | ||
} | ||
|
||
- (IBAction) changeMarkerType:(id) sender{ | ||
switch (segControl.selectedSegmentIndex) { | ||
case 0: | ||
{ | ||
myColor = MKPinAnnotationColorRed; | ||
break; | ||
} | ||
case 1: | ||
{ | ||
myColor = MKPinAnnotationColorPurple; | ||
break; | ||
} | ||
case 2: | ||
{ | ||
myColor = MKPinAnnotationColorGreen; | ||
break; | ||
} | ||
} | ||
} | ||
|
||
- (void) handleSingleTap{ | ||
if(segControl.selectedSegmentIndex == 3) | ||
{ | ||
//this means 'None' is selected, nothing gets placed on the map | ||
return; | ||
} | ||
|
||
CGPoint touchPoint = [myTapRecognizer locationInView:mapView]; | ||
CLLocationCoordinate2D touchMapCoordinate = | ||
[mapView convertPoint:touchPoint toCoordinateFromView:mapView]; | ||
|
||
MKPointAnnotation *pa = [[MKPointAnnotation alloc] init]; | ||
pa.coordinate = touchMapCoordinate; | ||
|
||
[mapView addAnnotation:pa]; | ||
[pa release]; | ||
} | ||
|
||
- (IBAction) handleClearButton{ | ||
[mapView removeAnnotations:mapView.annotations]; | ||
} | ||
|
||
- (MKAnnotationView *) mapView:(MKMapView *) mapView viewForAnnotation:(id ) annotation { | ||
MKPinAnnotationView *customPinView = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:nil] autorelease]; | ||
customPinView.pinColor = myColor; | ||
customPinView.animatesDrop = NO; | ||
customPinView.canShowCallout = YES; | ||
return customPinView; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// | ||
// MapViewTouch.h | ||
// MapKitiPhone | ||
// | ||
// Created by Matt on 2/17/11. | ||
// Copyright 2011 __MyCompanyName__. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
#import <MapKit/MapKit.h> | ||
|
||
@class MKMapView; | ||
|
||
@interface MapViewTouch : MKMapView { | ||
|
||
} | ||
|
||
- (void) initializeGesturers; | ||
- (IBAction) handleSingleTap: (UITapGestureRecognizer*)mySender; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// | ||
// MapViewTouch.m | ||
// MapKitiPhone | ||
// | ||
// Created by Matt on 2/17/11. | ||
// Copyright 2011 __MyCompanyName__. All rights reserved. | ||
// | ||
|
||
#import "MapViewTouch.h" | ||
|
||
@class MKMapView; | ||
|
||
@implementation MapViewTouch | ||
|
||
- (void) initializeGesturers{ | ||
self.mapType = MKMapTypeSatellite; | ||
/*UITapGestureRecognizer *tapRec = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleSingleTap)]; | ||
[self addGestureRecognizer:tapRec]; | ||
[tapRec release];*/ | ||
} | ||
|
||
- (IBAction) handleSingleTap: (UITapGestureRecognizer*)mySender{ | ||
self.mapType = MKMapTypeSatellite; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// | ||
// SettingViewController.h | ||
// MapKitiPhone | ||
// | ||
// Created by Matt on 3/3/11. | ||
// Copyright 2011 __MyCompanyName__. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
@interface SettingViewController : UIViewController { | ||
|
||
} | ||
|
||
@end |
Oops, something went wrong.