日期:2014-05-18 浏览次数:20765 次
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Text.RegularExpressions;
namespace Wars2Wgs
{
public partial class Form1 : Form
{
double[] TableX = new double[660 * 450];
double[] TableY = new double[660 * 450];
bool InitTable = false;
public Form1()
{
InitializeComponent();
LoadText();
}
private int GetID(int I, int J)
{
return I + 660 * J;
}
private void LoadText()
{
using (StreamReader sr = new StreamReader("Mars2Wgs.txt"))
{
string s = sr.ReadToEnd();
//textBox1.Text = s;
string[] lines = s.Split('\n');
Match MP = Regex.Match(s, "(\\d+)");
int i = 0;
while (MP.Success)
{
//MessageBox.Show(MP.Value);
if (i % 2 == 0) //第一列和第三列
{
TableX[i / 2] = Convert.ToDouble(MP.Value) / 100000.0;
}
else //第二列和第四列
{
TableY[(i - 1) / 2] = Convert.ToDouble(MP.Value) / 100000.0;
}
i++;
MP = MP.NextMatch();
}
InitTable = true;
//MessageBox.Show((i / 2).ToString());
}
}
/// <summary>
/// x是117左右,y是31左右
/// </summary>
/// <param name="xMars">实际维度 </param>
/// <param name="yMars">实际精度 </param>
/// <param nam