/MapView/Map/RMTileImage.h
C Header | 92 lines | 41 code | 19 blank | 32 comment | 0 complexity | ad2a4e772d81bca4548a05ee5ce85037 MD5 | raw file
1// 2// RMTileImage.h 3// 4// Copyright (c) 2008-2009, Route-Me Contributors 5// All rights reserved. 6// 7// Redistribution and use in source and binary forms, with or without 8// modification, are permitted provided that the following conditions are met: 9// 10// * Redistributions of source code must retain the above copyright notice, this 11// list of conditions and the following disclaimer. 12// * Redistributions in binary form must reproduce the above copyright notice, 13// this list of conditions and the following disclaimer in the documentation 14// and/or other materials provided with the distribution. 15// 16// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26// POSSIBILITY OF SUCH DAMAGE. 27 28#import <TargetConditionals.h> 29#if TARGET_OS_IPHONE 30 #import <UIKit/UIKit.h> 31#else 32 #import <Cocoa/Cocoa.h> 33typedef NSImage UIImage; 34#endif 35 36#import "RMFoundation.h" 37#import "RMNotifications.h" 38#import "RMTile.h" 39#import "RMTileProxy.h" 40#import "FMDatabase.h" 41 42@class RMTileImage; 43@class NSData; 44 45@interface RMTileImage : NSObject { 46 // I know this is a bit nasty. 47 RMTile tile; 48 CGRect screenLocation; 49 50 /// Used by cache 51 NSDate *lastUsedTime; 52 53 /// \bug placing the "layer" on the RMTileImage implicitly assumes that a particular RMTileImage will be used in only 54 /// one UIView. Might see some interesting crashes if you have two RMMapViews using the same tile source. 55 // Only used when appropriate 56 CALayer *layer; 57} 58 59- (id) initWithTile: (RMTile)tile; 60 61+ (RMTileImage*) dummyTile: (RMTile)tile; 62 63//- (void)drawInRect:(CGRect)rect; 64- (void)draw; 65 66+ (RMTileImage*)imageForTile: (RMTile) tile withURL: (NSString*)url; 67+ (RMTileImage*)imageForTile: (RMTile) tile fromFile: (NSString*)filename; 68+ (RMTileImage*)imageForTile: (RMTile) tile withData: (NSData*)data; 69+ (RMTileImage*)imageForTile: (RMTile) tile fromDB: (FMDatabase*)db; 70 71- (void)moveBy: (CGSize) delta; 72- (void)zoomByFactor: (float) zoomFactor near:(CGPoint) center; 73 74- (void)makeLayer; 75 76- (void)cancelLoading; 77 78- (BOOL)updateImageUsingData: (NSData*) data; 79- (void)updateImageUsingImage: (UIImage*) image; 80 81- (void)touch; 82 83- (BOOL)isLoaded; 84 85- (void) displayProxy:(UIImage*)img; 86 87@property (readwrite, assign) CGRect screenLocation; 88@property (readonly, assign) RMTile tile; 89@property (readonly) CALayer *layer; 90@property (readonly) NSDate *lastUsedTime; 91 92@end