protected override void OnClick() { activeMapView = ProSDKSampleModule.ActiveMapView; Camera activeCamera = activeMapView.Camera; if (activeMapView.Is2D) { // in 2D we are changing the scale double scaleStep = activeCamera.Scale / _zoomSteps; activeCamera.Scale = activeCamera.Scale + scaleStep; } else { // in 3D we are changing the Z-value and the pitch (for drama) double heightZStep = activeCamera.EyeXYZ.Z / _zoomSteps; double pitchStep = 90.0 / _zoomSteps; activeCamera.Pitch = activeCamera.Pitch + pitchStep; activeCamera.EyeXYZ.Z = activeCamera.EyeXYZ.Z + heightZStep; } // the heading changes the same in 2D and 3D activeCamera.Heading = HollywoodZoomUtils.StepHeading(activeCamera.Heading, -30); // assign the changed camera back to the view activeMapView.Camera = activeCamera; }
protected override async void OnClick() { activeMapView = ProSDKSampleModule.ActiveMapView; Camera camera = await activeMapView.GetCameraAsync(); bool is2D = false; try { is2D = activeMapView.ViewMode == ViewMode.Map; } catch (System.ApplicationException) { return; } if (is2D) { // in 2D we are changing the scale double scaleStep = camera.Scale / _zoomSteps; camera.Scale = camera.Scale - scaleStep; } else { // in 3D we are changing the Z-value and the pitch (for drama) double heightZStep = camera.Z / _zoomSteps; double pitchStep = 90.0 / _zoomSteps; camera.Pitch = camera.Pitch - pitchStep; camera.Z = camera.Z - heightZStep; } // the heading changes the same in 2D and 3D camera.Heading = HollywoodZoomUtils.StepHeading(camera.Heading, 30); // assign the changed camera back to the view activeMapView.ZoomToAsync(camera); }