示例#1
0
        public bool IsMatch(OsmObjectBase element)
        {
            if (element.HasTag(tag.Key))
            {
                return(element.GetTagValue(tag.Key) == tag.Value);
            }

            return(false);
        }
示例#2
0
        public virtual void CopyToClone(OsmObjectBase clone)
        {
            clone.objectId  = objectId;
            clone.timestamp = timestamp;
            if (user != null)
            {
                clone.user = (OsmUser)user.Clone();
            }
            else
            {
                clone.user = null;
            }
            clone.visible = visible;
            clone.action  = action;

            foreach (string key in tags.Keys)
            {
                string cloneKey   = (string)key.Clone();
                OsmTag cloneValue = (OsmTag)tags[key].Clone();
                clone.tags[cloneKey] = cloneValue;
            }
        }
示例#3
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);
        }
 public OsmDuplicatedObjectIdException(OsmObjectBase osmObject)
     : base(GetMessage(osmObject))
 {
 }
        private static string GetMessage(OsmObjectBase osmObject)
        {
            string msg = "A {0} object with ObjectId {1} is already in the database.";

            return(String.Format(CultureInfo.CurrentCulture, msg, osmObject.GetType().Name, osmObject.ObjectId));
        }
示例#6
0
文件: OsmWay.cs 项目: mibe/Srtm2Osm
        public override void CopyToClone(OsmObjectBase clone)
        {
            base.CopyToClone(clone);

            ((OsmWay)clone).nodesList = new List <long> (nodesList);
        }