Authored by Thomas Rasch

o Readded RMOpenCycleMapSource

  1 +//
  2 +// OpenCycleMapSource.h
  3 +//
  4 +// Copyright (c) 2008, Route-Me Contributors
  5 +// All rights reserved.
  6 +//
  7 +// Redistribution and use in source and binary forms, with or without
  8 +// modification, are permitted provided that the following conditions are met:
  9 +//
  10 +// * Redistributions of source code must retain the above copyright notice, this
  11 +// list of conditions and the following disclaimer.
  12 +// * Redistributions in binary form must reproduce the above copyright notice,
  13 +// this list of conditions and the following disclaimer in the documentation
  14 +// and/or other materials provided with the distribution.
  15 +//
  16 +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  17 +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  18 +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  19 +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  20 +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  21 +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  22 +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  23 +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  24 +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  25 +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  26 +// POSSIBILITY OF SUCH DAMAGE.
  27 +
  28 +#import "RMAbstractWebMapSource.h"
  29 +
  30 +/*!
  31 + \brief Subclass of RMAbstractWebMapSource for access to the Open Cycle Map project's development server.
  32 +
  33 + Provides key-based access to tiles from the Open Cycle Map project.
  34 + */
  35 +@interface RMOpenCycleMapSource : RMAbstractWebMapSource {
  36 +}
  37 +
  38 +@end
  1 +//
  2 +// OpenCycleMapSource.m
  3 +//
  4 +// Copyright (c) 2008-2009, Route-Me Contributors
  5 +// All rights reserved.
  6 +//
  7 +// Redistribution and use in source and binary forms, with or without
  8 +// modification, are permitted provided that the following conditions are met:
  9 +//
  10 +// * Redistributions of source code must retain the above copyright notice, this
  11 +// list of conditions and the following disclaimer.
  12 +// * Redistributions in binary form must reproduce the above copyright notice,
  13 +// this list of conditions and the following disclaimer in the documentation
  14 +// and/or other materials provided with the distribution.
  15 +//
  16 +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  17 +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  18 +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  19 +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  20 +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  21 +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  22 +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  23 +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  24 +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  25 +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  26 +// POSSIBILITY OF SUCH DAMAGE.
  27 +
  28 +#import "RMOpenCycleMapSource.h"
  29 +
  30 +@implementation RMOpenCycleMapSource
  31 +
  32 +- (id)init
  33 +{
  34 + if (!(self = [super init]))
  35 + return nil;
  36 +
  37 + // http://wiki.openstreetmap.org/index.php/FAQ#What_is_the_map_scale_for_a_particular_zoom_level_of_the_map.3F
  38 + [self setMaxZoom:15];
  39 + [self setMinZoom:1];
  40 +
  41 + return self;
  42 +}
  43 +
  44 +- (NSURL *)URLForTile:(RMTile)tile
  45 +{
  46 + NSAssert4(((tile.zoom >= self.minZoom) && (tile.zoom <= self.maxZoom)),
  47 + @"%@ tried to retrieve tile with zoomLevel %d, outside source's defined range %f to %f",
  48 + self, tile.zoom, self.minZoom, self.maxZoom);
  49 + return [NSURL URLWithString:[NSString stringWithFormat:@"http://andy.sandbox.cloudmade.com/tiles/cycle/%d/%d/%d.png", tile.zoom, tile.x, tile.y]];
  50 +}
  51 +
  52 +- (NSString *)uniqueTilecacheKey
  53 +{
  54 + return @"OpenCycleMap";
  55 +}
  56 +
  57 +- (NSString *)shortName
  58 +{
  59 + return @"Open Cycle Map";
  60 +}
  61 +
  62 +- (NSString *)longDescription
  63 +{
  64 + return @"Open Cycle 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.";
  65 +}
  66 +
  67 +- (NSString *)shortAttribution
  68 +{
  69 + return @"© OpenCycleMap CC-BY-SA";
  70 +}
  71 +
  72 +-(NSString *)longAttribution
  73 +{
  74 + return @"Map data © OpenCycleMap, licensed under Creative Commons Share Alike By Attribution.";
  75 +}
  76 +
  77 +@end
@@ -33,6 +33,8 @@ @@ -33,6 +33,8 @@
33 33
34 /* Begin PBXBuildFile section */ 34 /* Begin PBXBuildFile section */
35 126693040EB76C0B00E002D5 /* RMConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = 126692A00EB75C0A00E002D5 /* RMConfiguration.m */; }; 35 126693040EB76C0B00E002D5 /* RMConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = 126692A00EB75C0A00E002D5 /* RMConfiguration.m */; };
  36 + 1606C9FE13D86BA400547581 /* RMOpenCycleMapSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 1606C9FC13D86BA300547581 /* RMOpenCycleMapSource.h */; };
  37 + 1606C9FF13D86BA400547581 /* RMOpenCycleMapSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 1606C9FD13D86BA300547581 /* RMOpenCycleMapSource.m */; };
