common.cs
来自「This is a document about routing [a spat」· CS 代码 · 共 28 行
CS
28 行
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 + =
减小字号Ctrl + -
显示快捷键?