ArcEngine最短路径分析.doc
上传人:sy****28 上传时间:2024-09-14 格式:DOC 页数:10 大小:46KB 金币:16 举报 版权申诉
预览加载中,请您耐心等待几秒...

ArcEngine最短路径分析.doc

ArcEngine最短路径分析.doc

预览

在线预览结束,喜欢就下载吧,查找使用更方便

16 金币

下载此文档

如果您无法下载资料,请参考说明:

1、部分资料下载需要金币,请确保您的账户上有足够的金币

2、已购买过的文档,再次下载不重复扣费

3、资料包下载后请先用软件解压,在使用对应软件打开

publicclassForm1:System.Windows.Forms.Form{IMappMap;IActiveViewpActiveView;……􀳼Form1􂱘Load􀑟􀓊􄬂􀜹􀽖􀏟􀒷􂷕􀋖privatevoidForm1_Load(objectsender,System.EventArgse){pMap=axMapControl1.Map;//􃦋􀦪􁥻􀓊􀐁􂱘􀴄􀳒pActiveView=pMapasIActiveView;//QIpActiveView.Extent=axMapControl1.FullExtent;//􁰒􂼎􀜼􁈔􃾚􀳒pActiveView.Refresh();//􄆒􃕂􀧢􀠋􁮄􀴄􀳒}􀳼axMapControl1􂱘MouseDown􀑟􀓊􀐁􄬂􀜹􀽖􀏟􀒷􂷕􀋖privatevoidaxMapControl1_OnMouseDown(objectsender,ESRI.ArcGIS.MapControl.IMapControlEvents2_OnMouseDownEvente){axMapControl1.MousePointer=ESRI.ArcGIS.Controls.esriControlsMousePointer.esriPointerCrosshair;CrosshairIEnvelopepEnv;pEnv=axMapControl1.TrackRectangle();//􄗮􄖛TrackRectangle􁮍􂊩􃦋􁕫􀏔􀏾pActiveView.Extent=pEnv;//􁇚􀴄􀳒􂱘􃾚􀳒􃣗􀳈􄆒􃕂􀐎􁮄􃣗􀳈􁇍􄈵pEnvpActiveView.Refresh();//}ArcEngine最短路径分析(源码)usingSystem;usingESRI.ArcGIS.Carto;usingESRI.ArcGIS.Geometry;usingESRI.ArcGIS.Geodatabase;usingESRI.ArcGIS.NetworkAnalysis;namespaceGisEditor{///<summary>///最短路径分析///</summary>publicclassClsPathFinder{privateIGeometricNetworkm_ipGeometricNetwork;privateIMapm_ipMap;privateIPointCollectionm_ipPoints;privateIPointToEIDm_ipPointToEID;privatedoublem_dblPathCost=0;privateIEnumNetEIDm_ipEnumNetEID_Junctions;privateIEnumNetEIDm_ipEnumNetEID_Edges;privateIPolylinem_ipPolyline;#regionPublicFunction//返回和设置当前地图publicIMapSetOrGetMap{set{m_ipMap=value;}get{returnm_ipMap;}}//打开几何数据集的网络工作空间publicvoidOpenFeatureDatasetNetwork(IFeatureDatasetFeatureDataset){CloseWorkspace();if(!InitializeNetworkAndMap(FeatureDataset))Console.WriteLine("打开network出错");}//输入点的集合publicIPointCollectionStopPoints{set{m_ipPoints=value;}get{returnm_ipPoints;}}//路径成本publicdoublePathCost{get{returnm_dblPathCost;}}//返回路径的几何体publicIPolylinePathPolyLine(){IEIDInfoipEIDInfo;IGeometryipGeometry;if(m_ipPolyline!=null)returnm_ipPolyline;m_ipPolyline=newPolylineClass();IGeometryCollectionipNewGeometryColl=m_ipPolylineasIGeometryCollection;ISpatialReferenceipSpatialReference=m_ipMap.SpatialReference;IEIDHelperipEIDHelper=newEIDHelperClass();ipEIDHelper.GeometricNetwork=m_ipGeometricNetwork;i