C#操作地图文档和图层
来源:互联网 发布:linux ntp服务器配置 编辑:程序博客网 时间:2024/06/03 19:53
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using ESRI.ArcGIS.Carto;using ESRI.ArcGIS.Geodatabase;namespace EngineWindowsApplication4{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } IMap m_pMap; //获得AxMapControl1的地图 IEnumLayer m_pEnumLayers; //在一个地图中枚举层集 ILayer m_pLayer; private void Form1_Load(object sender, EventArgs e) { string path = Application.StartupPath + "\\实验三数据\\实验三数据.mxd"; if (axMapControl1.CheckMxFile(path)) axMapControl1.LoadMxFile(path); axTOCControl1.SetBuddyControl(axMapControl1); cboMaps.Items.Add(axMapControl1.Map.Name); } private void cboMaps_SelectedIndexChanged(object sender, EventArgs e) { m_pMap = axMapControl1.Map; m_pEnumLayers = m_pMap.Layers; m_pLayer = m_pEnumLayers.Next(); while (m_pLayer != null) { lboMapLayers.Items.Add(m_pLayer.Name); m_pLayer = m_pEnumLayers.Next(); } } private void lboMapLayers_Click(object sender, EventArgs e) { lboFields.Items.Clear(); m_pEnumLayers.Reset(); m_pLayer = m_pEnumLayers.Next(); while (m_pLayer != null) { if (m_pLayer.Name == lboMapLayers.Text) break; m_pLayer = m_pEnumLayers.Next(); } IFeatureLayer pFLayer = m_pLayer as IFeatureLayer; IFeatureClass pFClass; IFields pFields; pFClass = pFLayer.FeatureClass; pFields = pFClass.Fields; int i; for (i = 0; i < pFields.FieldCount - 1; i++) { lboFields.Items.Add(pFields.get_Field(i).Name); } } private void lboFields_Click(object sender, EventArgs e) { lboFields.Items.Clear(); m_pEnumLayers.Reset(); m_pLayer = m_pEnumLayers.Next(); while (m_pLayer != null) if (m_pLayer.Name == lboMapLayers.Text) break; m_pLayer = m_pEnumLayers.Next(); IFeatureLayer pFLayer = m_pLayer as IFeatureLayer; IFeatureClass pFClass; IFields pFields; pFClass = pFLayer.FeatureClass; pFields = pFClass.Fields; int i; for (i = 0; i < pFields.FieldCount - 1; i++) { lboFields.Items.Add(pFields.get_Field(i).Name); } } }}
0 0
- C#操作地图文档和图层
- 地图加载和图层简介
- AE+地图文档基本操作
- 渲染地图图层
- 增加地图图层
- 地图图层添加
- c#操作word文档
- C#操作Word文档
- C#操作Excel文档
- C#操作Word文档
- C#操作Word文档
- C# 操作word文档
- C#操作Word文档
- C#操作RTF文档
- C#操作word文档
- C#操作Word文档
- C# XML 文档操作
- C# 操作word文档
- hadoop学习中DNF服务器的安装(主要用来替换host文件的配置)
- Android Fragment 你应该知道的一切
- JavaScript 跨域访问的问题和解决过程
- 两张图片合成
- STM32 RGB点阵屏故事 下
- C#操作地图文档和图层
- Android程序的反破解技术
- MemCache工作流程
- Android仿微信界面
- Accessing the Raspberry Pi Camera with OpenCV and Python
- swift资源库-2-初识UI
- 解决java.lang.IllegalStateException: Fragment not attached to Activity
- 韩顺平Spring框架学习,学习笔记(一)
- NoSQL之Redis安装