Disable pitch and heading in SceneView

1187
1
09-22-2016 06:02 AM
EugenReiswich
New Contributor

Hi folks,

as our users complained that navigating in a 3D scene is more complex than in 2D we would like to enable and disable the 3D effect in our application using toggle buttons. In a MapView we could precisely set the interaction options like rotation, panning etc. In a SceneView these options are missing. Is there any workaround for this problem? 

Kind regards,

Eugen

0 Kudos
1 Reply
EugenReiswich
New Contributor

Hey folks,

we've made a litte progress on this. We've put a transparent Border above the SceneView that does catch all the interactions:

Snippet

<Border x:Name="InteractionAdapter" IsManipulationEnabled="True" Background="#00FF0000"        ManipulationDelta="InteractionAdapter_OnManipulationDelta"        Margin="0" Panel.ZIndex="100" TouchDown="InteractionAdapterBorder_OnTouchDown"        TouchUp="InteractionAdapter_OnTouchUp" />        <esri:SceneView x:Name="MainSceneView" LayerLoaded="OnLayerLoaded"                SceneViewTapped="MapView_OnMapViewTapped"                CameraChanged="SceneView_CameraChanged"                ManipulationInertiaStarting="BaseMapView_OnManipulationInertiaStarting"                ManipulationDelta="MainSceneView_OnManipulationDelta">

The Border translates ManipulationDeltas into Camera adjustments:

Snippet

 public void OnManipulationDelta(object sender, ManipulationDeltaEventArgs e){
    var camera = _sceneView.Camera;     double height = camera.Location.Z;      MapPoint newZoom = CalculateZoom(camera.Location, e);     MapPoint newPan = CalculatePan(camera, e, height);     MapPoint mergedManipulations = new MapPoint(newPan.X, newPan.Y, newZoom.Z, camera.Location.SpatialReference);      Camera newCameraRotation = CalculateRotation(e, camera);      Camera updatedCamera = newCameraRotation.SetLocation(mergedManipulations);      _sceneView.SetView(updatedCamera); }

Thats works fine for Pan, Rotate and Zoom gestures. However, we don't know how to pass on Tapped-Events to the SceneView. That is necessary for e.g. Hit-Testing. We've tried to pass on touch_up and touch_down events to the SceneView but that didn't work.

Snippet

private void InteractionAdapter_OnTouchUp(object sender, TouchEventArgs e) {     MainSceneView.RaiseEvent(e); }

We would appreciate any hint on how to raise MapViewTapped-Events.

Kind regards,

Eugen

0 Kudos