36 160EEDAF13D41DEC007C5501 /* RMAnnotation.h in Headers */ = {isa = PBXBuildFile; fileRef = 160EEDAD13D41DEC007C5501 /* RMAnnotation.h */; }; 38 160EEDAF13D41DEC007C5501 /* RMAnnotation.h in Headers */ = {isa = PBXBuildFile; fileRef = 160EEDAD13D41DEC007C5501 /* RMAnnotation.h */; };
37 160EEDB013D41DEC007C5501 /* RMAnnotation.m in Sources */ = {isa = PBXBuildFile; fileRef = 160EEDAE13D41DEC007C5501 /* RMAnnotation.m */; }; 39 160EEDB013D41DEC007C5501 /* RMAnnotation.m in Sources */ = {isa = PBXBuildFile; fileRef = 160EEDAE13D41DEC007C5501 /* RMAnnotation.m */; };
38 16EC85D2133CA6C300219947 /* RMAbstractMercatorTileSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 16EC85CC133CA6C300219947 /* RMAbstractMercatorTileSource.h */; }; 40 16EC85D2133CA6C300219947 /* RMAbstractMercatorTileSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 16EC85CC133CA6C300219947 /* RMAbstractMercatorTileSource.h */; };
@@ -174,6 +176,8 @@ @@ -174,6 +176,8 @@
174 1266929F0EB75C0A00E002D5 /* RMConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RMConfiguration.h; sourceTree = "<group>"; }; 176 1266929F0EB75C0A00E002D5 /* RMConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RMConfiguration.h; sourceTree = "<group>"; };
175 126692A00EB75C0A00E002D5 /* RMConfiguration.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RMConfiguration.m; sourceTree = "<group>"; }; 177 126692A00EB75C0A00E002D5 /* RMConfiguration.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RMConfiguration.m; sourceTree = "<group>"; };
176 12F2031E0EBB65E9003D7B6B /* RMMapViewDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RMMapViewDelegate.h; sourceTree = "<group>"; }; 178 12F2031E0EBB65E9003D7B6B /* RMMapViewDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RMMapViewDelegate.h; sourceTree = "<group>"; };
  179 + 1606C9FC13D86BA300547581 /* RMOpenCycleMapSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RMOpenCycleMapSource.h; sourceTree = "<group>"; };
  180 + 1606C9FD13D86BA300547581 /* RMOpenCycleMapSource.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RMOpenCycleMapSource.m; sourceTree = "<group>"; };
177 160EEDAD13D41DEC007C5501 /* RMAnnotation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RMAnnotation.h; sourceTree = "<group>"; }; 181 160EEDAD13D41DEC007C5501 /* RMAnnotation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RMAnnotation.h; sourceTree = "<group>"; };
178 160EEDAE13D41DEC007C5501 /* RMAnnotation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RMAnnotation.m; sourceTree = "<group>"; }; 182 160EEDAE13D41DEC007C5501 /* RMAnnotation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RMAnnotation.m; sourceTree = "<group>"; };
179 16EC85CC133CA6C300219947 /* RMAbstractMercatorTileSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RMAbstractMercatorTileSource.h; sourceTree = "<group>"; }; 183 16EC85CC133CA6C300219947 /* RMAbstractMercatorTileSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RMAbstractMercatorTileSource.h; sourceTree = "<group>"; };
@@ -333,6 +337,8 @@ @@ -333,6 +337,8 @@
333 children = ( 337 children = (
334 D1437B33122869E400888DAE /* RMDBMapSource.h */, 338 D1437B33122869E400888DAE /* RMDBMapSource.h */,
335 D1437B32122869E400888DAE /* RMDBMapSource.m */, 339 D1437B32122869E400888DAE /* RMDBMapSource.m */,
  340 + 1606C9FC13D86BA300547581 /* RMOpenCycleMapSource.h */,
  341 + 1606C9FD13D86BA300547581 /* RMOpenCycleMapSource.m */,
336 B83E64ED0E80E73F001663B6 /* RMOpenStreetMapSource.h */, 342 B83E64ED0E80E73F001663B6 /* RMOpenStreetMapSource.h */,
337 B83E64EE0E80E73F001663B6 /* RMOpenStreetMapSource.m */, 343 B83E64EE0E80E73F001663B6 /* RMOpenStreetMapSource.m */,
338 ); 344 );
@@ -664,6 +670,7 @@ @@ -664,6 +670,7 @@
664 16EC85D4133CA6C300219947 /* RMAbstractWebMapSource.h in Headers */, 670 16EC85D4133CA6C300219947 /* RMAbstractWebMapSource.h in Headers */,
665 16EC85D6133CA6C300219947 /* RMCacheObject.h in Headers */, 671 16EC85D6133CA6C300219947 /* RMCacheObject.h in Headers */,
666 160EEDAF13D41DEC007C5501 /* RMAnnotation.h in Headers */, 672 160EEDAF13D41DEC007C5501 /* RMAnnotation.h in Headers */,
  673 + 1606C9FE13D86BA400547581 /* RMOpenCycleMapSource.h in Headers */,
667 ); 674 );
668 runOnlyForDeploymentPostprocessing = 0; 675 runOnlyForDeploymentPostprocessing = 0;
669 }; 676 };
@@ -880,6 +887,7 @@ @@ -880,6 +887,7 @@
880 16EC85D5133CA6C300219947 /* RMAbstractWebMapSource.m in Sources */, 887 16EC85D5133CA6C300219947 /* RMAbstractWebMapSource.m in Sources */,
881 16EC85D7133CA6C300219947 /* RMCacheObject.m in Sources */, 888 16EC85D7133CA6C300219947 /* RMCacheObject.m in Sources */,
882 160EEDB013D41DEC007C5501 /* RMAnnotation.m in Sources */, 889 160EEDB013D41DEC007C5501 /* RMAnnotation.m in Sources */,
  890 + 1606C9FF13D86BA400547581 /* RMOpenCycleMapSource.m in Sources */,
883 ); 891 );
884 runOnlyForDeploymentPostprocessing = 0; 892 runOnlyForDeploymentPostprocessing = 0;
885 }; 893 };