/// <summary> /// Loads a group of tags, reading them with a section of the configuration file with a certain type of values /// </summary> /// <param name="typeSection">XElement section "string" or "hash" or "int" configuration file</param> /// <param name="typeValueTag"></param> private void UploadTagWithTypeValue(XElement typeSection, TypeValueTag typeValueTag) { if (typeSection != null && typeSection.Elements().Count() > 0) { foreach (XElement typeXElement in typeSection.Elements()) { if (typeXElement.Attribute("contain") != null) { _tagsContains.Add(typeXElement.Attribute("contain").Value, typeValueTag); } if (typeXElement.Attribute("tag") != null) { _tags.Add(OsmImportUtilites.GetHash(typeXElement.Attribute("tag").Value), typeValueTag); } } } }
/// <summary> /// Returns the type in which to store the tag value /// </summary> /// <param name="tag">Tag Name</param> /// <returns>Enumerator value ("Hash", "String", "Int" etc.)</returns> public TypeValueTag GetTypeValueTag(string tag) { foreach (KeyValuePair <string, TypeValueTag> keyValuePair in _tagsContains) { if (tag.Contains(keyValuePair.Key)) { return(keyValuePair.Value); } } TypeValueTag typeValueTag; if (_tags.TryGetValue(OsmImportUtilites.GetHash(tag), out typeValueTag)) { return(typeValueTag); } else { return(TypeValueTag.Id); } }