欢迎来到天天文库
浏览记录
ID:12463858
大小:43.00 KB
页数:7页
时间:2018-07-17
《最短路径分析(代码)》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、最短路径分析(源码)usingSystem;ArcEngineusingESRI.ArcGIS.Carto;usingESRI.ArcGIS.Geometry;usingESRI.ArcGIS.Geodatabase;usingESRI.ArcGIS.NetworkAnalysis;//12namespaceGisEditor{//////最短路径分析///publicclassClsPathFinder{ privateIGeometricNetworkm_ipGeometricNetwork; privateIMap
2、m_ipMap; privateIPointCollectionm_ipPoints; privateIPointToEIDm_ipPointToEID; privatedoublem_dblPathCost=0; privateIEnumNetEIDm_ipEnumNetEID_Junctions; privateIEnumNetEIDm_ipEnumNetEID_Edges; privateIPolyline m_ipPolyline; #regionPublicFunction //返回和设置当前地图 publicIMapSetOrG
3、etMap { set{m_ipMap=value;} get{return m_ipMap;} } //打开几何数据集的网络工作空间 publicvoidOpenFeatureDatasetNetwork(IFeatureDatasetFeatureDataset) { CloseWorkspace(); if(!InitializeNetworkAndMap(FeatureDataset)) Console.WriteLine("打开network出错"); } //输入点的集合 publicIPointCol
4、lectionStopPoints { set{m_ipPoints=value;} get{return m_ipPoints;} } //路径成本 publicdoublePathCost { get{returnm_dblPathCost;} } //返回路径的几何体 publicIPolylinePathPolyLine() { IEIDInfoipEIDInfo; IGeometryipGeometry; if(m_ipPolyline!=null)returnm_ipPolyline;
5、 m_ipPolyline=newPolylineClass(); IGeometryCollectionipNewGeometryColl=m_ipPolylineasIGeometryCollection; ISpatialReferenceipSpatialReference=m_ipMap.SpatialReference; IEIDHelperipEIDHelper=newEIDHelperClass(); ipEIDHelper.GeometricNetwork=m_ipGeometricNetwork; ipE
6、IDHelper.OutputSpatialReference=ipSpatialReference; ipEIDHelper.ReturnGeometries=true; IEnumEIDInfoipEnumEIDInfo=ipEIDHelper.CreateEnumEIDInfo(m_ipEnumNetEID_Edges); intcount=ipEnumEIDInfo.Count; ipEnumEIDInfo.Reset(); for(inti=0;i7、Next(); ipGeometry=ipEIDInfo.Geometry; ipNewGeometryColl.AddGeometryCollection(ipGeometryasIGeometryCollection); } returnm_ipPolyline; } //解决路径 publicvoidSolvePath(stringWeightName) { try { intintEdgeUserClassID; intintEdgeUserID; intintEdgeUserSubID; 8、 intintEdg
7、Next(); ipGeometry=ipEIDInfo.Geometry; ipNewGeometryColl.AddGeometryCollection(ipGeometryasIGeometryCollection); } returnm_ipPolyline; } //解决路径 publicvoidSolvePath(stringWeightName) { try { intintEdgeUserClassID; intintEdgeUserID; intintEdgeUserSubID;
8、 intintEdg
此文档下载收益归作者所有