public void SaveDestinationXml(XmlElement arrowNode) { XmlDocument doc = arrowNode.OwnerDocument; arrowNode.SetAttribute("coords", DestinationCoords.ToString()); if (HasRoute) { XmlElement routeNode = (XmlElement)arrowNode.AppendChild(Route.ToXml(doc)); routeNode.SetAttribute("routeIndex", RouteIndex.ToString()); } else if (HasDestinationObject) { XmlElement objectNode = (XmlElement)arrowNode.AppendChild(doc.CreateElement("object")); objectNode.SetAttribute("id", DestinationObject.Id.ToString("X")); objectNode.SetAttribute("name", DestinationObject.Name); objectNode.SetAttribute("icon", DestinationObject.Icon.ToString("X8")); objectNode.SetAttribute("coords", DestinationObject.Coords.ToString()); } else if (HasDestinationLocation) { XmlElement locationNode = (XmlElement)arrowNode.AppendChild(doc.CreateElement("location")); locationNode.SetAttribute("id", DestinationLocation.Id.ToString()); locationNode.SetAttribute("name", DestinationLocation.Name); } }
// Compare To (to allow sort) public int CompareTo(StationStop other) { if (other == null) { return(1); } int result = SubrouteIndex.CompareTo(other.SubrouteIndex); if (result != 0) { return(result / Math.Abs(result)); } result = RouteIndex.CompareTo(other.RouteIndex); if (result != 0) { return(result / Math.Abs(result)); } result = StopOffset.CompareTo(other.StopOffset); if (result != 0) { return(result / Math.Abs(result)); } return(0); }