Authored by Hal Mueller

added shortName, longDescription, shortAttribution, and longAttribution methods …

…to tile sources. Modified SampleMap to display some attribution. Closes Issue 19.
... ... @@ -44,4 +44,8 @@
-(float) minZoom;
-(float) maxZoom;
-(NSString *)shortName;
-(NSString *)longDescription;
-(NSString *)shortAttribution;
-(NSString *)longAttribution;
@end
... ...
... ... @@ -97,5 +97,22 @@
@throw [NSException exceptionWithName:@"RMAbstractMethodInvocation" reason:@"uniqueTilecacheKey invoked on AbstractMercatorWebSource. Override this method when instantiating abstract class." userInfo:nil];
}
-(NSString *)shortName
{
@throw [NSException exceptionWithName:@"RMAbstractMethodInvocation" reason:@"shortName invoked on AbstractMercatorWebSource. Override this method when instantiating abstract class." userInfo:nil];
}
-(NSString *)longDescription
{
return [self shortName];
}
-(NSString *)shortAttribution
{
@throw [NSException exceptionWithName:@"RMAbstractMethodInvocation" reason:@"shortAttribution invoked on AbstractMercatorWebSource. Override this method when instantiating abstract class." userInfo:nil];
}
-(NSString *)longAttribution
{
return [self shortAttribution];
}
@end
... ...
... ... @@ -46,4 +46,9 @@
- (id<RMTileSource>) underlyingTileSource;
-(NSString *)shortName;
-(NSString *)longDescription;
-(NSString *)shortAttribution;
-(NSString *)longAttribution;
@end
... ...
... ... @@ -112,4 +112,22 @@
{
return [tileSource uniqueTilecacheKey];
}
-(NSString *)shortName
{
return [tileSource shortName];
}
-(NSString *)longDescription
{
return [tileSource longDescription];
}
-(NSString *)shortAttribution
{
return [tileSource shortAttribution];
}
-(NSString *)longAttribution
{
return [tileSource longAttribution];
}
@end
... ...
... ... @@ -76,4 +76,21 @@
return 256;
}
-(NSString *)shortName
{
return [NSString stringWithFormat:@"Cloud Made %d", cloudmadeStyleNumber];
}
-(NSString *)longDescription
{
return @"CloudMade.com provides high quality renderings of Open Street Map data";
}
-(NSString *)shortAttribution
{
return @"© CloudMade.com";
}
-(NSString *)longAttribution
{
return @"Map images © CloudMade.com. Original map data © OpenStreetMap, licensed under Creative Commons Share Alike By Attribution.";
}
@end
... ...
... ... @@ -42,4 +42,21 @@
return @"OpenAerialMap";
}
-(NSString *)shortName
{
return @"Open Aerial Map";
}
-(NSString *)longDescription
{
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.";
}
-(NSString *)shortAttribution
{
return @"© OpenAerialMap CC-BY-SA";
}
-(NSString *)longAttribution
{
return @"Map data © OpenAerialMap, licensed under Creative Commons Share Alike By Attribution.";
}
@end
... ...
... ... @@ -42,4 +42,22 @@
return @"OpenStreetMap";
}
-(NSString *)shortName
{
return @"Open Street Map";
}
-(NSString *)longDescription
{
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.";
}
-(NSString *)shortAttribution
{
return @"© OpenStreetMap CC-BY-SA";
}
-(NSString *)longAttribution
{
return @"Map data © OpenStreetMap, licensed under Creative Commons Share Alike By Attribution.";
}
@end
... ...
... ... @@ -50,4 +50,9 @@
-(NSString *)uniqueTilecacheKey;
-(NSString *)shortName;
-(NSString *)longDescription;
-(NSString *)shortAttribution;
-(NSString *)longAttribution;
@end
... ...
... ... @@ -30,6 +30,8 @@
@interface RMVirtualEarthSource : RMAbstractMercatorWebSource <RMAbstractMercatorWebSource> {
NSString *maptypeFlag;
NSString *accessKey;
@private
NSString *_shortName;
}
// to obtain a Virtual Earth key, see this blog post:
... ...
... ... @@ -41,6 +41,7 @@
if (self = [super init]) {
maptypeFlag = @"a";
accessKey = developerAccessKey;
_shortName = @"Microsoft Virtual Earth satellite";
}
return self;
}
... ... @@ -51,6 +52,8 @@
NSAssert(([developerAccessKey length] > 0), @"Virtual Earth access key must be non-empty");
if (self = [super init]) {
maptypeFlag = @"r";
accessKey = developerAccessKey;
_shortName = @"Microsoft Virtual Earth roads";
}
return self;
}
... ... @@ -60,6 +63,8 @@
NSAssert(([developerAccessKey length] > 0), @"Virtual Earth access key must be non-empty");
if (self = [super init]) {
maptypeFlag = @"h";
accessKey = developerAccessKey;
_shortName = @"Microsoft Virtual Earth hybrid";
}
return self;
}
... ... @@ -111,4 +116,21 @@
return [NSString stringWithFormat:@"MicrosoftVirtualEarth%@", maptypeFlag];
}
-(NSString *)shortName
{
return _shortName;
}
-(NSString *)longDescription
{
return @"Microsoft Virtual Earth. All data © Microsoft or their licensees.";
}
-(NSString *)shortAttribution
{
return @"© Microsoft Virtual Earth";
}
-(NSString *)longAttribution
{
return @"Map data © Microsoft Virtual Earth.";
}
@end
... ...
... ... @@ -73,12 +73,15 @@
float iphoneMillimetersPerPixel = .1543;
float truescaleDenominator = routemeMetersPerPixel / (0.001 * iphoneMillimetersPerPixel) ;
[infoTextView setText:[NSString stringWithFormat:@"Latitude : %f\nLongitude : %f\nZoom level : %.2f\nMeter per pixel : %.1f\nTrue scale : 1:%.0f",
[infoTextView setText:[NSString stringWithFormat:@"Latitude : %f\nLongitude : %f\nZoom level : %.2f\nMeter per pixel : %.1f\nTrue scale : 1:%.0f\n%@\n%@",
mapCenter.latitude,
mapCenter.longitude,
contents.zoom,
routemeMetersPerPixel,
truescaleDenominator]];
truescaleDenominator,
[[contents tileSource] shortName],
[[contents tileSource] shortAttribution]
]];
}
#pragma mark -
... ...
... ... @@ -8,7 +8,7 @@
<string key="IBDocument.HIToolboxVersion">353.00</string>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="37"/>
<integer value="39"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
... ... @@ -44,7 +44,7 @@
<object class="IBUITextView" id="922595057">
<reference key="NSNextResponder" ref="79822186"/>
<int key="NSvFlags">274</int>
<string key="NSFrame">{{0, 342}, {320, 118}}</string>
<string key="NSFrame">{{0, 298}, {320, 162}}</string>
<reference key="NSSuperview" ref="79822186"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">1</int>
... ... @@ -254,7 +254,7 @@ ZAo</string>
</object>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.LastKnownRelativeProjectPath">Sample2.xcodeproj</string>
<string key="IBDocument.LastKnownRelativeProjectPath">SampleMap.xcodeproj</string>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
</data>
</archive>
... ...