⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 common.cs

📁 This is a document about routing [a spatial analysis - network]
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.Text;

namespace MapService
{
    public class Common
    {
        public const int D2M = 111200;

        public static int Len(double x1, double y1, double x2, double y2)
        {
            return (int)(D2M * Math.Sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)));
        }
        public static int Len(Node p1, Node p2)
        {
            return Len(p1.Lon, p1.Lat, p2.Lon, p2.Lat);
        }

        public static Node GetNode(Node n1, Node n2, int l1, int l2)
        {
            double lon = (double)((l2 * n1.Lon + l1 * n2.Lon) / (l1 + l2));
            double lat = (double)((l2 * n1.Lat + l1 * n2.Lat) / (l1 + l2));
            return new Node(String.Format("{0:n6},{1:n6}", lon, lat), lon, lat);
        }
    }
}

⌨️ 快捷键说明

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