• 技术文章 >后端开发 >C#.Net教程

    详细介绍C# 利用IRawPixels接口遍历栅格数据的代码实例

    黄舟黄舟2017-03-08 11:23:42原创1197

    本文主要介绍了利用IRawPixels接口遍历栅格数据。具有很好的参考价值,下面跟着小编一起来看下吧

    AO的版本为10.2,开发的语言是C#。栅格数据来源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);     
      }
    }

    以上就是详细介绍C# 利用IRawPixels接口遍历栅格数据的代码实例的详细内容,更多请关注php中文网其它相关文章!

    声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。
    上一篇:C#实现char字符数组与字符串相互转换的方法详解 下一篇:自己动手写 PHP MVC 框架(40节精讲/巨细/新人进阶必看)

    相关文章推荐

    • 指针数组和数组指针的区别是什么• 汇编语言和c语言的区别是什么• c语言文件读写怎么操作• c语言怎么获取数组长度• c语言怎么计算n的阶乘
    1/1

    PHP中文网