首页 技术 正文
技术 2022年11月22日
0 收藏 626 点赞 3,099 浏览 1566 个字
//// Copyright (C) 1000 - 9999 Somebody Anonymous// NO WARRANTY OR GUARANTEE//using System;namespace Navi{    class EvilTransform    {        const double pi = 3.14159265358979324;        //        // Krasovsky 1940        //        // a = 6378245.0, 1/f = 298.3        // b = a * (1 - f)        // ee = (a^2 - b^2) / a^2;        const double a = 6378245.0;        const double ee = 0.00669342162296594323;        //        // World Geodetic System ==> Mars Geodetic System        public static void transform(double wgLat, double wgLon, out double mgLat, out double mgLon)        {            if (outOfChina(wgLat, wgLon))            {                mgLat = wgLat;                mgLon = wgLon;                return;            }            double dLat = transformLat(wgLon - 105.0, wgLat - 35.0);            double dLon = transformLon(wgLon - 105.0, wgLat - 35.0);            double radLat = wgLat / 180.0 * pi;            double magic = Math.Sin(radLat);            magic = 1 - ee * magic * magic;            double sqrtMagic = Math.Sqrt(magic);            dLat = (dLat * 180.0) / ((a * (1 - ee)) / (magic * sqrtMagic) * pi);            dLon = (dLon * 180.0) / (a / sqrtMagic * Math.Cos(radLat) * pi);            mgLat = wgLat + dLat;            mgLon = wgLon + dLon;        }        static bool outOfChina(double lat, double lon)        {            if (lon < 72.004 || lon > 137.8347)                return true;            if (lat < 0.8293 || lat > 55.8271)                return true;            return false;        }        static double transformLat(double x, double y)        {            double ret = -100.0 + 2.0 * x + 3.0 * y + 0.2 * y * y + 0.1 * x * y + 0.2 * Math.Sqrt(Math.Abs(x));            ret += (20.0 * Math.Sin(6.0 * x * pi) + 20.0 * Math.Sin(2.0 * x * pi)) * 2.0 / 3.0;            ret += (20.0 * Math.Sin(y * pi) + 40.0 * Math.Sin(y / 3.0 * pi)) * 2.0 / 3.0;            ret += (160.0 * Math.Sin(y / 12.0 * pi) + 320 * Math.Sin(y * pi / 30.0)) * 2.0 / 3.0;            return ret;        }        static double transformLon(double x, double y)        {            double ret = 300.0 + x + 2.0 * y + 0.1 * x * x + 0.1 * x * y + 0.1 * Math.Sqrt(Math.Abs(x));            ret += (20.0 * Math.Sin(6.0 * x * pi) + 20.0 * Math.Sin(2.0 * x * pi)) * 2.0 / 3.0;            ret += (20.0 * Math.Sin(x * pi) + 40.0 * Math.Sin(x / 3.0 * pi)) * 2.0 / 3.0;            ret += (150.0 * Math.Sin(x / 12.0 * pi) + 300.0 * Math.Sin(x / 30.0 * pi)) * 2.0 / 3.0;            return ret;        }    }}
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,103
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,579
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,427
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,199
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,834
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,917