${iServer2_UpdateEntityService_Title}

${iServer2_UpdateEntityService_Description}

Inheritance: SuperMap.Web.Service.ServiceBase
        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 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 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);
            }
        }