示例#1
0
        private void SetCurrentSketchTool()
        {
            if (m_mapControl != null)
            {
                ICommand tool = null;

                switch (strGeometryType)
                {
                case "点":
                    tool = new CreatePointTool(GetFeatureLayer(tempFeatureLayerName));      //CreatePointTool
                    break;

                case "线":
                    tool = new CreatePolylineTool(GetFeatureLayer(tempFeatureLayerName));      //CreatePolylineTool
                    break;

                case "多边形":
                    tool = new CreatePolygonTool(GetFeatureLayer(tempFeatureLayerName));      //CreatePolygonTool
                    break;

                case "矩形":
                    tool = new CreateRectangleTool(GetFeatureLayer(tempFeatureLayerName));      //CreateRectangleTool
                    break;

                case "圆":
                    tool = new CreateCircleTool(GetFeatureLayer(tempFeatureLayerName));      //CreateCircleTool
                    break;

                default:
                    break;
                }
                if (tool == null)
                {
                    return;
                }
                tool.OnCreate(m_mapControl);
                m_mapControl.CurrentTool  = tool as ITool;
                m_mapControl.MousePointer = esriControlsMousePointer.esriPointerHand;
            }
        }
示例#2
0
        private void SetCurrentSketchTool()
        {
            if (m_application != null)
            {
                ICommandBars documentBars = m_application.Document.CommandBars;
                UID          cmdID        = new UIDClass();
                switch (strGeometryType)
                {
                case "点":
                case "线":
                case "多边形":
                    cmdID.Value = "{B479F48A-199D-11D1-9646-0000F8037368}";    //sketch tool
                    break;

                case "矩形":
                    cmdID.Value = "{6F0ED2CC-C099-4895-BD7E-BEEC2F78ADBF}";     //esriEditor.RectangleTool
                    break;

                case "圆":
                    cmdID.Value = "{09C6F589-A3CE-48AB-81BC-46965C58F264}";    //esriEditor.CircleTool
                    break;

                default:
                    break;
                }
                ICommandItem cmdItem = documentBars.Find(cmdID, false, false);
                m_application.CurrentTool = cmdItem;
            }
            if (m_mapControl != null)
            {
                ICommand tool = null;

                switch (strGeometryType)
                {
                case "点":
                    tool = new CreatePointTool(GetFeatureLayer(tempFeatureLayerName));      //CreatePointTool
                    break;

                case "线":
                    tool = new CreatePolylineTool(GetFeatureLayer(tempFeatureLayerName));      //CreatePolylineTool
                    break;

                case "多边形":
                    tool = new CreatePolygonTool(GetFeatureLayer(tempFeatureLayerName));      //CreatePolygonTool
                    break;

                case "矩形":
                    tool = new CreateRectangleTool(GetFeatureLayer(tempFeatureLayerName));      //CreateRectangleTool
                    break;

                case "圆":
                    tool = new CreateCircleTool(GetFeatureLayer(tempFeatureLayerName));     //CreateCircleTool
                    break;

                default:
                    break;
                }
                if (tool == null)
                {
                    return;
                }
                tool.OnCreate(m_mapControl);
                m_mapControl.CurrentTool  = tool as ITool;
                m_mapControl.MousePointer = esriControlsMousePointer.esriPointerHand;
            }
        }