PIE SDK栅格生成等值线、面
1.算法功能简介
等值线图能直观地展示数据的变化趋势,是众多领域展示成果的重要图建之一,被广泛应用于石油勘探、矿物开采、气象预报等众多领域。等值线的绘制是指从大量采样数据中提取出具有相同值的点的信息,并生成形态完整、位置精确的等值线的过程,包括等值线网格化、等值线追踪、等值线光滑、等值线填充与标注几个处理步骤。
PIE支持算法功能的执行,下面对等值线生成算法功能进行介绍。
2.算法功能实现说明
2.1. 实现步骤
第一步 |
算法参数设置 |
第二步 |
算法执行 |
第三步 |
结果显示 |
2.2. 算法参数
C#算法DLL |
PIE.CommonAlgo.dll |
|
C#算法名称 |
PIE.CommonAlgo.RasterToContourContructAlgo |
|
参数结构体 |
RasterToContourContruct_Exchange_Info |
|
参数说明 |
||
BandIndex |
Int |
波段 |
BAutoSetStartEndValue |
bool |
是否自动计算起始终止值 |
BClosed |
bool |
是否闭合 |
BGenerateContourFace |
bool |
是否生成等值面 |
BGenerateContourLine |
bool |
是否生成等值线 |
EndValue |
double |
终止值 |
InputRasterDataset |
IRasterDataset |
输入栅格数据集 |
OutputContourFaceFDataset |
IFeatureDataset |
输出等值面(内存) |
OutputContourLineFDataset |
IFeatureDataset |
输出等值线 (内存) |
SampleRatio |
int |
采样比 |
StartValue |
double |
起始值 |
ValueInterval |
double |
间隔 |
2.3. 示例代码
数据路径 |
百度云盘地址下/ PIE示例数据/栅格数/04.World/World.tif |
视频路径 |
百度云盘地址下/PIE视频教程/10.算法调用/实用工具/等值线生成.avi |
示例代码 |
|
![]() 1 /// <summary> 2 /// 等值线生成算法测试 3 /// </summary> 4 private void Test_RasterToContourContructAlgo() 5 { 6 #region 1参数设置 7 #region 获取待加载文件路径 8 System.Windows.Forms.OpenFileDialog openFileDialog = new System.Windows.Forms.OpenFileDialog(); 9 openFileDialog.Title = "请选择要打开的数据"; 10 openFileDialog.Multiselect = true; 11 openFileDialog.Filter = "Tiff|*.tif;*.tiff|所有文件|*.*"; 12 if (openFileDialog.ShowDialog() != System.Windows.Forms.DialogResult.OK) return; 13 string strFileName = openFileDialog.FileName; 14 #endregion 15 IRasterDataset rDataset = PIE.DataSource.DatasetFactory.OpenRasterDataset(strFileName, OpenMode.ReadOnly); 16 RasterToContourContruct_Exchange_Info info = new RasterToContourContruct_Exchange_Info(); 17 info.InputRasterDataset = rDataset; 18 info.BandIndex = 1; 19 info.BAutoSetStartEndValue = true; 20 info.BGenerateContourFace = true; 21 info.BGenerateContourLine = true; 22 info.BClosed = true; 23 info.ValueInterval = 50; 24 info.SampleRatio = 20; 25 #endregion 26 //2、算法执行 27 PIE.CommonAlgo.RasterToContourContructAlgo alog = new RasterToContourContructAlgo(); 28 alog.Params = info; 29 alog.Execute(); 30 //3、结果显示 31 info = alog.Params as RasterToContourContruct_Exchange_Info; 32 if (info.OutputContourFaceFDataset != null)//等值面 33 { 34 IFeatureLayer featureLayerFace = new FeatureLayer(); 35 featureLayerFace.FeatureClass = new FeatureClass(info.OutputContourFaceFDataset); 36 m_HookHelper.FocusMap.AddLayer(featureLayerFace as ILayer); 37 } 38 if (info.OutputContourLineFDataset != null)//等值线 39 { 40 IFeatureLayer featureLayerLine = new FeatureLayer(); 41 featureLayerLine.FeatureClass = new FeatureClass(info.OutputContourLineFDataset); 42 m_HookHelper.FocusMap.AddLayer(featureLayerLine as ILayer); 43 } 44 m_HookHelper.ActiveView.Refresh(); 45 (rDataset as IDisposable).Dispose(); 46 rDataset = null; 47 } |
2.4. 示例截图