Here is the interface to MapAnnotation:
// CSMapAnnotation.h
// mapLines
// Created by Craig on 5/15/09.
// Copyright 2009 Craig Spitzkoff. All rights reserved.
#import <Foundation/Foundation.h>
#import <MapKit/MapKit.h>
// types of annotations for which we will provide annotation views.
typedef enum {
MapAnnotationTypeStart = 0,
MapAnnotationTypeEnd = 1,
MapAnnotationTypeImage = 2
} MapAnnotationType;
@interface MapAnnotation : NSObject <MKAnnotation>
{
CLLocationCoordinate2D _coordinate;
MapAnnotationType _annotationType;
NSString* _title;
NSString* _subtitle;
NSString* _userData;
NSString* speed;
NSString* identifier;
}
@property (nonatomic, retain) NSString *speed;
@property (nonatomic, retain) NSString *identifier;
-(id) initWithCoordinate:(CLLocationCoordinate2D)coordinate
annotationType: (MapAnnotationType) annotationType
title: (NSString*) title
subtitle: (NSString*) subtitle
speed: (NSString *) speed
identifier: (NSString *) identifier;
-(id) setWithCoordinate: (CLLocationCoordinate2D) coordinate
annotationType: (MapAnnotationType) annotationType
title: (NSString*) title
subtitle: (NSString*) subtitle
speed: (NSString*) speed
identifier: (NSString*) identifier;
@property MapAnnotationType annotationType;
@property (nonatomic, retain) NSString* userData;
@end
And here is the implementation:
// CSMapAnnotation.m
// mapLines
// Created by Craig on 5/15/09.
// Copyright 2009 Craig Spitzkoff. All rights reserved.
#import "MapAnnotation.h"
@implementation MapAnnotation
@synthesize coordinate = _coordinate;
@synthesize annotationType = _annotationType;
@synthesize userData = _userData;
@synthesize speed;
@synthesize identifier;
-(id) initWithCoordinate:(CLLocationCoordinate2D)coordinate
annotationType: (MapAnnotationType) annotationType
title: (NSString*)title
subtitle: (NSString*) subtitle
speed: (NSString *) speedz
identifier: (NSString *) identifierz
{
self = [super init];
_coordinate = coordinate;
_title = [title retain];
_subtitle = [subtitle retain];
_annotationType = annotationType;
speed = speedz;
identifier = identifierz;
return self;
}
-(id) setWithCoordinate:(CLLocationCoordinate2D)coordinate
annotationType: (MapAnnotationType) annotationType
title: (NSString*) title
subtitle: (NSString*) subtitle
speed: (NSString*) speedz
identifier: (NSString*) identifierz
{
_coordinate = coordinate;
_title = [title retain];
_subtitle = [subtitle retain];
_annotationType = annotationType;
speed = speedz;
identifier = identifierz;
return self;
}
-(NSString*) title
{
return _title;
}
-(NSString*) subtitle
{
return _subtitle;
}
-(void) dealloc
{
[_title release];
[_userData release];
[super dealloc];
}
@end