Created
September 9, 2011 20:23
-
-
Save pmark/1207231 to your computer and use it in GitHub Desktop.
How to move a 3DAR POI to a new location.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// This functionality will be added to the 3DAR library in the future. | |
// | |
- (SM3DARPointOfInterest *) movePOI:(SM3DARPointOfInterest *)poi toLatitude:(CLLocationDegrees)latitude longitude:(CLLocationDegrees)longitude altitude:(CLLocationDistance)altitude | |
{ | |
CLLocation *newLocation = [[CLLocation alloc] initWithLatitude:latitude longitude:longitude]; | |
SM3DARPointOfInterest *newPOI = [[SM3DARPointOfInterest alloc] initWithLocation:newLocation | |
title:poi.title | |
subtitle:poi.subtitle | |
url:poi.dataURL | |
properties:poi.properties]; | |
newPOI.view = poi.view; | |
newPOI.delegate = poi.delegate; | |
newPOI.annotationViewClass = poi.annotationViewClass; | |
newPOI.canReceiveFocus = poi.canReceiveFocus; | |
newPOI.hasFocus = poi.hasFocus; | |
newPOI.identifier = poi.identifier; | |
newPOI.gearPosition = poi.gearPosition; | |
id oldAnnotation = [mapView annotationForPoint:poi]; | |
if (oldAnnotation) | |
{ | |
[mapView removeAnnotation:oldAnnotation]; | |
[mapView addAnnotation:newPOI]; | |
} | |
else | |
{ | |
[mapView.sm3dar removePointOfInterest:poi]; | |
[mapView.sm3dar addPointOfInterest:newPOI]; | |
} | |
[newLocation release]; | |
[newPOI release]; | |
return newPOI; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment