public GpxFile(EventDB eventDB, CoordinateMapper coordinateMapper, GpxCreationSettings settings) { this.eventDB = eventDB; this.settings = settings; this.coordinateMapper = coordinateMapper; if (coordinateMapper == null) throw new Exception("The map file must be an OCAD file to use GPX files."); }
public void WriteXml(string filename, EventDB eventDB, RectangleF mapBounds, CoordinateMapper coordinateMapper) { this.eventDB = eventDB; this.mapBounds = mapBounds; this.coordinateMapper = coordinateMapper; this.modificationDate = DateTimeOffset.Now; controlCodeMap = new Dictionary<Id<ControlPoint>, string>(); // Create the XML writer. XmlWriterSettings settings = new XmlWriterSettings(); settings.Indent = true; settings.Encoding = new UTF8Encoding(false); xmlWriter = XmlWriter.Create(filename, settings); WriteStart(); // Write the start point information WriteControls(ControlPointKind.Start, "STA"); WriteControls(ControlPointKind.MapExchange, "XCHG"); // Write the control information WriteControls(ControlPointKind.Normal, "CTL"); // Write the end point information WriteControls(ControlPointKind.Finish, "FIN"); // Write the crossint point information WriteControls(ControlPointKind.CrossingPoint, "CROSS"); // Write the course information. WriteCourses(); WriteEnd(); // And done. xmlWriter.Close(); eventDB = null; xmlWriter = null; }