半城风月半城雪
2017-02-09 02:21
采纳率: 76.9%
浏览 1.9k

没做过,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条)

相关推荐 更多相似问题