Example #1
0
 private void frmCacu_Load(object sender, EventArgs e)
 {
     if (this.m_mapControl != null)
     {
         for (int i = 0; i < m_mapControl.LayerCount; i++)
         {
             if (m_mapControl.get_Layer(i) is ITinLayer)
             {
                 this.comboBox1.Items.Add(m_mapControl.get_Layer(i).Name.ToString());
             }
         }
     }
 }
Example #2
0
        private ILayer GetLayerByName(IMapControlDefault mapControl, string LayerName)
        {
            ILayer pLayer = null;

            for (int i = 0; i < mapControl.LayerCount; i++)
            {
                if (mapControl.get_Layer(i).Name == LayerName)
                {
                    pLayer = mapControl.get_Layer(i);
                    break;
                }
            }
            return(pLayer);
        }
Example #3
0
        /// <summary>
        /// 根据图层名称获取图层对象
        /// </summary>
        /// <param name="name">图层名称</param>
        /// <param name="mapControl">地图控件对象</param>
        /// <returns>ILayer图层对象</returns>
        public ILayer getLayerByName(string name, IMapControlDefault mapControl)
        {
            if (mapControl == null)
            {
                return(null);
            }

            for (int i = 0; i < mapControl.LayerCount; i++)
            {
                ILayer layer = mapControl.get_Layer(i);
                if (name.ToUpper() == layer.Name.ToUpper())
                {
                    return(layer);
                }
            }
            return(null);
        }
Example #4
0
        /// <summary>
        /// 通过图名获取图层
        /// </summary>
        /// <param name="LayerName"></param>
        /// <returns></returns>
        private ILayer GetLayerByName(string LayerName)
        {
            ILayer pLayer = null;

            if (m_MapControl.LayerCount > 0)
            {
                for (int i = 0; i < m_MapControl.LayerCount; i++)
                {
                    pLayer = m_MapControl.get_Layer(i);
                    if (pLayer.Valid && pLayer.Name == LayerName)
                    {
                        return(pLayer);
                    }
                }
            }

            return(pLayer = null);
        }