• 大小: 91KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-11
  • 语言: C#
  • 标签: 最短路径  ARCGIS  

资源简介

ARCGIS地图查找最短路径开发语言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 < count; 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;

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

     文件      40960  2008-07-11 14:34  FindShortPath\FindShortPath\bin\Debug\FindShortPath.exe

     文件      38400  2008-07-11 14:34  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

     文件       6045  2007-12-30 22:53  FindShortPath\FindShortPath\FindShortPath.csproj

     文件      14673  2008-07-11 14:34  FindShortPath\FindShortPath\Form1.cs

     文件      12877  2007-12-30 22:53  FindShortPath\FindShortPath\Form1.Designer.cs

     文件      14588  2007-12-30 22:53  FindShortPath\FindShortPath\Form1.resx

     文件       1220  2008-07-11 13:21  FindShortPath\FindShortPath\obj\Debug\FindShortPath.csproj.GenerateResource.Cache

     文件      40960  2008-07-11 14:34  FindShortPath\FindShortPath\obj\Debug\FindShortPath.exe

     文件       5524  2008-07-11 13:21  FindShortPath\FindShortPath\obj\Debug\FindShortPath.Form1.resources

     文件      38400  2008-07-11 14:34  FindShortPath\FindShortPath\obj\Debug\FindShortPath.pdb

     文件       4037  2008-07-11 13:21  FindShortPath\FindShortPath\obj\Debug\FindShortPath.Properties.Resources.resources

     文件     288484  2008-07-11 13:21  FindShortPath\FindShortPath\obj\Debug\ResolveAssemblyReference.cache

     文件        310  2007-12-30 22:45  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

     文件       4973  2007-12-30 22:52  FindShortPath\FindShortPath\Properties\Resources.Designer.cs

     文件       8009  2007-12-30 22:52  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.     25088  2008-08-28 16:10  FindShortPath\FindShortPath.suo

     目录          0  2006-05-05 14:47  FindShortPath\FindShortPath\obj\Debug\Refactor

     目录          0  2008-07-11 15:06  FindShortPath\FindShortPath\obj\Debug\TempPE

     目录          0  2006-05-05 14:47  FindShortPath\FindShortPath\bin\Debug

     目录          0  2008-07-11 14:34  FindShortPath\FindShortPath\obj\Debug

     目录          0  2006-05-05 14:47  FindShortPath\FindShortPath\bin

     目录          0  2008-07-11 15:06  FindShortPath\FindShortPath\obj

     目录          0  2007-12-30 22:52  FindShortPath\FindShortPath\Properties

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

评论

共有 条评论