private async Task SelectGraphicAsync(Point point) { // Clear previous selection if (_selection != null) { _selection.Unselect(); _selection.SetVisible(); } _selection = null; // Find first graphic from the overlays foreach (var overlay in MySceneView.GraphicsOverlays) { var foundGraphic = (await MySceneView.IdentifyGraphicsOverlayAsync(overlay, point, 2, false, 1)).Graphics.FirstOrDefault(); if (foundGraphic != null) { _selection = new GraphicSelection(foundGraphic, overlay); _selection.Select(); break; } } EditButton.IsEnabled = _selection == null ? false : true; }
private async Task SelectGraphicAsync(Point point) { // Clear previous selection if (_selection != null) { _selection.Unselect(); _selection.SetVisible(); } _selection = null; // Find first graphic from the overlays foreach (var overlay in MySceneView.GraphicsOverlays) { var foundGraphic = await overlay.HitTestAsync( MySceneView, point); if (foundGraphic != null) { _selection = new GraphicSelection(foundGraphic, overlay); _selection.Select(); break; } } EditButton.IsEnabled = _selection == null ? false : true; }
private void Clear_Click(object sender, RoutedEventArgs e) { // Clear any existing graphics _pointsOverlay.Graphics.Clear(); _polylinesOverlay.Graphics.Clear(); _polygonsOverlay.Graphics.Clear(); if (_selection != null) { _selection.Unselect(); _selection = null; } DrawButton.IsEnabled = true; EditButton.IsEnabled = false; }