Exemple #1
0
        IFeature[] GetFeaturesAroundPoint(Point point, double radius, string[] layers)
        {
            var   output       = new List <IFeature>();
            RectF rect         = point.ToRect(Context.ToPixels(radius));
            var   listFeatures = map.QueryRenderedFeatures(rect, layers);

            return(listFeatures.Select(x => x.ToFeature())
                   .Where(x => x != null)
                   .ToArray());
        }
Exemple #2
0
        public void OnMapClick(LatLng point)
        {
            var mapLockedPinsLayer = (SymbolLayer)nMap.GetLayer(mapLockedPinsKey);
            var normalPinsLayer    = (SymbolLayer)nMap.GetLayer(normalPinsKey);

            var pixel    = nMap.Projection.ToScreenLocation(point);
            var features = nMap.QueryRenderedFeatures(pixel, mapLockedPinsKey, normalPinsKey);

            System.Diagnostics.Debug.WriteLine($"Features: {features}");

            if (features.Any() && xMap.pinClickedCommand != null)
            {
                if (features[0] is Feature feature)
                {
                    xMap.pinClickedCommand.Execute(xMap.pins.FirstOrDefault(x => x.id == feature.GetStringProperty(pin_id_key).ToString()));
                }
            }
            else
            {
                xMap.mapClicked(point.toFormsPostion());
            }
        }