• 大小: 294KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-22
  • 语言: 其他
  • 标签: C#  ArcGIS  Engine  

资源简介

从零开始:AE二次开发中获取A点到B点的最佳路径(5) 文章中的源代码。其实跟文章中的一模一样。

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ESRI.ArcGIS.NetworkAnalysis;
using ESRI.ArcGIS.Geodatabase;
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.Geometry;
using ESRI.ArcGIS.Controls;

namespace WindowsFormsApplication3
{
    class ClassPathFinder
    {
        AxMapControl mymap;

        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;
        private bool clicked;
        IGraphicsContainer pGC;
        int clickedcount = 0;
        
        public ClassPathFinder(object map)
        {
            this.mymap = map as AxMapControl;
            m_ipActiveView = mymap.ActiveView;
            m_ipMap = m_ipActiveView.FocusMap;
            
            clicked = false;
            pGC = m_ipMap as IGraphicsContainer;

        }

   

        #region Public Function
        //返回和设置当前地图
        public IMap SetOrGetMap
        {
            set { m_ipMap = value; }
            get { return m_ipMap; }
        }
        //打开网络
        public void OpenFeatureDatasetNetwork(IFeatureDataset FeatureDataset)
        {
            CloseWorkspace();
            if (!InitializeNetworkAndMap(FeatureDataset))
                Console.WriteLine(“打开出错“);
        }
        //输入点的集合
        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);

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

     文件     269312  2014-04-09 10:22  WindowsFormsApplication3\WindowsFormsApplication3\bin\Debug\WindowsFormsApplication3.exe

     文件     126464  2014-04-09 10:22  WindowsFormsApplication3\WindowsFormsApplication3\bin\Debug\WindowsFormsApplication3.pdb

     文件      11600  2014-04-09 15:45  WindowsFormsApplication3\WindowsFormsApplication3\bin\Debug\WindowsFormsApplication3.vshost.exe

     文件        490  2010-03-17 22:39  WindowsFormsApplication3\WindowsFormsApplication3\bin\Debug\WindowsFormsApplication3.vshost.exe.manifest

     文件       1503  2014-02-20 10:10  WindowsFormsApplication3\WindowsFormsApplication3\ClassDiagram1.cd

     文件       9083  2014-04-09 09:23  WindowsFormsApplication3\WindowsFormsApplication3\ClassPathFinder.cs

     文件       2335  2014-03-24 10:16  WindowsFormsApplication3\WindowsFormsApplication3\CloloTest.cs

     文件       5691  2014-03-24 10:16  WindowsFormsApplication3\WindowsFormsApplication3\CloloTest.Designer.cs

     文件       5817  2014-03-24 10:16  WindowsFormsApplication3\WindowsFormsApplication3\CloloTest.resx

     文件       2494  2014-02-20 10:10  WindowsFormsApplication3\WindowsFormsApplication3\Form1.cs

     文件       6609  2014-02-20 10:10  WindowsFormsApplication3\WindowsFormsApplication3\Form1.Designer.cs

     文件     197013  2014-02-20 10:10  WindowsFormsApplication3\WindowsFormsApplication3\Form1.resx

     文件        724  2014-03-24 16:12  WindowsFormsApplication3\WindowsFormsApplication3\Form2.cs

     文件       3599  2014-03-24 16:12  WindowsFormsApplication3\WindowsFormsApplication3\Form2.Designer.cs

     文件       5817  2014-03-24 16:12  WindowsFormsApplication3\WindowsFormsApplication3\Form2.resx

     文件      49233  2014-03-27 18:33  WindowsFormsApplication3\WindowsFormsApplication3\MapsTest.cs

     文件      10571  2014-03-27 18:33  WindowsFormsApplication3\WindowsFormsApplication3\MapsTest.Designer.cs

     文件     127572  2014-03-27 18:33  WindowsFormsApplication3\WindowsFormsApplication3\MapsTest.resx

     文件      31217  2014-04-09 09:51  WindowsFormsApplication3\WindowsFormsApplication3\NetworkAnalysis.cs

     文件      13053  2014-04-09 09:02  WindowsFormsApplication3\WindowsFormsApplication3\NetworkAnalysis.Designer.cs

     文件       9907  2014-04-09 09:02  WindowsFormsApplication3\WindowsFormsApplication3\NetworkAnalysis.resx

     文件     129277  2014-02-19 11:38  WindowsFormsApplication3\WindowsFormsApplication3\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache

     文件       6782  2014-04-09 15:47  WindowsFormsApplication3\WindowsFormsApplication3\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件        180  2014-04-09 10:08  WindowsFormsApplication3\WindowsFormsApplication3\obj\x86\Debug\WindowsFormsApplication3.CloloTest.resources

     文件       1771  2014-04-09 15:45  WindowsFormsApplication3\WindowsFormsApplication3\obj\x86\Debug\WindowsFormsApplication3.csproj.FileListAbsolute.txt

     文件       1281  2014-04-09 10:13  WindowsFormsApplication3\WindowsFormsApplication3\obj\x86\Debug\WindowsFormsApplication3.csproj.GenerateResource.Cache

     文件     149168  2014-03-18 09:24  WindowsFormsApplication3\WindowsFormsApplication3\obj\x86\Debug\WindowsFormsApplication3.csprojResolveAssemblyReference.cache

     文件     269312  2014-04-09 10:22  WindowsFormsApplication3\WindowsFormsApplication3\obj\x86\Debug\WindowsFormsApplication3.exe

     文件     127598  2014-04-09 10:08  WindowsFormsApplication3\WindowsFormsApplication3\obj\x86\Debug\WindowsFormsApplication3.Form1.resources

     文件        180  2014-04-09 10:08  WindowsFormsApplication3\WindowsFormsApplication3\obj\x86\Debug\WindowsFormsApplication3.Form2.resources

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

评论

共有 条评论