Ejemplo n.º 1
0
        private List <LayerInfoViewModel> LoadLayerInfosFromArcMap()
        {
            List <LayerInfoViewModel> result = new List <LayerInfoViewModel>();

            var layers = ArcmapLayerUtils.EnumerateLayers(ArcmapUtils.GetFocusMap(), false);

            foreach (IFeatureLayer layer in layers)
            {
                LayerInfoViewModel layerInfo = LoadLayerInfoFromArcMap(layer);
                result.Add(layerInfo);
            }
            return(result);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Checks whether a note matches with a given search pattern.
        /// </summary>
        /// <param name="item">Note model to test.</param>
        /// <param name="pattern">Filter pattern to search for.</param>
        /// <returns>Returns true if the note matches the pattern, otherwise false.</returns>
        private bool LayerInfoMatchesPattern(LayerInfoViewModel item, string pattern)
        {
            if (string.IsNullOrEmpty(pattern))
            {
                return(true);
            }

            // Search in title
            string title = item.Title;

            if (!string.IsNullOrEmpty(title) && (title.IndexOf(pattern, StringComparison.InvariantCultureIgnoreCase) >= 0))
            {
                return(true);
            }

            // Search in category
            string category = item.Group;

            if (!string.IsNullOrEmpty(category) && (category.IndexOf(pattern, StringComparison.InvariantCultureIgnoreCase) >= 0))
            {
                return(true);
            }

            // Search in table name
            string content = item.TableName;

            if (!string.IsNullOrEmpty(content) && (content.IndexOf(pattern, StringComparison.InvariantCultureIgnoreCase) >= 0))
            {
                return(true);
            }

            // Search in query
            string query = item.Filter;

            if (!string.IsNullOrEmpty(query) && (query.IndexOf(pattern, StringComparison.InvariantCultureIgnoreCase) >= 0))
            {
                return(true);
            }

            // Search in visibility
            string visibility = item.Visible.ToString();

            if ((pattern.Length > 2) && (visibility.IndexOf(pattern, StringComparison.InvariantCultureIgnoreCase) >= 0))
            {
                return(true);
            }

            return(false);
        }