Permalink
Browse files

Added standard OpenMapQuest and Bing Aerial

  • Loading branch information...
1 parent caf9d24 commit 916db97fe391d78ed1c0eac0e45ec45f8cfaeb24 @davidchiles committed Nov 1, 2012
View
@@ -1 +1,4 @@
+[submodule "lib/mapbox"]
+ path = lib/mapbox
+ url = git://github.com/mapbox/mapbox-ios-sdk.git
@@ -222,7 +222,6 @@
632573B11520FFB200478B78 /* tileSource.plist in Resources */ = {isa = PBXBuildFile; fileRef = 632573B01520FFB100478B78 /* tileSource.plist */; };
632573DB152108BD00478B78 /* OPEStamenTerrain.m in Sources */ = {isa = PBXBuildFile; fileRef = 632573DA152108BD00478B78 /* OPEStamenTerrain.m */; };
632573DF15211A1C00478B78 /* OPEStamenToner.m in Sources */ = {isa = PBXBuildFile; fileRef = 632573DE15211A1C00478B78 /* OPEStamenToner.m */; };
- 632573E215211CE300478B78 /* OPEMapquestAerial.m in Sources */ = {isa = PBXBuildFile; fileRef = 632573E115211CE200478B78 /* OPEMapquestAerial.m */; };
6325B4451534B28B00C8691F /* location.png in Resources */ = {isa = PBXBuildFile; fileRef = 6325B4431534B28A00C8691F /* location.png */; };
6325B4461534B28B00C8691F /* location@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6325B4441534B28B00C8691F /* location@2x.png */; };
63292E6B1593ED670010A11B /* OPEBinaryCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 63292E621593ED670010A11B /* OPEBinaryCell.m */; };
@@ -350,6 +349,7 @@
63E525EB1536560300D2DA35 /* Tags.plist in Resources */ = {isa = PBXBuildFile; fileRef = 63E525EA1536560200D2DA35 /* Tags.plist */; };
63F1F28615A7AD630027829B /* OPEWay.m in Sources */ = {isa = PBXBuildFile; fileRef = 63F1F28515A7AD630027829B /* OPEWay.m */; };
63F9CCA514F32B2E00308DE1 /* iphone_delete_button.png in Resources */ = {isa = PBXBuildFile; fileRef = 63F9CCA414F32B2E00308DE1 /* iphone_delete_button.png */; };
+ 63FCA4421643127D00A28470 /* OPEBingTileSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 63FCA4411643127D00A28470 /* OPEBingTileSource.m */; };
63FFDC6614E480DF00701DEC /* OPETagInterpreter.m in Sources */ = {isa = PBXBuildFile; fileRef = 63FFDC6514E480DF00701DEC /* OPETagInterpreter.m */; };
/* End PBXBuildFile section */
@@ -591,8 +591,6 @@
632573DA152108BD00478B78 /* OPEStamenTerrain.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OPEStamenTerrain.m; sourceTree = "<group>"; };
632573DD15211A1C00478B78 /* OPEStamenToner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OPEStamenToner.h; sourceTree = "<group>"; };
632573DE15211A1C00478B78 /* OPEStamenToner.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OPEStamenToner.m; sourceTree = "<group>"; };
- 632573E015211CE200478B78 /* OPEMapquestAerial.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OPEMapquestAerial.h; sourceTree = "<group>"; };
- 632573E115211CE200478B78 /* OPEMapquestAerial.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OPEMapquestAerial.m; sourceTree = "<group>"; };
6325B4431534B28A00C8691F /* location.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = location.png; path = icons/location.png; sourceTree = "<group>"; };
6325B4441534B28B00C8691F /* location@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "location@2x.png"; path = "icons/location@2x.png"; sourceTree = "<group>"; };
63292E611593ED670010A11B /* OPEBinaryCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OPEBinaryCell.h; sourceTree = "<group>"; };
@@ -808,6 +806,8 @@
63F1F28415A7AD630027829B /* OPEWay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OPEWay.h; sourceTree = "<group>"; };
63F1F28515A7AD630027829B /* OPEWay.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OPEWay.m; sourceTree = "<group>"; };
63F9CCA414F32B2E00308DE1 /* iphone_delete_button.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = iphone_delete_button.png; sourceTree = "<group>"; };
+ 63FCA4401643127D00A28470 /* OPEBingTileSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OPEBingTileSource.h; sourceTree = "<group>"; };
+ 63FCA4411643127D00A28470 /* OPEBingTileSource.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OPEBingTileSource.m; sourceTree = "<group>"; };
63FFDC6414E480DF00701DEC /* OPETagInterpreter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OPETagInterpreter.h; path = ../OPETagInterpreter.h; sourceTree = "<group>"; };
63FFDC6514E480DF00701DEC /* OPETagInterpreter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OPETagInterpreter.m; path = ../OPETagInterpreter.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
@@ -1085,8 +1085,8 @@
632573DA152108BD00478B78 /* OPEStamenTerrain.m */,
632573DD15211A1C00478B78 /* OPEStamenToner.h */,
632573DE15211A1C00478B78 /* OPEStamenToner.m */,
- 632573E015211CE200478B78 /* OPEMapquestAerial.h */,
- 632573E115211CE200478B78 /* OPEMapquestAerial.m */,
+ 63FCA4401643127D00A28470 /* OPEBingTileSource.h */,
+ 63FCA4411643127D00A28470 /* OPEBingTileSource.m */,
);
name = MapSources;
sourceTree = "<group>";
@@ -1854,7 +1854,6 @@
6383949714EC7DAC00C74A57 /* GTMHTTPFetcher.m in Sources */,
632573DB152108BD00478B78 /* OPEStamenTerrain.m in Sources */,
632573DF15211A1C00478B78 /* OPEStamenToner.m in Sources */,
- 632573E215211CE300478B78 /* OPEMapquestAerial.m in Sources */,
636D7819152E58F8005E31A3 /* MBProgressHUD.m in Sources */,
63E525D21534D90500D2DA35 /* OPECreditViewController.m in Sources */,
6310F4B6153736D000C65FD8 /* OPEMessage.m in Sources */,
@@ -1866,6 +1865,7 @@
63CE5DC115BE085E00C84B90 /* OPEOptionalTag.m in Sources */,
63AD8F7A15E8570B006F92B8 /* OPECategory.m in Sources */,
63AD8F7D15E8577E006F92B8 /* OPEType.m in Sources */,
+ 63FCA4421643127D00A28470 /* OPEBingTileSource.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1952,10 +1952,12 @@
"$(SDKROOT)/usr/include/libxml2",
);
INFOPLIST_FILE = "OSM POI Editor/OSM POI Editor-Info.plist";
+ IPHONEOS_DEPLOYMENT_TARGET = 5.0;
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/../../../Library/Developer/Xcode/DerivedData/OSM_POI_Editor-eqgolvplfdafjffvryvwtjldlhbj/Build/Products/Debug-iphoneos\"",
);
+ ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "-ObjC";
OTHER_TEST_FLAGS = "";
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -1980,10 +1982,12 @@
"$(SDKROOT)/usr/include/libxml2",
);
INFOPLIST_FILE = "OSM POI Editor/OSM POI Editor-Info.plist";
+ IPHONEOS_DEPLOYMENT_TARGET = 5.0;
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/../../../Library/Developer/Xcode/DerivedData/OSM_POI_Editor-eqgolvplfdafjffvryvwtjldlhbj/Build/Products/Debug-iphoneos\"",
);
+ ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "-ObjC";
OTHER_TEST_FLAGS = "";
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -180,7 +180,7 @@
endingColumnNumber = "9223372036854775807"
startingLineNumber = "223"
endingLineNumber = "223"
- landmarkName = "-addMarkerAt:withNode:"
+ landmarkName = "-mapView:layerForAnnotation:"
landmarkType = "5">
</FileBreakpoint>
<FileBreakpoint
@@ -214,11 +214,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "OSM POI Editor/OPEInfoViewController.m"
- timestampString = "371691561.845876"
+ timestampString = "373496867.031686"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "325"
- endingLineNumber = "325"
+ startingLineNumber = "329"
+ endingLineNumber = "329"
landmarkName = "-loggedIn"
landmarkType = "5">
</FileBreakpoint>
@@ -284,7 +284,7 @@
endingColumnNumber = "9223372036854775807"
startingLineNumber = "543"
endingLineNumber = "543"
- landmarkName = "-createdNode:"
+ landmarkName = "-updatedNode:"
landmarkType = "5">
</FileBreakpoint>
<FileBreakpoint
@@ -479,7 +479,7 @@
endingColumnNumber = "9223372036854775807"
startingLineNumber = "483"
endingLineNumber = "483"
- landmarkName = "-addMarkers:"
+ landmarkName = "-afterMapTouch:"
landmarkType = "5">
</FileBreakpoint>
<FileBreakpoint
@@ -583,7 +583,7 @@
endingColumnNumber = "9223372036854775807"
startingLineNumber = "358"
endingLineNumber = "358"
- landmarkName = "-tapOnLabelForMarker:onMap:onLayer:"
+ landmarkName = "-tapOnMarker:onMap:"
landmarkType = "5">
</FileBreakpoint>
<FileBreakpoint
@@ -812,11 +812,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "OSM POI Editor/OPEInfoViewController.m"
- timestampString = "371691561.845876"
+ timestampString = "373496867.031686"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "160"
- endingLineNumber = "160"
+ startingLineNumber = "161"
+ endingLineNumber = "161"
landmarkName = "-signInToOSM"
landmarkType = "5">
</FileBreakpoint>
@@ -825,11 +825,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "OSM POI Editor/OPEInfoViewController.m"
- timestampString = "371691561.845876"
+ timestampString = "373496867.031686"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "284"
- endingLineNumber = "284"
+ startingLineNumber = "288"
+ endingLineNumber = "288"
landmarkName = "-tableView:didSelectRowAtIndexPath:"
landmarkType = "5">
</FileBreakpoint>
@@ -838,11 +838,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "OSM POI Editor/OPEInfoViewController.m"
- timestampString = "371691561.845876"
+ timestampString = "373496867.031686"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "373"
- endingLineNumber = "373"
+ startingLineNumber = "380"
+ endingLineNumber = "380"
landmarkName = "-viewDidAppear:"
landmarkType = "5">
</FileBreakpoint>
@@ -851,11 +851,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "OSM POI Editor/OPEInfoViewController.m"
- timestampString = "371691561.845876"
+ timestampString = "373496867.031686"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "316"
- endingLineNumber = "316"
+ startingLineNumber = "320"
+ endingLineNumber = "320"
landmarkName = "-loggedIn"
landmarkType = "5">
</FileBreakpoint>
@@ -0,0 +1,41 @@
+//
+// RMBingSource.h
+//
+// Copyright (c) 2008-2012, Route-Me Contributors
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//
+// * Redistributions of source code must retain the above copyright notice, this
+// list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+
+#import "RMAbstractWebMapSource.h"
+
+typedef enum NSUInteger {
+ RMBingImagerySetRoad = 0, // default
+ RMBingImagerySetAerial = 1,
+ RMBingImagerySetAerialWithLabels = 2,
+} RMBingImagerySet;
+
+@interface OPEBingTileSource : RMAbstractWebMapSource
+
+- (id)initWithMapsKey:(NSString *)mapsKey;
+- (id)initWithMapsKey:(NSString *)mapsKey forImagerySet:(RMBingImagerySet)imagerySet;
+
+@end
@@ -0,0 +1,150 @@
+//
+// RMBingSource.m
+//
+// Copyright (c) 2008-2012, Route-Me Contributors
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//
+// * Redistributions of source code must retain the above copyright notice, this
+// list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+
+#import "OPEBingTileSource.h"
+
+@implementation OPEBingTileSource
+{
+ NSString *_mapsKey;
+ NSString *_imageURLString;
+ RMBingImagerySet _imagerySet;
+}
+
+- (id)initWithMapsKey:(NSString *)mapsKey
+{
+ return [self initWithMapsKey:mapsKey forImagerySet:RMBingImagerySetAerial];
+}
+
+- (id)initWithMapsKey:(NSString *)mapsKey forImagerySet:(RMBingImagerySet)imagerySet;
+{
+ if (self = [super init])
+ {
+ _mapsKey = mapsKey;
+
+ _imagerySet = imagerySet;
+
+ self.minZoom = 1;
+ self.maxZoom = 21;
+
+ return self;
+ }
+
+ return nil;
+}
+
+- (void)dealloc
+{
+ _mapsKey = nil;
+ _imageURLString = nil;
+}
+
+- (NSURL *)URLForTile:(RMTile)tile
+{
+ if ( ! _imageURLString)
+ {
+ NSString *imagerySetString;
+
+ if (_imagerySet == RMBingImagerySetAerial)
+ imagerySetString = @"Aerial";
+ else if (_imagerySet == RMBingImagerySetAerialWithLabels)
+ imagerySetString = @"AerialWithLabels";
+ else
+ imagerySetString = @"Road";
+
+ NSURL *metadataURL = [NSURL URLWithString:[NSString stringWithFormat:@"http://dev.virtualearth.net/REST/v1/Imagery/Metadata/%@?key=%@", imagerySetString, _mapsKey]];
+
+ NSData *metadataData = [NSData dataWithContentsOfURL:metadataURL];
+
+ id metadata = [NSJSONSerialization JSONObjectWithData:metadataData options:0 error:nil];
+
+ if (metadata && [metadata isKindOfClass:[NSDictionary class]] && [[metadata objectForKey:@"statusCode"] intValue] == 200)
+ {
+ NSDictionary *resources = [[[[(NSDictionary *)metadata objectForKey:@"resourceSets"] objectAtIndex:0] objectForKey:@"resources"] objectAtIndex:0];
+
+ _imageURLString = [[[resources objectForKey:@"imageUrl"] stringByReplacingOccurrencesOfString:@"{subdomain}"
+ withString:[[resources objectForKey:@"imageUrlSubdomains"] objectAtIndex:0]] copy];
+ }
+ }
+
+ if ( ! _imageURLString)
+ return nil;
+
+ NSMutableString *tileURLString = [NSMutableString stringWithString:_imageURLString];
+
+ [tileURLString replaceOccurrencesOfString:@"{culture}" withString:@"en" options:0 range:NSMakeRange(0, [tileURLString length])];
+
+ NSMutableString *quadKey = [NSMutableString string];
+
+ for (int i = tile.zoom; i > 0; i--)
+ {
+ int digit = 0;
+
+ int mask = 1 << (i - 1);
+
+ if ((tile.x & mask) != 0)
+ digit++;
+
+ if ((tile.y & mask) != 0)
+ {
+ digit++;
+ digit++;
+ }
+
+ [quadKey appendString:[NSString stringWithFormat:@"%i", digit]];
+ }
+
+ [tileURLString replaceOccurrencesOfString:@"{quadkey}" withString:quadKey options:0 range:NSMakeRange(0, [tileURLString length])];
+
+ return [NSURL URLWithString:tileURLString];
+}
+
+- (NSString *)uniqueTilecacheKey
+{
+ return [NSString stringWithFormat:@"Bing%i", _imagerySet];
+}
+
+- (NSString *)shortName
+{
+ return @"Bing";
+}
+
+- (NSString *)longDescription
+{
+ return @"Microsoft Bing Maps";
+}
+
+- (NSString *)shortAttribution
+{
+ return @"Copyright © 2012 Microsoft";
+}
+
+- (NSString *)longAttribution
+{
+ return @"Copyright © 2012 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.";
+}
+
+@end
Oops, something went wrong. Retry.

0 comments on commit 916db97

Please sign in to comment.