Moved marker manager into MapContents. API shouldn't change.
Showing
5 changed files
with
19 additions
and
12 deletions
@@ -27,6 +27,7 @@ enum { | @@ -27,6 +27,7 @@ enum { | ||
27 | RMMapMinWidthBound = 2 | 27 | RMMapMinWidthBound = 2 |
28 | }; | 28 | }; |
29 | 29 | ||
30 | +@class RMMarkerManager; | ||
30 | @class RMProjection; | 31 | @class RMProjection; |
31 | @class RMMercatorToScreenProjection; | 32 | @class RMMercatorToScreenProjection; |
32 | @class RMTileImageSet; | 33 | @class RMTileImageSet; |
@@ -45,6 +46,7 @@ enum { | @@ -45,6 +46,7 @@ enum { | ||
45 | // This is the underlying UIView's layer. | 46 | // This is the underlying UIView's layer. |
46 | CALayer *layer; | 47 | CALayer *layer; |
47 | 48 | ||
49 | + RMMarkerManager *markerManager; | ||
48 | RMMapLayer *background; | 50 | RMMapLayer *background; |
49 | RMLayerSet *overlay; | 51 | RMLayerSet *overlay; |
50 | 52 | ||
@@ -89,6 +91,8 @@ enum { | @@ -89,6 +91,8 @@ enum { | ||
89 | 91 | ||
90 | @property (retain, readwrite) RMMapLayer *background; | 92 | @property (retain, readwrite) RMMapLayer *background; |
91 | @property (retain, readwrite) RMLayerSet *overlay; | 93 | @property (retain, readwrite) RMLayerSet *overlay; |
94 | +@property (retain, readonly) RMMarkerManager *markerManager; | ||
95 | + | ||
92 | @property (readwrite) NSUInteger boundingMask; | 96 | @property (readwrite) NSUInteger boundingMask; |
93 | 97 | ||
94 | - (id) initForView: (UIView*) view; | 98 | - (id) initForView: (UIView*) view; |
@@ -22,6 +22,7 @@ | @@ -22,6 +22,7 @@ | ||
22 | #import "RMCachedTileSource.h" | 22 | #import "RMCachedTileSource.h" |
23 | 23 | ||
24 | #import "RMLayerSet.h" | 24 | #import "RMLayerSet.h" |
25 | +#import "RMMarkerManager.h" | ||
25 | 26 | ||
26 | #import "RMMarker.h" | 27 | #import "RMMarker.h" |
27 | 28 | ||
@@ -30,6 +31,7 @@ | @@ -30,6 +31,7 @@ | ||
30 | @synthesize boundingMask; | 31 | @synthesize boundingMask; |
31 | @synthesize minZoom; | 32 | @synthesize minZoom; |
32 | @synthesize maxZoom; | 33 | @synthesize maxZoom; |
34 | +@synthesize markerManager; | ||
33 | 35 | ||
34 | #pragma mark Initialisation | 36 | #pragma mark Initialisation |
35 | - (id) initForView: (UIView*) view | 37 | - (id) initForView: (UIView*) view |
@@ -93,6 +95,8 @@ | @@ -93,6 +95,8 @@ | ||
93 | [self setOverlay:theOverlay]; | 95 | [self setOverlay:theOverlay]; |
94 | [theOverlay release]; | 96 | [theOverlay release]; |
95 | 97 | ||
98 | + markerManager = [[RMMarkerManager alloc] initWithContents:self]; | ||
99 | + | ||
96 | [view setNeedsDisplay]; | 100 | [view setNeedsDisplay]; |
97 | 101 | ||
98 | NSLog(@"Map contents initialised. view: %@ tileSource %@ renderer %@", view, tileSource, renderer); | 102 | NSLog(@"Map contents initialised. view: %@ tileSource %@ renderer %@", view, tileSource, renderer); |
@@ -110,6 +114,9 @@ | @@ -110,6 +114,9 @@ | ||
110 | [mercatorToScreenProjection release]; | 114 | [mercatorToScreenProjection release]; |
111 | [tileSource release]; | 115 | [tileSource release]; |
112 | [layer release]; | 116 | [layer release]; |
117 | + [overlay release]; | ||
118 | + [background release]; | ||
119 | + [markerManager release]; | ||
113 | 120 | ||
114 | [super dealloc]; | 121 | [super dealloc]; |
115 | } | 122 | } |
@@ -24,8 +24,6 @@ typedef struct { | @@ -24,8 +24,6 @@ typedef struct { | ||
24 | } RMGestureDetails; | 24 | } RMGestureDetails; |
25 | 25 | ||
26 | @class RMMapContents; | 26 | @class RMMapContents; |
27 | -@class RMMarker; | ||
28 | -@class RMMarkerManager; | ||
29 | 27 | ||
30 | // This class is a wrapper around RMMapContents for the iphone. | 28 | // This class is a wrapper around RMMapContents for the iphone. |
31 | // It implements event handling; but thats about it. All the interesting map | 29 | // It implements event handling; but thats about it. All the interesting map |
@@ -33,7 +31,6 @@ typedef struct { | @@ -33,7 +31,6 @@ typedef struct { | ||
33 | @interface RMMapView : UIView | 31 | @interface RMMapView : UIView |
34 | { | 32 | { |
35 | RMMapContents *contents; | 33 | RMMapContents *contents; |
36 | - RMMarkerManager *markerManager; | ||
37 | id<RMMapViewDelegate> delegate; | 34 | id<RMMapViewDelegate> delegate; |
38 | 35 | ||
39 | BOOL enableDragging; | 36 | BOOL enableDragging; |
@@ -28,12 +28,9 @@ | @@ -28,12 +28,9 @@ | ||
28 | 28 | ||
29 | @implementation RMMapView | 29 | @implementation RMMapView |
30 | 30 | ||
31 | -@synthesize markerManager; | ||
32 | - | ||
33 | -(void) initValues | 31 | -(void) initValues |
34 | { | 32 | { |
35 | contents = [[RMMapContents alloc] initForView:self]; | 33 | contents = [[RMMapContents alloc] initForView:self]; |
36 | - markerManager = [[RMMarkerManager alloc] initWithContents:contents]; | ||
37 | 34 | ||
38 | enableDragging = YES; | 35 | enableDragging = YES; |
39 | enableZoom = YES; | 36 | enableZoom = YES; |
@@ -64,7 +61,6 @@ | @@ -64,7 +61,6 @@ | ||
64 | 61 | ||
65 | -(void) dealloc | 62 | -(void) dealloc |
66 | { | 63 | { |
67 | - [markerManager release]; | ||
68 | [contents release]; | 64 | [contents release]; |
69 | [super dealloc]; | 65 | [super dealloc]; |
70 | } | 66 | } |
@@ -77,7 +73,7 @@ | @@ -77,7 +73,7 @@ | ||
77 | -(NSString*) description | 73 | -(NSString*) description |
78 | { | 74 | { |
79 | CGRect bounds = [self bounds]; | 75 | CGRect bounds = [self bounds]; |
80 | - return [NSString stringWithFormat:@"iPhone MapView at %.0f,%.0f-%.0f,%.0f", bounds.origin.x, bounds.origin.y, bounds.size.width, bounds.size.height]; | 76 | + return [NSString stringWithFormat:@"MapView at %.0f,%.0f-%.0f,%.0f", bounds.origin.x, bounds.origin.y, bounds.size.width, bounds.size.height]; |
81 | } | 77 | } |
82 | 78 | ||
83 | -(RMMapContents*) contents | 79 | -(RMMapContents*) contents |
@@ -337,11 +333,14 @@ | @@ -337,11 +333,14 @@ | ||
337 | [contents zoomWithLatLngBoundsNorthEast:ne SouthWest:se]; | 333 | [contents zoomWithLatLngBoundsNorthEast:ne SouthWest:se]; |
338 | } | 334 | } |
339 | 335 | ||
340 | - | ||
341 | - | ||
342 | - (CLLocationCoordinate2DBounds) getScreenCoordinateBounds | 336 | - (CLLocationCoordinate2DBounds) getScreenCoordinateBounds |
343 | { | 337 | { |
344 | return [contents getScreenCoordinateBounds]; | 338 | return [contents getScreenCoordinateBounds]; |
345 | } | 339 | } |
346 | 340 | ||
341 | +- (RMMarkerManager *)markerManager | ||
342 | +{ | ||
343 | + return [contents markerManager]; | ||
344 | +} | ||
345 | + | ||
347 | @end | 346 | @end |
@@ -505,6 +505,8 @@ | @@ -505,6 +505,8 @@ | ||
505 | B86F26A80E8742ED007A3773 /* Layers */ = { | 505 | B86F26A80E8742ED007A3773 /* Layers */ = { |
506 | isa = PBXGroup; | 506 | isa = PBXGroup; |
507 | children = ( | 507 | children = ( |
508 | + 090C948B0EC23FCD003AEE25 /* RMMarkerManager.h */, | ||
509 | + 090C948C0EC23FCD003AEE25 /* RMMarkerManager.m */, | ||
508 | B86F26AC0E87442C007A3773 /* RMMapLayer.h */, | 510 | B86F26AC0E87442C007A3773 /* RMMapLayer.h */, |
509 | B8F3FC600EA2B382004D8F85 /* RMMapLayer.m */, | 511 | B8F3FC600EA2B382004D8F85 /* RMMapLayer.m */, |
510 | B8FA92170E9315EC003A9FE6 /* RMLayerSet.h */, | 512 | B8FA92170E9315EC003A9FE6 /* RMLayerSet.h */, |
@@ -522,8 +524,6 @@ | @@ -522,8 +524,6 @@ | ||
522 | B8C9740D0E8A196E007D16AD /* Map */ = { | 524 | B8C9740D0E8A196E007D16AD /* Map */ = { |
523 | isa = PBXGroup; | 525 | isa = PBXGroup; |
524 | children = ( | 526 | children = ( |
525 | - 090C948B0EC23FCD003AEE25 /* RMMarkerManager.h */, | ||
526 | - 090C948C0EC23FCD003AEE25 /* RMMarkerManager.m */, | ||
527 | B8C9740E0E8A198F007D16AD /* README.txt */, | 527 | B8C9740E0E8A198F007D16AD /* README.txt */, |
528 | B8C974690E8A1A50007D16AD /* RMMapView.h */, | 528 | B8C974690E8A1A50007D16AD /* RMMapView.h */, |
529 | B8C9746A0E8A1A50007D16AD /* RMMapView.m */, | 529 | B8C9746A0E8A1A50007D16AD /* RMMapView.m */, |
-
Please register or login to post a comment