MBS Xojo Developer Conference and Training
Join us from 11th to 14th September 2013 in Koblenz.

Platforms to show: All Mac Windows Linux Cross-Platform

/MountainLion/GeoCoder
Feedback.

Function:
You find this example project in your Plugins Download as a Realbasic project file within the examples folder: /MountainLion/GeoCoder
This example is the version from Mon, 29th Jul 2012.
Notes: Last modified: Mon, 29th Jul 2012
Project "GeoCoder.rbp"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control Label1 Inherits Label
ControlInstance Label1 Inherits Label
End ControlInstance
End Control
Control TextField1 Inherits TextField
ControlInstance TextField1 Inherits TextField
End ControlInstance
End Control
Control List Inherits Listbox
ControlInstance List Inherits Listbox
End ControlInstance
End Control
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
End ControlInstance
Sub Action() if g.isGeocoding then g.cancelGeocode end if g.geocodeAddressString TextField1.text, c End
End Control
Sub Close() if c<>nil then c.l = nil end if End
Sub Open() if CLGeocoderMBS.Available = false then MsgBox "Please upgrade to Mac OS X 10.8." quit end if g = new CLGeocoderMBS c = new MyCLGeocodeCompletionHandlerMBS c.l = list End
Property c As MyCLGeocodeCompletionHandlerMBS
Property g As CLGeocoderMBS
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
Class MyCLGeocodeCompletionHandlerMBS Inherits CLGeocodeCompletionHandlerMBS
Sub Completed(geocoder as CLGeocoderMBS, placemarks() as CLPlacemarkMBS, error as NSErrorMBS) if l = nil then Return l.DeleteAllRows if error<>Nil then l.AddRow "Error: "+error.localizedDescription end if for each p as CLPlacemarkMBS in placemarks l.AddRow "Placemark found:" Add " name: ", p.name Add " locality: ", p.locality Add " subLocality: ", p.subLocality Add " thoroughfare: ", p.thoroughfare Add " subThoroughfare: ", p.subThoroughfare for each a as string in p.areasOfInterest Add " areasOfInterest: ", a next Add " inlandWater: ", p.inlandWater Add " ocean: ", p.ocean Add " postalCode: ", p.postalCode Add " administrativeArea: ", p.administrativeArea Add " subAdministrativeArea: ", p.subAdministrativeArea Add " ISOcountryCode: ", p.ISOcountryCode Add " country: ", p.country dim cl as CLLocationMBS = p.location if cl<>nil then add " latitude: ",cstr(cl.latitude) add " longitude: ",cstr(cl.longitude) end if next End
Sub Add(label as string, text as string) if text<>"" then l.AddRow label+text end if End
Property l As Listbox
End Class
End Project

The items on this page are in the following plugins: MBS Real Studio MountainLion Plugin.




Links
MBS Realbasic PDF Plugins