1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/sucksis-geo-flying

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
Клонировать/Скачать
TiessenInter.cs 2.4 КБ
Копировать Редактировать Web IDE Исходные данные Просмотреть построчно История
Yonghe Отправлено 02.10.2020 04:33 367b0b1
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;
}
}
}

Опубликовать ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://api.gitlife.ru/oschina-mirror/sucksis-geo-flying.git
git@api.gitlife.ru:oschina-mirror/sucksis-geo-flying.git
oschina-mirror
sucksis-geo-flying
sucksis-geo-flying
master