Authored by Hal Mueller

modified MarkerMurder for better validation of marker projection

... ... @@ -14,6 +14,7 @@
#import "RMMapView.h"
#import "RMMarkerManager.h"
#import "RMMarker.h"
#import "RMTestableMarker.h"
#import "RMMercatorToScreenProjection.h"
#import "RMProjection.h"
... ... @@ -36,7 +37,8 @@
#define kNumberColumns 9
#define kSpacing 2.0
UIImage *markerImage = [UIImage imageNamed:@"marker-red.png"];
UIImage *redMarkerImage = [UIImage imageNamed:@"marker-red.png"];
UIImage *blueMarkerImage = [UIImage imageNamed:@"marker-blue.png"];
markerPosition.latitude = center.latitude - ((kNumberRows - 1)/2.0 * kSpacing);
int i, j;
for (i = 0; i < kNumberRows; i++) {
... ... @@ -44,9 +46,14 @@
for (j = 0; j < kNumberColumns; j++) {
markerPosition.longitude += kSpacing;
NSLog(@"%f %f", markerPosition.latitude, markerPosition.longitude);
RMMarker *newMarker = [[RMMarker alloc] initWithUIImage:markerImage];
RMTestableMarker *newMarker;
if ((markerPosition.longitude < -180) ||
(markerPosition.longitude > 0))
newMarker = [[RMTestableMarker alloc] initWithUIImage:redMarkerImage];
else
newMarker = [[RMTestableMarker alloc] initWithUIImage:blueMarkerImage];
#ifdef DEBUG
[newMarker setLatlon:markerPosition];
[newMarker setCoordinate:markerPosition];
#endif
[self.mapView.contents.markerManager addMarker:newMarker
AtLatLong:markerPosition];
... ... @@ -120,10 +127,10 @@
LogMethod();
RMMarkerManager *mangler = [[[self mapView] contents] markerManager];
for (RMMarker *theMarker in [mangler getMarkers]) {
for (RMTestableMarker *theMarker in [mangler getMarkers]) {
CGPoint screenPosition = [mangler getMarkerScreenCoordinate:theMarker];
NSLog(@"%@ %3.1f %3.1f %f %f", theMarker,
theMarker.latlon.latitude, theMarker.latlon.longitude,
theMarker.coordinate.latitude, theMarker.coordinate.longitude,
screenPosition.y, screenPosition.x);
}
}
... ...
... ... @@ -21,6 +21,7 @@
289233AF0DB2D0DB0083E9F9 /* RootViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 289233AB0DB2D0DB0083E9F9 /* RootViewController.m */; };
289233B00DB2D0DB0083E9F9 /* FlipsideViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 289233AD0DB2D0DB0083E9F9 /* FlipsideViewController.m */; };
2B12B8680F84ADA5003AE2BF /* marker-red.png in Resources */ = {isa = PBXBuildFile; fileRef = 2B12B8670F84ADA5003AE2BF /* marker-red.png */; };
2B580E4A0F8D236100D495B2 /* marker-blue.png in Resources */ = {isa = PBXBuildFile; fileRef = 2B580E490F8D236100D495B2 /* marker-blue.png */; };
2B70CB7A0F856A46002BAF97 /* loading.png in Resources */ = {isa = PBXBuildFile; fileRef = 2B70CB790F856A46002BAF97 /* loading.png */; };
EBDDE0E00F649CE100377FFE /* CoreLocation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EBDDE0DF0F649CE100377FFE /* CoreLocation.framework */; };
EBDDE0E20F649CE100377FFE /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EBDDE0E10F649CE100377FFE /* QuartzCore.framework */; };
... ... @@ -74,6 +75,7 @@
289233AD0DB2D0DB0083E9F9 /* FlipsideViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FlipsideViewController.m; path = Classes/FlipsideViewController.m; sourceTree = "<group>"; };
29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
2B12B8670F84ADA5003AE2BF /* marker-red.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "marker-red.png"; sourceTree = "<group>"; };
2B580E490F8D236100D495B2 /* marker-blue.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "marker-blue.png"; sourceTree = "<group>"; };
2B70CB790F856A46002BAF97 /* loading.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = loading.png; sourceTree = "<group>"; };
32CA4F630368D1EE00C91783 /* MarkerMurder_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MarkerMurder_Prefix.pch; sourceTree = "<group>"; };
8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
... ... @@ -171,6 +173,7 @@
isa = PBXGroup;
children = (
2B12B8670F84ADA5003AE2BF /* marker-red.png */,
2B580E490F8D236100D495B2 /* marker-blue.png */,
2B70CB790F856A46002BAF97 /* loading.png */,
280E754A0DD40C5E005A515E /* FlipsideView.xib */,
280E754B0DD40C5E005A515E /* MainView.xib */,
... ... @@ -280,6 +283,7 @@
280E754F0DD40C5E005A515E /* MainWindow.xib in Resources */,
2B12B8680F84ADA5003AE2BF /* marker-red.png in Resources */,
2B70CB7A0F856A46002BAF97 /* loading.png in Resources */,
2B580E4A0F8D236100D495B2 /* marker-blue.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
... ...