⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 selecttool.cs

📁 C#开发的ArcGIS Server9.2地图选择控件
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI.WebControls;
using ESRI.ArcGIS.ADF.Web.UI.WebControls.Tools;
using ESRI.ArcGIS.ADF.Web.UI.WebControls;
using ESRI.ArcGIS.ADF.Web.DataSources;
using ESRI.ArcGIS.ADF.Web.DataSources.Graphics;
using ESRI.ArcGIS.ADF.Web.Display.Graphics;

namespace SelectToolTask
{
    class SelectTool : IMapServerToolAction, IToolbarItemSetup
    {
        #region IToolbarItemSetup Members
        ToolbarItemInfo toolbarItemInfo;
        public void Initialize(ToolbarItemInfo info)
        {
            // information on the tool, including task that rendered it, 
            //  is passed in automatically by implementing IToolbarItemSetup
            toolbarItemInfo = info;
        }

        public void Unload(ToolbarItemInfo info)
        {
        }

        #endregion

        #region IMapServerToolAction Members

        public void ServerAction(ToolEventArgs args)
        {

            // Get task via hierarchy used during task rendering: Toolbar.Cell.Row.Table.Task
            SelectToolTask gsTask = 
                toolbarItemInfo.Toolbar.Parent as SelectToolTask;
            Map mapCtrl = args.Control as Map;

            if (gsTask != null)
            {
                // Convert the screen coordinates to map geometry - need to
                //  save it in map coordinates so we can re-run the task
                ESRI.ArcGIS.ADF.Web.Geometry.Geometry selectGeometry =
                        Utilities.ToAdfGeometry(args, mapCtrl,
                        gsTask.PointSelectionTolerance);

                // Call Task method to save the geometry - Task also then performs
                //  callback to itself to execute the task
                gsTask.SetSelectionGeometry(selectGeometry);
            }
            else
                mapCtrl.CallbackResults.Add(null, "javascript", new string[] {
                    "运行任务出错. 请联系网站管理员.\n"+
                    "(技术细节: SelectTool.ServerAction 没有找到任务对象.)"});

            return;

        }

        #endregion

    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -