Re: Geographic Location drag type
Re: Geographic Location drag type
- Subject: Re: Geographic Location drag type
- From: William Bates <email@hidden>
- Date: Fri, 13 Jun 2008 07:51:06 -0500
Here's what I've decided to use. I put two flavors on the pasteboard:
com.knowledgeengineering.ISO6709.string
a UTF8 string conforming to ISO6709
com.knowledgeengineering.ISO6709.dictionary
a CFDictionary containting 3 CFNumbers of type double
(kCFNumberDoubleType) with keys: latitude, longitude, altitude
(2) Aside from internal use in my app, I put the parser code into my
apps' stand-alone .service thingy; configured its plist so it is a
filter service (see the Pasteboard Peeker read-me). So now _any_
string flowing thru Services that conforms to ISO6709 syntax will get
parsed and the little Geo dictionary added to the drag. It's pretty
nice to highlight some text containing lat/long on a web page, choose
the services menu item, and pop up a Google map of the location.
Objective C 2.0 example:
if dict is a NSDictionary* obtained from the pasteboard, and
myLocation is a Cocoa object of class CLLocation,
myLocation.coordinate.latitude = [dict valueForKey:@"latitude"];
myLocation.coordinate.longitude = [dict valueForKey:@"longitude"];
myLocation.altitude = [dict valueForKey:@"altitude"];
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden