• 地图框选得到要素属性值


    自己添加响应函数即可,以下为响应函数中的代码:

    IMap pMap = pMapControl.Map;
                ISelectionEnvironment pSelEnvi = new SelectionEnvironmentClass();
                IEnvelope pEnv = new EnvelopeClass();
                pEnv = pMapControl.TrackRectangle();
                pMap.SelectByShape(pEnv, pSelEnvi, false);
                IFeatureSelection pFeatureSelection;
                IFeatureLayer pFeatureLayer;
                IFeature pFeature;
                pFeatureLayer = pMapControl.get_Layer(0) as FeatureLayer;
                pFeatureSelection = pFeatureLayer as IFeatureSelection;
                ISelectionSet pSelectionSet;
                pSelectionSet = pFeatureSelection.SelectionSet;
               // MessageBox.Show(pSelectionSet.Count.ToString());
                IEnumIDs pEnumIDs;
                IEnvelope pEnv2 = new EnvelopeClass();
                pEnumIDs = pSelectionSet.IDs;
                long id = pEnumIDs.Next();
                while (id != -1)
                {
                    pFeature=pFeatureLayer.FeatureClass.GetFeature((int)id);
                    pMapControl.FlashShape(pFeature.Shape, 3, 300, null); //闪烁要素
                    pEnv2.Union(pFeature.Extent);
                    //MessageBox.Show(pFeature.get_Value(4).ToString()); //得到要素属性值
                    id = pEnumIDs.Next();
                }
                pMapControl.Extent = pEnv2;
                pMapControl.ActiveView.Refresh();

    一起学习GIS及其二次开发,一起进步!
  • 相关阅读:
    详细分析MySQL事务日志(redo log和undo log)
    详细分析MySQL的日志(一)
    MySQL/MariaDB中的事务和事务隔离级别
    详细介绍MySQL/MariaDB的锁
    MariaDB/MySQL用户和权限管理
    (MariaDB)开窗函数用法
    翻译:window function(已提交到MariaDB官方手册)
    翻译:group_concat()函数(已提交到MariaDB官方手册)
    (MariaDB/MySQL)之DML(1):数据插入
    (MariaDB/MySQL)MyISAM存储引擎读、写操作的优先级
  • 原文地址:https://www.cnblogs.com/tuncaysanli/p/1330080.html
Copyright © 2020-2023  润新知