- 1、本文档共8页,可阅读全部内容。
- 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
identify工具
首先判断identify工具是否启动 bool showidentify = false;// 全局变量,identify工具是否启动 public void identify_Click(object sender, EventArgs e) { showidentify = true; }然后在axMapControl1.OnMouseDown中添加代码: axMapControl1.OnMouseDown += (sender, e) = { if (e.button == 1 showidentify) { axMapControl1.MousePointer = esriControlsMousePointer.esriPointerArrow; #region Identify IFeatureLayer pFL; IFeatureSelection pFeatureSelection; IEnvelope pEnv; IGeometry pGeometry; ISpatialFilter pSpatialFilter; ISelectionSet pSelectionSet; IEnumIDs pEnumIDs; IFeature pFeature; //用于查询的矩形(相当于点的缓冲区,这样比生成缓冲区节省资源), //envelope的大小根据实际情况设定,以方便使用为准 pEnv = new EnvelopeClass(); pEnv.PutCoords(e.mapX - 200, e.mapY - 200, e.mapX + 200, e.mapY + 200); pGeometry = pEnv as IGeometry; pSpatialFilter = new SpatialFilterClass(); pSpatialFilter.Geometry = pGeometry; pSpatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects; //运用singleton模式设计窗体,只允许存在一个ShowAttributeTable实例 identify frmShowAttribute = identify.CreateForm(); frmShowAttribute.Show(); frmShowAttribute.AttributeTreeView.Nodes.Clear();//首先清除上次结果 frmShowAttribute.AttributeTreeView.ShowLines = true; frmShowAttribute.AttributeTreeView.ShowPlusMinus = true; frmShowAttribute.pActiveView = this.axMapControl1.ActiveView; frmShowAttribute.pMap = axMapControl1.Map; frmShowAttribute.pSFilter = pSpatialFilter; TreeNode rootNode = new TreeNode(); rootNode.Text = 属性信息;//添加根节点“属性信息” frmShowAttribute.AttributeTreeView.Nodes.Add(rootNode); for (int i = 0; i this.axMapControl1.LayerCount; i++) { pFL = this.axMapControl1.get_Layer(i) as IFeatureLayer; if (pFL.Visible pFL.Selectable) { pFeatureSelection = pFL as IFeatureSelection; //选择之前先清除,这是个好习惯(除非是用Add方式) pFeatureSelection.Clear(); pFeatureSelection.SelectFeatures(pSpatialFilter, esriSelectionResultEnum.esriSelectionResultNew, true); pSelectionSet = pFeatureSelection.SelectionSet; axMapControl1.ActiveView.Refresh(); //如果选择集内有Feature if (pSelectionSet.Count 0) { //构建图层节点并添加到根节点 TreeNode layerNameNode = new TreeNode();
文档评论(0)