zoukankan      html  css  js  c++  java
  • ArcGis 中MapControl 框选

    void mCtrl_OnMouseDown(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnMouseDownEvent e)
            {
                #region 框选
                
                
                if (e.button == 4)
                {
                    IEnvelope pEnvelope = mCtrl.TrackRectangle();  // 通过鼠标,取得一个包络线对象
                    ISelectionEnvironment pSelectionEnv = new SelectionEnvironmentClass();  // 设置一个新环境
                    pSelectionEnv.DefaultColor = MapHelper.GetRGBColor(Color.Red);     // 再改变原来要素的眼神值
                    mCtrl.Map.SelectByShape(pEnvelope, pSelectionEnv, false);
                    mCtrl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, null);

                    ISelection selection = mCtrl.Map.FeatureSelection;
                    IEnumFeatureSetup enumFeatureSetup = selection as IEnumFeatureSetup;    //这里很必要
                    enumFeatureSetup.AllFields = true;                                      //这里很必要
                    IEnumFeature enumFeature = enumFeatureSetup as IEnumFeature;
                    enumFeature.Reset();
                    IFeature feature = enumFeature.Next();

                    IFeatureLayer pFeatureLayer = (IFeatureLayer)mCtrl.get_Layer(currentLayerIndex);
                    IFeatureClass pFeatureClass = (IFeatureClass)pFeatureLayer.FeatureClass;

                    int fLCDIdx = pFeatureClass.FindField(fieldName);
                    lbFields.Items.Clear();
                    while (feature != null)
                    {
                        var _lcd = feature.get_Value(fLCDIdx);
                        long lcd = Convert.ToInt64(_lcd);
                        lbFields.Items.Add(lcd);
                        feature = enumFeature.Next();
                    }
                }
                


                #endregion

                mCtrl.Refresh(esriViewDrawPhase.esriViewForeground, Type.Missing, Type.Missing);
            }
  • 相关阅读:
    WM11破解版
    安装系统
    linux配置问题
    PAT:1022. Digital Library (30) (部分正确,错最后两个)
    PAT:1023. Have Fun with Numbers (20) AC
    PAT:1081. Rational Sum (20) AC(类似math.h中的sqrt(1.0*n),algorithm的abs()用于取绝对值)
    PAT:1013. Battle Over Cities (25) AC
    conv2的计算过程
    UFLDL Tutorial
    视频深度学习 Deep Learning
  • 原文地址:https://www.cnblogs.com/94cool/p/4347430.html
Copyright © 2011-2022 走看看