-
大小: 81KB文件類型: .rar金幣: 2下載: 0 次發(fā)布日期: 2021-05-16
- 語言: 其他
- 標(biāo)簽: C#??MapProject??
資源簡介
對經(jīng)緯度坐標(biāo)進(jìn)行讀取,完成投影后繪制在界面上,另外實(shí)現(xiàn)道格拉斯算法對地圖抽稀

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.Collections;
using?System.Linq;
using?System.Data;
using?System.Text;
using?System.Windows.Forms;
using?System.Drawing;
using?System.IO;
namespace?蘭勃特墨卡托投影
{
????public?class?MyPoint
????{
????????public?double?x;
????????public?double?y;
????}
????public?struct?line//記錄直線參數(shù)的結(jié)構(gòu)
????{
????????public?double?k;
????????public?double?b;
????}
????class?Dpeucker
????{
????????List?outPoint?=?new?List();
????????public?void?Do(List?inPoint?double?DPictureBox?picbox??)
????????{
????????????int?n1?=?0;
????????????int?n2?=?inPoint.Count;
????????????Douglas(inPoint?n1?n2?D);
????????????//Bitmap?memoryBuffer1?=?new?Bitmap(picbox.Width?picbox.Height);
????????????//Graphics?g?=?Graphics.FromImage(memoryBuffer1);
????????????Graphics?g?=?picbox.CreateGraphics();
????????????Pen?p?=?new?Pen(Color.Red?2f);???????????
????????????g.ScaleTransform(0.00009f?0.00009f);//畫面縮小
????????????g.TranslateTransform(5200000?7200000);//平移
????????????g.RotateTransform(-90);//旋轉(zhuǎn)??
????????????Point[]?points?=?new?Point[outPoint.Count];
????????????for?(int?i?=?0;?i?????????????{
????????????????points[i].X?=?(int)outPoint[i].x;
????????????????points[i].Y?=?(int)outPoint[i].y;
????????????}
????????????g.DrawLines(p?points);
????????????g.Dispose();
????????????//picbox.Visible?=?true;
????????????//picbox.Image?=?memoryBuffer1;
????????????
????????????//List?mPoints?=?outPoint.Distinct().ToList();?;
????????}
????????///?
????????///?求直線斜率與截距
????????///?
????????///?
????????///?
????????///?
????????private?line?parameter(MyPoint?p1?MyPoint?p2)
????????{
????????????double?k?b;
????????????line?newcs?=?new?line();
????????????k?=?(p2.y?-?p1.y)?/?(p2.x?-?p1.x);
????????????b?=?p1.y?-?k?*?p1.x;
????????????newcs.k?=?k;
????????????newcs.b?=?b;
????????????return?newcs;
????????}
????????///?
????????///?求點(diǎn)到直線的距離
????????///?
????????///?
????????///?
????????///?
????????private?double?distance(MyPoint?dot?line?cs)
????????{
????????????double?dis?=?(Math.Abs(cs.k?*?dot.x?-?dot.y?+?cs.b))?/?Math.Sqrt(cs.k?*?cs.k?+?1);
????????????return?dis;
????????}
????????///?
????????///?
????????///?
????????///?
????????///?
????????///?
????????///?
????????private?void?Douglas(List?InPoints?int?n1?int?n2?double?d)
????????{
????????????int?num?=?InPoints.Count;
????????????//List?OutPoint?=?new?List();
????????????int?Max?=?0;//定義擁有最大距離值的點(diǎn)的編號
????????????line?MyLine?=?new?line();
????????????MyLine?=?parameter(InPoints
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件??????27648??2019-08-29?21:32??蘭勃特墨卡托投影\bin\Debug\蘭勃特墨卡托投影.exe
?????文件??????44544??2019-08-29?21:32??蘭勃特墨卡托投影\bin\Debug\蘭勃特墨卡托投影.pdb
?????文件??????21464??2019-08-07?10:20??蘭勃特墨卡托投影\bin\Debug\蘭勃特墨卡托投影.vshost.exe
?????文件???????4942??2019-08-30?18:16??蘭勃特墨卡托投影\Dpeucker.cs
?????文件??????15707??2019-08-29?21:33??蘭勃特墨卡托投影\Form1.cs
?????文件??????24922??2019-08-29?21:33??蘭勃特墨卡托投影\Form1.Designer.cs
?????文件???????8564??2019-08-29?21:33??蘭勃特墨卡托投影\Form1.resx
?????文件???????3403??2019-08-13?21:46??蘭勃特墨卡托投影\GetDataFromTxt.cs
?????文件???????3672??2019-09-22?15:43??蘭勃特墨卡托投影\MapProject.cs
?????文件???????1209??2019-09-20?15:23??蘭勃特墨卡托投影\obj\Debug\DesignTimeResolveAssemblyReferences.cache
?????文件???????7088??2019-08-19?13:02??蘭勃特墨卡托投影\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
?????文件?????????42??2019-08-19?13:02??蘭勃特墨卡托投影\obj\Debug\蘭勃特墨卡托投影.csproj.CoreCompileInputs.cache
?????文件???????1531??2019-08-13?23:06??蘭勃特墨卡托投影\obj\Debug\蘭勃特墨卡托投影.csproj.FileListAbsolute.txt
?????文件????????847??2019-08-29?21:32??蘭勃特墨卡托投影\obj\Debug\蘭勃特墨卡托投影.csproj.GenerateResource.cache
?????文件???????9084??2019-08-11?12:25??蘭勃特墨卡托投影\obj\Debug\蘭勃特墨卡托投影.csprojAssemblyReference.cache
?????文件??????27648??2019-08-29?21:32??蘭勃特墨卡托投影\obj\Debug\蘭勃特墨卡托投影.exe
?????文件???????1942??2019-08-29?21:32??蘭勃特墨卡托投影\obj\Debug\蘭勃特墨卡托投影.Form1.resources
?????文件??????44544??2019-08-29?21:32??蘭勃特墨卡托投影\obj\Debug\蘭勃特墨卡托投影.pdb
?????文件????????180??2019-08-19?13:04??蘭勃特墨卡托投影\obj\Debug\蘭勃特墨卡托投影.Properties.Resources.resources
?????文件???????5148??2019-08-13?21:46??蘭勃特墨卡托投影\peucker.cs
?????文件????????505??2019-07-28?08:45??蘭勃特墨卡托投影\Program.cs
?????文件???????1368??2019-07-28?08:45??蘭勃特墨卡托投影\Properties\AssemblyInfo.cs
?????文件???????2900??2019-07-28?08:45??蘭勃特墨卡托投影\Properties\Resources.Designer.cs
?????文件???????5612??2019-07-28?08:45??蘭勃特墨卡托投影\Properties\Resources.resx
?????文件???????1111??2019-07-28?08:45??蘭勃特墨卡托投影\Properties\Settings.Designer.cs
?????文件????????249??2019-07-28?08:45??蘭勃特墨卡托投影\Properties\Settings.settings
?????文件???????3877??2019-08-19?13:04??蘭勃特墨卡托投影\蘭勃特墨卡托投影.csproj
?????目錄??????????0??2019-07-28?08:45??蘭勃特墨卡托投影\obj\Debug\TempPE
?????目錄??????????0??2019-09-28?00:16??蘭勃特墨卡托投影\bin\Debug
?????目錄??????????0??2019-08-07?10:14??蘭勃特墨卡托投影\bin\Release
............此處省略9個(gè)文件信息
評論
共有 條評論