资源简介
使用C#编写的道格拉斯算法,经由弹出的窗口用鼠标绘制任意曲线来演示道格拉斯的算法
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace GIS
{
public partial class Form1 : Form
{
private Boolean _calculateDouglasPeuckerReduction = false;
private List _amerenPoints = new List();
public Form1()
{
InitializeComponent();
}
protected override void OnPaint(PaintEventArgs e)
{
List drawingPoints = new List();
foreach (GIS.Point point in _amerenPoints)
{
drawingPoints.Add(new System.Drawing.Point(Convert.ToInt32(point.X) Convert.ToInt32(point.Y)));
}
if (drawingPoints.Count > 2)
{
e.Graphics.DrawLines(new Pen(Brushes.Black 2) drawingPoints.ToArray());
lblOriginal.Text = drawingPoints.Count.ToString();
if (_calculateDouglasPeuckerReduction)
{
List points = Utility.DouglasPeuckerReduction(_amerenPoints Convert.ToDouble(nudTolerance.Value));
drawingPoints = new List();
foreach (GIS.Point point in points)
{
drawingPoints.Add(new System.Drawing.Point(Convert.ToInt32(point.X) Convert.ToInt32(point.Y)));
}
e.Graphics.DrawLines(new Pen(Brushes.Red 2) drawingPoints.ToArray());
lblSimplified.Text = drawingPoints.Count.ToString();
}
}
base.OnPaint(e);
}
private void Form1_MouseMove(object sender MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
_amerenPoints.Add(new GIS.Point(e.X e.Y));
this.Invalidate();
}
}
private void Form1_MouseUp(object sender MouseEventArgs e)
{
//DO the calculation
_calculateDouglasPeuckerReduction = true;
this.Invalidate();
}
private void Form1_MouseDown(object sender MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
_amerenPoints.Clear();
_calculateDouglasPeuckerReduction = false;
}
}
private void nudTolerance_ValueChanged(object sender EventArgs e)
{
this.Invalidate();
}
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2007-06-06 13:25 GIS\bin\
目录 0 2007-06-06 13:35 GIS\bin\Debug\
文件 24576 2007-05-25 07:06 GIS\bin\Debug\GIS.exe
文件 5632 2005-09-23 07:56 GIS\bin\Debug\GIS.vshost.exe
文件 2692 2007-05-25 07:10 GIS\Form1.cs
文件 5381 2007-05-25 07:06 GIS\Form1.Designer.cs
文件 5814 2007-05-25 07:06 GIS\Form1.resx
文件 3324 2007-05-25 07:03 GIS\GIS.csproj
文件 894 2007-05-25 07:10 GIS\GIS.sln
文件 13824 2007-05-25 07:10 GIS\GIS.suo
文件 2060 2007-05-25 07:03 GIS\Point.cs
文件 470 2007-05-25 06:59 GIS\Program.cs
目录 0 2007-06-06 13:35 GIS\Properties\
文件 1266 2007-05-25 06:59 GIS\Properties\AssemblyInfo.cs
文件 2831 2007-05-25 07:03 GIS\Properties\Resources.Designer.cs
文件 5612 2007-05-25 06:59 GIS\Properties\Resources.resx
文件 1082 2007-05-25 07:03 GIS\Properties\Settings.Designer.cs
文件 249 2007-05-25 06:59 GIS\Properties\Settings.settings
文件 9932 2007-06-06 13:35 GIS\Utility.cs
目录 0 2007-06-06 13:35 GIS\
相关资源
- 智慧城市 智能家居 C# 源代码
- MVC model层代码生成器 C#
- c# winform 自动登录 百度账户 源代码
- C#版保龄球记分代码
- C# 使用ListView控件实现图片浏览器(源
- c#记事本 基本功能已经全部实现 包附
- C# TCP通讯组件源代码
- C#版IE浏览器源代码
- C#使用GDI 绘制汽车车速表等量表源代
- 用C#绘制正弦曲线,要用到Form1_Resiz
- 随机抽题系统C#源代码
- 医院业务管理系统(C#源代码)
- C#代码生成器(生成MVC三层代码)
- C#冒泡排序动态演示程序(看了就会)
- 远程监控(C#源代码)
- C#Oracle数据库备份
- AssetStudio V0.16.0 源代码 使用VS2019
- 串口调试助手代码(XCOM V2.0)
- C#代码生成工具
- 热血江湖20服务端源代码
- C# 视觉处理代码、神经网络和遗传算
- C#跑马灯代码
- C#最新阿里云短信验证sdk代码
- socket服务端
- C# 立马关机 代码
- kepserver 连接 PLC代码
- VS2012保存时自动格式化代码插件(F
- EPLAN 菜单插件代码
- C# 取色工具源代码(RGB)
- C# 人员随机分组抽签工具及源代码
评论
共有 条评论