PageRenderTime 20ms CodeModel.GetById 1ms app.highlight 17ms RepoModel.GetById 0ms app.codeStats 0ms

/MapView/Map/RMMarker.h

http://github.com/route-me/route-me
C Header | 92 lines | 37 code | 14 blank | 41 comment | 0 complexity | e5a1b1a05ab3700f04a6b314867bad8a MD5 | raw file
 1//
 2//  RMMarker.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 <UIKit/UIKit.h>
29#import "RMMapLayer.h"
30#import "RMFoundation.h"
31#ifdef DEBUG
32#import <CoreLocation/CoreLocation.h>
33#endif
34
35@class RMMarkerStyle;
36
37/// one marker drawn on the map. Note that RMMarker ultimately descends from CALayer, and has an image contents.
38/// RMMarker inherits "position" and "anchorPoint" from CALayer.
39@interface RMMarker : RMMapLayer <RMMovingMapLayer> {
40	/// expressed in projected meters. The anchorPoint of the image is plotted here. 
41	RMProjectedPoint projectedLocation;	
42	/// provided for storage of arbitrary user data
43	NSObject* data; 
44	
45	/// Text label, visible by default if it has content, but not required.
46	UIView *label;
47	UIColor *textForegroundColor;
48	UIColor *textBackgroundColor;
49	
50	BOOL enableDragging;
51	BOOL enableRotation;
52}
53@property (assign, nonatomic) RMProjectedPoint projectedLocation;
54@property (assign) BOOL enableDragging;
55@property (assign) BOOL enableRotation;
56
57@property (nonatomic, retain) NSObject* data;
58@property (nonatomic, retain) UIView* label;
59@property(nonatomic,retain) UIColor *textForegroundColor;
60@property(nonatomic,retain) UIColor *textBackgroundColor;
61
62/// the font used for labels when another font is not explicitly requested; currently [UIFont systemFontOfSize:15]
63+ (UIFont *)defaultFont;
64
65/// returns RMMarker initialized with #image, and the default anchor point (0.5, 0.5)
66- (id) initWithUIImage: (UIImage*) image;
67/// \brief returns RMMarker initialized with provided image and anchorPoint. 
68/// #anchorPoint x and y range from 0 to 1, normalized to the width and height of image, 
69/// referenced to upper left corner, y increasing top to bottom. To put the image's upper right corner on the marker's 
70/// #projectedLocation, use an anchor point of (1.0, 0.0);
71- (id) initWithUIImage: (UIImage*) image anchorPoint: (CGPoint) anchorPoint;
72
73/// changes the labelView to a UILabel with supplied #text and default marker font, using existing text foreground/background color.
74- (void) changeLabelUsingText: (NSString*)text;
75/// changes the labelView to a UILabel with supplied #text and default marker font, positioning the text some weird way i don't understand yet. Uses existing text color/background color.
76- (void) changeLabelUsingText: (NSString*)text position:(CGPoint)position;
77/// changes the labelView to a UILabel with supplied #text and default marker font, changing this marker's text foreground/background colors for this and future text strings.
78- (void) changeLabelUsingText: (NSString*)text font:(UIFont*)font foregroundColor:(UIColor*)textColor backgroundColor:(UIColor*)backgroundColor;
79/// changes the labelView to a UILabel with supplied #text and default marker font, changing this marker's text foreground/background colors for this and future text strings; modifies position as in #changeLabelUsingText:position.
80- (void) changeLabelUsingText: (NSString*)text position:(CGPoint)position font:(UIFont*)font foregroundColor:(UIColor*)textColor backgroundColor:(UIColor*)backgroundColor;
81
82- (void) toggleLabel;
83- (void) showLabel;
84- (void) hideLabel;
85
86- (void) replaceUIImage:(UIImage*)image;
87- (void) replaceUIImage:(UIImage*)image anchorPoint:(CGPoint)anchorPoint;
88
89
90- (void) dealloc;
91
92@end