etopologymanager.cs

来自「基于ehotgis开发的嵌入式gis最短路径应用源码」· CS 代码 · 共 49 行

CS
49
字号
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;

namespace TopoTest
{
    public class eTopologyManager
    {
        [DllImport("ePath.dll")]
        private static extern int CreateTopo();
        [DllImport("ePath.dll")]
        private static extern void DestroyTopo(int handle);
        [DllImport("ePath.dll")]
        private static extern int Open(int handle, [In] string strPath);
        [DllImport("ePath.dll")]
        private static extern void Close(int handle);
        [DllImport("ePath.dll")]
        private static extern void MinPathAnalyse(int handle, int lStart, int lEnd,ref double cost,[Out] StringBuilder lpBuffer);

        

        private int handle=0;
        public eTopologyManager()
        {
            handle = CreateTopo();
        }
        ~eTopologyManager()
        {
            if(handle!=0)
                DestroyTopo(handle);
        }
        public bool Open(string strPath)
        {
            return Open(handle, strPath) == 1;
        }
        public void Close()
        {
            Close(handle);
        }
        public string MinPathAnalyse(int lStart, int lEnd,ref double cost)
        {
            StringBuilder sb = new StringBuilder(1024);
            MinPathAnalyse(handle, lStart, lEnd,ref cost,sb);
            return sb.ToString();
        }
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?