半城风月半城雪 2017-02-09 02:21 采纳率: 50%
浏览 1902
已采纳

没做过,C#的代码,从哪开始看啊,找不到头,看起来好乱

 using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Collections.Specialized;

using System.Runtime.InteropServices;

using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.Server;
using ESRI.ArcGIS.Geometry;
using ESRI.ArcGIS.Geodatabase;
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.SOESupport;

using ESRI.ArcGIS.DataSourcesRaster; 

//TODO: sign the project (project properties > signing tab > sign the assembly)
//      this is strongly suggested if the dll will be registered using regasm.exe <your>.dll /codebase


namespace NetEditFeaturesRESTSOE
{
    [ComVisible(true)]
    [Guid("6d79a67b-27d2-4a7f-85a3-6bf6fab061df")]
    [ClassInterface(ClassInterfaceType.None)]
    [ServerObjectExtension("MapServer",
        AllCapabilities = "",
        DefaultCapabilities = "",
        Description = ".Net Edit features SOE - allows feature validation and editing.",
        DisplayName = ".Net Edit Features REST SOE",
        Properties = "layerId=0",
        SupportsREST = true,
        SupportsSOAP = false)]
    public class NetEditFeaturesRESTSOE : IServerObjectExtension, IObjectConstruct, IRESTRequestHandler
    {
        private string soe_name;

        private IPropertySet configProps;
        private IServerObjectHelper serverObjectHelper;
        private ServerLogger logger;
        private IRESTRequestHandler reqHandler;

        private IMapServerInfo mapServerInfo = null;
        private IMapServerDataAccess mapServerDataAccess = null;
        private IMapLayerInfos layerInfos = null;
        private IMapLayerInfo editLayerInfo = null;
        private int layerId = -1;
        private IFeatureClass fc = null;

        public NetEditFeaturesRESTSOE()
        {
            soe_name = this.GetType().Name;
            logger = new ServerLogger();
            reqHandler = new SoeRestImpl(soe_name, CreateRestSchema()) as IRESTRequestHandler;
        }

        #region IServerObjectExtension Members

        public void Init(IServerObjectHelper pSOH)
        {
            serverObjectHelper = pSOH;

            mapServerDataAccess = (IMapServerDataAccess)pSOH.ServerObject;
            IMapServer3 ms = (IMapServer3)pSOH.ServerObject;
            this.mapServerInfo = ms.GetServerInfo(ms.DefaultMapName);
            this.layerInfos = mapServerInfo.MapLayerInfos;

            if (layerId < 0)
                layerId = 0;
        }

        public void Shutdown()
        {
        }

        #endregion

        #region IObjectConstruct Members

        public void Construct(IPropertySet props)
        {
            configProps = props;
            string lid = (string)props.GetProperty("layerId");
            this.layerId = Convert.ToInt32(lid);

            this.fc = (IFeatureClass) this.mapServerDataAccess.GetDataSource(this.mapServerInfo.Name, this.layerId);
            this.editLayerInfo = this.layerInfos.get_Element(this.layerId);
        }

        #endregion

        #region IRESTRequestHandler Members

        public string GetSchema()
        {
            return reqHandler.GetSchema();
        }

        public byte[] HandleRESTRequest(string Capabilities, string resourceName, string operationName, string operationInput, string outputFormat, string requestProperties, out string responseProperties)
        {
            return reqHandler.HandleRESTRequest(Capabilities, resourceName, operationName, operationInput, outputFormat, requestProperties, out responseProperties);
        }

        #endregion


放不下了,网址在这
soe](https://github.com/Esri/arcobjects-sdk-community-samples/blob/master/Net/Server/ServerEditFeaturesRESTSOE/CSharp/EditFeaturesRESTSOE/NetEditFeaturesRESTSOE.cs "")

  • 写回答

4条回答 默认 最新

  • 一支糖包仔 2017-02-09 03:44
    关注

    从上往下看呗。
    public class NetEditFeaturesRESTSOE : IServerObjectExtension, IObjectConstruct, IRESTRequestHandler
    NetEditFeaturesRESTSOE是类名,:后面的是接口。
    下面的是各个方法,
    public NetEditFeaturesRESTSOE()
    {
    soe_name = this.GetType().Name;
    logger = new ServerLogger();
    reqHandler = new SoeRestImpl(soe_name, CreateRestSchema()) as IRESTRequestHandler;
    }
    是构造方法,最先执行,接着就是其他方法。调用接口里面方法名时执行,或者直接调用这个也执行。
    接口里面的方法全部要实现,所以有
    public void Shutdown()
    {
    }

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 matlab数字图像处理频率域滤波
  • ¥15 在abaqus做了二维正交切削模型,给刀具添加了超声振动条件后输出切削力为什么比普通切削增大这么多
  • ¥15 ELGamal和paillier计算效率谁快?
  • ¥15 file converter 转换格式失败 报错 Error marking filters as finished,如何解决?
  • ¥15 ubuntu系统下挂载磁盘上执行./提示权限不够
  • ¥15 Arcgis相交分析无法绘制一个或多个图形
  • ¥15 关于#r语言#的问题:差异分析前数据准备,报错Error in data[, sampleName1] : subscript out of bounds请问怎么解决呀以下是全部代码:
  • ¥15 seatunnel-web使用SQL组件时候后台报错,无法找到表格
  • ¥15 fpga自动售货机数码管(相关搜索:数字时钟)
  • ¥15 用前端向数据库插入数据,通过debug发现数据能走到后端,但是放行之后就会提示错误