Пример #1
0
        private void MapOnDoubleClick(object sender, MapInputEventArgs args)
        {
            var currentCamera = BingMap.ActualCamera;

            _ = BingMap.TrySetSceneAsync(MapScene.CreateFromCamera(currentCamera));

            var geopoint = args.Location;

            AddMarker(geopoint);
            ReverseGeocodePoint(geopoint);
        }
        private async void UpdateCameraView()
        {
            if (customMap == null || nativeMap == null)
            {
                return;
            }

            if (nativeMap.Is3DSupported && customMap.IsMapLoaded)
            {
                try
                {
                    // Set the aerial 3D view.
                    //nativeMap.Style = MapStyle.Aerial3DWithRoads;

                    // Specify the location.

                    /*BasicGeoposition hwGeoposition = new BasicGeoposition() { Latitude = customMap.VisibleRegion.LatitudeDegrees, Longitude = customMap.VisibleRegion.LongitudeDegrees };
                     * Geopoint hwPoint = new Geopoint(hwGeoposition);
                     * // Create the map scene.
                     * MapScene hwScene = MapScene.CreateFromLocationAndRadius(hwPoint,
                     *                                                                   80, //show this many meters around
                     *                                                                   0, //looking at it to the North
                     *                                                                   60); //degrees pitch*/

                    MapScene hwScene = MapScene.CreateFromCamera(nativeMap.ActualCamera);

                    // Set the 3D view with animation.
                    await nativeMap.TrySetSceneAsync(hwScene, MapAnimationKind.Bow);
                } catch (Exception e)
                {
                    Debug.WriteLine("------------------------");
                    Debug.WriteLine(e.ToString());
                    Debug.WriteLine(e.StackTrace);
                    Debug.WriteLine("------------------------");
                }
            }
            else
            {
                // If 3D views are not supported, display dialog.
                ContentDialog viewNotSupportedDialog = new ContentDialog()
                {
                    Title             = "3D is not supported",
                    Content           = "\n3D views are not supported on this device.",
                    PrimaryButtonText = "OK"
                };
                await viewNotSupportedDialog.ShowAsync();
            }
        }
        public async Task MapDoubleClick(object sender, MapInputEventArgs e)
        {
            //Delete zoom behavior on doubleclick
            var camera        = (MapControl)sender;
            var currentCamera = camera.ActualCamera;
            await camera.TrySetSceneAsync(MapScene.CreateFromCamera(currentCamera));

            //End of delete zoom behavior
            try
            {
                if (PushpinTitle == null || PushpinTitle == "")
                {
                    throw new EmptyFieldException("Title");
                }
                if (EventSelected.PointsOfInterest.Where(pi => pi.Name == PushpinTitle).FirstOrDefault() != null)
                {
                    throw new PushpinTitleTakenException();
                }
                MapIcon newPushpin = new MapIcon
                {
                    Location = e.Location,
                    ZIndex   = 0,
                    NormalizedAnchorPoint = new Point(0.5, 1),
                    Title = PushpinTitle,
                };
                Pushpins.Add(newPushpin);
                EventSelected.PointsOfInterest.Add(new PointOfInterest()
                {
                    Latitude    = e.Location.Position.Latitude,
                    Longitude   = e.Location.Position.Longitude,
                    Name        = PushpinTitle,
                    Description = null,
                    EventId     = EventSelected.EventId,
                    ToBeRemoved = false,
                });
            } catch (EventException ex)
            {
                await _dialogService.ShowMessage(ex.Message, ex.Title);
            }
        }
Пример #4
0
 private void SaveScene(object sender, RoutedEventArgs e)
 {
     lastScene = MapScene.CreateFromCamera(MyMap.ActualCamera);
 }