${iServer2_UpdateEntityParameters_Title}

${iServer2_UpdateEntityParameters_Description}

Inheritance: ParametersBase
        /// <summary>${iServer2_UpdateEntityService_method_ProcessAsync_D}</summary>
        /// <param name="parameters">${iServer2_UpdateEntityService_method_ProcessAsync_param_parameters}</param>
        /// <param name="state">${iServer2_UpdateEntityService_method_ProcessAsync_param_state}</param>
        public void ProcessAsync(UpdateEntityParameters parameters, object state)
        {
            if (parameters == null)
            {
                throw new ArgumentNullException(ExceptionStrings.ArgumentIsNull);
            }
            if (string.IsNullOrEmpty(base.Url))
            {
                throw new InvalidOperationException(ExceptionStrings.InvalidUrl);
            }

            if (!base.Url.EndsWith("/"))
            {
                base.Url += '/';
            }

            base.SubmitRequest(base.Url + "commonhandler?", GetParameters(parameters),
                new EventHandler<RequestEventArgs>(request_Completed), state, false);
        }
        //属性编辑结束,提交新的属性信息
        private void dgVegetable_RowEditEnded(object sender, DataGridRowEditEndedEventArgs e)
        {
            List<string> getEntityFieldValues = new List<string>();
            if (dgVegetable != null)
            {
                getEntityFieldValues.Add(listVegetable[0].SmID);
                getEntityFieldValues.Add(listVegetable[0].SmUserID);
                getEntityFieldValues.Add(listVegetable[0].SmPerimeter);
                getEntityFieldValues.Add(listVegetable[0].SmArea);
                getEntityFieldValues.Add(listVegetable[0].ClassID);
            }

            //FieldNames与FieldValues必须一一对应
            Entity entity = new Entity
            {
                Shape = shape,
                ID = entityID,
                FieldNames = getEntityFieldNames,
                FieldValues = getEntityFieldValues
            };
            UpdateEntityParameters parameters = new UpdateEntityParameters
            {
                MapName = "Changchun",
                LayerName = "Vegetable@changchun",
                Entity = entity
            };

            //与服务器交互更新地物属性
            UpdateEntityService updateEntityService = new UpdateEntityService("http://localhost:7080/demo");
            updateEntityService.ProcessAsync(parameters);
            updateEntityService.Failed += new EventHandler<ServiceFailedEventArgs>(Service_Failed);
            updateEntityService.ProcessCompleted += new EventHandler<EditEventArgs>(Service_ProcessCompleted);
        }
        private void spatialService_ProcessCompleted(object sender, SpatialOperateEventArgs e)
        {
            //清除图层中选中要素
            drawLayer.ClearFeatures();

            if (e.Result == null)
            {
                MessageBox.Show("No Result!");
                return;
            }

            //将合并后的形状绘制到图层中
            Feature f = new Feature
            {
                Geometry = e.Result.ToGeometry(),
                Style = (SuperMap.Web.Core.Style)App.Current.Resources["CustomDiagonalBlackHatchFillSymbol"]
            };
            drawLayer.Features.Add(f);

            //将合并后的形状更新到服务器
            Entity entity = new Entity
            {
                Shape = e.Result,
                ID = ids[ids.Count - 2]
            };
            UpdateEntityParameters parameters = new UpdateEntityParameters
            {
                MapName = "Changchun",
                LayerName = "Vegetable@changchun",
                Entity = entity
            };
            UpdateEntityService updateEntityService = new UpdateEntityService("http://localhost:7080/demo");
            updateEntityService.ProcessAsync(parameters);
            updateEntityService.Failed += new EventHandler<ServiceFailedEventArgs>(Service_Failed);
            updateEntityService.ProcessCompleted += new EventHandler<EditEventArgs>(Service_ProcessCompleted);
        }
        //编辑地物形状
        private void editEntity_GeometryEdit(object sender, SuperMap.Web.Actions.Edit.GeometryEditEventArgs e)
        {
            if (e.Action == SuperMap.Web.Actions.Edit.GeometryEditAction.EditCompleted)
            {
                Point2DCollection ps = new Point2DCollection();

                //记录编辑后的地物结点
                GeoRegion region = e.Feature.Geometry as GeoRegion;
                for (int i = 0; i < region.Parts.Count; i++)
                {
                    for (int j = 0; j < region.Parts[i].Count; j++)
                    {
                        ps.Add(new Point2D(region.Parts[i][j].X, region.Parts[i][j].Y));
                    }
                }

                shape = new ServerGeometry
                {
                    Feature = ServerFeatureType.Polygon,
                    Point2Ds = ps
                };
                Entity entity = new Entity
                {
                    Shape = shape,
                    ID = entityID
                };
                UpdateEntityParameters parameters = new UpdateEntityParameters
                {
                    MapName = "Changchun",
                    LayerName = "Vegetable@changchun",
                    Entity = entity
                };

                //与服务器交互更新地物形状
                UpdateEntityService updateEntityService = new UpdateEntityService("http://localhost:7080/demo");
                updateEntityService.ProcessAsync(parameters);
                updateEntityService.Failed += new EventHandler<ServiceFailedEventArgs>(Service_Failed);
                updateEntityService.ProcessCompleted += new EventHandler<EditEventArgs>(Service_ProcessCompleted);
            }
        }
        private Dictionary<string, string> GetParameters(UpdateEntityParameters parameters)
        {
            Dictionary<string, string> dictionary = new Dictionary<string, string>();
            string method = "UpdateEntity";
            dictionary.Add("method", method);
            dictionary.Add("mapName", parameters.MapName);

            Dictionary<string, string> dict = new Dictionary<string, string>();
            dict.Add("mapName", parameters.MapName);
            dict.Add("layerName", parameters.LayerName);
            dict.Add("entities", Entity.ToJson(parameters.Entity));

            dict.Add("lockID", DateTime.Now.Ticks.ToString());
            dictionary.Add("params", Bridge.CreateParams(method, dict));

            return dictionary;
        }
 /// <overloads>${iServer2_UpdateEntityService_method_ProcessAsync_overloads_D}</overloads>
 /// <summary>${iServer2_UpdateEntityService_method_ProcessAsync_D}</summary>
 /// <param name="parameters">${iServer2_UpdateEntityService_method_ProcessAsync_param_parameters}</param>
 public void ProcessAsync(UpdateEntityParameters parameters)
 {
     ProcessAsync(parameters, null);
 }