Authored by devel-hb

new delegate method: tap on marker

... ... @@ -21,6 +21,7 @@
BOOL delegateHasBeforeMapZoomByFactor;
BOOL delegateHasAfterMapZoomByFactor;
BOOL delegateHasDoubleTapOnMap;
BOOL delegateHasTapOnMarker;
@end
@implementation RMMapView
... ... @@ -94,9 +95,7 @@
delegateHasAfterMapZoomByFactor = [(NSObject*) delegate respondsToSelector: @selector(afterMapZoom: byFactor: near:)];
delegateHasDoubleTapOnMap = [(NSObject*) delegate respondsToSelector: @selector(doubleTapOnMap:)];
NSLog(@"%d %d %d %d %d", delegateHasBeforeMapMove, delegateHasAfterMapMove, delegateHasBeforeMapZoomByFactor, delegateHasAfterMapZoomByFactor, delegateHasDoubleTapOnMap);
delegateHasTapOnMarker = [(NSObject*) delegate respondsToSelector:@selector(tapOnMarker:onMap:)];
}
- (id<RMMapViewDelegate>) delegate
... ... @@ -247,8 +246,7 @@
// When factoring, beware these two instructions need to happen in this order.
[RMMapContents setPerformExpensiveOperations:YES];
}
//*************************************************************************************
//Double-tap detection (currently used for debugging pixelToLatLng() method)
if (touch.tapCount == 2)
{
if (delegateHasDoubleTapOnMap) {
... ... @@ -258,7 +256,14 @@
// [contents zoomInToNextNativeZoom];
}
}
//***************************************************************************************
if (touch.tapCount == 1)
{
CALayer* hit = [contents.overlay hitTest:[touch locationInView:self]];
if (hit != nil && [hit isMemberOfClass: [RMMarker class]]) {
if (delegateHasTapOnMarker) [delegate tapOnMarker: (RMMarker*) hit onMap: self];
}
}
// [contents recalculateImageSet];
}
... ...
... ... @@ -9,6 +9,7 @@
#import <UIKit/UIKit.h>
@class RMMapView;
@class RMMarker;
@protocol RMMapViewDelegate
... ... @@ -22,4 +23,6 @@
- (void) doubleTapOnMap: (RMMapView*) map;
- (void) tapOnMarker: (RMMarker*) marker onMap: (RMMapView*) map;
@end
... ...
... ... @@ -16,7 +16,8 @@ extern NSString * const RMMarkerBlueKey;
extern NSString * const RMMarkerRedKey;
@interface RMMarker : RMMapLayer <RMMovingMapLayer> {
RMXYPoint location;
RMXYPoint location;
NSObject* data;
}
+ (RMMarker*) markerWithNamedStyle: (NSString*) styleName;
... ... @@ -29,6 +30,7 @@ extern NSString * const RMMarkerRedKey;
- (id) initWithNamedStyle: (NSString*) styleName;
@property (assign, nonatomic) RMXYPoint location;
@property (retain) NSObject* data;
// Call this with either RMMarkerBlue or RMMarkerRed for the key.
+ (CGImageRef) markerImage: (NSString *) key;
... ...
... ... @@ -21,6 +21,7 @@ static CGImageRef _markerBlue = nil;
@implementation RMMarker
@synthesize location;
@synthesize data;
+ (RMMarker*) markerWithNamedStyle: (NSString*) styleName
{
... ...