資源簡介
是對幾何網絡的最短路徑分析,開發環境是AE+C#
代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.Text;
using?ESRI.ArcGIS.Carto;
using?ESRI.ArcGIS.Geometry;
using?ESRI.ArcGIS.Geodatabase;
using?ESRI.ArcGIS.NetworkAnalysis;
using?ESRI.ArcGIS.DataSourcesGDB;
using?System.Windows.Forms;
namespace?最短路徑
{
????class?ClsPathFinder
????{
????????private?IGeometricNetwork?m_ipGeometricNetwork;
????????private?IMap?m_ipMap;
????????private?IPointCollection?m_ipPoints;
????????private?IPointToEID?m_ipPointToEID;
????????private?double?m_dblPathCost?=?0;
????????private?IEnumNetEID?m_ipEnumNetEID_Junctions;
????????private?IEnumNetEID?m_ipEnumNetEID_Edges;
????????private?IPolyline?m_ipPolyline;
????????private?IActiveView?m_ipActiveView;
????????//返回和設置當前地圖
????????public?IMap?SetOrGetMap
????????{
????????????set?{?m_ipMap?=?value;?}
????????????get?{?return?m_ipMap;?}
????????}
????????public?IActiveView?SetOrGetActiveView
????????{
????????????set?{?m_ipActiveView?=?value;?}
????????????get?{?return?m_ipActiveView;?}
????????}
????????//打開幾何數據集的網絡工作空間
????????public?void?OpenFeatureDatasetNetwork(IFeatureDataset?FeatureDataset)
????????{
????????????CloseWorkspace();
????????????if?(!InitializeNetworkAndMap(FeatureDataset))
????????????????Console.WriteLine(“打開network出錯“);
????????}
????????//輸入點的集合
????????public?IPointCollection?StopPoints
????????{
????????????set?{?m_ipPoints?=?value;?}
????????????get?{?return?m_ipPoints;?}
????????}
????????//路徑成本
????????public?double?PathCost
????????{
????????????get?{?return?m_dblPathCost;?}
????????}
????????//返回路徑的幾何體
????????public?IPolyline?PathPolyLine()
????????{
????????????IEIDInfo?ipEIDInfo;
????????????IGeometry?ipGeometry;
????????????if?(m_ipPolyline?!=?null)?return?m_ipPolyline;
????????????m_ipPolyline?=?new?PolylineClass();
????????????IGeometryCollection?ipNewGeometryColl?=?m_ipPolyline?as?IGeometryCollection;//引用傳遞
????????????ISpatialReference?ipSpatialReference?=?m_ipMap.SpatialReference;
????????????IEIDHelper?ipEIDHelper?=?new?EIDHelperClass();
????????????ipEIDHelper.GeometricNetwork?=?m_ipGeometricNetwork;
????????????ipEIDHelper.OutputSpatialReference?=?ipSpatialReference;
????????????ipEIDHelper.ReturnGeometries?=?true;
????????????IEnumEIDInfo?ipEnumEIDInfo?=?ipEIDHelper.CreateEnumEIDInfo(m_ipEnumNetEID_Edges);
????????????int?count?=?ipEnumEIDInfo.Count;
????????????ipEnumEIDInfo.Reset();
????????????for?(int?i?=?0;?i?????????????{
????????????????ipEIDInfo?=?ipEnumEIDInfo.Next();
????????????????ipGeometry?=?ipEIDInfo.Geometry;
????????????????ipNewGeometryColl.AddGeometryCollection(ipGeometry?as?IGeometryCollection);
????????????}
????????????return?m_ipPolyline;
????????}
????????//解決路徑
????????public?void?SolvePath(string?WeightName)
????????{
????????????try
????????????{
????????????????int?intEdgeUserClassID;
????????????????int?intEdgeUserID;
????????????????int?intEdgeUserSubID;
????????????????int?intEdgeID;
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????36864??2006-05-09?16:27??FindShortPath\FindShortPath\bin\Debug\FindShortPath.exe
?????文件??????38400??2006-05-09?16:27??FindShortPath\FindShortPath\bin\Debug\FindShortPath.pdb
?????文件???????5632??2005-09-23?06:56??FindShortPath\FindShortPath\bin\Debug\FindShortPath.vshost.exe
?????文件??????10344??2006-04-21?13:21??FindShortPath\FindShortPath\ClsPathFinder.cs
?????文件???????5342??2006-04-26?17:35??FindShortPath\FindShortPath\FindShortPath.csproj
?????文件??????14094??2006-04-26?17:35??FindShortPath\FindShortPath\Form1.cs
?????文件??????12821??2006-04-26?17:33??FindShortPath\FindShortPath\Form1.Designer.cs
?????文件??????15721??2006-04-26?17:33??FindShortPath\FindShortPath\Form1.resx
?????文件????????842??2006-04-26?17:33??FindShortPath\FindShortPath\obj\Debug\FindShortPath.csproj.GenerateResource.Cache
?????文件??????36864??2006-05-09?16:27??FindShortPath\FindShortPath\obj\Debug\FindShortPath.exe
?????文件???????6450??2006-05-09?16:27??FindShortPath\FindShortPath\obj\Debug\FindShortPath.Form1.resources
?????文件??????38400??2006-05-09?16:27??FindShortPath\FindShortPath\obj\Debug\FindShortPath.pdb
?????文件????????180??2006-05-09?16:27??FindShortPath\FindShortPath\obj\Debug\FindShortPath.Properties.Resources.resources
?????文件?????134841??2006-04-26?17:35??FindShortPath\FindShortPath\obj\Debug\ResolveAssemblyReference.cache
?????文件????????310??2006-05-09?16:27??FindShortPath\FindShortPath\obj\FindShortPath.csproj.FileList.txt
?????文件????????483??2006-04-26?11:34??FindShortPath\FindShortPath\Program.cs
?????文件???????1298??2006-04-26?11:34??FindShortPath\FindShortPath\Properties\AssemblyInfo.cs
?????文件???????2853??2006-04-26?11:34??FindShortPath\FindShortPath\Properties\Resources.Designer.cs
?????文件???????5612??2006-04-26?11:34??FindShortPath\FindShortPath\Properties\Resources.resx
?????文件???????1096??2006-04-26?11:34??FindShortPath\FindShortPath\Properties\Settings.Designer.cs
?????文件????????249??2006-04-26?11:34??FindShortPath\FindShortPath\Properties\Settings.settings
?????文件????????928??2006-04-26?11:34??FindShortPath\FindShortPath.sln
????..A..H.?????18944??2006-05-09?16:28??FindShortPath\FindShortPath.suo
?????目錄??????????0??2006-05-05?14:47??FindShortPath\FindShortPath\obj\Debug\Refactor
?????目錄??????????0??2006-05-05?14:47??FindShortPath\FindShortPath\obj\Debug\TempPE
?????目錄??????????0??2006-05-05?14:47??FindShortPath\FindShortPath\bin\Debug
?????目錄??????????0??2006-05-09?16:27??FindShortPath\FindShortPath\obj\Debug
?????目錄??????????0??2006-05-05?14:47??FindShortPath\FindShortPath\bin
?????目錄??????????0??2006-05-05?14:47??FindShortPath\FindShortPath\obj
?????目錄??????????0??2006-05-05?14:47??FindShortPath\FindShortPath\Properties
............此處省略5個文件信息
- 上一篇:c#+sqlserver電費收費管理系統
- 下一篇:C#北大刷課工具
評論
共有 條評論