资源简介

AE开发:实现将地图导入,并且点击鼠标即可测量地图上两点距离,适合AE初学者使用

资源截图

代码片段和文件信息

using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.Controls;
using ESRI.ArcGIS.Display;
using ESRI.ArcGIS.Geodatabase;
using ESRI.ArcGIS.Geometry;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace sy532
{
    public partial class Form1 : Form
    {
        //axTOCControl.HitTest
        esriTOCControlItem pSelected = esriTOCControlItem.esriTOCControlItemNone;
        IBasicMap pBasicMap = null;
        ilayer player = null;
        object pLegendGroup = null;
        object pLegendGroupIdex = null;
        int SelectIndex;//选择的图层索引
        string flag;
        int pTime = 0;//计数器   
        IGeometry[] pGeoArr = new IGeometry[100];
        ITopologicalOperator[] pTopo = new ITopologicalOperator[100];
        string TopologicalOperator;
        //IGeometryCollection pGeoColl = new GeometryBagClass();
        IPointCollection pPointColl;//点集
        IGeometry pGeo;
        double sum = 0;

        public Form1()
        {
            ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.EngineOrDesktop);
            InitializeComponent();
        }

        private void Form1_Load(object sender EventArgs e)
        {
            pPointColl = new MultipointClass();
            //使用相对路径使程序具有通用性,便于移植
            string CurrentPath = Directory.GetCurrentDirectory();
            Directory.SetCurrentDirectory(CurrentPath + “\\..\\..\\..\\..\\data\\world“);
            string FilePath = Directory.GetCurrentDirectory();
            axMapControl1.AddShapeFile(FilePath “country.shp“);
            axMapControl1.AddShapeFile(FilePath “rivers.shp“);
            axMapControl1.AddShapeFile(FilePath “cities.shp“);
        }
        //清空
        private void ClearAll()
        {
            TopologicalOperator = null;
            pTime = 0;
            axMapControl1.Map.ClearSelection();
            IGraphicsContainer pGraphicsContainer = axMapControl1.Map as IGraphicsContainer;
            pGraphicsContainer.DeleteAllElements();
            pGeo = null;
            pPointColl.RemovePoints(0 pPointColl.PointCount);//清空点集
            axMapControl1.Refresh();
        }
        private void axMapControl1_onmousedown(object sender IMapControlEvents2_onmousedownEvent e)
        {
            if (flag == “Distence“)
            {
                double pLen;
                IPoint pTextPoint = new PointClass();
                IPoint pFromPoint = new PointClass();
                IPoint pToPoint = new PointClass();
                IPoint pt = new PointClass();
                pt.PutCoords(e.mapX e.mapY);
                pPointColl.AddPoint(pt);
                IElement pPtEle = new MarkerElementClass();
                pPtEle.Geometry = pt;
                IGraphicsContainer pGraphicsContainer = axMapCon

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

    ..A..H.     43520  2018-11-12 15:05  sy532\.vs\sy532\v14\.suo

     文件        189  2018-11-11 23:18  sy532\sy532\App.config

     文件     115200  2015-12-23 13:30  sy532\sy532\bin\Debug\ESRI.ArcGIS.AxControls.dll

     文件    2614272  2015-12-23 12:58  sy532\sy532\bin\Debug\ESRI.ArcGIS.Carto.dll

     文件    9389915  2015-12-13 09:32  sy532\sy532\bin\Debug\ESRI.ArcGIS.Carto.xml

     文件     150016  2015-12-23 12:55  sy532\sy532\bin\Debug\ESRI.ArcGIS.DataSourcesFile.dll

     文件     763301  2015-12-13 09:32  sy532\sy532\bin\Debug\ESRI.ArcGIS.DataSourcesFile.xml

     文件    1142784  2015-12-23 12:55  sy532\sy532\bin\Debug\ESRI.ArcGIS.DataSourcesRaster.dll

     文件    4566710  2015-12-13 09:32  sy532\sy532\bin\Debug\ESRI.ArcGIS.DataSourcesRaster.xml

     文件     397312  2015-12-23 12:50  sy532\sy532\bin\Debug\ESRI.ArcGIS.Display.dll

     文件    1909050  2015-12-13 09:32  sy532\sy532\bin\Debug\ESRI.ArcGIS.Display.xml

     文件      88576  2015-12-23 12:56  sy532\sy532\bin\Debug\ESRI.ArcGIS.GeoDatabaseDistributed.dll

     文件     390186  2015-12-13 09:32  sy532\sy532\bin\Debug\ESRI.ArcGIS.GeoDatabaseDistributed.xml

     文件     226304  2015-12-23 12:57  sy532\sy532\bin\Debug\ESRI.ArcGIS.GeoDatabaseExtensions.dll

     文件     886545  2015-12-13 09:32  sy532\sy532\bin\Debug\ESRI.ArcGIS.GeoDatabaseExtensions.xml

     文件    1137664  2015-12-23 12:49  sy532\sy532\bin\Debug\ESRI.ArcGIS.Geometry.dll

     文件    4622109  2015-12-13 09:32  sy532\sy532\bin\Debug\ESRI.ArcGIS.Geometry.xml

     文件      75776  2015-12-23 12:54  sy532\sy532\bin\Debug\ESRI.ArcGIS.GISClient.dll

     文件     240354  2015-12-13 09:32  sy532\sy532\bin\Debug\ESRI.ArcGIS.GISClient.xml

     文件     135168  2015-12-23 12:51  sy532\sy532\bin\Debug\ESRI.ArcGIS.Server.dll

     文件     466017  2015-12-13 09:32  sy532\sy532\bin\Debug\ESRI.ArcGIS.Server.xml

     文件      14336  2015-12-23 12:18  sy532\sy532\bin\Debug\ESRI.ArcGIS.Version.dll

     文件      14848  2018-11-12 15:02  sy532\sy532\bin\Debug\sy532.exe

     文件        189  2018-11-11 23:18  sy532\sy532\bin\Debug\sy532.exe.config

     文件      22016  2018-11-12 15:02  sy532\sy532\bin\Debug\sy532.pdb

     文件      22696  2018-11-12 15:05  sy532\sy532\bin\Debug\sy532.vshost.exe

     文件        189  2018-11-11 23:18  sy532\sy532\bin\Debug\sy532.vshost.exe.config

     文件        490  2018-04-12 07:35  sy532\sy532\bin\Debug\sy532.vshost.exe.manifest

     文件       4621  2018-11-12 15:05  sy532\sy532\Form1.cs

     文件       5073  2018-11-11 23:40  sy532\sy532\Form1.Designer.cs

............此处省略35个文件信息

评论

共有 条评论