diff --git a/Xamarin.Forms.GoogleMaps/Xamarin.Forms.GoogleMaps.Android/Logics/PolylineLogic.cs b/Xamarin.Forms.GoogleMaps/Xamarin.Forms.GoogleMaps.Android/Logics/PolylineLogic.cs index 6711fd4c..b6a10dc8 100644 --- a/Xamarin.Forms.GoogleMaps/Xamarin.Forms.GoogleMaps.Android/Logics/PolylineLogic.cs +++ b/Xamarin.Forms.GoogleMaps/Xamarin.Forms.GoogleMaps.Android/Logics/PolylineLogic.cs @@ -41,6 +41,7 @@ protected override NativePolyline CreateNativeItem(Polyline outerItem) foreach (var p in outerItem.Positions) opts.Add(new LatLng(p.Latitude, p.Longitude)); + opts.Geodesic(outerItem.IsGeodesic); opts.InvokeWidth(outerItem.StrokeWidth * this.ScaledDensity); // TODO: convert from px to pt. Is this collect? (looks like same iOS Maps) opts.InvokeColor(outerItem.StrokeColor.ToAndroid()); opts.Clickable(outerItem.IsClickable); @@ -105,6 +106,11 @@ internal override void OnUpdateZIndex(Polyline outerItem, NativePolyline nativeI { nativeItem.ZIndex = outerItem.ZIndex; } + + internal override void OnUpdateIsGeodesic(Polyline outerItem, NativePolyline nativeItem) + { + nativeItem.Geodesic = outerItem.IsGeodesic; + } } } diff --git a/Xamarin.Forms.GoogleMaps/Xamarin.Forms.GoogleMaps.UWP/Logics/PolylineLogic.cs b/Xamarin.Forms.GoogleMaps/Xamarin.Forms.GoogleMaps.UWP/Logics/PolylineLogic.cs index 6f039e58..8dcd04c1 100644 --- a/Xamarin.Forms.GoogleMaps/Xamarin.Forms.GoogleMaps.UWP/Logics/PolylineLogic.cs +++ b/Xamarin.Forms.GoogleMaps/Xamarin.Forms.GoogleMaps.UWP/Logics/PolylineLogic.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; @@ -109,5 +109,9 @@ internal override void OnUpdateZIndex(Polyline outerItem, MapPolyline nativeItem { nativeItem.ZIndex = outerItem.ZIndex; } + + internal override void OnUpdateIsGeodesic(Polyline outerItem, MapPolyline nativeItem) + { + } } } \ No newline at end of file diff --git a/Xamarin.Forms.GoogleMaps/Xamarin.Forms.GoogleMaps.iOS/Logics/PolylineLogic.cs b/Xamarin.Forms.GoogleMaps/Xamarin.Forms.GoogleMaps.iOS/Logics/PolylineLogic.cs index fdb722e2..4b8bd27a 100644 --- a/Xamarin.Forms.GoogleMaps/Xamarin.Forms.GoogleMaps.iOS/Logics/PolylineLogic.cs +++ b/Xamarin.Forms.GoogleMaps/Xamarin.Forms.GoogleMaps.iOS/Logics/PolylineLogic.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; @@ -90,6 +90,11 @@ internal override void OnUpdateZIndex(Polyline outerItem, NativePolyline nativeI { nativeItem.ZIndex = outerItem.ZIndex; } + + internal override void OnUpdateIsGeodesic(Polyline outerItem, NativePolyline nativeItem) + { + nativeItem.Geodesic = outerItem.IsGeodesic; + } } } diff --git a/Xamarin.Forms.GoogleMaps/Xamarin.Forms.GoogleMaps/Logics/DefaultPolylineLogic.cs b/Xamarin.Forms.GoogleMaps/Xamarin.Forms.GoogleMaps/Logics/DefaultPolylineLogic.cs index 2eddcc57..94785ace 100644 --- a/Xamarin.Forms.GoogleMaps/Xamarin.Forms.GoogleMaps/Logics/DefaultPolylineLogic.cs +++ b/Xamarin.Forms.GoogleMaps/Xamarin.Forms.GoogleMaps/Logics/DefaultPolylineLogic.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.ComponentModel; @@ -21,11 +21,13 @@ protected override void OnItemPropertyChanged(object sender, PropertyChangedEven else if (e.PropertyName == Polyline.StrokeColorProperty.PropertyName) OnUpdateStrokeColor(outerItem, nativeItem); else if (e.PropertyName == Polyline.StrokeWidthProperty.PropertyName) OnUpdateStrokeWidth(outerItem, nativeItem); else if (e.PropertyName == Polyline.ZIndexProperty.PropertyName) OnUpdateZIndex(outerItem, nativeItem); + else if (e.PropertyName == Polyline.IsGeodesicProperty.PropertyName) OnUpdateIsGeodesic(outerItem, nativeItem); } internal abstract void OnUpdateIsClickable(Polyline outerItem, TNative nativeItem); internal abstract void OnUpdateStrokeColor(Polyline outerItem, TNative nativeItem); internal abstract void OnUpdateStrokeWidth(Polyline outerItem, TNative nativeItem); internal abstract void OnUpdateZIndex(Polyline outerItem, TNative nativeItem); + internal abstract void OnUpdateIsGeodesic(Polyline outerItem, TNative nativeItem); } } diff --git a/Xamarin.Forms.GoogleMaps/Xamarin.Forms.GoogleMaps/Polyline.cs b/Xamarin.Forms.GoogleMaps/Xamarin.Forms.GoogleMaps/Polyline.cs index 1dacabf1..53fed159 100644 --- a/Xamarin.Forms.GoogleMaps/Xamarin.Forms.GoogleMaps/Polyline.cs +++ b/Xamarin.Forms.GoogleMaps/Xamarin.Forms.GoogleMaps/Polyline.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Collections.Specialized; @@ -16,6 +16,7 @@ void HandleAction(GoogleMaps.Polygon arg1, NotifyCollectionChangedEventArgs arg2 public static readonly BindableProperty StrokeColorProperty = BindableProperty.Create(nameof(StrokeColor), typeof(Color), typeof(Polyline), Color.Blue); public static readonly BindableProperty IsClickableProperty = BindableProperty.Create(nameof(IsClickable), typeof(bool), typeof(Polyline), false); public static readonly BindableProperty ZIndexProperty = BindableProperty.Create(nameof(ZIndex), typeof(int), typeof(Polyline), 0); + public static readonly BindableProperty IsGeodesicProperty = BindableProperty.Create(nameof(IsGeodesic), typeof(bool), typeof(Polyline), false); private readonly ObservableCollection _positions = new ObservableCollection(); @@ -45,6 +46,12 @@ public int ZIndex set { SetValue(ZIndexProperty, value); } } + public bool IsGeodesic + { + get { return (bool)GetValue(IsGeodesicProperty); } + set { SetValue(IsGeodesicProperty, value); } + } + public IList Positions { get { return _positions; }