C# 利用IRawPixels接口遍歷柵格數(shù)據(jù)
更新時間:2017年02月10日 11:22:49 作者:杰桀
本文主要介紹了利用IRawPixels接口遍歷柵格數(shù)據(jù)。具有很好的參考價值,下面跟著小編一起來看下吧
AO的版本為10.2,開發(fā)的語言是C#。柵格數(shù)據(jù)來源IRasterDataset接口。
IRasterBandCollection pRasterBandCollection = pRasterDataset as IRasterBandCollection;
IRasterBand pRasterBand = pRasterBandCollection.Item(0);
IRaster pRaster = (pRasterDataset as IRasterDataset2).CreateFullRaster();
IRawPixels pRawPixels = pRasterBand as IRawPixels;
IRasterProps pRasterProps = pRasterBand as IRasterProps;
int dHeight = pRasterProps.Height;
int dWidth = pRasterProps.Width;
IPnt pntSize = new PntClass();
pntSize.SetCoords(dHeight, dWidth);
IPnt pPixelBlockOrigin = new PntClass();
pPixelBlockOrigin.SetCoords(0, 0);
IPixelBlock pixelBlock = pRaster.CreatePixelBlock(pntSize);
pRawPixels.Read(pPixelBlockOrigin, pixelBlock);
System.Array arr = (System.Array)(pixelBlock as IPixelBlock3).get_PixelData(0);
for (int i = 0; i < dHeight;i++ )
{
for (int j = 0; j < dWidth; j++)
{
float number = 0;
float.TryParse(arr.GetValue(i,j).ToString(),out number);
}
}
以上就是本文的全部內(nèi)容,希望本文的內(nèi)容對大家的學習或者工作能帶來一定的幫助,同時也希望多多支持腳本之家!
相關文章
C#使用Directoryinfo類獲得目錄信息和屬性的方法
這篇文章主要介紹了C#使用Directoryinfo類獲得目錄信息和屬性的方法,涉及C#操作目錄的技巧,非常具有實用價值,需要的朋友可以參考下2015-04-04
C#實現(xiàn)的微信網(wǎng)頁授權操作邏輯封裝示例
這篇文章主要介紹了C#實現(xiàn)的微信網(wǎng)頁授權操作邏輯封裝,分析了微信網(wǎng)頁授權操作的原理、步驟并給出了C#實現(xiàn)的網(wǎng)頁授權操作邏輯封裝類,需要的朋友可以參考下2016-10-10

