diff options
author | chungryeol lim <cdark.lim@samsung.com> | 2016-12-20 20:16:18 +0900 |
---|---|---|
committer | Kangho Hur <kangho.hur@samsung.com> | 2017-03-24 13:18:59 +0900 |
commit | 11fa683302f23c3a00a51d5e554fc40c51d31348 (patch) | |
tree | c8285321b25a9a59e4318435a9f2011db9a732bc /Xamarin.Forms.Maps.Tizen/GeocoderBackend.cs | |
parent | 78f2c9fc9b607770f64177dfba632b80f2ed46db (diff) | |
download | xamarin-forms-11fa683302f23c3a00a51d5e554fc40c51d31348.tar.gz xamarin-forms-11fa683302f23c3a00a51d5e554fc40c51d31348.tar.bz2 xamarin-forms-11fa683302f23c3a00a51d5e554fc40c51d31348.zip |
Add MapRenderer to enable Xamarin.Forms.Maps on Tizen
- Implementation of MapRenderer under Xamarin.Forms.Maps.Tizen
- Implementation of FormsMaps to initialize Tizen Map
- Implementation of GeocoderBackend
TASK=TCAPI2044
Change-Id: I4b6f15b5190767ca0c92bb27c383af5f66ae5328
Diffstat (limited to 'Xamarin.Forms.Maps.Tizen/GeocoderBackend.cs')
-rwxr-xr-x[-rw-r--r--] | Xamarin.Forms.Maps.Tizen/GeocoderBackend.cs | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/Xamarin.Forms.Maps.Tizen/GeocoderBackend.cs b/Xamarin.Forms.Maps.Tizen/GeocoderBackend.cs index a18990d4..dbf93979 100644..100755 --- a/Xamarin.Forms.Maps.Tizen/GeocoderBackend.cs +++ b/Xamarin.Forms.Maps.Tizen/GeocoderBackend.cs @@ -1,25 +1,32 @@ using System.Collections.Generic; using System.Threading.Tasks; -using System; namespace Xamarin.Forms.Maps.Tizen { - public class Position {}; + internal class GeocoderBackend + { + public static void Register() + { + Geocoder.GetPositionsForAddressAsyncFunc = GetPositionsForAddressAsync; + Geocoder.GetAddressesForPositionFuncAsync = GetAddressesForPositionAsync; + } - internal class GeocoderBackend - { - public static void Register() - { - } + public static async Task<IEnumerable<Position>> GetPositionsForAddressAsync(string address) + { + var request = FormsMaps.MapService.CreateGeocodeRequest(address); + var positions = new List<Position>(); + foreach (var result in await request.GetResponseAsync()) + positions.Add(new Position(result.Latitude, result.Longitude)); + return positions; + } - public static async Task<IEnumerable<Position>> GetPositionsForAddressAsync(string address) - { - return new Position[]{}; - } - - public static async Task<IEnumerable<string>> GetAddressesForPositionAsync(Position position) - { - return new String[]{"Not supported"}; - } - } + public static async Task<IEnumerable<string>> GetAddressesForPositionAsync(Position position) + { + var request = FormsMaps.MapService.CreateReverseGeocodeRequest(position.Latitude, position.Longitude); + var addresses = new List<string>(); + foreach (var result in await request.GetResponseAsync()) + addresses.Add(result.Freetext); + return addresses; + } + } }
\ No newline at end of file |