Authored by Thomas Rasch

o Some code cleanup

... ... @@ -145,10 +145,10 @@ enum {
@property (readonly) RMTileLoader *tileLoader;
@property (readonly) RMProjection *projection;
@property (readonly) id<RMMercatorToTileProjection> mercatorToTileProjection;
@property (readonly) id <RMMercatorToTileProjection> mercatorToTileProjection;
@property (readonly) RMMercatorToScreenProjection *mercatorToScreenProjection;
@property (retain, readwrite) id<RMTileSource> tileSource;
@property (retain, readwrite) id <RMTileSource> tileSource;
@property (nonatomic, retain) RMTileCache *tileCache;
@property (retain, readwrite) RMMapRenderer *renderer;
... ... @@ -158,21 +158,21 @@ enum {
@property (retain, readwrite) RMLayerCollection *overlay;
@property (retain, readonly) RMMarkerManager *markerManager;
/// \bug probably shouldn't be retaining this delegate
@property (nonatomic, retain) id<RMTilesUpdateDelegate> tilesUpdateDelegate;
@property (nonatomic, retain) id <RMTilesUpdateDelegate> tilesUpdateDelegate;
@property (readwrite) NSUInteger boundingMask;
/// The denominator in a cartographic scale like 1/24000, 1/50000, 1/2000000.
@property (readonly)double scaleDenominator;
@property (readonly) double scaleDenominator;
// tileDepth defaults to zero. if tiles have no alpha, set this higher, 3 or so, to make zooming smoother
@property (readwrite, assign) short tileDepth;
@property (readonly, assign) BOOL fullyLoaded;
@property (readonly, assign) BOOL fullyLoaded;
- (id)initWithView: (UIView*) view;
- (id)initWithView: (UIView*) view
tilesource:(id<RMTileSource>)newTilesource;
- (id)initWithView:(UIView *)view;
- (id)initWithView:(UIView *)view
tilesource:(id <RMTileSource>)newTilesource;
/// designated initializer
- (id)initWithView:(UIView*)view
tilesource:(id<RMTileSource>)tilesource
- (id)initWithView:(UIView *)view
tilesource:(id <RMTileSource>)tilesource
centerLatLon:(CLLocationCoordinate2D)initialCenter
zoomLevel:(float)initialZoomLevel
maxZoomLevel:(float)maxZoomLevel
... ... @@ -184,7 +184,7 @@ enum {
- (void)handleMemoryWarningNotification:(NSNotification *)notification;
- (void)didReceiveMemoryWarning;
- (BOOL)tileSourceBoundsContainProjectedPoint:(RMProjectedPoint) point;
- (BOOL)tileSourceBoundsContainProjectedPoint:(RMProjectedPoint)point;
- (void)moveBy:(CGSize)delta;
- (void)moveBy:(CGSize)delta andCorrectAllSublayers:(BOOL)correctAllSublayers;
... ...
... ... @@ -76,13 +76,13 @@
#pragma mark Initialisation
- (id)initWithView: (UIView*) view
- (id)initWithView:(UIView *)view
{
LogMethod();
CLLocationCoordinate2D here;
here.latitude = kDefaultInitialLatitude;
here.longitude = kDefaultInitialLongitude;
return [self initWithView:view
tilesource:[[[RMOpenStreetMapSource alloc] init] autorelease]
centerLatLon:here
... ... @@ -92,14 +92,14 @@
backgroundImage:nil];
}
- (id)initWithView: (UIView*) view
tilesource:(id<RMTileSource>)newTilesource
- (id)initWithView:(UIView *)view
tilesource:(id <RMTileSource>)newTilesource
{
LogMethod();
CLLocationCoordinate2D here;
here.latitude = kDefaultInitialLatitude;
here.longitude = kDefaultInitialLongitude;
return [self initWithView:view
tilesource:newTilesource
centerLatLon:here
... ... @@ -109,8 +109,8 @@
backgroundImage:nil];
}
- (id)initWithView:(UIView*)newView
tilesource:(id<RMTileSource>)newTilesource
- (id)initWithView:(UIView *)newView
tilesource:(id <RMTileSource>)newTilesource
centerLatLon:(CLLocationCoordinate2D)initialCenter
zoomLevel:(float)initialZoomLevel
maxZoomLevel:(float)maxZoomLevel
... ... @@ -144,7 +144,6 @@
layer = [[newView layer] retain];
[self setTileCache:[[[RMTileCache alloc] init] autorelease]];
[self setTileSource:newTilesource];
[self setRenderer: [[[RMCoreAnimationRenderer alloc] initWithContent:self] autorelease]];
... ... @@ -222,7 +221,7 @@
[self didReceiveMemoryWarning];
}
- (void) didReceiveMemoryWarning
- (void)didReceiveMemoryWarning
{
LogMethod();
[tileSource didReceiveMemoryWarning];
... ... @@ -231,7 +230,7 @@
#pragma mark Tile Source Bounds
- (BOOL) projectedBounds:(RMProjectedRect)bounds containsPoint:(RMProjectedPoint)point
- (BOOL)projectedBounds:(RMProjectedRect)bounds containsPoint:(RMProjectedPoint)point
{
if (bounds.origin.easting > point.easting ||
bounds.origin.easting + bounds.size.width < point.easting ||
... ... @@ -606,23 +605,23 @@
if (([tileSource minZoom] - minZoom) <= 1.0) {
RMLog(@"Graphics & memory are overly taxed if [contents minZoom] is more than 1.5 smaller than [tileSource minZoom]");
}
[projection release];
projection = [[tileSource projection] retain];
[mercatorToTileProjection release];
mercatorToTileProjection = [[tileSource mercatorToTileProjection] retain];
tileSourceProjectedBounds = (RMProjectedRect)[self projectedRectFromLatLonBounds:[tileSource latitudeLongitudeBoundingBox]];
[imagesOnScreen setTileCache:tileCache];
[imagesOnScreen setTileSource:tileSource];
[imagesOnScreen setCurrentCacheKey:[newTileSource uniqueTilecacheKey]];
[tileLoader reset];
[tileLoader reload];
}
- (id<RMTileSource>)tileSource
- (id <RMTileSource>)tileSource
{
return [[tileSource retain] autorelease];
}
... ... @@ -974,7 +973,7 @@
}
- (RMSphericalTrapezium)latitudeLongitudeBoundingBoxFor:(CGRect)rect
{
{
RMSphericalTrapezium boundingBox;
CGPoint northwestScreen = rect.origin;
... ...
... ... @@ -69,7 +69,7 @@
{
[marker setAffineTransform:rotationTransform];
[marker setProjectedLocation:[[mapContents projection] coordinateToProjectedPoint:point]];
[marker setPosition:[[mapContents mercatorToScreenProjection] projectProjectedPoint:[[mapContents projection] coordinateToProjectedPoint:point]]];
[marker setPosition:[[mapContents mercatorToScreenProjection] projectProjectedPoint:[marker projectedLocation]]];
[[mapContents overlay] addSublayer:marker];
}
... ...