Exemplo n.º 1
0
        /// <summary>
        ///     Determines whether the specified parent of the layer is visible in the map.
        /// </summary>
        /// <param name="source">The source.</param>
        /// <param name="layer">The layer.</param>
        /// <returns>Returns <see cref="bool" /> representing <c>true</c> when the parent layer is visible.</returns>
        public static bool IsParentVisible(this IMap source, ILayer layer)
        {
            bool isLayerVisible;
            bool isParentVisible;

            IMapLayers2 layers = (IMapLayers2)source;

            layers.IsLayerVisibleEx(layer, out isLayerVisible, out isParentVisible);
            return(isParentVisible);
        }
Exemplo n.º 2
0
        public static void TraceLayerProperties(this IMap map)
        {
            string s  = "Layer: {0} is visible: {1}";
            string ms = "IMapLayers2: {0} is visible: {1}. Parent is visible:{2}";

            IEnumLayer  enumLayer = (IEnumLayer)map.get_Layers(null, true);
            IMapLayers2 mapLayers = map as IMapLayers2;
            ILayer      layer     = null;

            while ((layer = enumLayer.Next()) != null)
            {
                bool isvis;
                bool isparentvis;

                mapLayers.IsLayerVisibleEx(layer, out isvis, out isparentvis);

                ILayer2 layer2 = layer as ILayer2;
                Trace.WriteLine(s.FormatString(layer2.Name, layer2.Visible));

                Trace.WriteLine(ms.FormatString(layer2.Name, isvis, isparentvis));
            }
        }