Exemplo n.º 1
0
 public CameraBounds(
     LatLngBounds bounds,
     Thickness padding,
     double?bearing = null,
     double?tilt    = null)
 {
     Bounds  = bounds;
     Padding = padding;
     Bearing = bearing;
     Tilt    = tilt;
 }
        public Task <byte[]> TakeSnapshotAsync(NxLatLngBounds bounds = default)
        {
            var tcs = new TaskCompletionSource <byte[]>();

            map.GetStyle(new GetStyleLoadedCallback(
                             new WeakReference <MapViewRenderer>(this),
                             tcs
                             ));

            return(tcs.Task);
        }
        private void OnCameraIdle(object sender, EventArgs e)
        {
            cameraBusy        = false;
            currentCamera     = new NxLatLng(map.CameraPosition.Target.Latitude, map.CameraPosition.Target.Longitude);
            Element.ZoomLevel = map.CameraPosition.Zoom;

            if (!Element.Center.Equals(currentCamera))
            {
                Element.Center = currentCamera;
                var    region       = map.Projection.GetVisibleRegion(true);
                double northEastLat = region.LatLngBounds.NorthEast.Latitude;
                double northEastLng = region.LatLngBounds.NorthEast.Longitude;
                double southWestLat = region.LatLngBounds.SouthWest.Latitude;
                double southWestLng = region.LatLngBounds.SouthWest.Longitude;
                var    bounds       = new Naxam.Mapbox.LatLngBounds()
                {
                    NorthEast = new NxLatLng(northEastLat, northEastLng),
                    SouthWest = new NxLatLng(southWestLat, southWestLng)
                };
                Element.DidBoundariesChangedCommand?.Execute(bounds);
            }
        }