PIE SDK柵格生成等值線、面

 

1.算法功能簡介

    等值線圖能直觀地展現數據的變化趨勢,是衆多領域展現成果的重要圖建之一,被普遍應用於石油勘探、礦物開採、氣象預報等衆多領域。等值線的繪製是指從大量採樣數據中提取出具備相同值的點的信息,並生成形態完整、位置精確的等值線的過程,包括等值線網格化、等值線追蹤、等值線光滑、等值線填充與標註幾個處理步驟。算法

    PIE支持算法功能的執行,下面對等值線生成算法功能進行介紹。ide

2.算法功能實現說明

2.1. 實現步驟

第一步工具

算法參數設置測試

第二步spa

算法執行code

第三步orm

結果顯示視頻

2.2. 算法參數

C#算法DLLblog

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             //二、算法執行
27             PIE.CommonAlgo.RasterToContourContructAlgo alog = new RasterToContourContructAlgo();
28             alog.Params = info;
29             alog.Execute();
30             //三、結果顯示
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         }
View Code

2.4. 示例截圖

 

相關文章
相關標籤/搜索