Exemplo n.º 1
0
        private async void Is3DCheckBox_Toggled(object sender, RoutedEventArgs e)
        {
            if (sceneView != null && mapView != null)
            {
                bool isOn = ((ToggleSwitch)sender).IsOn;
                if (isOn == vm.Is3D)
                {
                    return; //this happens the first time it loads
                }
                HighlightFeature(null);
                if (vm.Is3D)
                {
                    var c = sceneView.Camera;
                    //If there's tilt or heading, reset before switching to 2D
                    if (c.Pitch > 1 || Math.Abs(c.Heading) > 1)
                    {
                        var center = await sceneView.ScreenToLocationAsync(new Point(sceneView.ActualWidth * .5, sceneView.ActualHeight * .5));

                        c = c.RotateAround(center, c.Heading, -c.Pitch, 0).RotateTo(0, 0, c.Roll);
                        await sceneView.SetViewpointCameraAsync(c);
                    }
                }
                GeoView from = vm.Is3D ? (GeoView)sceneView : (GeoView)mapView;
                GeoView to   = !vm.Is3D ? (GeoView)sceneView : (GeoView)mapView;
                var     vp   = from.GetCurrentViewpoint(ViewpointType.BoundingGeometry);
                if (vp != null)
                {
                    await to.SetViewpointAsync(vp, TimeSpan.Zero);
                }
                vm.Is3D = !vm.Is3D;
            }
        }
Exemplo n.º 2
0
        private void OnNavigationComplete(object sender, EventArgs eventArgs)
        {
            // Get a reference to the MapView or SceneView that raised the event.
            GeoView sendingView = (GeoView)sender;

            // Get a reference to the other view.
            GeoView otherView;

            if (sendingView is MapView)
            {
                otherView = _mySceneView;
            }
            else
            {
                otherView = _myMapView;
            }

            // Update the viewpoint on the other view.
            otherView.SetViewpoint(sendingView.GetCurrentViewpoint(ViewpointType.CenterAndScale));
        }