简体   繁体   English

Xamarin是否会形成Google Maps(基于 <Maps> )没有POI onclick方法?

[英]Does Xamarin Forms Google Maps (Custom Renderer based on <Maps>) Not have a POI onclick method?

I'm using Xamarin.Forms to build into Android and IOS applications. 我正在使用Xamarin.Forms构建到Android和IOS应用程序中。

I'm also using Xamarin.maps.googlemaps library that amay077 built based on xamarin.maps - github 我还使用Xamarin.maps.googlemaps是amay077基于xamarin.maps建库- github上

This library (as well as xamarin.maps ) only has an OnMapClicked event handler. 该库(以及xamarin.maps )只有一个OnMapClicked事件处理程序。 This library happens to just return the latitude and longitude of the clicked position (see below) Then I just take that latitude and longitude and query for the nearest POI. 该库恰好只是返回单击位置的纬度和经度(请参见下文),然后我仅获取该纬度和经度并查询最近的POI。

I remember when I built google-maps for specifically Android from Android Studio, when I clicked on the google-map and clicked on one of its POIs that shows with the map, I got some information on the clicked POI. 我记得当我从Android Studio构建专门用于Android的google-maps时,当我单击google-maps并单击与地图一起显示的POI之一时,我得到了有关单击的POI的一些信息。

Is there anything like that for xamarin.maps.googlemaps OR xamarin.maps? xamarin.maps.googlemaps或xamarin.maps有类似的东西吗? I just want to be able to click the POI icon that comes with the map. 我只希望能够单击地图随附的POI图标。

Another implementation is to just load up the entire view port of the map with ugly markers... I kind of want to avoid it. 另一种实现是使用丑陋的标记仅加载地图的整个视图端口……我有点想避免这种情况。

(init)
googlemap.MapClicked += Googlemap_MapClicked;

async void Googlemap_MapClicked(object sender, MapClickedEventArgs e){
/* HERE I WANT TO ACTUALLY GET SOME SORT OF POI INFORMATION THAT WAS CLICKED*/

/* ORIGINAL CODE */
google_results_layout.IsVisible = false;
GooglePlace place = await vm.GetMostLikelyPlace(e.Point.Latitude, e.Point.Longitude);
if (place == null)
  await DisplayAlert("Place Not Found!", "Place was not found via Google.", "OK");
else
  vm.SetSelectedLocation(place);
}

https://github.com/sp1008/Xamarin.Forms.GoogleMaps https://github.com/sp1008/Xamarin.Forms.GoogleMaps

I dont know if that is public or not, but I forked amay077's git and made poi changes to it. 我不知道这是否公开,但是我分叉了amay077的git并对其进行了poi更改。 It turns out it was simpler than I expected. 事实证明,这比我预期的要简单。

PS I only did it for Android and IOS. PS我只在Android和IOS上做到过。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM