Пример #1
0
        /// <summary>
        /// 初始化UI界面
        /// </summary>
        public virtual void InitUI()
        {
            string        className    = string.Empty;
            IFeatureClass featureClass = null;

            mListFeatureClass = MapOperation.GetFeatureClassListByMap(mMap);
            for (int i = 0; i < mListFeatureClass.Count; i++)
            {
                featureClass = mListFeatureClass[i];
                className    = featureClass.AliasName;
                if (!cmbSelectedLayer.Items.Contains(className))
                {
                    cmbSelectedLayer.Items.Add(className);
                }
            }
        }
Пример #2
0
        public void InitUI()
        {
            dataGridView.Rows.Clear();
            string        className    = string.Empty;
            IFeatureClass featureClass = null;

            cmbSelLyr.Items.Clear();
            mFeatureClassList = MapOperation.GetFeatureClassListByMap(mMap);
            for (int i = 0; i < mFeatureClassList.Count; i++)
            {
                featureClass = mFeatureClassList[i];

                className = featureClass.AliasName;

                if (!cmbSelLyr.Items.Contains(className))
                {
                    cmbSelLyr.Items.Add(className);
                    // 以下代码为判断该图层所包含数字值字段的个数,如果小于2,则将该字段从cmbSelLyr移除
                    int m = 0;
                    for (int j = 0; j < featureClass.Fields.FieldCount; j++)
                    {
                        IField pField = featureClass.Fields.get_Field(j);
                        //判断字段的数据类型是否为数字类型
                        if (pField.Type == esriFieldType.esriFieldTypeDouble ||
                            pField.Type == esriFieldType.esriFieldTypeInteger ||
                            pField.Type == esriFieldType.esriFieldTypeSingle ||
                            pField.Type == esriFieldType.esriFieldTypeSmallInteger)
                        {
                            m++;
                        }
                    }
                    if (m < 3)
                    {
                        cmbSelLyr.Items.Remove(className);
                    }
                }
            }
        }