/// <summary> /// Converts response into an array of results. /// </summary> /// <param name="response">Response of query.</param> /// <returns>Array of result.</returns> public static OnlineMapsOSMNominatimResult[] GetResults(string response) { try { OnlineMapsXML xml = OnlineMapsXML.Load(response); bool isReverse = xml.name == "reversegeocode"; OnlineMapsXMLList resNodes = xml.FindAll(isReverse? "//result" : "//place"); if (resNodes.count == 0) { return(null); } List <OnlineMapsOSMNominatimResult> results = new List <OnlineMapsOSMNominatimResult>(); foreach (OnlineMapsXML node in resNodes) { OnlineMapsOSMNominatimResult result = new OnlineMapsOSMNominatimResult(node, isReverse); OnlineMapsXML adNode = isReverse ? xml["addressparts"] : node; if (!adNode.isNull) { result.LoadAddressDetails(adNode); } results.Add(result); } return(results.ToArray()); } catch (Exception exception) { Debug.Log("Can not get a result.\n" + exception.Message + "\n" + exception.StackTrace); } return(null); }
/// <summary> /// Converts response into an array of results. /// </summary> /// <param name="response">Response of query.</param> /// <returns>Array of result.</returns> public static OnlineMapsOSMNominatimResult[] GetResults(string response) { try { OnlineMapsXML xml = OnlineMapsXML.Load(response); bool isReverse = xml.name == "reversegeocode"; OnlineMapsXMLList resNodes = xml.FindAll(isReverse? "//result" : "//place"); if (resNodes.count == 0) return null; List<OnlineMapsOSMNominatimResult> results = new List<OnlineMapsOSMNominatimResult>(); foreach (OnlineMapsXML node in resNodes) { OnlineMapsOSMNominatimResult result = new OnlineMapsOSMNominatimResult(node, isReverse); OnlineMapsXML adNode = isReverse ? xml["addressparts"] : node; if (!adNode.isNull) result.LoadAddressDetails(adNode); results.Add(result); } return results.ToArray(); } catch (Exception exception) { Debug.Log(exception.Message + "\n" + exception.StackTrace); } return null; }
public override void Init(OnlineMapsOSMNominatimResult _data) { base.Init(_data); xButton.SetActive(true); GSHome.Instance.LockPositionClick(data); GSHome.Instance.localeCurrent.Init(data); }
public void Init(OnlineMapsOSMNominatimResult _data) { data = _data; display_name.text = data.display_name; position.text = data.location.ToString(); Show(true); }
public void LockPositionClick(OnlineMapsOSMNominatimResult data) { SetSearchMarker(data.location, data.display_name); if (_api.zoom < 13) { _api.zoom = 13; } _api.position = data.location; _api.Redraw(); }
public void OnUnitClick(OnlineMapsOSMNominatimResult _data) { Show(false); lableCurrent.Init(_data); }
public virtual void Init(OnlineMapsOSMNominatimResult _data) { data = _data; txt.text = data.display_name; }
public void OnUnitClickDirections(OnlineMapsOSMNominatimResult data) { localeObj.SetActive(false); directionsObj.gameObject.SetActive(true); ToLocale.Init(data); }