public void AppendToNode(OnlineMapsXML node) { node.A("lat", lat); node.A("lon", lon); if (elevation.HasValue) node.Create("ele", elevation.Value); if (time.HasValue) node.Create("time", time.Value.ToUniversalTime().ToString("s") + "Z"); if (magvar.HasValue) node.Create("magvar", magvar.Value); if (geoidheight.HasValue) node.Create("geoidheight", geoidheight.Value); if (!string.IsNullOrEmpty(name)) node.Create("name", name); if (!string.IsNullOrEmpty(comment)) node.Create("cmt", comment); if (!string.IsNullOrEmpty(description)) node.Create("desc", description); if (!string.IsNullOrEmpty(source)) node.Create("src", source); if (links != null) foreach (Link l in links) l.AppendToNode(node.Create("link")); if (!string.IsNullOrEmpty(symbol)) node.Create("sym", symbol); if (!string.IsNullOrEmpty(type)) node.Create("type", type); if (!string.IsNullOrEmpty(fix)) node.Create("fix", fix); if (sat.HasValue) node.Create("sat", sat.Value); if (hdop.HasValue) node.Create("hdop", hdop.Value); if (vdop.HasValue) node.Create("vdop", vdop.Value); if (pdop.HasValue) node.Create("pdop", pdop.Value); if (ageofdgpsdata.HasValue) node.Create("ageofdgpsdata", ageofdgpsdata.Value); if (dgpsid.HasValue) node.Create("dgpsid", dgpsid.Value); if (extensions != null) node.AppendChild(extensions); }
/// <summary> /// Constructor /// </summary> /// <param name="node">XML Node</param> /// <param name="isReverse">Indicates reverse geocoding result.</param> public OnlineMapsOSMNominatimResult(OnlineMapsXML node, bool isReverse) { this.node = node; place_id = node.A <long>("place_id"); osm_type = node.A("osm_type"); osm_id = node.A <long>("osm_id"); place_rank = node.A <int>("place_rank"); latitude = node.A <double>("lat"); longitude = node.A <double>("lon"); location = new Vector2((float)longitude, (float)latitude); display_name = isReverse? node.Value(): node.A("display_name"); type = node.A("type"); importance = node.A <double>("importance"); string bb = node.A("boundingbox"); if (!string.IsNullOrEmpty(bb)) { string[] bbParts = bb.Split(','); double w = Double.Parse(bbParts[0]); double e = Double.Parse(bbParts[1]); double s = Double.Parse(bbParts[2]); double n = Double.Parse(bbParts[3]); boundingbox = new Rect((float)w, (float)n, (float)(e - w), (float)(s - n)); } addressdetails = new Dictionary <string, string>(); }
/// <summary> /// Creates instance and loads the data from the node. /// </summary> /// <param name="node">Waypoint node</param> public Waypoint(OnlineMapsXML node) { links = new List<Link>(); lat = node.A<double>("lat"); lon = node.A<double>("lon"); foreach (OnlineMapsXML n in node) { if (n.name == "ele") elevation = n.Value<double>(); else if (n.name == "time") time = DateTime.Parse(n.Value()); else if (n.name == "magvar") magvar = n.Value<double>(); else if (n.name == "geoidheight") geoidheight = n.Value<double>(); else if (n.name == "name") name = n.Value(); else if (n.name == "cmt") comment = n.Value(); else if (n.name == "desc") description = n.Value(); else if (n.name == "src") source = n.Value(); else if (n.name == "link") links.Add(new Link(n)); else if (n.name == "sym") symbol = n.Value(); else if (n.name == "type") type = n.Value(); else if (n.name == "fix") fix = n.Value(); else if (n.name == "sat") sat = n.Value<uint>(); else if (n.name == "hdop") hdop = n.Value<double>(); else if (n.name == "vdop") vdop = n.Value<double>(); else if (n.name == "pdop") pdop = n.Value<double>(); else if (n.name == "ageofdgpsdata") ageofdgpsdata = n.Value<double>(); else if (n.name == "dgpsid") dgpsid = n.Value<short>(); else if (n.name == "extensions") extensions = n; else Debug.Log(n.name); } }
/// <summary> /// Load GPX Object from string. /// </summary> /// <param name="content">A string containing GPX content.</param> /// <returns>Instance of GPX Object</returns> public static OnlineMapsGPXObject Load(string content) { OnlineMapsGPXObject instance = new OnlineMapsGPXObject(); try { OnlineMapsXML xml = OnlineMapsXML.Load(content); instance.version = xml.A("version"); instance.creator = xml.A("creator"); foreach (OnlineMapsXML n in xml) { if (n.name == "wpt") instance.waypoints.Add(new Waypoint(n)); else if (n.name == "rte") instance.routes.Add(new Route(n)); else if (n.name == "trk") instance.tracks.Add(new Track(n)); else if (n.name == "metadata") instance.metadata = new Meta(n); else if (n.name == "extensions") instance.extensions = n; else Debug.Log(n.name); } } catch (Exception exception) { Debug.Log(exception.Message + "\n" + exception.StackTrace); } return instance; }
public void AppendToNode(OnlineMapsXML node) { node.A("minlat", minlat); node.A("minlon", minlon); node.A("maxlat", maxlat); node.A("maxlon", maxlon); }
/// <summary> /// Creates instance and loads the data from the node. /// </summary> /// <param name="node">Bounds node</param> public Bounds(OnlineMapsXML node) { minlat = node.A <double>("minlat"); minlon = node.A <double>("minlon"); maxlat = node.A <double>("maxlat"); maxlon = node.A <double>("maxlon"); }
/// <summary> /// Constructor /// </summary> /// <param name="node">Node</param> public OnlineMapsOSMNode(OnlineMapsXML node) { id = node.A("id"); lat = node.A <float>("lat"); lon = node.A <float>("lon"); tags = new List <OnlineMapsOSMTag>(node.count); foreach (OnlineMapsXML subNode in node) { tags.Add(new OnlineMapsOSMTag(subNode)); } }
/// <summary> /// Returns OnlineMapsXML, contains full information about GPX Object. /// </summary> /// <returns>Instance of OnlineMapsXML.</returns> public OnlineMapsXML ToXML() { OnlineMapsXML xml = new OnlineMapsXML("gpx"); xml.A("version", version); xml.A("creator", creator); if (metadata != null) metadata.AppendToNode(xml.Create("metadata")); if (waypoints != null) foreach (Waypoint i in waypoints) i.AppendToNode(xml.Create("wpt")); if (routes != null) foreach (Route i in routes) i.AppendToNode(xml.Create("rte")); if (tracks != null) foreach (Track i in tracks) i.AppendToNode(xml.Create("trk")); if (extensions != null) xml.AppendChild(extensions); return xml; }
/// <summary> /// Creates instance and loads the data from the node. /// </summary> /// <param name="node">Copyright node</param> public Copyright(OnlineMapsXML node) { author = node.A("author"); foreach (OnlineMapsXML n in node) { if (n.name == "year") year = n.Value<int>(); else if (n.name == "license") license = n.Value(); else Debug.Log(n.name); } }
/// <summary> /// Creates instance and loads the data from the node. /// </summary> /// <param name="node">Link node</param> public Link(OnlineMapsXML node) { href = node.A("href"); foreach (OnlineMapsXML n in node) { if (n.name == "text") text = n.Value(); else if (n.name == "type") type = n.Value(); else Debug.Log(n.name); } }
/// <summary> /// Constructor /// </summary> /// <param name="node">Node</param> public OnlineMapsOSMArea(OnlineMapsXML node) { id = node.A("id"); tags = new List <OnlineMapsOSMTag>(node.count); foreach (OnlineMapsXML subNode in node) { tags.Add(new OnlineMapsOSMTag(subNode)); } }
public void AppendToNode(OnlineMapsXML node) { node.A("author", author); if (year.HasValue) { node.Create("year", year.Value); } if (!string.IsNullOrEmpty(license)) { node.Create("license", license); } }
public void AppendToNode(OnlineMapsXML node) { node.A("href", href); if (!string.IsNullOrEmpty(text)) { node.Create("text", text); } if (!string.IsNullOrEmpty(type)) { node.Create("type", type); } }
/// <summary> /// Constructor /// </summary> /// <param name="node">Node</param> public OnlineMapsOSMWay(OnlineMapsXML node) { id = node.A("id"); _nodeRefs = new List <string>(); tags = new List <OnlineMapsOSMTag>(); foreach (OnlineMapsXML subNode in node) { if (subNode.name == "nd") { _nodeRefs.Add(subNode.A("ref")); } else if (subNode.name == "tag") { tags.Add(new OnlineMapsOSMTag(subNode)); } } }
/// <summary> /// Constructor /// </summary> /// <param name="node">Node</param> public OnlineMapsOSMRelation(OnlineMapsXML node) { id = node.A("id"); _members = new List <OnlineMapsOSMRelationMember>(16); tags = new List <OnlineMapsOSMTag>(4); foreach (OnlineMapsXML subNode in node) { if (subNode.name == "member") { _members.Add(new OnlineMapsOSMRelationMember(subNode)); } else if (subNode.name == "tag") { tags.Add(new OnlineMapsOSMTag(subNode)); } } }
/// <summary> /// Constructor /// </summary> /// <param name="node">Node</param> public OnlineMapsOSMRelation(OnlineMapsXML node) { id = node.A("id"); members = new List<OnlineMapsOSMRelationMember>(); tags = new List<OnlineMapsOSMTag>(); foreach (OnlineMapsXML subNode in node) { if (subNode.name == "member") members.Add(new OnlineMapsOSMRelationMember(subNode)); else if (subNode.name == "tag") tags.Add(new OnlineMapsOSMTag(subNode)); } }
/// <summary> /// Constructor /// </summary> /// <param name="node">Node</param> public OnlineMapsOSMTag(OnlineMapsXML node) { key = node.A("k"); value = node.A("v"); }
/// <summary> /// Constructor /// </summary> /// <param name="node">Node</param> public OnlineMapsOSMWay(OnlineMapsXML node) { id = node.A("id"); nodeRefs = new List<string>(); tags = new List<OnlineMapsOSMTag>(); foreach (OnlineMapsXML subNode in node) { if (subNode.name == "nd") nodeRefs.Add(subNode.A("ref")); else if (subNode.name == "tag") tags.Add(new OnlineMapsOSMTag(subNode)); } }
/// <summary> /// Constructor /// </summary> /// <param name="node">Node</param> public OnlineMapsOSMRelationMember(OnlineMapsXML node) { type = node.A("type"); reference = node.A("ref"); role = node.A("role"); }
/// <summary> /// Constructor /// </summary> /// <param name="node">Node</param> public OnlineMapsOSMNode(OnlineMapsXML node) { id = node.A("id"); lat = node.A<float>("lat"); lon = node.A<float>("lon"); tags = new List<OnlineMapsOSMTag>(); foreach (OnlineMapsXML subNode in node) tags.Add(new OnlineMapsOSMTag(subNode)); }
/// <summary> /// Constructor /// </summary> /// <param name="node">XML Node</param> /// <param name="isReverse">Indicates reverse geocoding result.</param> public OnlineMapsOSMNominatimResult(OnlineMapsXML node, bool isReverse) { this.node = node; place_id = node.A<int>("place_id"); osm_type = node.A("osm_type"); osm_id = node.A<int>("osm_id"); place_rank = node.A<int>("place_rank"); latitude = node.A<double>("lat"); longitude = node.A<double>("lon"); location = new Vector2((float)longitude, (float)latitude); display_name = isReverse? node.Value(): node.A("display_name"); type = node.A("type"); importance = node.A<double>("importance"); string bb = node.A("boundingbox"); if (!string.IsNullOrEmpty(bb)) { string[] bbParts = bb.Split(','); double w = Double.Parse(bbParts[0]); double e = Double.Parse(bbParts[1]); double s = Double.Parse(bbParts[2]); double n = Double.Parse(bbParts[3]); boundingbox = new Rect((float)w, (float)n, (float)(e - w), (float)(s - n)); } addressdetails = new Dictionary<string, string>(); }
public void AppendToNode(OnlineMapsXML node) { node.A("id", id); node.A("domain", domain); }
/// <summary> /// Creates instance and loads the data from the node. /// </summary> /// <param name="node">EMail node</param> public EMail(OnlineMapsXML node) { id = node.A("id"); domain = node.A("domain"); }