Пример #1
0
 private async void OnEraseButtonClick()
 {
     while ((SelectedDrawingOption as DrawingOption) == _eraseDrawingOption)
     {
         await SceneEditHelper.EraseGeometrys(View);
     }
 }
Пример #2
0
        private async void OnEditButtonClick()
        {
            if (_selection == null)
            {
                return;                     // Selection missing
            }
            // Cancel previous edit
            if (SceneEditHelper.IsActive)
            {
                SceneEditHelper.Cancel();
            }

            Esri.ArcGISRuntime.Geometry.Geometry editedGeometry = null;

            try
            {
                // Edit selected geometry and set it back to the selected graphic
                switch (_selection.GeometryType)
                {
                case GeometryType.Point:
                    editedGeometry = await SceneEditHelper.CreatePointAsync(
                        View);

                    break;

                case GeometryType.Polyline:
                    _selection.SetHidden();     // Hide selected graphic from the UI
                    editedGeometry = await SceneEditHelper.EditPolylineAsync(
                        View,
                        _selection.SelectedGraphic.Geometry as Polyline);

                    break;

                case GeometryType.Polygon:
                    _selection.SetHidden();     // Hide selected graphic from the UI
                    editedGeometry = await SceneEditHelper.EditPolygonAsync(
                        View,
                        _selection.SelectedGraphic.Geometry as Polygon);

                    break;

                default:
                    break;
                }

                _selection.SelectedGraphic.Geometry = editedGeometry; // Set edited geometry to selected graphic
            }
            catch (TaskCanceledException tce)
            {
                // This occurs if draw operation is canceled or new operation is started before previous was finished.
                Debug.WriteLine("Previous edit operation was canceled.");
            }
            finally
            {
                _selection.Unselect();
                _selection.SetVisible(); // Show selected graphic from the UI
            }
        }
Пример #3
0
 private void onDrawingOptionSelectionChange(object value)
 {
     if (value != null)
     {
         (value as DrawingOption).OnCheck();
     }
     else
     {
         SceneEditHelper.Cancel();
     }
 }
Пример #4
0
        private async void LineButton_Click(object sender, RoutedEventArgs e)
        {
            var geometry = await SceneEditHelper.CreatePolylineAsync(View);

            var graphic = new Graphic(geometry);

            graphic.Symbol = new SimpleLineSymbol()
            {
                Color = SelectedColor.Color, Width = DEFAULT_WIDTH
            };
            _polylinesOverlay.Graphics.Add(graphic);
        }
        private async void DrawButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Geometry geometry = null;
                Graphic  graphic  = null;

                CancelButton.IsEnabled = true;
                ClearButton.IsEnabled  = false;

                // Draw geometry and create a new graphic using it
                switch ((DrawShape)DrawShapes.SelectedValue)
                {
                case DrawShape.Point:
                    geometry = await SceneEditHelper.CreatePointAsync(MySceneView);

                    graphic = new Graphic(geometry);
                    _pointsOverlay.Graphics.Add(graphic);
                    break;

                case DrawShape.Polygon:
                    geometry = await SceneEditHelper.CreatePolygonAsync(MySceneView);

                    graphic = new Graphic(geometry);
                    _polygonsOverlay.Graphics.Add(graphic);
                    break;

                case DrawShape.Polyline:
                    geometry = await SceneEditHelper.CreatePolylineAsync(MySceneView);

                    graphic = new Graphic(geometry);
                    _polylinesOverlay.Graphics.Add(graphic);
                    break;

                default:
                    break;
                }
            }
            catch (TaskCanceledException)
            {
                // This occurs if draw operation is canceled or new operation is started before previous was finished.
                Debug.WriteLine("Previous draw operation was canceled.");
            }
            finally
            {
                CancelButton.IsEnabled = false;
                ClearButton.IsEnabled  = true;
            }
        }
Пример #6
0
        private async void AreaButton_Click(object sender, RoutedEventArgs e)
        {
            var geometry = await SceneEditHelper.CreatePolygonAsync(View);

            var graphic = new Graphic(geometry);

            graphic.Symbol = new SimpleFillSymbol()
            {
                Color = getColorWithAlpha(SelectedColor.Color, DEFAULT_AREA_ALPHA), Outline = new SimpleLineSymbol()
                {
                    Color = DEFAULT_POLYGON_BORFDER_COLOR
                }
            };
            _polygonsOverlay.Graphics.Add(graphic);
        }
        private void SetIsServerAndVersion(bool val, string version)
        {
            using (var sceneEdit = new SceneEditHelper("Assets/Scenes/Menu-WebGL.unity"))
            {
                var arsNm = sceneEdit.GetFirstComponentOfType <ArsNetworkManager>();
                if (arsNm == null)
                {
                    return;
                }

                Undo.RecordObject(arsNm, "IsServer and Version"); //this might not be needed, but it works so whatever
                arsNm.IsServer             = val;
                arsNm.CurrentVersionNumber = version;
                EditorUtility.SetDirty(arsNm); //This is supposed to be deprecated, but its the only thing that works
            }
        }
 private void CancelButton_Click(object sender, RoutedEventArgs e)
 {
     // Cancel existing draw or edit operation.
     SceneEditHelper.Cancel();
 }
        private async void EditButton_Click(object sender, RoutedEventArgs e)
        {
            if (_selection == null)
            {
                return;                         // Selection missing
            }
            // Cancel previous edit
            if (SceneEditHelper.IsActive)
            {
                SceneEditHelper.Cancel();
            }

            Geometry editedGeometry = null;

            DrawButton.IsEnabled   = false;
            ClearButton.IsEnabled  = false;
            EditButton.IsEnabled   = false;
            CancelButton.IsEnabled = true;

            try
            {
                // Edit selected geometry and set it back to the selected graphic
                switch (_selection.GeometryType)
                {
                case GeometryType.Point:
                    editedGeometry = await SceneEditHelper.CreatePointAsync(
                        MySceneView);

                    break;

                case GeometryType.Polyline:
                    _selection.SetHidden();                     // Hide selected graphic from the UI
                    editedGeometry = await SceneEditHelper.EditPolylineAsync(
                        MySceneView,
                        _selection.SelectedGraphic.Geometry as Polyline);

                    break;

                case GeometryType.Polygon:
                    _selection.SetHidden();                     // Hide selected graphic from the UI
                    editedGeometry = await SceneEditHelper.EditPolygonAsync(
                        MySceneView,
                        _selection.SelectedGraphic.Geometry as Polygon);

                    break;

                default:
                    break;
                }

                _selection.SelectedGraphic.Geometry = editedGeometry;         // Set edited geometry to selected graphic
            }
            catch (TaskCanceledException)
            {
                // This occurs if draw operation is canceled or new operation is started before previous was finished.
                Debug.WriteLine("Previous edit operation was canceled.");
            }
            finally
            {
                _selection.Unselect();
                _selection.SetVisible();                 // Show selected graphic from the UI
                DrawButton.IsEnabled   = true;
                ClearButton.IsEnabled  = true;
                CancelButton.IsEnabled = false;
            }
        }