-
Notifications
You must be signed in to change notification settings - Fork 1
/
TLGPXTrackSegment.m
67 lines (57 loc) · 1.71 KB
/
TLGPXTrackSegment.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//
// TLGPXTrackSegment.m
// Mercatalog
//
// Created by Nathan Vander Wilt on 3/17/08.
// Copyright 2008 Calf Trail Software, LLC. All rights reserved.
//
#import "TLGPXTrackSegment.h"
#import "TLGPXWaypoint.h"
@implementation TLGPXTrackSegment
#pragma mark Initialization from XML
- (id)initWithParent:(TLGPXNode*)theParent
forElement:(NSString*)elementName
namespaceURI:(NSString*)namespaceURI
qualifiedName:(NSString*)qualifiedName
attributes:(NSDictionary*)attributes
{
self = [super initWithParent:theParent
forElement:elementName
namespaceURI:namespaceURI
qualifiedName:qualifiedName
attributes:attributes];
if (self) {
trackpoints = [[NSMutableArray array] retain];
}
return self;
}
- (void)dealloc {
[trackpoints release];
[super dealloc];
}
- (void)parser:(NSXMLParser*)parser didStartElement:(NSString*)elementName
namespaceURI:(NSString*)namespaceURI
qualifiedName:(NSString*)qualifiedName
attributes:(NSDictionary*)attributeDict
{
(void)namespaceURI;
(void)qualifiedName;
(void)attributeDict;
if ([elementName isEqualToString:@"trkpt"]) {
TLGPXWaypoint* newTrackpoint = [[TLGPXWaypoint alloc] initWithParent:self
forElement:elementName
namespaceURI:namespaceURI
qualifiedName:qualifiedName
attributes:attributeDict];
[parser setDelegate:newTrackpoint];
[trackpoints addObject:[newTrackpoint autorelease]];
}
}
#pragma mark Accessors
- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id *)stackbuf count:(NSUInteger)len {
return [trackpoints countByEnumeratingWithState:state objects:stackbuf count:len];
}
- (NSArray*)trackpoints {
return trackpoints;
}
@end