Alpstein/route-me — Issue #20: Static RMPaths
Author: mtoon
Created: 2012-02-11 15:31:46+00:00
State: open

Sorry about all of the posts, please let me know if there's a better "forum"-esque place to ask these questions.. Is there anyway to add a static path to the map? In the old route-me, I could do something like this to create a box RMPath: (See remark at bottom). Thank you!

if (self.nearbyItemsPath) {
if (self.nearbyItemsPath.superlayer) {
[self.nearbyItemsPath removeFromSuperlayer];
}
self.nearbyItemsPath = nil;
}

self.nearbyItemsPath = [[[RMPath alloc] initWithContents:self.mapView.contents] autorelease];
self.nearbyItemsPath.lineColor = [UIColor whiteColor];
self.nearbyItemsPath.fillColor = [UIColor lightGrayColor];
self.nearbyItemsPath.opacity = 0.80;
self.nearbyItemsPath.lineWidth = 3;

[self.nearbyItemsPath moveToLatLong:CLLocationCoordinate2DMake(ne_lat, ne_lon)];
[self.nearbyItemsPath addLineToLatLong:CLLocationCoordinate2DMake(sw_lat, ne_lon)];
[self.nearbyItemsPath addLineToLatLong:CLLocationCoordinate2DMake(sw_lat, sw_lon)];
[self.nearbyItemsPath addLineToLatLong:CLLocationCoordinate2DMake(ne_lat, sw_lon)];
[self.nearbyItemsPath addLineToLatLong:CLLocationCoordinate2DMake(ne_lat, ne_lon)];
self.nearbyItemsPath.zPosition = C_ZPOSITION_NEARBY_ITEMS;

// THIS IS THE KEY thing that doesn't work anymore (obviously because contents no longer exists, but is there an alternative way to do this? I have experimented with paths as annotation markers, but that is a very cumbersom way to simply add a quick static path.
[[self.mapView.contents overlay] addSublayer:self.nearbyItemsPath];