コード例 #1
0
ファイル: KeyValueSelector.cs プロジェクト: mibe/Srtm2Osm
        public bool IsMatch(OsmObjectBase element)
        {
            if (element.HasTag(tag.Key))
            {
                return(element.GetTagValue(tag.Key) == tag.Value);
            }

            return(false);
        }
コード例 #2
0
        /// <summary>
        /// Determines whether the specified OSM element is a match for this selector.
        /// </summary>
        /// <param name="element">The OSM element to check.</param>
        /// <returns>
        ///     <c>true</c> if the specified element is a match; otherwise, <c>false</c>.
        /// </returns>
        public bool IsMatch(OsmObjectBase element)
        {
            foreach (OsmTag tag in tags)
            {
                bool isTagMatch = element.HasTag(tag.Key) && element.GetTagValue(tag.Key) == tag.Value;

                if (false == isTagMatch && operation == MultipleKeyValueSelectorOperation.And)
                {
                    return(false);
                }

                if (true == isTagMatch && operation == MultipleKeyValueSelectorOperation.Or)
                {
                    return(true);
                }
            }

            if (operation == MultipleKeyValueSelectorOperation.And)
            {
                return(true);
            }

            return(false);
        }