Ejemplo n.º 1
0
        /// <summary>
        /// Get Ilayer from TOC Control
        /// </summary>
        /// <param name="iTOCControl2">pass by ref the toccontol</param>
        /// <returns></returns>
        private ILayer getIlayer(ITOCControl2 iTOCControl2)
        {
            try
            {
                ILayer iLayer = null;
                IBasicMap map = null;
                ILayer layer = null;
                Object other = null;
                Object index = null;
                esriTOCControlItem item = esriTOCControlItem.esriTOCControlItemNone;

                iTOCControl2.GetSelectedItem(ref item, ref map, ref layer, ref other, ref index);

                //Attempt a cast
                iLayer = layer as ESRI.ArcGIS.Carto.ILayer;

                //return layer of type ilayer
                return iLayer;
            }
            catch (Exception)
            {

                throw;
            }
        }