Authored by Hal Mueller

dropped "get" prefix where appropriate, and corrected latitudeLongitudeBoundingB…

…oxFor: to account for keystoning. Renamed RMOpenStreetMapsSource to RMOpenStreetMapSource
... ... @@ -32,16 +32,18 @@
#if TARGET_OS_IPHONE
#import <CoreLocation/CoreLocation.h>
/*! \struct RMLatLongBounds
/*! \struct RMSphericalTrapezium
\brief Specifies a spherical trapezium by northwest and southeast corners, each given as CLLocationCoordinate2D.
\brief Specifies a spherical trapezium by northwest and southeast corners, each given as CLLocationCoordinate2D, similar to specifying the corners of a box.
A spherical trapezium is the surface of a sphere or ellipsoid bounded by two meridians and two parallels. Note that in almost all cases, the lengths of the northern and southern sides of the box are different.
\deprecated Note: northWest and southEast will change to northeast and southwest (note spelling and corner changes) after 0.5 to keep right-handed coordinate system
*/
typedef struct {
CLLocationCoordinate2D northWest;
CLLocationCoordinate2D southEast;
} RMLatLongBounds;
CLLocationCoordinate2D northeast;
CLLocationCoordinate2D southwest;
} RMSphericalTrapezium;
#else
... ...
... ... @@ -196,8 +196,7 @@ enum {
- (void)adjustMapPlacementWithScale:(float)aScale;
/// \deprecated removed after 0.5
- (void)setZoomBounds:(float)aMinZoom maxZoom:(float)aMaxZoom;
/// \deprecated renamed after 0.5
- (float)getNextNativeZoomFactor;
- (float)nextNativeZoomFactor;
- (void) drawRect: (CGRect) rect;
... ... @@ -219,10 +218,10 @@ enum {
- (void)zoomWithLatLngBoundsNorthEast:(CLLocationCoordinate2D)ne SouthWest:(CLLocationCoordinate2D)se;
- (void)zoomWithRMMercatorRectBounds:(RMProjectedRect)bounds;
/// \deprecated name change pending after 0.5
- (RMLatLongBounds) getScreenCoordinateBounds;
/// \deprecated name change pending after 0.5
- (RMLatLongBounds) getCoordinateBounds:(CGRect) rect;
/// returns the smallest bounding box containing the entire screen
- (RMSphericalTrapezium) latitudeLongitudeBoundingBoxForScreen;
/// returns the smallest bounding box containing a rectangular region of the screen
- (RMSphericalTrapezium) latitudeLongitudeBoundingBoxFor:(CGRect) rect;
- (void) tilesUpdatedRegion:(CGRect)region;
... ... @@ -266,9 +265,9 @@ enum {
- (void)zoomWithRMMercatorRectBounds:(RMProjectedRect)bounds;
/// \deprecated name change pending after 0.5
- (RMLatLongBounds) getScreenCoordinateBounds;
- (RMSphericalTrapezium) latitudeLongitudeBoundingBoxForScreen;
/// \deprecated name change pending after 0.5
- (RMLatLongBounds) getCoordinateBounds:(CGRect) rect;
- (RMSphericalTrapezium) latitudeLongitudeBoundingBoxFor:(CGRect) rect;
- (void) tilesUpdatedRegion:(CGRect)region;
... ...
... ... @@ -37,7 +37,7 @@
#import "RMTileLoader.h"
#import "RMTileImageSet.h"
#import "RMOpenStreetMapsSource.h"
#import "RMOpenStreetMapSource.h"
#import "RMCoreAnimationRenderer.h"
#import "RMCachedTileSource.h"
... ... @@ -72,7 +72,7 @@
here.longitude = kDefaultInitialLongitude;
return [self initWithView:view
tilesource:[[RMOpenStreetMapsSource alloc] init]
tilesource:[[RMOpenStreetMapSource alloc] init]
centerLatLon:here
zoomLevel:kDefaultInitialZoomLevel
maxZoomLevel:kDefaultMaximumZoomLevel
... ... @@ -176,7 +176,7 @@
{
WarnDeprecated();
LogMethod();
id<RMTileSource> _tileSource = [[RMOpenStreetMapsSource alloc] init];
id<RMTileSource> _tileSource = [[RMOpenStreetMapSource alloc] init];
RMMapRenderer *_renderer = [[RMCoreAnimationRenderer alloc] initWithContent:self];
id mapContents = [self initForView:view WithTileSource:_tileSource WithRenderer:_renderer LookingAt:latlong];
... ... @@ -525,7 +525,7 @@
[self zoomInToNextNativeZoomAt:pivot animated:NO];
}
- (float)getNextNativeZoomFactor
- (float)nextNativeZoomFactor
{
float newZoom = roundf([self zoom] + 1);
return newZoom >= [self maxZoom] ? 0 : exp2f(newZoom - [self zoom]);
... ... @@ -929,39 +929,58 @@ static BOOL _performExpensiveOperations = YES;
// Move overlays stuff here - at the moment overlay stuff is above...
- (RMLatLongBounds) getScreenCoordinateBounds
- (RMSphericalTrapezium) latitudeLongitudeBoundingBoxForScreen
{
CGRect rect = [mercatorToScreenProjection screenBounds];
return [self getCoordinateBounds:rect];
return [self latitudeLongitudeBoundingBoxFor:rect];
}
- (RMLatLongBounds) getCoordinateBounds:(CGRect) rect
- (RMSphericalTrapezium) latitudeLongitudeBoundingBoxFor:(CGRect) rect
{
RMLatLongBounds bounds;
CGPoint northWest = rect.origin;
CGPoint southEast;
southEast.x = rect.origin.x + rect.size.width;
southEast.y = rect.origin.y + rect.size.height;
// RMLog(@"NortWest x:%lf y:%lf", northWest.x, northWest.y);
// RMLog(@"SouthEast x:%lf y:%lf", southEast.x, southEast.y);
bounds.northWest = [self pixelToLatLong:northWest];
bounds.southEast = [self pixelToLatLong:southEast];
// RMLog(@"NortWest Lat:%lf Lon:%lf", bounds.northWest.latitude, bounds.northWest.longitude);
// RMLog(@"SouthEast Lat:%lf Lon:%lf", bounds.southEast.latitude, bounds.southEast.longitude);
RMSphericalTrapezium boundingBox;
CGPoint northwestScreen = rect.origin;
CGPoint southeastScreen;
southeastScreen.x = rect.origin.x + rect.size.width;
southeastScreen.y = rect.origin.y + rect.size.height;
CGPoint northeastScreen, southwestScreen;
northeastScreen.x = southeastScreen.x;
northeastScreen.y = northwestScreen.y;
southwestScreen.x = northwestScreen.x;
southwestScreen.y = southeastScreen.y;
CLLocationCoordinate2D northeastLL, northwestLL, southeastLL, southwestLL;
northeastLL = [self pixelToLatLong:northeastScreen];
northwestLL = [self pixelToLatLong:northwestScreen];
southeastLL = [self pixelToLatLong:southeastScreen];
southwestLL = [self pixelToLatLong:southwestScreen];
boundingBox.northeast.latitude = fmax(northeastLL.latitude, northwestLL.latitude);
boundingBox.southwest.latitude = fmin(southeastLL.latitude, southwestLL.latitude);
// westerly computations:
// -179, -178 -> -179 (min)
// -179, 179 -> 179 (max)
if (fabs(northwestLL.longitude - southwestLL.longitude) <= 180.)
boundingBox.southwest.longitude = fmin(northwestLL.longitude, southwestLL.longitude);
else
boundingBox.southwest.longitude = fmax(northwestLL.longitude, southwestLL.longitude);
return bounds;
if (fabs(northeastLL.longitude - southeastLL.longitude) <= 180.)
boundingBox.northeast.longitude = fmax(northeastLL.longitude, southeastLL.longitude);
else
boundingBox.northeast.longitude = fmin(northeastLL.longitude, southeastLL.longitude);
return boundingBox;
}
- (void) tilesUpdatedRegion:(CGRect)region
{
if(delegateHasRegionUpdate)
{
RMLatLongBounds locationBounds = [self getCoordinateBounds:region];
RMSphericalTrapezium locationBounds = [self latitudeLongitudeBoundingBoxFor:region];
[tilesUpdateDelegate regionUpdate:locationBounds];
}
}
... ...
... ... @@ -230,7 +230,7 @@
#pragma mark Event handling
- (RMGestureDetails) getGestureDetails: (NSSet*) touches
- (RMGestureDetails) gestureDetails: (NSSet*) touches
{
RMGestureDetails gesture;
gesture.center.x = gesture.center.y = 0;
... ... @@ -327,7 +327,7 @@
}
// RMLog(@"touchesBegan %d", [[event allTouches] count]);
lastGesture = [self getGestureDetails:[event allTouches]];
lastGesture = [self gestureDetails:[event allTouches]];
if(deceleration)
{
... ... @@ -373,7 +373,7 @@
NSInteger lastTouches = lastGesture.numTouches;
// Calculate the gesture.
lastGesture = [self getGestureDetails:[event allTouches]];
lastGesture = [self gestureDetails:[event allTouches]];
// If there are no more fingers on the screen, resume any slow operations.
if (lastGesture.numTouches == 0)
... ... @@ -389,7 +389,7 @@
[delegate doubleTapOnMap: self At: lastGesture.center];
} else {
// Default behaviour matches built in maps.app
float nextZoomFactor = [self.contents getNextNativeZoomFactor];
float nextZoomFactor = [self.contents nextNativeZoomFactor];
if (nextZoomFactor != 0)
[self zoomByFactor:nextZoomFactor near:[touch locationInView:self] animated:YES];
}
... ... @@ -479,7 +479,7 @@
}
}
RMGestureDetails newGesture = [self getGestureDetails:[event allTouches]];
RMGestureDetails newGesture = [self gestureDetails:[event allTouches]];
if (enableDragging && newGesture.numTouches == lastGesture.numTouches)
{
... ...
... ... @@ -47,15 +47,15 @@
- (void) hideAllMarkers;
- (void) unhideAllMarkers;
- (NSArray *)getMarkers;
- (NSArray *)markers;
- (void) removeMarker:(RMMarker *)marker;
- (void) removeMarkers:(NSArray *)markers;
/// \deprecated to be renamed screenCoordinates after 0.5
- (CGPoint) getMarkerScreenCoordinate: (RMMarker *)marker;
- (CGPoint) screenCoordinatesForMarker: (RMMarker *)marker;
/// \deprecated to be renamed after 0.5
- (CLLocationCoordinate2D) getMarkerCoordinate2D: (RMMarker *) marker;
- (CLLocationCoordinate2D) latitudeLongitudeForMarker: (RMMarker *) marker;
/// \deprecated to be renamed markersForScreenBounds after 0.5
- (NSArray *) getMarkersForScreenBounds;
- (NSArray *) markersWithinScreenBounds;
- (BOOL) isMarkerWithinScreenBounds:(RMMarker*)marker;
- (BOOL) isMarker:(RMMarker*)marker withinBounds:(CGRect)rect;
- (BOOL) managingMarker:(RMMarker*)marker;
... ...
... ... @@ -100,7 +100,7 @@
#pragma mark Marker information
/// \deprecated violates Objective-C naming rules
- (NSArray *)getMarkers
- (NSArray *)markers
{
return [[contents overlay] sublayers];
}
... ... @@ -115,25 +115,22 @@
[[contents overlay] removeSublayers:markers];
}
/// \deprecated violates Objective-C naming rules
- (CGPoint) getMarkerScreenCoordinate: (RMMarker *)marker
- (CGPoint) screenCoordinatesForMarker: (RMMarker *)marker
{
return [[contents mercatorToScreenProjection] projectXYPoint:[marker projectedLocation]];
}
/// \deprecated violates Objective-C naming rules, confusing name
- (CLLocationCoordinate2D) getMarkerCoordinate2D: (RMMarker *) marker
- (CLLocationCoordinate2D) latitudeLongitudeForMarker: (RMMarker *) marker
{
return [contents pixelToLatLong:[self getMarkerScreenCoordinate:marker]];
return [contents pixelToLatLong:[self screenCoordinatesForMarker:marker]];
}
/// \deprecated violates Objective-C naming rules
- (NSArray *) getMarkersForScreenBounds
- (NSArray *) markersWithinScreenBounds
{
NSMutableArray *markersInScreenBounds = [NSMutableArray array];
CGRect rect = [[contents mercatorToScreenProjection] screenBounds];
for (RMMarker *marker in [self getMarkers]) {
for (RMMarker *marker in [self markers]) {
if ([self isMarker:marker withinBounds:rect]) {
[markersInScreenBounds addObject:marker];
}
... ... @@ -154,7 +151,7 @@
return NO;
}
CGPoint markerCoord = [self getMarkerScreenCoordinate:marker];
CGPoint markerCoord = [self screenCoordinatesForMarker:marker];
if ( markerCoord.x > rect.origin.x
&& markerCoord.x < rect.origin.x + rect.size.width
... ... @@ -169,7 +166,7 @@
/// \deprecated violates Objective-C naming rules
- (BOOL) managingMarker:(RMMarker*)marker
{
if (marker != nil && [[self getMarkers] indexOfObject:marker] != NSNotFound) {
if (marker != nil && [[self markers] indexOfObject:marker] != NSNotFound) {
return YES;
}
return NO;
... ...
... ... @@ -32,7 +32,7 @@
Provides key-based access to tiles from the Open Street Map project.
*/
@interface RMOpenStreetMapsSource : RMAbstractMercatorWebSource <RMAbstractMercatorWebSource>{
@interface RMOpenStreetMapSource : RMAbstractMercatorWebSource <RMAbstractMercatorWebSource>{
}
@end
... ...
... ... @@ -25,9 +25,9 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
#import "RMOpenStreetMapsSource.h"
#import "RMOpenStreetMapSource.h"
@implementation RMOpenStreetMapsSource
@implementation RMOpenStreetMapSource
-(NSString*) tileURL: (RMTile) tile
{
... ...
... ... @@ -48,10 +48,10 @@
@property (readonly) RMProjectedRect planetBounds;
@property (readwrite) BOOL projectionWrapsHorizontally;
/// If #projectionWrapsHorizontally, returns #aPoint with easting adjusted modulo Earth's diameter to be within projection's bounds. if !#projectionWrapsHorizontally, returns #aPoint unchanged.
/// If #projectionWrapsHorizontally, returns #aPoint with its easting adjusted modulo Earth's diameter to be within projection's planetBounds. if !#projectionWrapsHorizontally, returns #aPoint unchanged.
- (RMProjectedPoint) wrapPointHorizontally: (RMProjectedPoint) aPoint;
/// applies #wrapPointHorizontally to aPoint, and then clamps northing (Y coordinate) to projection's bounds
/// applies #wrapPointHorizontally to aPoint, and then clamps northing (Y coordinate) to projection's planetBounds
- (RMProjectedPoint) constrainPointToBounds: (RMProjectedPoint) aPoint;
+ (RMProjection *) googleProjection;
... ...
... ... @@ -13,6 +13,6 @@
@required
- (void) regionUpdate: (RMLatLongBounds) region;
- (void) regionUpdate: (RMSphericalTrapezium) region;
@end
... ...
... ... @@ -79,7 +79,7 @@
2BEC60430F8AC729008FB858 /* RMMemoryCache.m in Sources */ = {isa = PBXBuildFile; fileRef = B83E64D30E80E73F001663B6 /* RMMemoryCache.m */; };
2BEC60440F8AC729008FB858 /* RMMercatorToScreenProjection.m in Sources */ = {isa = PBXBuildFile; fileRef = B83E64C90E80E73F001663B6 /* RMMercatorToScreenProjection.m */; };
2BEC60450F8AC72B008FB858 /* RMOpenAerialMapSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 2B5682710F68E36000E8DF40 /* RMOpenAerialMapSource.m */; };
2BEC60460F8AC72C008FB858 /* RMOpenStreetMapsSource.m in Sources */ = {isa = PBXBuildFile; fileRef = B83E64EE0E80E73F001663B6 /* RMOpenStreetMapsSource.m */; };
2BEC60460F8AC72C008FB858 /* RMOpenStreetMapSource.m in Sources */ = {isa = PBXBuildFile; fileRef = B83E64EE0E80E73F001663B6 /* RMOpenStreetMapSource.m */; };
2BEC60470F8AC72E008FB858 /* RMPath.m in Sources */ = {isa = PBXBuildFile; fileRef = B8CEB1C40ED5A3480014C431 /* RMPath.m */; };
2BEC60480F8AC72F008FB858 /* RMPixel.c in Sources */ = {isa = PBXBuildFile; fileRef = B83E64B70E80E73F001663B6 /* RMPixel.c */; };
2BEC60490F8AC738008FB858 /* RMProjection.m in Sources */ = {isa = PBXBuildFile; fileRef = B83E64E40E80E73F001663B6 /* RMProjection.m */; };
... ... @@ -127,7 +127,7 @@
B8C9741D0E8A19B2007D16AD /* RMCoreAnimationRenderer.h in Headers */ = {isa = PBXBuildFile; fileRef = B83E64BD0E80E73F001663B6 /* RMCoreAnimationRenderer.h */; };
B8C974220E8A19B2007D16AD /* RMProjection.h in Headers */ = {isa = PBXBuildFile; fileRef = B83E64E30E80E73F001663B6 /* RMProjection.h */; };
B8C974230E8A19B2007D16AD /* RMTileCache.h in Headers */ = {isa = PBXBuildFile; fileRef = B83E64D00E80E73F001663B6 /* RMTileCache.h */; };
B8C974250E8A19B2007D16AD /* RMOpenStreetMapsSource.h in Headers */ = {isa = PBXBuildFile; fileRef = B83E64ED0E80E73F001663B6 /* RMOpenStreetMapsSource.h */; settings = {ATTRIBUTES = (Public, ); }; };
B8C974250E8A19B2007D16AD /* RMOpenStreetMapSource.h in Headers */ = {isa = PBXBuildFile; fileRef = B83E64ED0E80E73F001663B6 /* RMOpenStreetMapSource.h */; settings = {ATTRIBUTES = (Public, ); }; };
B8C974260E8A19B2007D16AD /* RMTile.h in Headers */ = {isa = PBXBuildFile; fileRef = B83E64D60E80E73F001663B6 /* RMTile.h */; };
B8C974270E8A19B2007D16AD /* RMPixel.h in Headers */ = {isa = PBXBuildFile; fileRef = B83E64B60E80E73F001663B6 /* RMPixel.h */; };
B8C974290E8A19B2007D16AD /* RMFileTileImage.h in Headers */ = {isa = PBXBuildFile; fileRef = B83E64DE0E80E73F001663B6 /* RMFileTileImage.h */; };
... ... @@ -141,7 +141,7 @@
B8C9743A0E8A19B2007D16AD /* RMCoreAnimationRenderer.m in Sources */ = {isa = PBXBuildFile; fileRef = B83E64BE0E80E73F001663B6 /* RMCoreAnimationRenderer.m */; };
B8C9743F0E8A19B2007D16AD /* RMTileImage.m in Sources */ = {isa = PBXBuildFile; fileRef = B83E64D90E80E73F001663B6 /* RMTileImage.m */; };
B8C974400E8A19B2007D16AD /* RMTile.c in Sources */ = {isa = PBXBuildFile; fileRef = B83E64D70E80E73F001663B6 /* RMTile.c */; };
B8C974410E8A19B2007D16AD /* RMOpenStreetMapsSource.m in Sources */ = {isa = PBXBuildFile; fileRef = B83E64EE0E80E73F001663B6 /* RMOpenStreetMapsSource.m */; };
B8C974410E8A19B2007D16AD /* RMOpenStreetMapSource.m in Sources */ = {isa = PBXBuildFile; fileRef = B83E64EE0E80E73F001663B6 /* RMOpenStreetMapSource.m */; };
B8C974420E8A19B2007D16AD /* RMMemoryCache.m in Sources */ = {isa = PBXBuildFile; fileRef = B83E64D30E80E73F001663B6 /* RMMemoryCache.m */; };
B8C974430E8A19B2007D16AD /* RMPixel.c in Sources */ = {isa = PBXBuildFile; fileRef = B83E64B70E80E73F001663B6 /* RMPixel.c */; };
B8C974440E8A19B2007D16AD /* RMFractalTileProjection.m in Sources */ = {isa = PBXBuildFile; fileRef = B83E64EA0E80E73F001663B6 /* RMFractalTileProjection.m */; };
... ... @@ -294,8 +294,8 @@
B83E64E90E80E73F001663B6 /* RMFractalTileProjection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RMFractalTileProjection.h; sourceTree = "<group>"; };
B83E64EA0E80E73F001663B6 /* RMFractalTileProjection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RMFractalTileProjection.m; sourceTree = "<group>"; };
B83E64EC0E80E73F001663B6 /* RMTileSource.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = RMTileSource.h; sourceTree = "<group>"; };
B83E64ED0E80E73F001663B6 /* RMOpenStreetMapsSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RMOpenStreetMapsSource.h; sourceTree = "<group>"; };
B83E64EE0E80E73F001663B6 /* RMOpenStreetMapsSource.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RMOpenStreetMapsSource.m; sourceTree = "<group>"; };
B83E64ED0E80E73F001663B6 /* RMOpenStreetMapSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RMOpenStreetMapSource.h; sourceTree = "<group>"; };
B83E64EE0E80E73F001663B6 /* RMOpenStreetMapSource.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RMOpenStreetMapSource.m; sourceTree = "<group>"; };
B83E654A0E80E7A8001663B6 /* Proj4.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Proj4.xcodeproj; path = ../Proj4/Proj4.xcodeproj; sourceTree = SOURCE_ROOT; };
B83E65590E80E7EB001663B6 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; };
B83E65630E80E81C001663B6 /* CoreLocation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreLocation.framework; path = System/Library/Frameworks/CoreLocation.framework; sourceTree = SDKROOT; };
... ... @@ -573,8 +573,8 @@
B83E64EC0E80E73F001663B6 /* RMTileSource.h */,
C7A967500E8412930031BA75 /* RMAbstractMercatorWebSource.h */,
C7A967510E8412930031BA75 /* RMAbstractMercatorWebSource.m */,
B83E64ED0E80E73F001663B6 /* RMOpenStreetMapsSource.h */,
B83E64EE0E80E73F001663B6 /* RMOpenStreetMapsSource.m */,
B83E64ED0E80E73F001663B6 /* RMOpenStreetMapSource.h */,
B83E64EE0E80E73F001663B6 /* RMOpenStreetMapSource.m */,
C7A9675C0E84134B0031BA75 /* RMVirtualEarthSource.h */,
C7A9675D0E84134B0031BA75 /* RMVirtualEarthSource.m */,
B885ABB00EBB1332002206AB /* RMCloudMadeMapSource.h */,
... ... @@ -716,7 +716,7 @@
B8C9741D0E8A19B2007D16AD /* RMCoreAnimationRenderer.h in Headers */,
B8C974220E8A19B2007D16AD /* RMProjection.h in Headers */,
B8C974230E8A19B2007D16AD /* RMTileCache.h in Headers */,
B8C974250E8A19B2007D16AD /* RMOpenStreetMapsSource.h in Headers */,
B8C974250E8A19B2007D16AD /* RMOpenStreetMapSource.h in Headers */,
B8C974260E8A19B2007D16AD /* RMTile.h in Headers */,
B8C974270E8A19B2007D16AD /* RMPixel.h in Headers */,
B8C974290E8A19B2007D16AD /* RMFileTileImage.h in Headers */,
... ... @@ -918,7 +918,7 @@
2BEC60430F8AC729008FB858 /* RMMemoryCache.m in Sources */,
2BEC60440F8AC729008FB858 /* RMMercatorToScreenProjection.m in Sources */,
2BEC60450F8AC72B008FB858 /* RMOpenAerialMapSource.m in Sources */,
2BEC60460F8AC72C008FB858 /* RMOpenStreetMapsSource.m in Sources */,
2BEC60460F8AC72C008FB858 /* RMOpenStreetMapSource.m in Sources */,
2BEC60470F8AC72E008FB858 /* RMPath.m in Sources */,
2BEC60480F8AC72F008FB858 /* RMPixel.c in Sources */,
2BEC60490F8AC738008FB858 /* RMProjection.m in Sources */,
... ... @@ -954,7 +954,7 @@
B8C9743A0E8A19B2007D16AD /* RMCoreAnimationRenderer.m in Sources */,
B8C9743F0E8A19B2007D16AD /* RMTileImage.m in Sources */,
B8C974400E8A19B2007D16AD /* RMTile.c in Sources */,
B8C974410E8A19B2007D16AD /* RMOpenStreetMapsSource.m in Sources */,
B8C974410E8A19B2007D16AD /* RMOpenStreetMapSource.m in Sources */,
B8C974420E8A19B2007D16AD /* RMMemoryCache.m in Sources */,
B8C974430E8A19B2007D16AD /* RMPixel.c in Sources */,
B8C974440E8A19B2007D16AD /* RMFractalTileProjection.m in Sources */,
... ...
... ... @@ -106,8 +106,8 @@
#ifdef DEBUG
RMMarkerManager *mangler = [[mapView contents] markerManager];
for (RMTestableMarker *theMarker in [mangler getMarkers]) {
CGPoint screenPosition = [mangler getMarkerScreenCoordinate:theMarker];
for (RMTestableMarker *theMarker in [mangler markers]) {
CGPoint screenPosition = [mangler screenCoordinatesForMarker:theMarker];
RMLog(@"%@ %3.1f %3.1f %f %f", theMarker,
theMarker.coordinate.latitude, theMarker.coordinate.longitude,
screenPosition.y, screenPosition.x);
... ... @@ -145,16 +145,16 @@
[[mapView contents] moveBy:CGSizeMake(-5.0, 0.0)];
#ifdef DEBUG
RMLatLongBounds screenLimitsDegrees = [[mapView contents] getScreenCoordinateBounds];
RMLog(@"screen limits west: %4.1f east %4.1f", screenLimitsDegrees.northWest.longitude, screenLimitsDegrees.southEast.longitude);
RMLog(@"screen limits south: %4.1f north %4.1f", screenLimitsDegrees.southEast.latitude, screenLimitsDegrees.northWest.latitude);
RMSphericalTrapezium screenLimitsDegrees = [[mapView contents] latitudeLongitudeBoundingBoxForScreen];
RMLog(@"screen limits west: %4.1f east %4.1f", screenLimitsDegrees.southwest.longitude, screenLimitsDegrees.northeast.longitude);
RMLog(@"screen limits south: %4.1f north %4.1f", screenLimitsDegrees.southwest.latitude, screenLimitsDegrees.northeast.latitude);
#endif
for (j = 1; j < nColumns; j++) {
RMTestableMarker *leftMarker = [testMarkers objectAtIndex:j - 1];
RMTestableMarker *rightMarker = [testMarkers objectAtIndex:j];
CGPoint leftScreenPosition = [mangler getMarkerScreenCoordinate:leftMarker];
CGPoint rightScreenPosition = [mangler getMarkerScreenCoordinate:rightMarker];
CGPoint leftScreenPosition = [mangler screenCoordinatesForMarker:leftMarker];
CGPoint rightScreenPosition = [mangler screenCoordinatesForMarker:rightMarker];
STAssertLessThan(leftScreenPosition.x, rightScreenPosition.x,
@"screen position calculation failed (markers %d, %d): left (%f, %f) right (%f, %f) mapped to left (%f, %f) right (%f, %f)",
j-1, j,
... ... @@ -162,6 +162,14 @@
leftMarker.coordinate.longitude, leftMarker.coordinate.latitude,
rightMarker.coordinate.longitude, rightMarker.coordinate.latitude,
leftScreenPosition.x, leftScreenPosition.y, rightScreenPosition.x, rightScreenPosition.y);
CLLocationCoordinate2D computedLatitudeLongitude =
[mangler latitudeLongitudeForMarker:leftMarker];
STAssertEqualsWithAccuracy(leftMarker.coordinate.longitude, computedLatitudeLongitude.longitude, .00001,
@"round-trip computation of longitude failed %f %f",
leftMarker.coordinate.longitude, computedLatitudeLongitude.longitude);
STAssertEqualsWithAccuracy(leftMarker.coordinate.latitude, computedLatitudeLongitude.latitude, .00001,
@"round-trip computation of latitude failed %f %f",
leftMarker.coordinate.latitude, computedLatitudeLongitude.latitude);
}
}
... ... @@ -196,22 +204,30 @@
[[mapView contents] moveBy:CGSizeMake(-5.0, 0.0)];
#ifdef DEBUG
RMLatLongBounds screenLimitsDegrees = [[mapView contents] getScreenCoordinateBounds];
RMLog(@"screen limits west: %4.1f east %4.1f", screenLimitsDegrees.northWest.longitude, screenLimitsDegrees.southEast.longitude);
RMLog(@"screen limits south: %4.1f north %4.1f", screenLimitsDegrees.southEast.latitude, screenLimitsDegrees.northWest.latitude);
RMSphericalTrapezium screenLimitsDegrees = [[mapView contents] latitudeLongitudeBoundingBoxForScreen];
RMLog(@"screen limits west: %4.1f east %4.1f", screenLimitsDegrees.southwest.longitude, screenLimitsDegrees.northeast.longitude);
RMLog(@"screen limits south: %4.1f north %4.1f", screenLimitsDegrees.southwest.latitude, screenLimitsDegrees.northeast.latitude);
#endif
for (j = 1; j < nColumns; j++) {
RMTestableMarker *leftMarker = [testMarkers objectAtIndex:j - 1];
RMTestableMarker *rightMarker = [testMarkers objectAtIndex:j];
CGPoint leftScreenPosition = [mangler getMarkerScreenCoordinate:leftMarker];
CGPoint rightScreenPosition = [mangler getMarkerScreenCoordinate:rightMarker];
CGPoint leftScreenPosition = [mangler screenCoordinatesForMarker:leftMarker];
CGPoint rightScreenPosition = [mangler screenCoordinatesForMarker:rightMarker];
STAssertLessThan(leftScreenPosition.x, rightScreenPosition.x,
@"screen position calculation failed (markers %d, %d): left (%f, %f) right (%f, %f) mapped to left (%f, %f) right (%f, %f)",
j-1, j,
leftMarker.coordinate.longitude, leftMarker.coordinate.latitude,
rightMarker.coordinate.longitude, rightMarker.coordinate.latitude,
leftScreenPosition.x, leftScreenPosition.y, rightScreenPosition.x, rightScreenPosition.y);
CLLocationCoordinate2D computedLatitudeLongitude =
[mangler latitudeLongitudeForMarker:leftMarker];
STAssertEqualsWithAccuracy(leftMarker.coordinate.longitude, computedLatitudeLongitude.longitude, .00001,
@"round-trip computation of longitude failed %f %f",
leftMarker.coordinate.longitude, computedLatitudeLongitude.longitude);
STAssertEqualsWithAccuracy(leftMarker.coordinate.latitude, computedLatitudeLongitude.latitude, .00001,
@"round-trip computation of latitude failed %f %f",
leftMarker.coordinate.latitude, computedLatitudeLongitude.latitude);
}
}
... ...