C#、AE开发入门之打开TIFF文件并显示

继上篇文章,本次打开TIFF文件,附上源码及其注释

     private void button2_Click(object sender, EventArgs e)
{
axMapControl1.ClearLayers();
if (tiffPath == "")
return; int Index = tiffPath.LastIndexOf("\\");
string fileName = tiffPath.Substring(Index+);
string filePath = tiffPath.Substring(, Index); IWorkspaceFactory pWorkspaceFactory = new RasterWorkspaceFactoryClass();//利用工厂对象去生成一个raster文件的工作空间
IRasterWorkspace pRasterWorkspace = (IRasterWorkspace)pWorkspaceFactory.OpenFromFile(filePath, );//到指定路径下
IRasterDataset pRasterDataset = (IRasterDataset)pRasterWorkspace.OpenRasterDataset(fileName);//利用要素集去接收对应的raster文件 IRasterLayer pRasterLayer = new RasterLayerClass();//生成一个矢量图层对象
pRasterLayer.CreateFromDataset(pRasterDataset);//利用矢量图层对象去创建对应的raster文件
axMapControl1.Map.AddLayer(pRasterLayer);//添加对应的图层
axMapControl1.ActiveView.Refresh();
}
上一篇:redis与python交互


下一篇:linux PMBus总线及设备驱动分析