資源簡介
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.xm
?????文件?????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.xm
?????文件????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.xm
?????文件?????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.xm
?????文件??????88576??2015-12-23?12:56??sy532\sy532\bin\Debug\ESRI.ArcGIS.GeoDataba
?????文件?????390186??2015-12-13?09:32??sy532\sy532\bin\Debug\ESRI.ArcGIS.GeoDataba
?????文件?????226304??2015-12-23?12:57??sy532\sy532\bin\Debug\ESRI.ArcGIS.GeoDataba
?????文件?????886545??2015-12-13?09:32??sy532\sy532\bin\Debug\ESRI.ArcGIS.GeoDataba
?????文件????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.xm
?????文件??????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.xm
?????文件?????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.xm
?????文件??????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個文件信息
評論
共有 條評論