public bool TryGetStyleMapById(string id, out KmlStyleMap styleMap)
 {
     if (String.IsNullOrWhiteSpace(id))
     {
         throw new ArgumentNullException(nameof(id));
     }
     _lookup.TryGetValue(id, out KmlStyleSelector selector);
     styleMap = selector as KmlStyleMap;
     return(styleMap != null);
 }
 public void Add(KmlStyleMap styleMap)
 {
     if (styleMap == null)
     {
         throw new ArgumentNullException(nameof(styleMap));
     }
     _selectors.Add(styleMap);
     if (String.IsNullOrWhiteSpace(styleMap.Id))
     {
         return;
     }
     _lookup[styleMap.Id] = styleMap;
 }
        public static KmlStyleSelector Parse(XElement xml, XmlNamespaceManager namespaces)
        {
            if (xml == null)
            {
                return(null);
            }

            switch (xml.Name.LocalName)
            {
            case "Style":
                return(KmlStyle.Parse(xml, namespaces));

            case "StyleMap":
                return(KmlStyleMap.Parse(xml, namespaces));

            default:
                throw new Exception("Unknown style selector " + xml.Name.LocalName);
            }
        }