updated sample code to match refactors to date
Showing
9 changed files
with
66 additions
and
24 deletions
@@ -27,6 +27,13 @@ | @@ -27,6 +27,13 @@ | ||
27 | /* End PBXBuildFile section */ | 27 | /* End PBXBuildFile section */ |
28 | 28 | ||
29 | /* Begin PBXContainerItemProxy section */ | 29 | /* Begin PBXContainerItemProxy section */ |
30 | + 2B080D320F9FC12C00E947D5 /* PBXContainerItemProxy */ = { | ||
31 | + isa = PBXContainerItemProxy; | ||
32 | + containerPortal = EBE3696D0F673B95003DC21C /* MapView.xcodeproj */; | ||
33 | + proxyType = 2; | ||
34 | + remoteGlobalIDString = 2BF3078F0F8AC5C0007014EE /* RM Unit Tests.app */; | ||
35 | + remoteInfo = "Unit Tests"; | ||
36 | + }; | ||
30 | 2BB42BEE0F678951009967BB /* PBXContainerItemProxy */ = { | 37 | 2BB42BEE0F678951009967BB /* PBXContainerItemProxy */ = { |
31 | isa = PBXContainerItemProxy; | 38 | isa = PBXContainerItemProxy; |
32 | containerPortal = EBE3696D0F673B95003DC21C /* MapView.xcodeproj */; | 39 | containerPortal = EBE3696D0F673B95003DC21C /* MapView.xcodeproj */; |
@@ -184,6 +191,7 @@ | @@ -184,6 +191,7 @@ | ||
184 | isa = PBXGroup; | 191 | isa = PBXGroup; |
185 | children = ( | 192 | children = ( |
186 | EBE3697D0F673B95003DC21C /* libMapView.a */, | 193 | EBE3697D0F673B95003DC21C /* libMapView.a */, |
194 | + 2B080D330F9FC12C00E947D5 /* RM Unit Tests.app */, | ||
187 | ); | 195 | ); |
188 | name = Products; | 196 | name = Products; |
189 | sourceTree = "<group>"; | 197 | sourceTree = "<group>"; |
@@ -240,6 +248,13 @@ | @@ -240,6 +248,13 @@ | ||
240 | /* End PBXProject section */ | 248 | /* End PBXProject section */ |
241 | 249 | ||
242 | /* Begin PBXReferenceProxy section */ | 250 | /* Begin PBXReferenceProxy section */ |
251 | + 2B080D330F9FC12C00E947D5 /* RM Unit Tests.app */ = { | ||
252 | + isa = PBXReferenceProxy; | ||
253 | + fileType = wrapper.application; | ||
254 | + path = "RM Unit Tests.app"; | ||
255 | + remoteRef = 2B080D320F9FC12C00E947D5 /* PBXContainerItemProxy */; | ||
256 | + sourceTree = BUILT_PRODUCTS_DIR; | ||
257 | + }; | ||
243 | EBE3697D0F673B95003DC21C /* libMapView.a */ = { | 258 | EBE3697D0F673B95003DC21C /* libMapView.a */ = { |
244 | isa = PBXReferenceProxy; | 259 | isa = PBXReferenceProxy; |
245 | fileType = archive.ar; | 260 | fileType = archive.ar; |
@@ -86,7 +86,7 @@ | @@ -86,7 +86,7 @@ | ||
86 | 86 | ||
87 | RMMarkerManager *markerManager = [mapView markerManager]; | 87 | RMMarkerManager *markerManager = [mapView markerManager]; |
88 | 88 | ||
89 | - NSLog(@"New location: X:%lf Y:%lf", [marker location].x, [marker location].y); | 89 | + NSLog(@"New location: X:%lf Y:%lf", [marker projectedLocation].easting, [marker projectedLocation].northing); |
90 | CGRect rect = [marker bounds]; | 90 | CGRect rect = [marker bounds]; |
91 | 91 | ||
92 | [markerManager moveMarker:marker AtXY:CGPointMake(position.x,position.y +rect.size.height/3)]; | 92 | [markerManager moveMarker:marker AtXY:CGPointMake(position.x,position.y +rect.size.height/3)]; |
@@ -28,6 +28,13 @@ | @@ -28,6 +28,13 @@ | ||
28 | /* End PBXBuildFile section */ | 28 | /* End PBXBuildFile section */ |
29 | 29 | ||
30 | /* Begin PBXContainerItemProxy section */ | 30 | /* Begin PBXContainerItemProxy section */ |
31 | + 2B080DB40F9FC14400E947D5 /* PBXContainerItemProxy */ = { | ||
32 | + isa = PBXContainerItemProxy; | ||
33 | + containerPortal = EBE3696D0F673B95003DC21C /* MapView.xcodeproj */; | ||
34 | + proxyType = 2; | ||
35 | + remoteGlobalIDString = 2BF3078F0F8AC5C0007014EE /* RM Unit Tests.app */; | ||
36 | + remoteInfo = "Unit Tests"; | ||
37 | + }; | ||
31 | 2BB42BEE0F678951009967BB /* PBXContainerItemProxy */ = { | 38 | 2BB42BEE0F678951009967BB /* PBXContainerItemProxy */ = { |
32 | isa = PBXContainerItemProxy; | 39 | isa = PBXContainerItemProxy; |
33 | containerPortal = EBE3696D0F673B95003DC21C /* MapView.xcodeproj */; | 40 | containerPortal = EBE3696D0F673B95003DC21C /* MapView.xcodeproj */; |
@@ -187,6 +194,7 @@ | @@ -187,6 +194,7 @@ | ||
187 | isa = PBXGroup; | 194 | isa = PBXGroup; |
188 | children = ( | 195 | children = ( |
189 | EBE3697D0F673B95003DC21C /* libMapView.a */, | 196 | EBE3697D0F673B95003DC21C /* libMapView.a */, |
197 | + 2B080DB50F9FC14400E947D5 /* RM Unit Tests.app */, | ||
190 | ); | 198 | ); |
191 | name = Products; | 199 | name = Products; |
192 | sourceTree = "<group>"; | 200 | sourceTree = "<group>"; |
@@ -243,6 +251,13 @@ | @@ -243,6 +251,13 @@ | ||
243 | /* End PBXProject section */ | 251 | /* End PBXProject section */ |
244 | 252 | ||
245 | /* Begin PBXReferenceProxy section */ | 253 | /* Begin PBXReferenceProxy section */ |
254 | + 2B080DB50F9FC14400E947D5 /* RM Unit Tests.app */ = { | ||
255 | + isa = PBXReferenceProxy; | ||
256 | + fileType = wrapper.application; | ||
257 | + path = "RM Unit Tests.app"; | ||
258 | + remoteRef = 2B080DB40F9FC14400E947D5 /* PBXContainerItemProxy */; | ||
259 | + sourceTree = BUILT_PRODUCTS_DIR; | ||
260 | + }; | ||
246 | EBE3697D0F673B95003DC21C /* libMapView.a */ = { | 261 | EBE3697D0F673B95003DC21C /* libMapView.a */ = { |
247 | isa = PBXReferenceProxy; | 262 | isa = PBXReferenceProxy; |
248 | fileType = archive.ar; | 263 | fileType = archive.ar; |
@@ -27,6 +27,13 @@ | @@ -27,6 +27,13 @@ | ||
27 | /* End PBXBuildFile section */ | 27 | /* End PBXBuildFile section */ |
28 | 28 | ||
29 | /* Begin PBXContainerItemProxy section */ | 29 | /* Begin PBXContainerItemProxy section */ |
30 | + 2B080DBD0F9FC14400E947D5 /* PBXContainerItemProxy */ = { | ||
31 | + isa = PBXContainerItemProxy; | ||
32 | + containerPortal = EBE3696D0F673B95003DC21C /* MapView.xcodeproj */; | ||
33 | + proxyType = 2; | ||
34 | + remoteGlobalIDString = 2BF3078F0F8AC5C0007014EE /* RM Unit Tests.app */; | ||
35 | + remoteInfo = "Unit Tests"; | ||
36 | + }; | ||
30 | 2BB42BEE0F678951009967BB /* PBXContainerItemProxy */ = { | 37 | 2BB42BEE0F678951009967BB /* PBXContainerItemProxy */ = { |
31 | isa = PBXContainerItemProxy; | 38 | isa = PBXContainerItemProxy; |
32 | containerPortal = EBE3696D0F673B95003DC21C /* MapView.xcodeproj */; | 39 | containerPortal = EBE3696D0F673B95003DC21C /* MapView.xcodeproj */; |
@@ -184,6 +191,7 @@ | @@ -184,6 +191,7 @@ | ||
184 | isa = PBXGroup; | 191 | isa = PBXGroup; |
185 | children = ( | 192 | children = ( |
186 | EBE3697D0F673B95003DC21C /* libMapView.a */, | 193 | EBE3697D0F673B95003DC21C /* libMapView.a */, |
194 | + 2B080DBE0F9FC14400E947D5 /* RM Unit Tests.app */, | ||
187 | ); | 195 | ); |
188 | name = Products; | 196 | name = Products; |
189 | sourceTree = "<group>"; | 197 | sourceTree = "<group>"; |
@@ -240,6 +248,13 @@ | @@ -240,6 +248,13 @@ | ||
240 | /* End PBXProject section */ | 248 | /* End PBXProject section */ |
241 | 249 | ||
242 | /* Begin PBXReferenceProxy section */ | 250 | /* Begin PBXReferenceProxy section */ |
251 | + 2B080DBE0F9FC14400E947D5 /* RM Unit Tests.app */ = { | ||
252 | + isa = PBXReferenceProxy; | ||
253 | + fileType = wrapper.application; | ||
254 | + path = "RM Unit Tests.app"; | ||
255 | + remoteRef = 2B080DBD0F9FC14400E947D5 /* PBXContainerItemProxy */; | ||
256 | + sourceTree = BUILT_PRODUCTS_DIR; | ||
257 | + }; | ||
243 | EBE3697D0F673B95003DC21C /* libMapView.a */ = { | 258 | EBE3697D0F673B95003DC21C /* libMapView.a */ = { |
244 | isa = PBXReferenceProxy; | 259 | isa = PBXReferenceProxy; |
245 | fileType = archive.ar; | 260 | fileType = archive.ar; |
@@ -9,7 +9,7 @@ | @@ -9,7 +9,7 @@ | ||
9 | #import "MainView.h" | 9 | #import "MainView.h" |
10 | 10 | ||
11 | #import "RMOpenAerialMapSource.h" | 11 | #import "RMOpenAerialMapSource.h" |
12 | -#import "RMOpenStreetMapsSource.h" | 12 | +#import "RMOpenStreetMapSource.h" |
13 | #import "RMMapContents.h" | 13 | #import "RMMapContents.h" |
14 | #import "RMMapView.h" | 14 | #import "RMMapView.h" |
15 | #import "RMMarkerManager.h" | 15 | #import "RMMarkerManager.h" |
@@ -66,7 +66,7 @@ | @@ -66,7 +66,7 @@ | ||
66 | - (void)viewDidLoad { | 66 | - (void)viewDidLoad { |
67 | [super viewDidLoad]; | 67 | [super viewDidLoad]; |
68 | [mapView setDelegate:self]; | 68 | [mapView setDelegate:self]; |
69 | - id myTilesource = [[[RMOpenStreetMapsSource alloc] init] autorelease]; | 69 | + id myTilesource = [[[RMOpenStreetMapSource alloc] init] autorelease]; |
70 | 70 | ||
71 | // have to initialize the RMMapContents object explicitly if we want it to use a particular tilesource | 71 | // have to initialize the RMMapContents object explicitly if we want it to use a particular tilesource |
72 | [[[RMMapContents alloc] initWithView:mapView | 72 | [[[RMMapContents alloc] initWithView:mapView |
@@ -127,8 +127,8 @@ | @@ -127,8 +127,8 @@ | ||
127 | LogMethod(); | 127 | LogMethod(); |
128 | RMMarkerManager *mangler = [[[self mapView] contents] markerManager]; | 128 | RMMarkerManager *mangler = [[[self mapView] contents] markerManager]; |
129 | 129 | ||
130 | - for (RMTestableMarker *theMarker in [mangler getMarkers]) { | ||
131 | - CGPoint screenPosition = [mangler getMarkerScreenCoordinate:theMarker]; | 130 | + for (RMTestableMarker *theMarker in [mangler markers]) { |
131 | + CGPoint screenPosition = [mangler screenCoordinatesForMarker:theMarker]; | ||
132 | NSLog(@"%@ %3.1f %3.1f %f %f", theMarker, | 132 | NSLog(@"%@ %3.1f %3.1f %f %f", theMarker, |
133 | theMarker.coordinate.latitude, theMarker.coordinate.longitude, | 133 | theMarker.coordinate.latitude, theMarker.coordinate.longitude, |
134 | screenPosition.y, screenPosition.x); | 134 | screenPosition.y, screenPosition.x); |
@@ -54,7 +54,7 @@ | @@ -54,7 +54,7 @@ | ||
54 | - (void)testMarkers | 54 | - (void)testMarkers |
55 | { | 55 | { |
56 | RMMarkerManager *markerManager = [mapView markerManager]; | 56 | RMMarkerManager *markerManager = [mapView markerManager]; |
57 | - NSArray *markers = [markerManager getMarkers]; | 57 | + NSArray *markers = [markerManager markers]; |
58 | 58 | ||
59 | NSLog(@"Nb markers %d", [markers count]); | 59 | NSLog(@"Nb markers %d", [markers count]); |
60 | 60 | ||
@@ -64,11 +64,11 @@ | @@ -64,11 +64,11 @@ | ||
64 | while (aMarker = (RMMarker *)[markerEnumerator nextObject]) | 64 | while (aMarker = (RMMarker *)[markerEnumerator nextObject]) |
65 | 65 | ||
66 | { | 66 | { |
67 | - RMXYPoint point = [aMarker location]; | ||
68 | - NSLog(@"Marker mercator location: X:%lf, Y:%lf", point.x, point.y); | ||
69 | - CGPoint screenPoint = [markerManager getMarkerScreenCoordinate: aMarker]; | 67 | + RMProjectedPoint point = [aMarker projectedLocation]; |
68 | + NSLog(@"Marker projected location: east:%lf, north:%lf", point.easting, point.northing); | ||
69 | + CGPoint screenPoint = [markerManager screenCoordinatesForMarker: aMarker]; | ||
70 | NSLog(@"Marker screen location: X:%lf, Y:%lf", screenPoint.x, screenPoint.y); | 70 | NSLog(@"Marker screen location: X:%lf, Y:%lf", screenPoint.x, screenPoint.y); |
71 | - CLLocationCoordinate2D coordinates = [markerManager getMarkerCoordinate2D: aMarker]; | 71 | + CLLocationCoordinate2D coordinates = [markerManager latitudeLongitudeForMarker: aMarker]; |
72 | NSLog(@"Marker Lat/Lon location: Lat:%lf, Lon:%lf", coordinates.latitude, coordinates.longitude); | 72 | NSLog(@"Marker Lat/Lon location: Lat:%lf, Lon:%lf", coordinates.latitude, coordinates.longitude); |
73 | 73 | ||
74 | [markerManager removeMarker:aMarker]; | 74 | [markerManager removeMarker:aMarker]; |
@@ -80,11 +80,8 @@ | @@ -80,11 +80,8 @@ | ||
80 | 80 | ||
81 | [markerManager addMarker:marker AtLatLong:[[mapView contents] mapCenter]]; | 81 | [markerManager addMarker:marker AtLatLong:[[mapView contents] mapCenter]]; |
82 | 82 | ||
83 | - | ||
84 | - | ||
85 | -// [markerManager addDefaultMarkerAt:[[mapView contents] mapCenter]]; | ||
86 | [marker release]; | 83 | [marker release]; |
87 | - markers = [markerManager getMarkersForScreenBounds]; | 84 | + markers = [markerManager markersWithinScreenBounds]; |
88 | 85 | ||
89 | NSLog(@"Nb Markers in Screen: %d", [markers count]); | 86 | NSLog(@"Nb Markers in Screen: %d", [markers count]); |
90 | 87 | ||
@@ -110,7 +107,7 @@ | @@ -110,7 +107,7 @@ | ||
110 | 107 | ||
111 | RMMarkerManager *markerManager = [mapView markerManager]; | 108 | RMMarkerManager *markerManager = [mapView markerManager]; |
112 | 109 | ||
113 | - NSLog(@"New location: X:%lf Y:%lf", [marker location].x, [marker location].y); | 110 | + NSLog(@"New location: east:%lf north:%lf", [marker projectedLocation].easting, [marker projectedLocation].northing); |
114 | CGRect rect = [marker bounds]; | 111 | CGRect rect = [marker bounds]; |
115 | 112 | ||
116 | [markerManager moveMarker:marker AtXY:CGPointMake(position.x,position.y +rect.size.height/3)]; | 113 | [markerManager moveMarker:marker AtXY:CGPointMake(position.x,position.y +rect.size.height/3)]; |
@@ -32,7 +32,7 @@ | @@ -32,7 +32,7 @@ | ||
32 | isa = PBXContainerItemProxy; | 32 | isa = PBXContainerItemProxy; |
33 | containerPortal = EBE3696D0F673B95003DC21C /* MapView.xcodeproj */; | 33 | containerPortal = EBE3696D0F673B95003DC21C /* MapView.xcodeproj */; |
34 | proxyType = 2; | 34 | proxyType = 2; |
35 | - remoteGlobalIDString = 2BF3078F0F8AC5C0007014EE /* RM Unit Tests.app */; | 35 | + remoteGlobalIDString = 2BF3078F0F8AC5C0007014EE; |
36 | remoteInfo = "RM Unit Tests"; | 36 | remoteInfo = "RM Unit Tests"; |
37 | }; | 37 | }; |
38 | 2BB42BEE0F678951009967BB /* PBXContainerItemProxy */ = { | 38 | 2BB42BEE0F678951009967BB /* PBXContainerItemProxy */ = { |
@@ -52,7 +52,7 @@ | @@ -52,7 +52,7 @@ | ||
52 | - (void)testMarkers | 52 | - (void)testMarkers |
53 | { | 53 | { |
54 | RMMarkerManager *markerManager = [mapView markerManager]; | 54 | RMMarkerManager *markerManager = [mapView markerManager]; |
55 | - NSArray *markers = [markerManager getMarkers]; | 55 | + NSArray *markers = [markerManager markers]; |
56 | 56 | ||
57 | NSLog(@"Nb markers %d", [markers count]); | 57 | NSLog(@"Nb markers %d", [markers count]); |
58 | 58 | ||
@@ -80,7 +80,7 @@ | @@ -80,7 +80,7 @@ | ||
80 | 80 | ||
81 | [markerManager addDefaultMarkerAt:[[mapView contents] mapCenter]]; | 81 | [markerManager addDefaultMarkerAt:[[mapView contents] mapCenter]]; |
82 | [marker release]; | 82 | [marker release]; |
83 | - markers = [markerManager getMarkersForScreenBounds]; | 83 | + markers = [markerManager markersWithinScreenBounds]; |
84 | 84 | ||
85 | NSLog(@"Nb Markers in Screen: %d", [markers count]); | 85 | NSLog(@"Nb Markers in Screen: %d", [markers count]); |
86 | 86 | ||
@@ -110,7 +110,7 @@ shouldDragMarker:(RMMarker *)marker | @@ -110,7 +110,7 @@ shouldDragMarker:(RMMarker *)marker | ||
110 | 110 | ||
111 | RMMarkerManager *markerManager = [mapView markerManager]; | 111 | RMMarkerManager *markerManager = [mapView markerManager]; |
112 | 112 | ||
113 | - NSLog(@"New location: X:%lf Y:%lf", [marker location].x, [marker location].y); | 113 | + NSLog(@"New location: east:%lf north:%lf", [marker projectedLocation].easting, [marker projectedLocation].northing); |
114 | CGRect rect = [marker bounds]; | 114 | CGRect rect = [marker bounds]; |
115 | 115 | ||
116 | [markerManager moveMarker:marker | 116 | [markerManager moveMarker:marker |
@@ -242,11 +242,11 @@ shouldDragMarker:(RMMarker *)marker | @@ -242,11 +242,11 @@ shouldDragMarker:(RMMarker *)marker | ||
242 | 242 | ||
243 | currentLocation = newLocation.coordinate; | 243 | currentLocation = newLocation.coordinate; |
244 | RMMarkerManager *markerManager = [mapView markerManager]; | 244 | RMMarkerManager *markerManager = [mapView markerManager]; |
245 | - NSArray *markers = [markerManager getMarkers]; | 245 | + NSArray *markers = [markerManager markers]; |
246 | for (NSInteger i = 0; i < [markers count]; ++i) | 246 | for (NSInteger i = 0; i < [markers count]; ++i) |
247 | { | 247 | { |
248 | RMMarker *marker = [markers objectAtIndex: i]; | 248 | RMMarker *marker = [markers objectAtIndex: i]; |
249 | - CLLocationCoordinate2D location = [markerManager getMarkerCoordinate2D: marker]; | 249 | + CLLocationCoordinate2D location = [markerManager latitudeLongitudeForMarker:marker]; |
250 | if (location.latitude == oldLocation.coordinate.latitude && | 250 | if (location.latitude == oldLocation.coordinate.latitude && |
251 | location.longitude == oldLocation.coordinate.longitude) | 251 | location.longitude == oldLocation.coordinate.longitude) |
252 | { | 252 | { |
@@ -25,21 +25,21 @@ | @@ -25,21 +25,21 @@ | ||
25 | isa = PBXContainerItemProxy; | 25 | isa = PBXContainerItemProxy; |
26 | containerPortal = 092AB7560F8D6EEA0059C0D2 /* MapView.xcodeproj */; | 26 | containerPortal = 092AB7560F8D6EEA0059C0D2 /* MapView.xcodeproj */; |
27 | proxyType = 2; | 27 | proxyType = 2; |
28 | - remoteGlobalIDString = B8C974590E8A19B2007D16AD /* libMapView.a */; | 28 | + remoteGlobalIDString = B8C974590E8A19B2007D16AD; |
29 | remoteInfo = MapView; | 29 | remoteInfo = MapView; |
30 | }; | 30 | }; |
31 | 092AB75F0F8D6EEA0059C0D2 /* PBXContainerItemProxy */ = { | 31 | 092AB75F0F8D6EEA0059C0D2 /* PBXContainerItemProxy */ = { |
32 | isa = PBXContainerItemProxy; | 32 | isa = PBXContainerItemProxy; |
33 | containerPortal = 092AB7560F8D6EEA0059C0D2 /* MapView.xcodeproj */; | 33 | containerPortal = 092AB7560F8D6EEA0059C0D2 /* MapView.xcodeproj */; |
34 | proxyType = 2; | 34 | proxyType = 2; |
35 | - remoteGlobalIDString = 2BF3078F0F8AC5C0007014EE /* RM Unit Tests.app */; | 35 | + remoteGlobalIDString = 2BF3078F0F8AC5C0007014EE; |
36 | remoteInfo = "Unit Tests"; | 36 | remoteInfo = "Unit Tests"; |
37 | }; | 37 | }; |
38 | 092AB7620F8D6F010059C0D2 /* PBXContainerItemProxy */ = { | 38 | 092AB7620F8D6F010059C0D2 /* PBXContainerItemProxy */ = { |
39 | isa = PBXContainerItemProxy; | 39 | isa = PBXContainerItemProxy; |
40 | containerPortal = 092AB7560F8D6EEA0059C0D2 /* MapView.xcodeproj */; | 40 | containerPortal = 092AB7560F8D6EEA0059C0D2 /* MapView.xcodeproj */; |
41 | proxyType = 1; | 41 | proxyType = 1; |
42 | - remoteGlobalIDString = B8C974130E8A19B2007D16AD /* MapView */; | 42 | + remoteGlobalIDString = B8C974130E8A19B2007D16AD; |
43 | remoteInfo = MapView; | 43 | remoteInfo = MapView; |
44 | }; | 44 | }; |
45 | /* End PBXContainerItemProxy section */ | 45 | /* End PBXContainerItemProxy section */ |
-
Please register or login to post a comment