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示例資料/柵格數/World/world.tiff |
視訊路徑 |
百度雲盤地址下/PIE視訊教程/等值線生成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 }View Code |
2.4示例截圖