c#调用mapinfo中mif格式和txt文档地图数据并描绘算法(经过规范检验,无任何错误)

电脑杂谈  发布时间:2019-08-14 08:01:32  来源:网络整理

mapinfo mapx 5.0下载_mapinfo 地图下载_mapinfo mapx 5.0下载

#region 定义屏幕坐标转换函数

public System.Drawing.Point zuobuanzhuanhuan(Point point)

{

System.Drawing.Point ScreenPt = new System.Drawing.Point();

ScreenPt.X = (int)(pictureBox_Map.Width + (point.x -m_mapXmax)

* pictureBox_Map.Width / (m_mapXmax - m_mapXmin));

ScreenPt.Y = (int)(pictureBox_Map.Height -

(point.y - m_mapYmin) * pictureBox_Map.Height / (m_mapYmax -m_mapYmin));

return ScreenPt;

//System.Drawing.Point screenpoint = newSystem.Drawing.Point();

//screenpoint.X =(int)point .x ;

//screenpoint.Y =(int )point.y;

//return screenpoint;

}

#endregion

List<Line> LineList = new List<Line>();

private void dlu线ToolStripMenuItem_Click(object sender, EventArgse)

{

StreamReader objReader = new StreamReader('dlu线.txt');

string sLine = ' ';

sLine = objReader.ReadLine();

//ArrayList LineList = new ArrayList();

while (sLine != null)

{

string[] sl = sLine.Trim().Split(' ');

Line line = new Line();

line.number = Convert.ToInt32(sl[1]);

List<Point> PontList = new List<Point>();

for (int i = ; i < line.number; i++)

{

sLine = objReader.ReadLine();

sl = sLine.Trim().Split(' ');

Point p = new Point();

p.x = Convert.ToDouble(sl[]);

p.y = Convert.ToDouble(sl[1]);

PontList.Add(p);

if (blInitalValue)

{

m_mapXmin = p.x;// mpoint.X;

m_mapXmax = p.x;// mpoint.X;

m_mapYmin = p.y;// mpoint.Y;

m_mapYmax = p.y;// mpoint.Y;

blInitalValue = false;

}

else

{

if (m_mapXmax < p.x)

{

m_mapXmax = p.x;

}

if (m_mapXmin > p.x)

{

m_mapXmin = p.x;

}

if (m_mapYmax < p.y)

{

m_mapYmax = p.y;

}

if (m_mapYmin > p.y)

{

m_mapYmin = p.y;

}

}

}

line.PontList = PontList;

LineList.Add(line);

objReader.ReadLine();

sLine = objReader.ReadLine();

}

if (LineList == null)

return;

Graphics gs = pictureBox_Map.CreateGraphics();

foreach (Line line in LineList)

{

int number = line.number;

//PointF[] points = new PointF[number];

System.Drawing.Point[] points = newSystem.Drawing.Point[number];

for (int i = ; i < number; i++)

{

points[i] = zuobuanzhuanhuan(line.PontList[i]);

}

Pen pen = new Pen(Color.Red , 1);

gs.DrawLines(pen, points);

//gs.DrawLines(pen ,points );

}

objReader.Close();

}

private void fug线ToolStripMenuItem_Click(object sender, EventArgse)

{

StreamReader objReader = new StreamReader('fug线.txt');

string sLine = ' ';

sLine = objReader.ReadLine();

//ArrayList LineList = new ArrayList();

while (sLine != null)

{

string[] sl = sLine.Trim().Split(' ');

Line line = new Line();

line.number = Convert.ToInt32(sl[1]);

List<Point> PontList = new List<Point>();

for (int i = ; i < line.number; i++)

{

sLine = objReader.ReadLine();

sl = sLine.Trim().Split(' ');

Point p = new Point();

p.x = Convert.ToDouble(sl[]);

p.y = Convert.ToDouble(sl[1]);

PontList.Add(p);

if (blInitalValue)

{

m_mapXmin = p.x;// mpoint.X;

m_mapXmax = p.x;// mpoint.X;

m_mapYmin = p.y;// mpoint.Y;

m_mapYmax = p.y;// mpoint.Y;

blInitalValue = false;

}

else

{

if (m_mapXmax < p.x)

mapinfo 地图下载_mapinfo mapx 5.0下载_mapinfo mapx 5.0下载

{

m_mapXmax = p.x;

}

if (m_mapXmin > p.x)

{

m_mapXmin = p.x;

}

if (m_mapYmax < p.y)

{

m_mapYmax = p.y;

}

if (m_mapYmin > p.y)

{

m_mapYmin = p.y;

}

}

}

line.PontList = PontList;

LineList.Add(line);

objReader.ReadLine();

sLine = objReader.ReadLine();

}

if (LineList == null)

return;

Graphics gs = pictureBox_Map.CreateGraphics();

foreach (Line line in LineList)

{

int number = line.number;

//PointF[] points = new PointF[number];

System.Drawing.Point[] points = newSystem.Drawing.Point[number];

for (int i = ; i < number; i++)

{

points[i] = zuobuanzhuanhuan(line.PontList[i]);

}

Pen pen = new Pen(Color.Red, 1);

gs.DrawLines(pen, points);

//gs.DrawLines(pen ,points );

}

objReader.Close();

}

private void jj线ToolStripMenuItem_Click(object sender, EventArgse)

{

StreamReader objReader = new StreamReader('jj线.txt');

string sLine = ' ';

sLine = objReader.ReadLine();

//ArrayList LineList = new ArrayList();

while (sLine != null)

{

string[] sl = sLine.Trim().Split(' ');

Line line = new Line();

line.number = Convert.ToInt32(sl[1]);

List<Point> PontList = new List<Point>();

for (int i = ; i < line.number; i++)

{

sLine = objReader.ReadLine();

sl = sLine.Trim().Split(' ');

Point p = new Point();

p.x = Convert.ToDouble(sl[]);

p.y = Convert.ToDouble(sl[1]);

PontList.Add(p);

if (blInitalValue)

{

m_mapXmin = p.x;// mpoint.X;

m_mapXmax = p.x;// mpoint.X;

m_mapYmin = p.y;// mpoint.Y;

m_mapYmax = p.y;// mpoint.Y;

blInitalValue = false;

}

else

{

if (m_mapXmax < p.x)

{

m_mapXmax = p.x;

}

if (m_mapXmin > p.x)

{

m_mapXmin = p.x;

}

if (m_mapYmax < p.y)

{

m_mapYmax = p.y;

}

if (m_mapYmin > p.y)

{

m_mapYmin = p.y;

}

}

}

line.PontList = PontList;

LineList.Add(line);

objReader.ReadLine();

sLine = objReader.ReadLine();

}

if (LineList == null)

return;

Graphics gs = pictureBox_Map.CreateGraphics();

foreach (Line line in LineList)

{

int number = line.number;

//PointF[] points = new PointF[number];

System.Drawing.Point[] points = newSystem.Drawing.Point[number];

for (int i = ; i < number; i++)

{

points[i] = zuobuanzhuanhuan(line.PontList[i]);

}

Pen pen = new Pen(Color.Red , 1);

gs.DrawLines(pen, points);


本文来自电脑杂谈,转载请注明本文网址:
http://xinshanjie.com/a/tongxinshuyu/article-119186-1.html

相关阅读
发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

  • 陆翱
    陆翱

    所以呐让舍不得的美好留在美好的回忆里吧

热点图片
拼命载入中...