//Save the edit result to NewSearchArea when the shape of the search area has been created
        void Editor_EditCompleted(object sender, Editor.EditEventArgs e)
        {
            try
            {
                //Get the changes from the event arg
                IEnumerator <Editor.Change> changes = e.Edits.GetEnumerator();

                //Return if there are problems with the edits
                if (changes.MoveNext() == false)
                {
                    return;
                }

                //Since we are adding a new polygon the number of edits will always be one.
                //Save the new grphic to NewSearchArea; Attributes will be filled out later
                NewSearchArea = changes.Current.Graphic;

                if (IsValidGeometry(NewSearchArea.Geometry) == false)
                {
                    MessageBox.Show("invalid search area's geometry");
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Error adding new polygon. Please retry");
            }
        }
        private void Editor_EditCompleted(object sender, Editor.EditEventArgs e)
        {
            var editor = sender as Editor;

            if (e.Action == Editor.EditAction.Select)
            {
                foreach (var edit in e.Edits)
                {
                    if (edit.Graphic != null && edit.Graphic.Selected)
                    {
                        var layer = edit.Layer as FeatureLayer;
                        if (layer != null && layer.IsGeometryUpdateAllowed(edit.Graphic))
                        {
                            // edit geometry
                            if (editor.EditVertices.CanExecute(null))
                            {
                                editor.EditVertices.Execute(null);
                            }
                        }

                        // edit attribute
                        MyFeatureDataGrid.SelectedItem = edit.Graphic;
                        break;
                    }
                }
            }
            else if (e.Action == Editor.EditAction.EditVertices)
            {
                // should never happen since feature service AllowGeometryUpdates=False
                if (editor.Select.CanExecute("new"))
                {
                    editor.Select.Execute("new");
                }
            }
        }
示例#3
0
 private void Editor_EditCompleted(object sender, Editor.EditEventArgs e)
 {
     if (e.Action != Editor.EditAction.Cancel)
     {
         AttributeGrid.Visibility = System.Windows.Visibility.Visible;
         CoverGrid.Visibility     = System.Windows.Visibility.Visible;
     }
 }
        private void Editor_EditCompleted(object sender, Editor.EditEventArgs e)
        {
            EventHandler <ESRI.ArcGIS.Client.Editor.EditEventArgs> handler = EditCompleted;

            if (handler != null)
            {
                handler(this, e);
            }
        }
示例#5
0
        private void Editor_EditCompleted(object sender, Editor.EditEventArgs e)
        {
            if (e.Action == Editor.EditAction.Add)
            {
                e.Edits.ElementAt(0).Graphic.Attributes.Add("Facility",
                                                            (e.Edits.ElementAt(0).Layer as GraphicsLayer).Graphics.Count);

                SolveButton.IsEnabled = true;
            }
        }
示例#6
0
        private void Editor_EditCompleted(object sender, Editor.EditEventArgs e)
        {
            var editor = sender as Editor;

            if (e.Action == Editor.EditAction.Select)
            {
                foreach (var edit in e.Edits)
                {
                    if (edit.Graphic != null && edit.Graphic.Selected)
                    {
                        var layer = edit.Layer as FeatureLayer;
                        if (layer != null && layer.IsGeometryUpdateAllowed(edit.Graphic))
                        {
                            if (editor.EditVertices.CanExecute(edit.Graphic))
                            {
                                editor.EditVertices.Execute(edit.Graphic);
                            }

                            FeatureInfoPage.Visibility = System.Windows.Visibility.Visible;
                            symbolIDLB.SelectedIndex   = (Int16)edit.Graphic.Attributes["symbolid"];
                            _featureDataFormOpen       = true;


                            LayerDefinition layerDefinition = new LayerDefinition()
                            {
                                LayerID    = 2,
                                Definition = string.Format("{0} <> {1}", layer.LayerInfo.ObjectIdField,
                                                           edit.Graphic.Attributes[layer.LayerInfo.ObjectIdField].ToString())
                            };

                            (MyMap.Layers["WildFireDynamic"] as ArcGISDynamicMapServiceLayer).LayerDefinitions =
                                new System.Collections.ObjectModel.ObservableCollection <LayerDefinition>()
                            {
                                layerDefinition
                            };

                            (MyMap.Layers["WildFireDynamic"] as
                             ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer).Refresh();
                        }

                        FeatureInfoPage.DataContext = edit.Graphic;
                        break;
                    }
                }
            }
            else if (e.Action == Editor.EditAction.ClearSelection)
            {
                FeatureInfoPage.Visibility  = System.Windows.Visibility.Collapsed;
                FeatureInfoPage.DataContext = null;
                (MyMap.Layers["WildFirePolygons"] as FeatureLayer).ClearSelection();
                (MyMap.Layers["WildFireDynamic"] as ArcGISDynamicMapServiceLayer).LayerDefinitions = null;
                (MyMap.Layers["WildFireDynamic"] as ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer).Refresh();
            }
        }
示例#7
0
 private void Editor_EditCompleted(object sender, Editor.EditEventArgs e)
 {
     if (this.ShowAttributesOnAdd && e.Action == Editor.EditAction.Add)
     {
         foreach (Editor.Change change in e.Edits)
         {
             if (change.Layer != null && change.Layer is FeatureLayer && change.Graphic != null)
             {
                 FeatureLayer featureLayer = change.Layer as FeatureLayer;
                 ShowAttributeForm(featureLayer, change.Graphic);
                 break;
             }
         }
     }
     OnEditCompleted(e);
 }
        /// <summary>
        /// After a new feature is added, open Attribute Editor automatically
        /// </summary>
        private void FeatureEditor_EditCompleted(object sender, Editor.EditEventArgs e)
        {
            if (e.Action == Editor.EditAction.Add)
            {
                Editor.Change edit = e.Edits.FirstOrDefault <Editor.Change>();
                if (!widgetConfig.AutoSave)
                {
                    featureEditor.Save.Execute(null);
                }

                if (edit != null)
                {
                    FeatureLayer fLayer = edit.Layer as FeatureLayer;
                    OpenFeatureDataEditor(fLayer, edit.Graphic);
                }
            }
        }
        private void Editor_EditCompleted(object sender, Editor.EditEventArgs e)
        {
            var editor = sender as Editor;

            if (e.Action == Editor.EditAction.Select)
            {
                foreach (var edit in e.Edits)
                {
                    if (edit.Graphic != null && edit.Graphic.Selected)
                    {
                        // edit attribute
                        FeatureInfoPage.DataContext = edit.Graphic;
                        FeatureInfoPage.Visibility  = Visibility.Visible;
                        break;
                    }
                }
            }
        }
        private void Editor_EditCompleted(object sender, Editor.EditEventArgs e)
        {
            Editor editor = sender as Editor;

            if (e.Action == Editor.EditAction.Add)
            {
                if (editor.LayerIDs.ElementAt(0) == "MyFacilitiesGraphicsLayer")
                {
                    e.Edits.ElementAt(0).Graphic.Attributes.Add("FacilityNumber",
                                                                (e.Edits.ElementAt(0).Layer as GraphicsLayer).Graphics.Count);
                }
                else if (editor.LayerIDs.ElementAt(0) == "MyIncidentsGraphicsLayer")
                {
                    e.Edits.ElementAt(0).Graphic.Attributes.Add("IncidentNumber",
                                                                (e.Edits.ElementAt(0).Layer as GraphicsLayer).Graphics.Count);
                }

                if (facilitiesGraphicsLayer.Graphics.Count > 0 && IncidentsGraphicsLayer.Graphics.Count > 0)
                {
                    SolveButton.IsEnabled = true;
                }
            }
        }
示例#11
0
 private void Editor_EditCompleted(object sender, Editor.EditEventArgs e)
 {
     isAdd = false;
 }