{"id":336916,"date":"2022-08-12T03:00:06","date_gmt":"2022-08-12T03:00:06","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=336916"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=336916","title":{"rendered":"<span>Xamarin.Forms: \u041a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 \u043f\u0438\u043d\u044b \u0434\u043b\u044f xamarin.maps<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u044f \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438 \u043f\u0440\u0438\u043c\u0435\u0440 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0445 \u043f\u0438\u043d\u043e\u0432 \u0434\u043b\u044f \u043a\u0430\u0440\u0442\u044b xamarin. \u041f\u0438\u043d\u044b \u0431\u0443\u0434\u0443\u0442 \u043e\u0431\u043b\u0430\u0434\u0430\u0442\u044c \u0442\u0435\u043c \u0432\u0438\u0434\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u0430\u043c \u043d\u0443\u0436\u0435\u043d. \u0422\u0430\u043a \u0436\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0447\u0430\u0441\u0442\u044c \u043a\u043e\u0434\u0430 xamarin.maps, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0438\u0439 \u0437\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435, \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0443 \u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043f\u0438\u043d\u043e\u0432.<\/p>\n<p>\u0411\u043b\u0430\u0433\u043e \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 xamarin.forms \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u043d\u0430 github, \u0438 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0432\u0435\u0441\u044c \u043a\u043e\u0434:<\/p>\n<p><a href=\"https:\/\/github.com\/xamarin\/Xamarin.Forms\" rel=\"noopener noreferrer nofollow\">xamarin\/Xamarin.Forms: Xamarin.Forms Official Home (github.com)<\/a>  <\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u044d\u0442\u0438 \u0444\u0430\u0439\u043b\u044b \u0441 \u0433\u0438\u0442\u0430:<\/p>\n<ul>\n<li>\n<p>iOs.MapRenderer <a href=\"https:\/\/github.com\/xamarin\/Xamarin.Forms\/blob\/5.0.0\/Xamarin.Forms.Maps.iOS\/MapRenderer.cs\" rel=\"noopener noreferrer nofollow\">Xamarin.Forms\/MapRenderer.cs at 5.0.0 \u00b7 xamarin\/Xamarin.Forms (github.com)<\/a>  <\/p>\n<\/li>\n<li>\n<p>Android.MapRenderer <a href=\"https:\/\/github.com\/xamarin\/Xamarin.Forms\/blob\/5.0.0\/Xamarin.Forms.Maps.Android\/MapRenderer.cs\" rel=\"noopener noreferrer nofollow\">Xamarin.Forms\/MapRenderer.cs at 5.0.0 \u00b7 xamarin\/Xamarin.Forms (github.com)<\/a>  <\/p>\n<\/li>\n<\/ul>\n<p>\u0414\u043b\u044f \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0430 \u0443 \u0432\u0430\u0441 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u044b \u043f\u0430\u043a\u0435\u0442\u044b Xamarin.Maps \u0432\u043e \u0432\u0441\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u044b, \u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d \u043f\u043e <a href=\"https:\/\/docs.microsoft.com\/ru-ru\/xamarin\/xamarin-forms\/user-interface\/map\/setup\" rel=\"noopener noreferrer nofollow\">\u0433\u0430\u0439\u0434\u0443 \u043e\u0442 xamarin<\/a>:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/51f\/c4f\/972\/51fc4f972b3b5c47a545d964824156c5.png\" width=\"662\" height=\"259\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/51f\/c4f\/972\/51fc4f972b3b5c47a545d964824156c5.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0422\u0430\u043a \u0436\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u043f\u0430\u043a\u0435\u0442 SkiaSharp \u0438 SkiaSharp.Views.Forms \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 (\u043d\u0435 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0439 \u0434\u043b\u044f \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c):<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/af2\/18e\/450\/af218e450a5983bd958dc56bba9c5c67.png\" width=\"697\" height=\"262\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/af2\/18e\/450\/af218e450a5983bd958dc56bba9c5c67.png\"\/><figcaption><\/figcaption><\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/783\/07a\/60e\/78307a60ec5fb46c651ea4931b96fe5a.png\" width=\"690\" height=\"275\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/783\/07a\/60e\/78307a60ec5fb46c651ea4931b96fe5a.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0442\u0438\u043f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0442\u0430\u043d\u0435\u0442 \u0431\u0430\u0437\u043e\u0439 \u0434\u043b\u044f \u043f\u0438\u043d\u043e\u0432, \u0438 \u043a\u0430\u0440\u0442\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0439, \u0438 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043d\u0430\u0448 \u043f\u0438\u043d, \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 [ProjectName]:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 CustomPin &#8212; \u0431\u0430\u0437\u0430 \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0438\u043d\u0430<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cs\">public abstract class CustomPin : Pin     {         public class MapMarkerInvalidateEventArgs         {             public double Width { get; }             public double Height { get; }              internal MapMarkerInvalidateEventArgs(CustomPin marker)             {                 Width = marker.Width;                 Height = marker.Height;             }         }                  public event EventHandler&lt;MapMarkerInvalidateEventArgs> RequestInvalidate;  \/\/ Bindable properties         public static readonly BindableProperty WidthProperty = BindableProperty.Create(nameof(Width), typeof(double), typeof(CustomPin), 32.0, propertyChanged: OnDrawablePropertyChanged);         public static readonly BindableProperty HeightProperty = BindableProperty.Create(nameof(Height), typeof(double), typeof(CustomPin), 32.0, propertyChanged: OnDrawablePropertyChanged);         public static readonly BindableProperty AnchorXProperty = BindableProperty.Create(nameof(AnchorX), typeof(double), typeof(CustomPin), 0.5);         public static readonly BindableProperty AnchorYProperty = BindableProperty.Create(nameof(AnchorY), typeof(double), typeof(CustomPin), 0.5);         public static readonly BindableProperty IsVisibleProperty = BindableProperty.Create(nameof(IsVisible), typeof(bool), typeof(CustomPin), true);         public static readonly BindableProperty ClickableProperty = BindableProperty.Create(nameof(Clickable), typeof(bool), typeof(CustomPin), true);  \/\/ \u0428\u0438\u0440\u0438\u043d\u0430 \u043f\u0438\u043d\u0430         public double Width         {             get { return (double)GetValue(WidthProperty); }             set { SetValue(WidthProperty, value); }         }  \/\/ \u0412\u044b\u0441\u043e\u0442\u0430 \u043f\u0438\u043d\u0430         public double Height         {             get { return (double)GetValue(HeightProperty); }             set { SetValue(HeightProperty, value); }         }  \/\/ \u0420\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u0438\u043d\u0430 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0442\u043e\u0447\u043a\u0438 \u043d\u0430 \u043a\u0430\u0440\u0442\u0435 \u043f\u043e X         public double AnchorX         {             get { return (double)GetValue(AnchorXProperty); }             set { SetValue(AnchorXProperty, value); }         }  \/\/ \u0420\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u0438\u043d\u0430 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0442\u043e\u0447\u043a\u0438 \u043d\u0430 \u043a\u0430\u0440\u0442\u0435 \u043f\u043e Y         public double AnchorY         {             get { return (double)GetValue(AnchorYProperty); }             set { SetValue(AnchorYProperty, value); }         }  \/\/ \u0412\u0438\u0434\u0435\u043d \u043b\u0438 \u043f\u0438\u043d         public bool IsVisible         {             get { return (bool)GetValue(IsVisibleProperty); }             set { SetValue(IsVisibleProperty, value); }         }  \/\/ \u0418\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u0435\u043d \u043b\u0438 \u043f\u0438\u043d         public bool Clickable         {             get { return (bool)GetValue(ClickableProperty); }             set { SetValue(ClickableProperty, value); }         }          private static void OnDrawablePropertyChanged(BindableObject bindable, object oldValue, object newValue)         {             CustomPin marker = bindable as CustomPin;              marker.Invalidate();         }          public void Invalidate()         {             RequestInvalidate?.Invoke(this, new MapMarkerInvalidateEventArgs(this));         }  \/\/ \u041c\u0435\u0442\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u0430\u043d \u0432 \u0434\u043e\u0447\u0435\u0440\u043d\u0435\u043c \u043a\u043b\u0430\u0441\u0441\u0435, \u0432 \u043d\u0435\u043c \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0430 \u043f\u0438\u043d\u0430         public abstract void DrawPin(SKSurface surface);     }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 CustomMap &#8212; \u043d\u0430\u0448\u0430 \u043a\u0430\u0440\u0442\u0430 \u0441 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 CustomPin<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cs\">public class CustomMap : Map { }<\/code><\/pre>\n<p>\u041f\u0440\u043e\u0441\u0442\u043e\u0439 \u043a\u043e\u0434, \u0431\u043e\u043b\u044c\u0448\u0435\u0433\u043e \u043d\u0430\u043c \u0438 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e.<\/p>\n<\/div>\n<\/details>\n<p>\u0418 \u0442\u0430\u043a, \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0440\u0435\u043d\u0434\u0435\u0440 \u043f\u043e\u0434 Android, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e &#8212; \u043d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 \u043c\u0435\u0442\u043e\u0434 CreateMarker \u043d\u0430 248 \u0441\u0442\u0440\u043e\u043a\u0435, \u0432\u043e\u0442 \u0442\u0430\u043a \u043e\u043d \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u0435:<\/p>\n<pre><code class=\"cs\">protected virtual MarkerOptions CreateMarker(Pin pin) {   var opts = new MarkerOptions();   opts.SetPosition(new LatLng(pin.Position.Latitude, pin.Position.Longitude));   opts.SetTitle(pin.Label);   opts.SetSnippet(pin.Address);    return opts; }<\/code><\/pre>\n<p>\u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0438\u043d\u0430, \u0432\u0430\u0436\u043d\u044b\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u043c \u0437\u0434\u0435\u0441\u044c, \u043a\u0430\u043a \u043d\u0435\u0442\u0440\u0443\u0434\u043d\u043e \u0434\u043e\u0433\u0430\u0434\u0430\u0442\u044c\u0441\u044f, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f &#171;MarkerOptions opts&#187;, \u0442\u0438\u043f MarkerOptions \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043c\u0435\u0442\u043e\u0434 SetIcon(BitmapDescriptor), \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u044b \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0434\u043b\u044f \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u043d\u0438\u044f \u043f\u0438\u043d\u0430. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0439 \u043a\u043b\u0430\u0441\u0441 \u043a \u044d\u0442\u043e\u043c\u0443 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u0449\u0438\u043a\u0443 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 [ProjectName].Android, \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0432 \u043d\u0435\u043c \u043f\u0430\u043f\u043a\u0443 Renderers:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/7ab\/329\/8e8\/7ab3298e897ff6d498950d1f4d0ff44a.png\" width=\"527\" height=\"265\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/7ab\/329\/8e8\/7ab3298e897ff6d498950d1f4d0ff44a.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041a\u043e\u0434 \u0437\u0430\u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u043a\u043b\u0430\u0441\u0441\u0430 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u0449\u0438\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"cs\">[assembly: Xamarin.Forms.ExportRenderer(typeof(CustomMap), typeof(CustomMapRenderer))] namespace [ProjectName].Droid.Renderers {     public class CustomMapRenderer : MapRenderer     {         public CustomMapRenderer(Context context) : base(context){}          protected override MarkerOptions CreateMarker(Pin pin)         {             return base.CreateMarker(pin);         }     } }<\/code><\/pre>\n<p>\u041f\u043e\u043a\u0430 \u0447\u0442\u043e \u043e\u043d \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u043c\u0435\u043d\u044f\u0435\u0442 \u043b\u043e\u0433\u0438\u043a\u0443 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u0430 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u043d\u0430\u0448\u0435\u0433\u043e CustomPin, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"cs\">[assembly: Xamarin.Forms.ExportRenderer(typeof(CustomMap), typeof(CustomMapRenderer))] namespace [ProjectName].Droid.Renderers {     public class CustomMapRenderer : MapRenderer     {         public CustomMapRenderer(Context context) : base(context){}          protected override MarkerOptions CreateMarker(Pin pin)         {         \/\/ \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u0432 \u0431\u0430\u0437\u043e\u0432\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435 MarkerOptions             var opts = base.CreateMarker(pin); \/\/ \u0415\u0441\u043b\u0438 \u043d\u0430\u0448 \u043c\u0430\u0440\u043a\u0435\u0440 - \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0439...             if(pin is CustomPin cpin)             {             \/\/ ... \u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c SKPixmap \u0441 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c \u043f\u0438\u043d\u0430                 SKPixmap markerBitmap = DrawMarker(cpin); \/\/ \u0417\u0430\u0434\u0430\u0435\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043f\u0438\u043d\u0430 \u0438 \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u044c                 opts.SetIcon(BitmapDescriptorFactory.FromBitmap(markerBitmap.ToBitmap()))                        .Visible(cpin.IsVisible);             \/\/ \u0412\u044b\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u044f\u043a\u043e\u0440\u044f                 opts.Anchor((float)cpin.AnchorX, (float)cpin.AnchorY);             }              return opts;         }          private SKPixmap DrawMarker(CustomPin skPin)         {         \/\/ \u0421\u0447\u0438\u0442\u0430\u0435\u043c \u0440\u0430\u0437\u043c\u0435\u0440 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u0438\u043d\u0430 \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e Density \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430             double bitmapWidth = skPin.Width * Context.Resources.DisplayMetrics.Density;             double bitmapHeight = skPin.Height * Context.Resources.DisplayMetrics.Density;         \/\/ \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u0443\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438             SKSurface surface = SKSurface.Create(new SKImageInfo((int)bitmapWidth, (int)bitmapHeight, SKColorType.Rgba8888, SKAlphaType.Premul)); \/\/ \u0417\u0430\u043b\u0438\u0432\u0430\u0435\u043c \u0441\u0443\u0440\u0444\u0435\u0439\u0441 \u0446\u0432\u0435\u0442\u043e\u043c Transparent             surface.Canvas.Clear(SKColor.Empty);         \/\/ \u041f\u0440\u043e\u0441\u0438\u043c \u043f\u0438\u043d \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 \u0441\u0443\u0440\u0444\u0435\u0439\u0441             skPin.DrawPin(surface); \/\/ \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043f\u0438\u043a\u0441\u0435\u043b\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0432\u0435\u0441\u0442\u0438 \u0432 BitMap             return surface.PeekPixels();         }     } }<\/code><\/pre>\n<p>\u041e\u0442\u043b\u0438\u0447\u043d\u043e, \u0434\u043b\u044f Android \u043c\u044b \u0432\u0441\u0435 \u0441\u0434\u0435\u043b\u0430\u043b\u0438, \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043d\u0430\u0448\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0442\u0430\u043a\u043e\u0433\u043e \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043f\u0438\u043d\u0430 (\u0421\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 [ProjectName]):<\/p>\n<pre><code class=\"cs\">internal sealed class CirclePin : CustomPin     {         \/\/ \u0421\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u0439 Bitmap         SKBitmap pinBitmap;          \/\/ \u041a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 string - \u044d\u0442\u043e \u0442\u0435\u043a\u0441\u0442 \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u0440\u0443\u0433\u0430         public CirclePin(string text)         {             \/\/ \u041e\u0442\u0441\u0442\u0443\u043f \u0442\u0435\u043a\u0441\u0442\u0430 \u043e\u0442 \u043a\u0440\u0430\u0435\u0432 \u043a\u0440\u0443\u0433\u0430             int circleOffset = 10;              \/\/ \u041c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u043a\u0440\u0443\u0433\u0430, \u043f\u0440\u0438 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u043e\u043c \u0442\u0435\u043a\u0441\u0442\u0435             int minSize = 40;              \/\/ \u0420\u0430\u0437\u043c\u0435\u0440 \u0448\u0440\u0438\u0444\u0442\u0430 \u0442\u0435\u043a\u0441\u0442\u0430             int textSize = 18;              \/\/ \u0417\u0430\u0434\u0430\u043d\u0438\u0435 \u0446\u0432\u0435\u0442\u0430 \u0442\u0435\u043a\u0441\u0442\u0430             Color tempColor = Color.White;             \/\/ \u041f\u0435\u0440\u0435\u0432\u043e\u0434 \u0438\u0437 Color \u0432 SKColor             SKColor textColor = new SKColor((byte)(tempColor.R * 255), (byte)(tempColor.G * 255), (byte)(tempColor.B * 255));              \/\/ \u0417\u0430\u0434\u0430\u043d\u0438\u0435 \u0446\u0432\u0435\u0442\u0430 \u043a\u0440\u0443\u0433\u0430             tempColor = Color.Black;             \/\/ \u041f\u0435\u0440\u0435\u0432\u043e\u0434 \u0438\u0437 Color \u0432 SKColor             SKColor circleColor = new SKColor((byte)(tempColor.R * 255), (byte)(tempColor.G * 255), (byte)(tempColor.B * 255));              PrepareBitmap(circleOffset, circleColor, text, textSize, textColor, minSize);         }          private void PrepareBitmap(int circleOffset, SKColor circleColor, string text, float textSize, SKColor textColor, int minSize, int iconSize = 28)         {             int width;             float den = (float)DeviceDisplay.MainDisplayInfo.Density;              \/\/ \u0423\u0434\u0432\u0430\u0438\u0432\u0430\u0435\u043c \u043e\u0442\u0441\u0442\u0443\u043f, \u0442.\u043a. \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u0441 2-\u0445 \u0441\u0442\u043e\u0440\u043e\u043d \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0439             circleOffset *= 2;              using (var font = SKTypeface.FromFamilyName(\"Arial\"))             using (var textBrush = new SKPaint             {                 Typeface = font,                 TextSize = textSize * den,                 IsAntialias = true,                 Color = textColor,                 TextAlign = SKTextAlign.Center,             })             {                 \/\/ \u0412\u044b\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0442\u0435\u043a\u0441\u0442\u0430                 SKRect textRect = new SKRect();                 textBrush.MeasureText(text, ref textRect);                  \/\/ \u0428\u0438\u0440\u0438\u043d\u0430 \u0442\u0435\u043a\u0441\u0442\u0430 \u0432 dip                 width = Math.Max((int)(Math.Ceiling(textRect.Width) \/ den) + circleOffset, minSize);                  \/\/ \u0417\u0430\u0434\u0430\u0435\u043c \u0440\u0430\u0437\u043c\u0435\u0440 \u043f\u0438\u043d\u0430 \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0448\u0438\u0440\u0438\u043d\u0435 \u0432 dip                 Width = Height = width;                  \/\/ \u0428\u0438\u0440\u0438\u043d\u0430 \u0442\u0435\u043a\u0441\u0442\u0430 \u0432 \u043f\u0438\u043a\u0441\u0435\u043b\u044f\u0445                 width = (int)Math.Floor(width * den);                  \/\/ \u0421\u043e\u0437\u0434\u0430\u0435\u043c Bitmap \u0434\u043b\u044f \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438                 pinBitmap = new SKBitmap(width, width, SKColorType.Rgba8888, SKAlphaType.Premul);                  using (var canvas = new SKCanvas(pinBitmap))                 {                     using (var circleBrush = new SKPaint                     {                         IsAntialias = true,                         Color = circleColor                     })                     {                         \/\/\u041e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0430 \u043a\u0440\u0443\u0433\u0430                         canvas.DrawRoundRect(new SKRoundRect(new SKRect(0, width, width, 0), width \/ 2f), circleBrush);                          \/\/\u041e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0430 \u0442\u0435\u043a\u0441\u0442\u0430                         canvas.DrawText(text, width * 0.5f, width * 0.5f - textRect.MidY, textBrush);                          canvas.Flush();                     }                 }             }          }          public override void DrawPin(SKSurface surface)         {             \/\/ \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043a\u0430\u043d\u0432\u0430\u0441 \u0438\u0437 \u0441\u0443\u0440\u0444\u0435\u0439\u0441\u0430, \u0434\u043b\u044f \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438             SKCanvas canvas = surface.Canvas;              \/\/ \u041e\u0442\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u0435\u043c \u043d\u0430 \u043a\u0430\u043d\u0432\u0430\u0441 \u043d\u0430\u0448 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u0439 Bitmap             canvas.DrawBitmap(pinBitmap, canvas.LocalClipBounds.MidX - pinBitmap.Width \/ 2f, canvas.LocalClipBounds.MidY - pinBitmap.Height \/ 2f);         }     }<\/code><\/pre>\n<p>\u0414\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u044f \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u043b \u043a\u043e\u0434 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0433\u043e MainPage.xaml, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u0432 \u043d\u0435\u0433\u043e \u043a\u0430\u0440\u0442\u0443, \u0438 \u043a\u043e\u0434 MainPage.xaml.cs \u0434\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u0447\u043d\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u043f\u0438\u043d\u043e\u0432:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 MainPage.xaml<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"xml\">&lt;?xml version=\"1.0\" encoding=\"utf-8\" ?> &lt;ContentPage xmlns=\"http:\/\/xamarin.com\/schemas\/2014\/forms\"              xmlns:x=\"http:\/\/schemas.microsoft.com\/winfx\/2009\/xaml\" xmlns:xcmpexample=\"clr-namespace:XCMPExample\"              x:Class=\"[ProjectName].MainPage\">      &lt;StackLayout>         &lt;Frame BackgroundColor=\"#2196F3\" Padding=\"24\" CornerRadius=\"0\">             &lt;Label Text=\"Welcome to Xamarin.Forms!\" HorizontalTextAlignment=\"Center\" TextColor=\"White\" FontSize=\"36\"\/>         &lt;\/Frame>       &lt;!-- \u041a\u0430\u0440\u0442\u0430 -->         &lt;xcmpexample:CustomMap x:Name=\"customMap\"\/>     &lt;\/StackLayout>  &lt;\/ContentPage> <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 MainPage.xaml.cs<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cs\">public partial class MainPage : ContentPage     {         public MainPage()         {             InitializeComponent();              Random random = new Random();             for (int i = 0; i &lt; 100; i++)             {                 string universalFillData = i.ToString();                 customMap.Pins.Add(new CirclePin(universalFillData)                 {                     Label = universalFillData,                     Address = universalFillData,                     Position = new Position(                     \/\/\/ \u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u041c\u043e\u0441\u043a\u0432\u044b +-1                     \/\/\/ \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u043b\u043e \u043f\u0440\u043e\u0449\u0435 \u043d\u0430\u0439\u0442\u0438 \u043d\u0430\u0448\u0438 \u043f\u0438\u043d\u044b                         random.NextDouble() + 55,                         random.NextDouble() + 37)                 });             }         }     }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u041f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0438\u0439\u0441\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/p>\n<details class=\"spoiler\">\n<summary>\u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u043a\u0430\u0440\u0442\u0430, \u0441 \u0442\u043e\u0439 \u0436\u0435 \u043b\u043e\u0433\u0438\u043a\u043e\u0439 \u0432 xaml.cs, \u043d\u043e \u0441 Map \u0432\u043c\u0435\u0441\u0442\u043e CustomMap \u0432 xaml.<\/summary>\n<div class=\"spoiler__content\">\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/13d\/bbf\/aad\/13dbbfaaddd0923240defe3f078be6f0.png\" width=\"471\" height=\"912\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/13d\/bbf\/aad\/13dbbfaaddd0923240defe3f078be6f0.png\"\/><figcaption><\/figcaption><\/figure>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>\u041d\u0430\u0448\u0430 CustomMap<\/summary>\n<div class=\"spoiler__content\">\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/588\/653\/0d3\/5886530d39a7d81c8f9359024755e0ea.png\" width=\"474\" height=\"911\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/588\/653\/0d3\/5886530d39a7d81c8f9359024755e0ea.png\"\/><figcaption><\/figcaption><\/figure>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u044d\u0442\u043e \u0436\u0435 \u0434\u043b\u044f iOs, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u0434\u043b\u044f xamarin \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u0449\u0438\u043a \u043d\u0430 iOs, \u043d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 \u043c\u0435\u0442\u043e\u0434 CreateAnnotation \u043d\u0430 214 \u0441\u0442\u0440\u043e\u043a\u0435 \u0438 \u043c\u0435\u0442\u043e\u0434 GetViewForAnnotation \u043d\u0430 224 \u0441\u0442\u0440\u043e\u043a\u0435. \u0412 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u0435 \u044d\u0442\u0438 \u043c\u0435\u0442\u043e\u0434\u044b \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u0442\u0430\u043a:<\/p>\n<details class=\"spoiler\">\n<summary>CreateAnnotation<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cs\">protected virtual IMKAnnotation CreateAnnotation(Pin pin) { return new MKPointAnnotation { Title = pin.Label, Subtitle = pin.Address ?? \"\", Coordinate = new CLLocationCoordinate2D(pin.Position.Latitude, pin.Position.Longitude) }; }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>GetViewForAnnotation<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cs\">protected virtual MKAnnotationView GetViewForAnnotation(MKMapView mapView, IMKAnnotation annotation) { MKAnnotationView mapPin = null;  \/\/ https:\/\/bugzilla.xamarin.com\/show_bug.cgi?id=26416 var userLocationAnnotation = Runtime.GetNSObject(annotation.Handle) as MKUserLocation; if (userLocationAnnotation != null) return null;  const string defaultPinId = \"defaultPin\"; mapPin = mapView.DequeueReusableAnnotation(defaultPinId); if (mapPin == null) { mapPin = new MKPinAnnotationView(annotation, defaultPinId); mapPin.CanShowCallout = true; }  mapPin.Annotation = annotation; AttachGestureToPin(mapPin, annotation);  return mapPin; }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u041b\u043e\u0433\u0438\u043a\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u043d\u0430 iOs \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u043d\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u0435\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0430 Android, \u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438 \u043d\u0430 iOs \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f Annotation \u0438 AnnotationView, \u0432 \u043a\u0440\u0430\u0442\u0446\u0435 \u044d\u0442\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043f\u0438\u043d\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e (\u0445\u043e\u0442\u044f \u0442\u0430\u043a\u043e\u0439 \u043e\u0442\u0432\u0435\u0442 \u043d\u0435 \u0442\u043e\u0447\u043d\u044b\u0439, \u043d\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e\u0431 \u044d\u0442\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0445 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430\u0445). \u0412 \u043e\u0431\u0449\u0435\u043c, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u044b \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 Annotation \u0438 AnnotationView, \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043c\u044b \u0438\u0445 \u0431\u0443\u0434\u0435\u043c \u0432 [ProjectName].iOs \u043f\u0440\u043e\u0435\u043a\u0442\u0435:<\/p>\n<details class=\"spoiler\">\n<summary>CustomPinAnnotation<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cs\">public class CustomPinAnnotation : MKPointAnnotation     {     \/\/ \u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u043f\u0438\u043d, \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c         public CustomPin SharedPin { get; }          public CustomPinAnnotation(CustomPin pin)         {             SharedPin = pin;              Title = pin.Label;             Subtitle = pin.Address;             \/\/ \u041f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u043c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0432 CL \u0434\u043b\u044f iOs             Coordinate = ToLocationCoordinate(pin.Position);         }          public override string Title         {             get => base.Title;             set             {                 if (Title != value)                 {                     string titleKey = nameof(Title).ToLower();                      WillChangeValue(titleKey);                     base.Title = value;                     DidChangeValue(titleKey);                 }             }         }          public override string Subtitle         {             get => base.Subtitle;             set             {                 if (Subtitle != value)                 {                     string subtitleKey = nameof(Subtitle).ToLower();                      WillChangeValue(subtitleKey);                     base.Subtitle = value;                     DidChangeValue(subtitleKey);                 }             }         }          public override CLLocationCoordinate2D Coordinate         {             get => base.Coordinate;             set             {                 if (Coordinate.Latitude != value.Latitude ||                     Coordinate.Longitude != value.Longitude)                 {                     string coordinateKey = nameof(Coordinate).ToLower();                      WillChangeValue(coordinateKey);                     base.Coordinate = value;                     DidChangeValue(coordinateKey);                 }             }         }          private CLLocationCoordinate2D ToLocationCoordinate(Position self)         {             return new CLLocationCoordinate2D(self.Latitude, self.Longitude);         }     }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>CustomPinAnnotationView<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cs\">public class CustomPinAnnotationView : MKAnnotationView     {     \/\/ \u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 View         public const string ViewIdentifier = nameof(CustomPinAnnotationView); \/\/ \u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u0443\u044e \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044e         private CustomPinAnnotation _SkiaAnnotation => base.Annotation as CustomPinAnnotation;      \/\/ \u0422\u043e\u043a\u0435\u043d \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f         private CancellationTokenSource _imageUpdateCts;         \/\/ Density \u044d\u043a\u0440\u0430\u043d\u0430 \u0434\u043b\u044f \u0432\u044b\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0432 \u043f\u0438\u043a\u0441\u0435\u043b\u044f\u0445         private nfloat _screenDensity;          public CustomPinAnnotationView(CustomPinAnnotation annotation) : base(annotation, ViewIdentifier)         {             _screenDensity = UIScreen.MainScreen.Scale;         }          internal async void UpdateImage()         {             CustomPin pin = _SkiaAnnotation?.SharedPin;             UIImage image;             CancellationTokenSource renderCts = new CancellationTokenSource();              _imageUpdateCts?.Cancel();             _imageUpdateCts = renderCts;              try             {             \/\/ \u0420\u0438\u0441\u0443\u0435\u043c \u043f\u0438\u043d \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e                 image = await RenderPinAsync(pin, renderCts.Token).ConfigureAwait(false);                  renderCts.Token.ThrowIfCancellationRequested();                  Device.BeginInvokeOnMainThread(() =>                 {                     if (!renderCts.IsCancellationRequested)                     {                     \/\/ \u0417\u0430\u0434\u0430\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e \u0432 \u043f\u043e\u0442\u043e\u043a\u0435 UI                         Image = image;                         Bounds = new CGRect(CGPoint.Empty, new CGSize(pin.Width, pin.Height));                     }                 });             }             catch (OperationCanceledException)             {                 \/\/ Ignore             }             catch (Exception e)             {                 System.Diagnostics.Debug.WriteLine(\"Failed to render pin annotation: \\n\" + e);             }         }          private Task&lt;UIImage> RenderPinAsync(CustomPin pin, CancellationToken token = default(CancellationToken))         {             return Task.Run(() =>             {             \/\/ \u0412\u044b\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c \u0440\u0430\u0437\u043c\u0435\u0440\u044b \u043f\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0438 \u0441 Android \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u0449\u0438\u043a\u043e\u043c                 double bitmapWidth = pin.Width * _screenDensity;                 double bitmapHeight = pin.Height * _screenDensity;                  \/\/ \u041e\u0442\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u0435\u043c \u043f\u0438\u043d \u043f\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0438 \u0441 Android \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u0449\u0438\u043a\u043e\u043c                 using (SKSurface surface = SKSurface.Create(new SKImageInfo((int)bitmapWidth, (int)bitmapHeight, SKColorType.Rgba8888, SKAlphaType.Premul)))                 {                     surface.Canvas.Clear(SKColor.Empty);                     pin.DrawPin(surface);                      return surface.PeekPixels().ToUIImage();                 }             }, token);         }          public void UpdateAnchor()         {             CenterOffset = new CGPoint(Bounds.Width * (0.5 - _SkiaAnnotation.SharedPin.AnchorX),                                        Bounds.Height * (0.5 - _SkiaAnnotation.SharedPin.AnchorY));         }     }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u041a\u0430\u043a \u0438 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u0449\u0438\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b\u0438 \u043f\u043e\u0434 Android, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u0436\u0435 \u0432 [ProjectName].iOs \u043f\u0440\u043e\u0435\u043a\u0442\u0435, \u0437\u0430\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"cs\">[assembly: ExportRenderer(typeof(CustomMap), typeof(CustomMapRenderer))] namespace [ProjectName].iOS.Renderers {     public class CustomMapRenderer : MapRenderer     {         protected override IMKAnnotation CreateAnnotation(Pin pin)         {             return base.CreateAnnotation(pin);         }          protected override MKAnnotationView GetViewForAnnotation(MKMapView mapView, IMKAnnotation annotation)         {             return base.GetViewForAnnotation(mapView, annotation);         }     } }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0441\u044e\u0434\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0434\u043b\u044f \u043d\u0430\u0448\u0438\u0445 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0445 \u043f\u0438\u043d\u043e\u0432, \u0441 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0445 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u0439\u044e\u0449\u0438\u0439 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u0449\u0438\u043a \u0431\u0443\u0434\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c:<\/p>\n<pre><code class=\"cs\">[assembly: ExportRenderer(typeof(CustomMap), typeof(CustomMapRenderer))] namespace [ProjectName].iOS.Renderers {     public class CustomMapRenderer : MapRenderer     {         protected override IMKAnnotation CreateAnnotation(Pin pin)         {             if (pin is CustomPin skPin)             {                 \/\/\u0415\u0441\u043b\u0438 \u043c\u044b \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043d\u0430\u0448 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0439 \u043f\u0438\u043d, \u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0435\u043c\u0443 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u0443\u044e \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044e.                 IMKAnnotation result = new CustomPinAnnotation(skPin);                  skPin.MarkerId = result;                  return result;             }             else                 return base.CreateAnnotation(pin);         }          protected override MKAnnotationView GetViewForAnnotation(MKMapView mapView, IMKAnnotation annotation)         {             if (annotation is CustomPinAnnotation skiaAnnotation)             {                 \/\/ \u0415\u0441\u043b\u0438 \u043c\u044b \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043d\u0430\u0448\u0443 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u0443\u044e \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044e, \u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0438\u0437 \u043d\u0435\u0435 \u043d\u0430\u0448 \u043f\u0438\u043d                 CustomPin skPin = skiaAnnotation.SharedPin;                  \/\/ \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043d\u0430 \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438, \u043f\u043e \u0441\u043e\u0432\u0435\u0442\u0443 Xamarin                 CustomPinAnnotationView pinView = mapView.DequeueReusableAnnotation(CustomPinAnnotationView.ViewIdentifier) as CustomPinAnnotationView                                                     ?? new CustomPinAnnotationView(skiaAnnotation);                  \/\/ \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0436\u0435\u0441\u0442\u044b \u043a \u043f\u0438\u043d\u0443                 base.AttachGestureToPin(pinView, annotation);                  pinView.Annotation = skiaAnnotation;                 \/\/ \u041e\u0442\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u0435\u043c \u043f\u0438\u043d                 pinView.UpdateImage();                 \/\/ \u041e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u044f\u043a\u043e\u0440\u044c                 pinView.UpdateAnchor();                 pinView.Hidden = !skPin.IsVisible;                 pinView.Enabled = skPin.Clickable;                  return pinView;             }             else                 return base.GetViewForAnnotation(mapView, annotation);         }     } }<\/code><\/pre>\n<p>\u0418 \u043d\u0430 \u044d\u0442\u043e\u043c \u0432 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435 \u0432\u0441\u0435, \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0445 \u043f\u0438\u043d\u043e\u0432 \u043d\u0430 iOs, \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0434\u0435\u043b\u0430\u0442\u044c \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u043b\u044e\u0431\u044b\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u0438\u043d\u0430 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 SkiaSharp \u043f\u0443\u0442\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0442 CustomPin, \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0438\u0445 \u0432 CustomMap.Pins. \u0411\u0443\u0434\u0443 \u0440\u0430\u0434 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u0438\u0432\u043d\u043e\u0439 \u043a\u0440\u0438\u0442\u0438\u043a\u0435 \u0438 \u043e\u0442\u0437\u044b\u0432\u0443 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445!<\/p>\n<p>\u041f\u0440\u043e\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f \u0441\u043e\u0437\u0434\u0430\u043b \u043f\u043e \u043c\u0435\u0440\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u044c\u0438 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043d\u0430 github:<br \/><a href=\"https:\/\/github.com\/AlexMorOR\/Xamarin-CustomMap-with-CustomPins\" rel=\"noopener noreferrer nofollow\">AlexMorOR\/Xamarin-CustomMap-with-CustomPins: Here&#8217;s a solution to extend the native xamarin map to include custom image pins. (github.com)<\/a>  <\/p>\n<details class=\"spoiler\">\n<summary>P.S.<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0421\u0442\u0430\u0442\u044c\u044f \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u043b\u0430\u0441\u044c \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043a\u043e\u0434\u0430 \u0438\u0437 \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u043d\u0430\u0434 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u044f \u0440\u0430\u0431\u043e\u0442\u0430\u044e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0443\u043f\u0443\u0449\u0435\u043d\u044b \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0438\u0433\u0434\u0435 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f. \u041d\u043e \u0435\u0441\u043b\u0438 \u044f \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043b \u0442\u0430\u043a\u043e\u0435 \u0443\u043f\u0443\u0449\u0435\u043d\u0438\u0435 &#8212; \u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0443 \u043a\u0430\u0440\u0442\u044b \u044d\u0442\u043e \u043d\u0435 \u043f\u043e\u0432\u043b\u0438\u044f\u0435\u0442.<\/p>\n<\/div>\n<\/details>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <\/p>\n<div class=\"tm-article-poll\">\n<div class=\"tm-notice tm-article-poll__notice tm-notice_positive\"><!----> <\/p>\n<div class=\"tm-notice__inner\"><!----> <\/p>\n<div data-test-id=\"notice-content\" class=\"tm-notice__content\"><span>\u0422\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043c\u043e\u0433\u0443\u0442 \u0443\u0447\u0430\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0432 \u043e\u043f\u0440\u043e\u0441\u0435. <a rel=\"nofollow\" href=\"\/kek\/v1\/auth\/habrahabr\/?back=\/ru\/post\/682134\/&#038;hl=ru\">\u0412\u043e\u0439\u0434\u0438\u0442\u0435<\/a>, \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430.<\/span><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__header\">\u0427\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 \u0412\u044b: Xamarin \u0438\u043b\u0438 MAUI?<\/div>\n<div class=\"tm-article-poll__answers\">\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent\">             0%           <\/span> <span class=\"tm-article-poll__answer-label\">\u0415\u0449\u0435 \u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0441\u044c Xamarin<\/span> <span class=\"tm-article-poll__answer-votes\">             0           <\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress\" style=\"width:0%;\"><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent tm-article-poll__answer-percent_winning\">             0%           <\/span> <span class=\"tm-article-poll__answer-label\">\u0423\u0436\u0435 \u043f\u0435\u0440\u0435\u0448\u0435\u043b \u043d\u0430 MAUI<\/span> <span class=\"tm-article-poll__answer-votes\">             0           <\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress tm-article-poll__answer-progress_winning\" style=\"width:0%;\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__stats\">        \u041d\u0438\u043a\u0442\u043e \u0435\u0449\u0435 \u043d\u0435 \u0433\u043e\u043b\u043e\u0441\u043e\u0432\u0430\u043b.          \u0412\u043e\u0437\u0434\u0435\u0440\u0436\u0430\u043b\u0441\u044f 1 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c.      <\/div>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/682134\/\"> https:\/\/habr.com\/ru\/post\/682134\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u044f \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438 \u043f\u0440\u0438\u043c\u0435\u0440 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0445 \u043f\u0438\u043d\u043e\u0432 \u0434\u043b\u044f \u043a\u0430\u0440\u0442\u044b xamarin. \u041f\u0438\u043d\u044b \u0431\u0443\u0434\u0443\u0442 \u043e\u0431\u043b\u0430\u0434\u0430\u0442\u044c \u0442\u0435\u043c \u0432\u0438\u0434\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u0430\u043c \u043d\u0443\u0436\u0435\u043d. \u0422\u0430\u043a \u0436\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0447\u0430\u0441\u0442\u044c \u043a\u043e\u0434\u0430 xamarin.maps, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0438\u0439 \u0437\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435, \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0443 \u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043f\u0438\u043d\u043e\u0432.<\/p>\n<p>\u0411\u043b\u0430\u0433\u043e \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 xamarin.forms \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u043d\u0430 github, \u0438 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0432\u0435\u0441\u044c \u043a\u043e\u0434:<\/p>\n<p><a href=\"https:\/\/github.com\/xamarin\/Xamarin.Forms\" rel=\"noopener noreferrer nofollow\">xamarin\/Xamarin.Forms: Xamarin.Forms Official Home (github.com)<\/a>  <\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u044d\u0442\u0438 \u0444\u0430\u0439\u043b\u044b \u0441 \u0433\u0438\u0442\u0430:<\/p>\n<ul>\n<li>\n<p>iOs.MapRenderer <a href=\"https:\/\/github.com\/xamarin\/Xamarin.Forms\/blob\/5.0.0\/Xamarin.Forms.Maps.iOS\/MapRenderer.cs\" rel=\"noopener noreferrer nofollow\">Xamarin.Forms\/MapRenderer.cs at 5.0.0 \u00b7 xamarin\/Xamarin.Forms (github.com)<\/a>  <\/p>\n<\/li>\n<li>\n<p>Android.MapRenderer <a href=\"https:\/\/github.com\/xamarin\/Xamarin.Forms\/blob\/5.0.0\/Xamarin.Forms.Maps.Android\/MapRenderer.cs\" rel=\"noopener noreferrer nofollow\">Xamarin.Forms\/MapRenderer.cs at 5.0.0 \u00b7 xamarin\/Xamarin.Forms (github.com)<\/a>  <\/p>\n<\/li>\n<\/ul>\n<p>\u0414\u043b\u044f \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0430 \u0443 \u0432\u0430\u0441 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u044b \u043f\u0430\u043a\u0435\u0442\u044b Xamarin.Maps \u0432\u043e \u0432\u0441\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u044b, \u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d \u043f\u043e <a href=\"https:\/\/docs.microsoft.com\/ru-ru\/xamarin\/xamarin-forms\/user-interface\/map\/setup\" rel=\"noopener noreferrer nofollow\">\u0433\u0430\u0439\u0434\u0443 \u043e\u0442 xamarin<\/a>:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0422\u0430\u043a \u0436\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u043f\u0430\u043a\u0435\u0442 SkiaSharp \u0438 SkiaSharp.Views.Forms \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 (\u043d\u0435 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0439 \u0434\u043b\u044f \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c):<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0442\u0438\u043f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0442\u0430\u043d\u0435\u0442 \u0431\u0430\u0437\u043e\u0439 \u0434\u043b\u044f \u043f\u0438\u043d\u043e\u0432, \u0438 \u043a\u0430\u0440\u0442\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0439, \u0438 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043d\u0430\u0448 \u043f\u0438\u043d, \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 [ProjectName]:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 CustomPin &#8212; \u0431\u0430\u0437\u0430 \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0438\u043d\u0430<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cs\">public abstract class CustomPin : Pin     {         public class MapMarkerInvalidateEventArgs         {             public double Width { get; }             public double Height { get; }              internal MapMarkerInvalidateEventArgs(CustomPin marker)             {                 Width = marker.Width;                 Height = marker.Height;             }         }                  public event EventHandler&lt;MapMarkerInvalidateEventArgs> RequestInvalidate;  \/\/ Bindable properties         public static readonly BindableProperty WidthProperty = BindableProperty.Create(nameof(Width), typeof(double), typeof(CustomPin), 32.0, propertyChanged: OnDrawablePropertyChanged);         public static readonly BindableProperty HeightProperty = BindableProperty.Create(nameof(Height), typeof(double), typeof(CustomPin), 32.0, propertyChanged: OnDrawablePropertyChanged);         public static readonly BindableProperty AnchorXProperty = BindableProperty.Create(nameof(AnchorX), typeof(double), typeof(CustomPin), 0.5);         public static readonly BindableProperty AnchorYProperty = BindableProperty.Create(nameof(AnchorY), typeof(double), typeof(CustomPin), 0.5);         public static readonly BindableProperty IsVisibleProperty = BindableProperty.Create(nameof(IsVisible), typeof(bool), typeof(CustomPin), true);         public static readonly BindableProperty ClickableProperty = BindableProperty.Create(nameof(Clickable), typeof(bool), typeof(CustomPin), true);  \/\/ \u0428\u0438\u0440\u0438\u043d\u0430 \u043f\u0438\u043d\u0430         public double Width         {             get { return (double)GetValue(WidthProperty); }             set { SetValue(WidthProperty, value); }         }  \/\/ \u0412\u044b\u0441\u043e\u0442\u0430 \u043f\u0438\u043d\u0430         public double Height         {             get { return (double)GetValue(HeightProperty); }             set { SetValue(HeightProperty, value); }         }  \/\/ \u0420\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u0438\u043d\u0430 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0442\u043e\u0447\u043a\u0438 \u043d\u0430 \u043a\u0430\u0440\u0442\u0435 \u043f\u043e X         public double AnchorX         {             get { return (double)GetValue(AnchorXProperty); }             set { SetValue(AnchorXProperty, value); }         }  \/\/ \u0420\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u0438\u043d\u0430 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0442\u043e\u0447\u043a\u0438 \u043d\u0430 \u043a\u0430\u0440\u0442\u0435 \u043f\u043e Y         public double AnchorY         {             get { return (double)GetValue(AnchorYProperty); }             set { SetValue(AnchorYProperty, value); }         }  \/\/ \u0412\u0438\u0434\u0435\u043d \u043b\u0438 \u043f\u0438\u043d         public bool IsVisible         {             get { return (bool)GetValue(IsVisibleProperty); }             set { SetValue(IsVisibleProperty, value); }         }  \/\/ \u0418\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u0435\u043d \u043b\u0438 \u043f\u0438\u043d         public bool Clickable         {             get { return (bool)GetValue(ClickableProperty); }             set { SetValue(ClickableProperty, value); }         }          private static void OnDrawablePropertyChanged(BindableObject bindable, object oldValue, object newValue)         {             CustomPin marker = bindable as CustomPin;              marker.Invalidate();         }          public void Invalidate()         {             RequestInvalidate?.Invoke(this, new MapMarkerInvalidateEventArgs(this));         }  \/\/ \u041c\u0435\u0442\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u0430\u043d \u0432 \u0434\u043e\u0447\u0435\u0440\u043d\u0435\u043c \u043a\u043b\u0430\u0441\u0441\u0435, \u0432 \u043d\u0435\u043c \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0430 \u043f\u0438\u043d\u0430         public abstract void DrawPin(SKSurface surface);     }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 CustomMap &#8212; \u043d\u0430\u0448\u0430 \u043a\u0430\u0440\u0442\u0430 \u0441 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 CustomPin<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cs\">public class CustomMap : Map { }<\/code><\/pre>\n<p>\u041f\u0440\u043e\u0441\u0442\u043e\u0439 \u043a\u043e\u0434, \u0431\u043e\u043b\u044c\u0448\u0435\u0433\u043e \u043d\u0430\u043c \u0438 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e.<\/p>\n<\/div>\n<\/details>\n<p>\u0418 \u0442\u0430\u043a, \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0440\u0435\u043d\u0434\u0435\u0440 \u043f\u043e\u0434 Android, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e &#8212; \u043d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 \u043c\u0435\u0442\u043e\u0434 CreateMarker \u043d\u0430 248 \u0441\u0442\u0440\u043e\u043a\u0435, \u0432\u043e\u0442 \u0442\u0430\u043a \u043e\u043d \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u0435:<\/p>\n<pre><code class=\"cs\">protected virtual MarkerOptions CreateMarker(Pin pin) {   var opts = new MarkerOptions();   opts.SetPosition(new LatLng(pin.Position.Latitude, pin.Position.Longitude));   opts.SetTitle(pin.Label);   opts.SetSnippet(pin.Address);    return opts; }<\/code><\/pre>\n<p>\u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0438\u043d\u0430, \u0432\u0430\u0436\u043d\u044b\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u043c \u0437\u0434\u0435\u0441\u044c, \u043a\u0430\u043a \u043d\u0435\u0442\u0440\u0443\u0434\u043d\u043e \u0434\u043e\u0433\u0430\u0434\u0430\u0442\u044c\u0441\u044f, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f &#171;MarkerOptions opts&#187;, \u0442\u0438\u043f MarkerOptions \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043c\u0435\u0442\u043e\u0434 SetIcon(BitmapDescriptor), \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u044b \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0434\u043b\u044f \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u043d\u0438\u044f \u043f\u0438\u043d\u0430. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0439 \u043a\u043b\u0430\u0441\u0441 \u043a \u044d\u0442\u043e\u043c\u0443 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u0449\u0438\u043a\u0443 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 [ProjectName].Android, \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0432 \u043d\u0435\u043c \u043f\u0430\u043f\u043a\u0443 Renderers:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041a\u043e\u0434 \u0437\u0430\u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u043a\u043b\u0430\u0441\u0441\u0430 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u0449\u0438\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"cs\">[assembly: Xamarin.Forms.ExportRenderer(typeof(CustomMap), typeof(CustomMapRenderer))] namespace [ProjectName].Droid.Renderers {     public class CustomMapRenderer : MapRenderer     {         public CustomMapRenderer(Context context) : base(context){}          protected override MarkerOptions CreateMarker(Pin pin)         {             return base.CreateMarker(pin);         }     } }<\/code><\/pre>\n<p>\u041f\u043e\u043a\u0430 \u0447\u0442\u043e \u043e\u043d \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u043c\u0435\u043d\u044f\u0435\u0442 \u043b\u043e\u0433\u0438\u043a\u0443 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u0430 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u043d\u0430\u0448\u0435\u0433\u043e CustomPin, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"cs\">[assembly: Xamarin.Forms.ExportRenderer(typeof(CustomMap), typeof(CustomMapRenderer))] namespace [ProjectName].Droid.Renderers {     public class CustomMapRenderer : MapRenderer     {         public CustomMapRenderer(Context context) : base(context){}          protected override MarkerOptions CreateMarker(Pin pin)         {         \/\/ \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u0432 \u0431\u0430\u0437\u043e\u0432\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435 MarkerOptions             var opts = base.CreateMarker(pin); \/\/ \u0415\u0441\u043b\u0438 \u043d\u0430\u0448 \u043c\u0430\u0440\u043a\u0435\u0440 - \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0439...             if(pin is CustomPin cpin)             {             \/\/ ... \u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c SKPixmap \u0441 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c \u043f\u0438\u043d\u0430                 SKPixmap markerBitmap = DrawMarker(cpin); \/\/ \u0417\u0430\u0434\u0430\u0435\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043f\u0438\u043d\u0430 \u0438 \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u044c                 opts.SetIcon(BitmapDescriptorFactory.FromBitmap(markerBitmap.ToBitmap()))                        .Visible(cpin.IsVisible);             \/\/ \u0412\u044b\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u044f\u043a\u043e\u0440\u044f                 opts.Anchor((float)cpin.AnchorX, (float)cpin.AnchorY);             }              return opts;         }          private SKPixmap DrawMarker(CustomPin skPin)         {         \/\/ \u0421\u0447\u0438\u0442\u0430\u0435\u043c \u0440\u0430\u0437\u043c\u0435\u0440 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u0438\u043d\u0430 \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e Density \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430             double bitmapWidth = skPin.Width * Context.Resources.DisplayMetrics.Density;             double bitmapHeight = skPin.Height * Context.Resources.DisplayMetrics.Density;         \/\/ \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u0443\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438             SKSurface surface = SKSurface.Create(new SKImageInfo((int)bitmapWidth, (int)bitmapHeight, SKColorType.Rgba8888, SKAlphaType.Premul)); \/\/ \u0417\u0430\u043b\u0438\u0432\u0430\u0435\u043c \u0441\u0443\u0440\u0444\u0435\u0439\u0441 \u0446\u0432\u0435\u0442\u043e\u043c Transparent             surface.Canvas.Clear(SKColor.Empty);         \/\/ \u041f\u0440\u043e\u0441\u0438\u043c \u043f\u0438\u043d \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 \u0441\u0443\u0440\u0444\u0435\u0439\u0441             skPin.DrawPin(surface); \/\/ \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043f\u0438\u043a\u0441\u0435\u043b\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0432\u0435\u0441\u0442\u0438 \u0432 BitMap             return surface.PeekPixels();         }     } }<\/code><\/pre>\n<p>\u041e\u0442\u043b\u0438\u0447\u043d\u043e, \u0434\u043b\u044f Android \u043c\u044b \u0432\u0441\u0435 \u0441\u0434\u0435\u043b\u0430\u043b\u0438, \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043d\u0430\u0448\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0442\u0430\u043a\u043e\u0433\u043e \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043f\u0438\u043d\u0430 (\u0421\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 [ProjectName]):<\/p>\n<pre><code class=\"cs\">internal sealed class CirclePin : CustomPin     {         \/\/ \u0421\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u0439 Bitmap         SKBitmap pinBitmap;          \/\/ \u041a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 string - \u044d\u0442\u043e \u0442\u0435\u043a\u0441\u0442 \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u0440\u0443\u0433\u0430         public CirclePin(string text)         {             \/\/ \u041e\u0442\u0441\u0442\u0443\u043f \u0442\u0435\u043a\u0441\u0442\u0430 \u043e\u0442 \u043a\u0440\u0430\u0435\u0432 \u043a\u0440\u0443\u0433\u0430             int circleOffset = 10;              \/\/ \u041c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u043a\u0440\u0443\u0433\u0430, \u043f\u0440\u0438 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u043e\u043c \u0442\u0435\u043a\u0441\u0442\u0435             int minSize = 40;              \/\/ \u0420\u0430\u0437\u043c\u0435\u0440 \u0448\u0440\u0438\u0444\u0442\u0430 \u0442\u0435\u043a\u0441\u0442\u0430             int textSize = 18;              \/\/ \u0417\u0430\u0434\u0430\u043d\u0438\u0435 \u0446\u0432\u0435\u0442\u0430 \u0442\u0435\u043a\u0441\u0442\u0430             Color tempColor = Color.White;             \/\/ \u041f\u0435\u0440\u0435\u0432\u043e\u0434 \u0438\u0437 Color \u0432 SKColor             SKColor textColor = new SKColor((byte)(tempColor.R * 255), (byte)(tempColor.G * 255), (byte)(tempColor.B * 255));              \/\/ \u0417\u0430\u0434\u0430\u043d\u0438\u0435 \u0446\u0432\u0435\u0442\u0430 \u043a\u0440\u0443\u0433\u0430             tempColor = Color.Black;             \/\/ \u041f\u0435\u0440\u0435\u0432\u043e\u0434 \u0438\u0437 Color \u0432 SKColor             SKColor circleColor = new SKColor((byte)(tempColor.R * 255), (byte)(tempColor.G * 255), (byte)(tempColor.B * 255));              PrepareBitmap(circleOffset, circleColor, text, textSize, textColor, minSize);         }          private void PrepareBitmap(int circleOffset, SKColor circleColor, string text, float textSize, SKColor textColor, int minSize, int iconSize = 28)         {             int width;             float den = (float)DeviceDisplay.MainDisplayInfo.Density;              \/\/ \u0423\u0434\u0432\u0430\u0438\u0432\u0430\u0435\u043c \u043e\u0442\u0441\u0442\u0443\u043f, \u0442.\u043a. \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u0441 2-\u0445 \u0441\u0442\u043e\u0440\u043e\u043d \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0439             circleOffset *= 2;              using (var font = SKTypeface.FromFamilyName(\"Arial\"))             using (var textBrush = new SKPaint             {                 Typeface = font,                 TextSize = textSize * den,                 IsAntialias = true,                 Color = textColor,                 TextAlign = SKTextAlign.Center,             })             {                 \/\/ \u0412\u044b\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0442\u0435\u043a\u0441\u0442\u0430                 SKRect textRect = new SKRect();                 textBrush.MeasureText(text, ref textRect);                  \/\/ \u0428\u0438\u0440\u0438\u043d\u0430 \u0442\u0435\u043a\u0441\u0442\u0430 \u0432 dip                 width = Math.Max((int)(Math.Ceiling(textRect.Width) \/ den) + circleOffset, minSize);                  \/\/<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-336916","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/336916","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=336916"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/336916\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=336916"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=336916"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=336916"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}