-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathKMLStyle.m
84 lines (65 loc) · 1.39 KB
/
KMLStyle.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
//
// KMLStyle.m
// KMLViewer
//
// Created by Mojtaba Cazi on 2/27/18.
//
#import "KMLStyle.h"
#import "UIColor+KMLParser.h"
@implementation KMLStyle
- (BOOL)canAddString {
return flags.inColor || flags.inWidth || flags.inFill || flags.inOutline;
}
- (void)beginLineStyle {
flags.inLineStyle = YES;
}
- (void)endLineStyle {
flags.inLineStyle = NO;
}
- (void)beginPolyStyle {
flags.inPolyStyle = YES;
}
- (void)endPolyStyle {
flags.inPolyStyle = NO;
}
- (void)beginColor {
flags.inColor = YES;
}
- (void)endColor {
flags.inColor = NO;
if (flags.inLineStyle) {
strokeColor = [UIColor colorWithKMLString:accum];
} else if (flags.inPolyStyle) {
fillColor = [UIColor colorWithKMLString:accum];
}
[self clearString];
}
- (void)beginWidth {
flags.inWidth = YES;
}
- (void)endWidth {
flags.inWidth = NO;
strokeWidth = [accum floatValue];
[self clearString];
}
- (void)beginFill {
flags.inFill = YES;
}
- (void)endFill {
flags.inFill = NO;
fill = [accum boolValue];
[self clearString];
}
- (void)beginOutline {
flags.inOutline = YES;
}
- (void)endOutline {
stroke = [accum boolValue];
[self clearString];
}
- (void)applyToOverlayPathRenderer:(MKOverlayPathRenderer *)renderer {
renderer.strokeColor = strokeColor;
renderer.fillColor = fillColor;
renderer.lineWidth = strokeWidth;
}
@end