代码拉取完成,页面将自动刷新
using System;
using System.Collections.Generic;
using System.Text;
namespace GeoFly
{
public class TiessenInter:SpatialInterpolate
{
/// <summary>
/// 得到指定日期的栅格图层插值结果
/// </summary>
/// <param name="date">指定的日期</param>
public GridLayer SpatialGridOut(DateTime date)
{
if (this.pStationinfo == null || this.pMeteoData == null)
return null;
//栅格数据结构初始化
m_gridLayer = HydroSimulate.g_GridLayerPara.g_DemLayer.AttributesCopy();
ProgressBar bar = new ProgressBar();
bar.Show();
bar.Text = "正在内插栅格数据";
if (this.m_CoordType == CoordType.UTM_Coord)
{
this.PrepareFromUTM(date);
}
else
{
this.PrepareFromLongLa(date);
}
if (X.Length != Y.Length || X.Length != Z.Length)
throw new Exception("提供的样本数据有误");
for (int row = 0; row < m_gridLayer.rowCount; row++) //开始新一日的空间插值计算
{
for (int col = 0; col < m_gridLayer.colCount; col++)
{
double value = -9999;
//获取当前计算栅格中心坐标
//获取当前计算栅格的坐标
LPoint p = m_gridLayer.CellPosition(row, col);
double CurrentX = p.X;
double CurrentY = p.Y;
double minDist = 1e20;
double minDistValue = 0;
for (int i = 0; i < pStationinfo.Count; i++)
{
double distX = X[i] - CurrentX;
double distY = Y[i] - CurrentY;
double dist = Math.Sqrt(distX * distX + distY * distY);
if (dist < minDist)
{
minDist = dist;
minDistValue = Z[i];
}
}
this.m_gridLayer[row, col] = minDistValue;
}
}
//图层中间过程输出
bar.Close();
return this.m_gridLayer;
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。