PageRenderTime 49ms CodeModel.GetById 13ms app.highlight 32ms RepoModel.GetById 1ms app.codeStats 0ms

/samples/TileIssue/Classes/TileIssueViewController.m

http://github.com/route-me/route-me
Objective C | 87 lines | 49 code | 21 blank | 17 comment | 1 complexity | cd0fb6e5e7c321d7a9a030812fc725c9 MD5 | raw file
 1//
 2//  TileIssueViewController.m
 3//  TileIssue
 4//
 5//  Created by olivier on 4/8/09.
 6//  Copyright 2009 __MyCompanyName__. All rights reserved.
 7//
 8
 9#include <unistd.h>
10#import "TileIssueViewController.h"
11
12
13@implementation TileIssueViewController
14
15@synthesize mapView;
16
17
18// Implement loadView to create a view hierarchy programmatically, without using a nib.
19- (void)loadView 
20{
21	CLLocationCoordinate2D latlong;
22	
23	latlong.latitude = 43.61675;
24	latlong.longitude = 6.97167;
25	
26	RMMapView *map = [[RMMapView alloc]initWithFrame:CGRectMake(0.0, 0.0, [[UIScreen mainScreen]applicationFrame].size.width, [[UIScreen mainScreen]applicationFrame].size.height-79) WithLocation:latlong];
27	[self setMapView:map];
28	[map release];
29	[[[self mapView] contents]setZoom:18];
30	
31	self.view = mapView;
32}
33
34
35
36// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
37- (void)viewDidLoad 
38{
39    [NSThread detachNewThreadSelector: @selector(moveThread:) toTarget:self withObject:nil];
40}
41
42- (void)moveThread:(id)someLocation
43{
44	NSAutoreleasePool *pool = [ [ NSAutoreleasePool alloc ] init ];
45	CLLocationCoordinate2D latlong;
46	latlong.latitude = 43.61675;
47	latlong.longitude = 6.97167;
48	double s=1;
49	for(int i=0; i<2; i++){
50		sleep(3);
51		latlong.longitude+=s*0.002;
52		NSValue *vlocation= [NSValue value:&latlong withObjCType:@encode(CLLocationCoordinate2D)];
53		[self performSelectorOnMainThread:@selector(moveToLatLon:) withObject:vlocation waitUntilDone:NO];
54		s=-s;
55	}
56	[pool drain];
57
58}
59
60-(void)moveToLatLon:(NSValue *)vlocation
61{
62	CLLocationCoordinate2D location;  
63	[vlocation getValue:&location]; 
64	[mapView moveToLatLong:location];
65}
66
67/*
68// Override to allow orientations other than the default portrait orientation.
69- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
70    // Return YES for supported orientations
71    return (interfaceOrientation == UIInterfaceOrientationPortrait);
72}
73*/
74
75- (void)didReceiveMemoryWarning {
76    [super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview
77    // Release anything that's not essential, such as cached data
78}
79
80
81- (void)dealloc {
82	[mapView release];
83    [super dealloc];
84}
85
86
87@end