三角网等值线类,c#的
在这里可以下载三角网等值线类http://download.csdn.net/detail/hhstar/3998354
功能:实现三角网等值线
输入:逐点加入;文本文件导入
输出:可以直接导出KML文件,一般的GIS文件都能打开;另外提供等值先操作方法。
还有其他功能,正在完善中
方法:
using contour;
using DataAccess;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
//文件型散点数据
long N;
Contour mContour = new Contour();//实例等值线
mContour.FreeData();//初始化
N = mContour.AddRandomPointsFromFile(System.IO.Directory.GetCurrentDirectory().ToString() + "读文本文件散点数据
AddCustomedStep(10) // 以特定值来绘制等值线
//mContour.WriteRandomPointsToFile(System.IO.Directory.GetCurrentDirectory().ToString() + "原始散点数据保存为文本文件
//mContour.WriteRandomPointsToFile(System.IO.Directory.GetCurrentDirectory().ToString() + "\\yl0.kml", "kml");//原始散点数据保存为google标记文件
//水情数据库数据(国标20005版)
//mContour.FreeData();//初始化
//List<Stcd_yl_sum> mylsum = new List<Stcd_yl_sum>();//建立 站号、站名、经、纬、时段值(高程)结构的数组。
//MSSQLConnection mysql = new MSSQLConnection();//建立水情数据库实例连接
//mysql.SetCurSQLconn("Data Source=192.168.1.1;Initial Catalog=xxxx;User ID=xxxx;Password=xxx");//修改数据库连接参数
//mylsum = mysql.Get_2005_Data(System.IO.Directory.GetCurrentDirectory().ToString() + "\\st_stbprp_b.txt", DateTime.Parse("2011-08-10 08:00:00"), DateTime.Parse("2011-08-11 08:00:00"));//2005版实时雨水情数据库表结构与标识符标准,也为标准版
mylsum = mysql.Get_Data(DateTime.Parse("2011-07-26 08:00:00"), DateTime.Parse("2011-07-27 08:00:00"));//获取最近一百天雨量累计值
mContour.FreeData();//初始化
//if (mylsum != null)
//{
// for (int i = 0; i < mylsum.Count; i++)
// {
// mContour.AddPointRandom(mylsum[i].STCD, mylsum[i].STNM, mylsum[i].LGTD, mylsum[i].LTTD, mylsum[i].YL);//逐个点增加数据
// }
// mContour.WriteRandomPointsToFile(System.IO.Directory.GetCurrentDirectory().ToString() + "原始散点数据保存为文本文件
//mContour.WriteRandomPointsToFile(System.IO.Directory.GetCurrentDirectory().ToString() + "\\yl0.kml", "kml");//原始KML文件
mContour.CalculateRandom();//建立三角网,并生成等值线(折线)
mContour.WriteSJXtokml(System.IO.Directory.GetCurrentDirectory().ToString() + "写三角网文件
mContour.Write3Contoutokml(System.IO.Directory.GetCurrentDirectory().ToString() + "\\ylcontou.kml");//写等值线文件,kml格式
//}
}
}
}
原始散点数据文件kinge.txt。类似
113.37 32.57 8.5
113.4 32.38 0
113.48 32.45 0
113.58 32.58 0
113.63 32.43 0.5
113.63 32.62 5
113.65 32.28 0
边界文件 Border.txt。类似
113.72251 32.41839
113.72357 32.41526
113.73831 32.39966
113.74918 32.39186
113.74406 32.37632
113.74842 32.36348
113.76737 32.36887
113.72073 32.45754
113.71954 32.45028
113.71892 32.44253
113.72002 32.43283
113.71830 32.42557
113.72251 32.41839
st_stbprp_b.txt存放需要用来做等值线散点的站号,站名,经,纬度
效果图