MapXL / route-me

Automatically exported from code.google.com/p/route-me
0 stars 0 forks source link

RMMapContents has some legacy code that can be removed #101

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
RMMapContents has the following code in initwithView

        boundingMask = RMMapMinWidthBound;
    mercatorToScreenProjection = [[RMMercatorToScreenProjection alloc]
initFromProjection:[newTilesource projection] ToScreenBounds:[newView bounds]];

    tileSource = nil;
    projection = nil;
    mercatorToTileProjection = nil;
    renderer = nil;
    imagesOnScreen = nil;
    tileLoader = nil;

    layer = [[newView layer] retain];

    [self setTileSource:newTilesource];
    [self setRenderer: [[[RMCoreAnimationRenderer alloc] initWithContent:self]
autorelease]];

    imagesOnScreen = [[RMTileImageSet alloc] initWithDelegate:renderer];

RMTileImageSet needs to know about the renderer so that it send tilesAdded
and tilesRemoved messages. The line just above this also tries to set the
Renderer but imagesOnScreen is still nil. The code in setRenderer that sets
renderer on imagesOnScreen should be removed

- (void) setRenderer: (RMMapRenderer*) newRenderer
{
    if (renderer == newRenderer)
        return;

    [imagesOnScreen setDelegate:newRenderer];

This line is noop, as imagesOnScreen is nil at this point.

Also, the following code is not needed

    markerManager = [[RMMarkerManager alloc] initWithContents:self];

because RMMarkerManager now uses the overlay (RMLayerSet) allocated in
initWithView for managing its markers.

Original issue reported on code.google.com by surut...@gmail.com on 6 Apr 2009 at 8:10