added shortName, longDescription, shortAttribution, and longAttribution methods …
…to tile sources. Modified SampleMap to display some attribution. Closes Issue 19.
Showing
12 changed files
with
133 additions
and
5 deletions
@@ -97,5 +97,22 @@ | @@ -97,5 +97,22 @@ | ||
97 | @throw [NSException exceptionWithName:@"RMAbstractMethodInvocation" reason:@"uniqueTilecacheKey invoked on AbstractMercatorWebSource. Override this method when instantiating abstract class." userInfo:nil]; | 97 | @throw [NSException exceptionWithName:@"RMAbstractMethodInvocation" reason:@"uniqueTilecacheKey invoked on AbstractMercatorWebSource. Override this method when instantiating abstract class." userInfo:nil]; |
98 | } | 98 | } |
99 | 99 | ||
100 | +-(NSString *)shortName | ||
101 | +{ | ||
102 | + @throw [NSException exceptionWithName:@"RMAbstractMethodInvocation" reason:@"shortName invoked on AbstractMercatorWebSource. Override this method when instantiating abstract class." userInfo:nil]; | ||
103 | +} | ||
104 | +-(NSString *)longDescription | ||
105 | +{ | ||
106 | + return [self shortName]; | ||
107 | +} | ||
108 | +-(NSString *)shortAttribution | ||
109 | +{ | ||
110 | + @throw [NSException exceptionWithName:@"RMAbstractMethodInvocation" reason:@"shortAttribution invoked on AbstractMercatorWebSource. Override this method when instantiating abstract class." userInfo:nil]; | ||
111 | +} | ||
112 | +-(NSString *)longAttribution | ||
113 | +{ | ||
114 | + return [self shortAttribution]; | ||
115 | +} | ||
116 | + | ||
100 | @end | 117 | @end |
101 | 118 |
@@ -112,4 +112,22 @@ | @@ -112,4 +112,22 @@ | ||
112 | { | 112 | { |
113 | return [tileSource uniqueTilecacheKey]; | 113 | return [tileSource uniqueTilecacheKey]; |
114 | } | 114 | } |
115 | + | ||
116 | +-(NSString *)shortName | ||
117 | +{ | ||
118 | + return [tileSource shortName]; | ||
119 | +} | ||
120 | +-(NSString *)longDescription | ||
121 | +{ | ||
122 | + return [tileSource longDescription]; | ||
123 | +} | ||
124 | +-(NSString *)shortAttribution | ||
125 | +{ | ||
126 | + return [tileSource shortAttribution]; | ||
127 | +} | ||
128 | +-(NSString *)longAttribution | ||
129 | +{ | ||
130 | + return [tileSource longAttribution]; | ||
131 | +} | ||
132 | + | ||
115 | @end | 133 | @end |
@@ -76,4 +76,21 @@ | @@ -76,4 +76,21 @@ | ||
76 | return 256; | 76 | return 256; |
77 | } | 77 | } |
78 | 78 | ||
79 | +-(NSString *)shortName | ||
80 | +{ | ||
81 | + return [NSString stringWithFormat:@"Cloud Made %d", cloudmadeStyleNumber]; | ||
82 | +} | ||
83 | +-(NSString *)longDescription | ||
84 | +{ | ||
85 | + return @"CloudMade.com provides high quality renderings of Open Street Map data"; | ||
86 | +} | ||
87 | +-(NSString *)shortAttribution | ||
88 | +{ | ||
89 | + return @"© CloudMade.com"; | ||
90 | +} | ||
91 | +-(NSString *)longAttribution | ||
92 | +{ | ||
93 | + return @"Map images © CloudMade.com. Original map data © OpenStreetMap, licensed under Creative Commons Share Alike By Attribution."; | ||
94 | +} | ||
95 | + | ||
79 | @end | 96 | @end |
@@ -42,4 +42,21 @@ | @@ -42,4 +42,21 @@ | ||
42 | return @"OpenAerialMap"; | 42 | return @"OpenAerialMap"; |
43 | } | 43 | } |
44 | 44 | ||
45 | +-(NSString *)shortName | ||
46 | +{ | ||
47 | + return @"Open Aerial Map"; | ||
48 | +} | ||
49 | +-(NSString *)longDescription | ||
50 | +{ | ||
51 | + return @"Open Aerial Map, the free wiki world map, provides freely usable map data for all parts of the world, under the Creative Commons Attribution-Share Alike 2.0 license."; | ||
52 | +} | ||
53 | +-(NSString *)shortAttribution | ||
54 | +{ | ||
55 | + return @"© OpenAerialMap CC-BY-SA"; | ||
56 | +} | ||
57 | +-(NSString *)longAttribution | ||
58 | +{ | ||
59 | + return @"Map data © OpenAerialMap, licensed under Creative Commons Share Alike By Attribution."; | ||
60 | +} | ||
61 | + | ||
45 | @end | 62 | @end |
@@ -42,4 +42,22 @@ | @@ -42,4 +42,22 @@ | ||
42 | return @"OpenStreetMap"; | 42 | return @"OpenStreetMap"; |
43 | } | 43 | } |
44 | 44 | ||
45 | +-(NSString *)shortName | ||
46 | +{ | ||
47 | + return @"Open Street Map"; | ||
48 | +} | ||
49 | +-(NSString *)longDescription | ||
50 | +{ | ||
51 | + return @"Open Street Map, the free wiki world map, provides freely usable map data for all parts of the world, under the Creative Commons Attribution-Share Alike 2.0 license."; | ||
52 | +} | ||
53 | +-(NSString *)shortAttribution | ||
54 | +{ | ||
55 | + return @"© OpenStreetMap CC-BY-SA"; | ||
56 | +} | ||
57 | +-(NSString *)longAttribution | ||
58 | +{ | ||
59 | + return @"Map data © OpenStreetMap, licensed under Creative Commons Share Alike By Attribution."; | ||
60 | +} | ||
61 | + | ||
62 | + | ||
45 | @end | 63 | @end |
@@ -30,6 +30,8 @@ | @@ -30,6 +30,8 @@ | ||
30 | @interface RMVirtualEarthSource : RMAbstractMercatorWebSource <RMAbstractMercatorWebSource> { | 30 | @interface RMVirtualEarthSource : RMAbstractMercatorWebSource <RMAbstractMercatorWebSource> { |
31 | NSString *maptypeFlag; | 31 | NSString *maptypeFlag; |
32 | NSString *accessKey; | 32 | NSString *accessKey; |
33 | + @private | ||
34 | + NSString *_shortName; | ||
33 | } | 35 | } |
34 | 36 | ||
35 | // to obtain a Virtual Earth key, see this blog post: | 37 | // to obtain a Virtual Earth key, see this blog post: |
@@ -41,6 +41,7 @@ | @@ -41,6 +41,7 @@ | ||
41 | if (self = [super init]) { | 41 | if (self = [super init]) { |
42 | maptypeFlag = @"a"; | 42 | maptypeFlag = @"a"; |
43 | accessKey = developerAccessKey; | 43 | accessKey = developerAccessKey; |
44 | + _shortName = @"Microsoft Virtual Earth satellite"; | ||
44 | } | 45 | } |
45 | return self; | 46 | return self; |
46 | } | 47 | } |
@@ -51,6 +52,8 @@ | @@ -51,6 +52,8 @@ | ||
51 | NSAssert(([developerAccessKey length] > 0), @"Virtual Earth access key must be non-empty"); | 52 | NSAssert(([developerAccessKey length] > 0), @"Virtual Earth access key must be non-empty"); |
52 | if (self = [super init]) { | 53 | if (self = [super init]) { |
53 | maptypeFlag = @"r"; | 54 | maptypeFlag = @"r"; |
55 | + accessKey = developerAccessKey; | ||
56 | + _shortName = @"Microsoft Virtual Earth roads"; | ||
54 | } | 57 | } |
55 | return self; | 58 | return self; |
56 | } | 59 | } |
@@ -60,6 +63,8 @@ | @@ -60,6 +63,8 @@ | ||
60 | NSAssert(([developerAccessKey length] > 0), @"Virtual Earth access key must be non-empty"); | 63 | NSAssert(([developerAccessKey length] > 0), @"Virtual Earth access key must be non-empty"); |
61 | if (self = [super init]) { | 64 | if (self = [super init]) { |
62 | maptypeFlag = @"h"; | 65 | maptypeFlag = @"h"; |
66 | + accessKey = developerAccessKey; | ||
67 | + _shortName = @"Microsoft Virtual Earth hybrid"; | ||
63 | } | 68 | } |
64 | return self; | 69 | return self; |
65 | } | 70 | } |
@@ -111,4 +116,21 @@ | @@ -111,4 +116,21 @@ | ||
111 | return [NSString stringWithFormat:@"MicrosoftVirtualEarth%@", maptypeFlag]; | 116 | return [NSString stringWithFormat:@"MicrosoftVirtualEarth%@", maptypeFlag]; |
112 | } | 117 | } |
113 | 118 | ||
119 | +-(NSString *)shortName | ||
120 | +{ | ||
121 | + return _shortName; | ||
122 | +} | ||
123 | +-(NSString *)longDescription | ||
124 | +{ | ||
125 | + return @"Microsoft Virtual Earth. All data © Microsoft or their licensees."; | ||
126 | +} | ||
127 | +-(NSString *)shortAttribution | ||
128 | +{ | ||
129 | + return @"© Microsoft Virtual Earth"; | ||
130 | +} | ||
131 | +-(NSString *)longAttribution | ||
132 | +{ | ||
133 | + return @"Map data © Microsoft Virtual Earth."; | ||
134 | +} | ||
135 | + | ||
114 | @end | 136 | @end |
@@ -73,12 +73,15 @@ | @@ -73,12 +73,15 @@ | ||
73 | float iphoneMillimetersPerPixel = .1543; | 73 | float iphoneMillimetersPerPixel = .1543; |
74 | float truescaleDenominator = routemeMetersPerPixel / (0.001 * iphoneMillimetersPerPixel) ; | 74 | float truescaleDenominator = routemeMetersPerPixel / (0.001 * iphoneMillimetersPerPixel) ; |
75 | 75 | ||
76 | - [infoTextView setText:[NSString stringWithFormat:@"Latitude : %f\nLongitude : %f\nZoom level : %.2f\nMeter per pixel : %.1f\nTrue scale : 1:%.0f", | 76 | + [infoTextView setText:[NSString stringWithFormat:@"Latitude : %f\nLongitude : %f\nZoom level : %.2f\nMeter per pixel : %.1f\nTrue scale : 1:%.0f\n%@\n%@", |
77 | mapCenter.latitude, | 77 | mapCenter.latitude, |
78 | mapCenter.longitude, | 78 | mapCenter.longitude, |
79 | contents.zoom, | 79 | contents.zoom, |
80 | routemeMetersPerPixel, | 80 | routemeMetersPerPixel, |
81 | - truescaleDenominator]]; | 81 | + truescaleDenominator, |
82 | + [[contents tileSource] shortName], | ||
83 | + [[contents tileSource] shortAttribution] | ||
84 | + ]]; | ||
82 | } | 85 | } |
83 | 86 | ||
84 | #pragma mark - | 87 | #pragma mark - |
@@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
8 | <string key="IBDocument.HIToolboxVersion">353.00</string> | 8 | <string key="IBDocument.HIToolboxVersion">353.00</string> |
9 | <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> | 9 | <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> |
10 | <bool key="EncodedWithXMLCoder">YES</bool> | 10 | <bool key="EncodedWithXMLCoder">YES</bool> |
11 | - <integer value="37"/> | 11 | + <integer value="39"/> |
12 | </object> | 12 | </object> |
13 | <object class="NSArray" key="IBDocument.PluginDependencies"> | 13 | <object class="NSArray" key="IBDocument.PluginDependencies"> |
14 | <bool key="EncodedWithXMLCoder">YES</bool> | 14 | <bool key="EncodedWithXMLCoder">YES</bool> |
@@ -44,7 +44,7 @@ | @@ -44,7 +44,7 @@ | ||
44 | <object class="IBUITextView" id="922595057"> | 44 | <object class="IBUITextView" id="922595057"> |
45 | <reference key="NSNextResponder" ref="79822186"/> | 45 | <reference key="NSNextResponder" ref="79822186"/> |
46 | <int key="NSvFlags">274</int> | 46 | <int key="NSvFlags">274</int> |
47 | - <string key="NSFrame">{{0, 342}, {320, 118}}</string> | 47 | + <string key="NSFrame">{{0, 298}, {320, 162}}</string> |
48 | <reference key="NSSuperview" ref="79822186"/> | 48 | <reference key="NSSuperview" ref="79822186"/> |
49 | <object class="NSColor" key="IBUIBackgroundColor"> | 49 | <object class="NSColor" key="IBUIBackgroundColor"> |
50 | <int key="NSColorSpace">1</int> | 50 | <int key="NSColorSpace">1</int> |
@@ -254,7 +254,7 @@ ZAo</string> | @@ -254,7 +254,7 @@ ZAo</string> | ||
254 | </object> | 254 | </object> |
255 | </object> | 255 | </object> |
256 | <int key="IBDocument.localizationMode">0</int> | 256 | <int key="IBDocument.localizationMode">0</int> |
257 | - <string key="IBDocument.LastKnownRelativeProjectPath">Sample2.xcodeproj</string> | 257 | + <string key="IBDocument.LastKnownRelativeProjectPath">SampleMap.xcodeproj</string> |
258 | <int key="IBDocument.defaultPropertyAccessControl">3</int> | 258 | <int key="IBDocument.defaultPropertyAccessControl">3</int> |
259 | </data> | 259 | </data> |
260 | </archive> | 260 | </archive> |
-
Please register or login to post a comment