ArcGIS Engine开发——加载数据
来源:互联网 发布:手机淘宝首页海报尺寸 编辑:程序博客网 时间:2024/06/08 18:23
代码:
public static IMapDocument pMapDocument; public static IActiveView pActiveView; public static IMap pMap; public static DataTable attributeTable; //加载地图文档 public static void LoadGeoData(AxMapControl axMapControl1,AxMapControl axMapControl2,string strFileName) { string strExtentName = System.IO.Path.GetExtension(strFileName); switch(strExtentName) { case ".shp": { string strPath = System.IO.Path.GetDirectoryName(strFileName); string strNmae = System.IO.Path.GetFileNameWithoutExtension(strFileName); axMapControl1.AddShapeFile(strPath, strNmae); axMapControl2.AddShapeFile(strPath, strNmae); axMapControl2.Extent = axMapControl2.FullExtent; break; } case ".bmp": case ".tif": case ".jpg": case ".img": { IRasterLayer pRasterLayer; pRasterLayer = new RasterLayerClass(); string pathName = System.IO.Path.GetDirectoryName(strFileName); string fileName = System.IO.Path.GetFileName(strFileName); IRasterWorkspace pRWS; IWorkspaceFactory pWSF; IRaster pRaster; IRasterDataset pRasterDataset; IWorkspace pWS; pWSF = new RasterWorkspaceFactoryClass(); pWS = pWSF.OpenFromFile(pathName, 0); pRWS = pWS as IRasterWorkspace;//QI pRasterDataset = pRWS.OpenRasterDataset(fileName); //影像金字塔判断与创建 IRasterPyramid pRasPyrmid; pRasPyrmid = pRasterDataset as IRasterPyramid; if (pRasPyrmid != null) { if (!(pRasPyrmid.Present)) { pRasPyrmid.Create(); //在进度条中说明正在创建金字塔 } } pRaster = pRasterDataset.CreateDefaultRaster(); pRasterLayer.CreateFromRaster(pRaster); ILayer pLayer = pRasterLayer as ILayer; //向主控视图中添加图像 axMapControl1.AddLayer(pLayer, 0); //确定是否加入空间参考 axMapControl2.ClearLayers(); //向鹰眼视图中添加图像 axMapControl2.AddLayer(pLayer, 0); axMapControl2.Extent = axMapControl2.FullExtent; break; break; } case ".mxd": { if (axMapControl1.CheckMxFile(strFileName)) { axMapControl1.LoadMxFile(strFileName); } else MessageBox.Show("所选择的文件不是Mxd文档文件!", "信息提示"); break; } default: break; } }
记录:
- PageLayout是封装在PageLayoutControl中的一个组件类,组件类是可以直接实例化对象的,它提供了在布局视图中控制元素属性的方法
- IMap接口主要用于管理Map队形中的layer对象、要素选择集、MapSurroundd对象,标注引擎和空间参考对象。Map对象用来显示数据,Map对象是一个存放layer对象的容器,IMap接口定义了方法来操作Map对象中的图层对象
- IActiveView接口定义了Map对象的数据显示功能,PageLayout和Map都实现了该接口,前者为布局视图,后者为数据视图,但在任何一个时刻只有一个保持活跃
- WorkSpace及相关对象
函数学习
加载矢量数据:
axMapControl1.AddShapeFile(strPath, strNmae);
加载矢量数据,直接传入矢量数据的文件路径和文件名axMapControl2.Extent = axMapControl2.FullExtent;
在鹰眼图上全图显示
加载栅格数据:
- 加载地图文档:
axMapControl1.CheckMxFile(strFileName)
检查地图文档axMapControl1.LoadMxFile(strFileName);
加载地图文档
阅读全文
0 0
- ArcGIS Engine开发——加载数据
- ArcGIS Engine加载数据
- ArcGIS Engine中加载数据
- ArcGIS Engine中加载数据
- ArcGIS Engine中加载数据
- ArcGIS Engine中加载数据 (转载)
- 最新力作——ArcGIS Engine开发实例教程 下载
- ArcGIS Engine开发Geodatabase代码(一)——Cursors
- ArcGIS Engine开发Geodatabase代码(四)——Join
- ArcGIS Engine开发Geodatabase代码(六)——TopologyEdit
- arcgis engine中几种常用数据的加载方法
- 在ArcGIS Engine的MapControl直接加载arcserver切片数据
- ArcGIS Engine 数据渲染
- arcgis engine开发学习
- vc arcgis engine开发
- ArcGIS Engine开发入门教程
- Arcgis Engine 开发初步
- Arcgis engine开发
- 2017湘潭赛XTU1264Partial Sum
- ZooKeeper 选举过程
- Chromium Base学习笔记 —— Callback
- Hbase region切片 reqion切片合并操作
- 数据对接—kettle使用知识13
- ArcGIS Engine开发——加载数据
- JDK1.7 换成1.8后遇到的meaven异常
- BFS与反向BFS,链式前向星与反向建边
- bash编程之: Sed流文本编辑
- Eclipse创建java web工程
- TCP/IP协议三次握手与四次握手流程解析
- 数据分析(工具)及架构
- 分水岭分割
- bash编程之 awk格式化输出