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

没做过,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 一个服务器已经有一个系统了如果用usb再装一个系统,原来的系统会被覆盖掉吗
  • ¥15 使用esm_msa1_t12_100M_UR50S蛋白质语言模型进行零样本预测时,终端显示出了sequence handled的进度条,但是并不出结果就自动终止回到命令提示行了是怎么回事:
  • ¥15 前置放大电路与功率放大电路相连放大倍数出现问题
  • ¥30 关于<main>标签页面跳转的问题
  • ¥80 部署运行web自动化项目
  • ¥15 腾讯云如何建立同一个项目中物模型之间的联系
  • ¥30 VMware 云桌面水印如何添加
  • ¥15 用ns3仿真出5G核心网网元
  • ¥15 matlab答疑 关于海上风电的爬坡事件检测
  • ¥88 python部署量化回测异常问题