private async void MySceneView_MouseLeftDown(object sender, MouseEventArgs e) { if (edit == true && (type == "line" || type == "area")) { if (MySceneView.GetCurrentViewpoint(ViewpointType.BoundingGeometry) == null) { return; } _mapViewModel.Clear(type); System.Windows.Point screenPoint = e.GetPosition(MySceneView); MapPoint mapPoint = await MySceneView.ScreenToLocationAsync(screenPoint); if (mapPoint.X != 0 && mapPoint.Y != 0 && mapPoint.Z != 0) { mapPoint = GeometryEngine.NormalizeCentralMeridian(mapPoint) as MapPoint; mapPoint_list.Add(new MapPoint(mapPoint.X, mapPoint.Y)); if (mapPoint_list.Count > 1) { var boatPositions = new PolylineBuilder(SpatialReferences.Wgs84); boatPositions.AddPoint(new MapPoint(mapPoint_list[mapPoint_list.Count - 2].X, mapPoint_list[mapPoint_list.Count - 2].Y)); boatPositions.AddPoint(new MapPoint(mapPoint_list[mapPoint_list.Count - 1].X, mapPoint_list[mapPoint_list.Count - 1].Y)); var boatRoute = boatPositions.ToGeometry(); _mapViewModel.Line(boatRoute, "temp");; } } } }
private async void MySceneView_PointerMoved(object sender, PointerRoutedEventArgs e) { try { // Get the geographic location for the current mouse position. MapPoint geoPoint = await MySceneView.ScreenToLocationAsync(e.GetCurrentPoint(MySceneView).Position); if (geoPoint == null) { return; } // Update the location distance measurement. _distanceMeasurement.EndLocation = geoPoint; } catch (Exception ex) { Debug.WriteLine(ex.ToString()); } }