AE开发,生成镶嵌数据集概视图方法

tech2023-10-14  97

为了在放大缩小情况下都能浏览栅格数据,如DOM,大型影像,可对多幅影像构建概视图,其功能与对单幅影像构建金字塔效果一样,仅是对多幅影像进行操作(即构建概视图),有如下两种方法。

方法1:

public void BuildOverviewsOnMD(IMosaicDataset theMosaicDataset) { // The mosaic dataset operation interface is used to perform operations on // a mosaic dataset. IMosaicDatasetOperation theMosaicDatasetOperation = (IMosaicDatasetOperation) (theMosaicDataset); // Create a define overview parameters object. IDefineOverviewsParameters defineOvArgs = new DefineOverviewsParametersClass(); // Use the overview tile parameters interface to specify the overview factor // used to generate overviews. ((IOverviewTileParameters)defineOvArgs).OverviewFactor = 3; // Use the mosaic dataset operation interface to define overviews. theMosaicDatasetOperation.DefineOverviews(defineOvArgs, null); // Create a generate overviews parameters object. IGenerateOverviewsParameters genPars = new GenerateOverviewsParametersClass(); // Set properties to control overview generation. IQueryFilter genQuery = new QueryFilterClass(); ((ISelectionParameters)genPars).QueryFilter = genQuery; genPars.GenerateMissingImages = true; genPars.GenerateStaleImages = true; // Use the mosaic dataset operation interface to generate overviews. theMosaicDatasetOperation.GenerateOverviews(genPars, null); }

方法2:通过调用GP工具

ESRI.ArcGIS.DataManagementTools.BuildOverviews pBuildOverviews = new ESRI.ArcGIS.DataManagementTools.BuildOverviews(); pBuildOverviews.in_mosaic_dataset = pMosicDataset; Geoprocessor gp = new Geoprocessor(); try { gp.OverwriteOutput = true; gp.Execute(pBuildOverviews, null); } catch (Exception err) { DevExpress.XtraEditors.XtraMessageBox.Show("概视图生成失败!"); }

注意:通过GP工具构建概视图时,建议通过全路径获取镶嵌数据集pMosicDataset,否则可能会因找不到该数据集而构建失败。

最新回复(0)