public static IDisposable CreateReader(string filepath, out IGpxReader reader, out IStreamProgress streamProgress) { var stream = new MemoryStream(System.IO.File.ReadAllBytes(filepath)); IDisposable result = CreateReader(stream, out reader, out streamProgress); return(new Disposable(result, stream)); }
public static IDisposable CreateReader(MemoryStream stream, out IGpxReader reader) { var result = new GpxReader(stream); reader = result; return(result); }
public static IDisposable CreateReader(MemoryStream stream, out IGpxReader reader, out IStreamProgress streamProgress) { var result = new GpxReader(stream); streamProgress = new StreamProgress(stream); reader = result; return(result); }
public static IDisposable CreateReader <TTrackPoint>(string filepath, IGpxTrackPointReader <TTrackPoint> trackPointReader, out IGpxReader reader, out IStreamProgress streamProgress) where TTrackPoint : GpxTrackPoint, new() { var stream = new MemoryStream(System.IO.File.ReadAllBytes(filepath)); IDisposable result = CreateReader(stream, trackPointReader, out reader, out streamProgress); return(new Disposable(result, stream)); }
public static IDisposable CreateReader <TTrackPoint>(MemoryStream stream, IGpxTrackPointReader <TTrackPoint> trackPointReader, out IGpxReader reader, out IStreamProgress streamProgress) where TTrackPoint : GpxTrackPoint, new() { var result = new GpxReader <TTrackPoint>(stream, trackPointReader ?? new NopTrackPointReader <TTrackPoint>()); streamProgress = new StreamProgress(stream); reader = result; return(result); }
/// <summary> /// Loads Gpx data from IGpxReader /// </summary> /// <param name="reader">The reader to read data from</param> /// <returnsGpxDocument instance eith data from GpxReader></returns> public static GpxDocument Load(IGpxReader reader) { if (reader == null) { throw new ArgumentNullException("reader"); } GpxDocument result = new GpxDocument(); result.LoadFromReader(reader); return(result); }
/// <summary> /// Loads Gpx data from reader to this instance of the GpxDocument class /// </summary> /// <param name="reader">The reader to read data from</param> private void LoadFromReader(IGpxReader reader) { IGpxGeometry geometry = null; while ((geometry = reader.Read()) != null) { switch (geometry.GeometryType) { case GpxGeometryType.Waypoint: this.Waypoints.Add((GpxPoint)geometry); break; case GpxGeometryType.Route: this.Routes.Add((GpxRoute)geometry); break; case GpxGeometryType.Track: this.Tracks.Add((GpxTrack)geometry); break; } } }
public static IDisposable CreateReader(string filepath, out IGpxReader reader, out IStreamProgress streamProgress) { return(CreateReader <GpxTrackPoint>(filepath, trackPointReader: null, reader: out reader, streamProgress: out streamProgress)); }
public static IDisposable CreateReader(MemoryStream stream, out IGpxReader reader, out IStreamProgress streamProgress) { return(CreateReader <GpxTrackPoint>(stream, trackPointReader: null, reader: out reader, streamProgress: out streamProgress)); }
public GpxToKmlConverter(ICommandLineParserService commandLineParserService, IGpxReader gpxReader, IKmlWriter kmlWriter) { CommandLineParserService = commandLineParserService; GpxReader = gpxReader; KmlWriter = kmlWriter; }
/// <summary> /// Loads Gpx data from IGpxReader /// </summary> /// <param name="reader">The reader to read data from</param> /// <returnsGpxDocument instance eith data from GpxReader></returns> public static GpxDocument Load(IGpxReader reader) { if (reader == null) { throw new ArgumentNullException("reader"); } GpxDocument result = new GpxDocument(); result.LoadFromReader(reader); return result; }
/// <summary> /// Loads Gpx data from reader to this instance of the GpxDocument class /// </summary> /// <param name="reader">The reader to read data from</param> private void LoadFromReader(IGpxReader reader) { IGpxGeometry geometry = null; while ((geometry = reader.Read()) != null) { switch (geometry.GeometryType) { case GpxGeometryType.Waypoint: this.Waypoints.Add((GpxPoint)geometry); break; case GpxGeometryType.Route: this.Routes.Add((GpxRoute)geometry); break; case GpxGeometryType.Track: this.Tracks.Add((GpxTrack)geometry); break; } } }
public void Load_IGpxReader_ThrowsExceptionIfReaderIsNull() { IGpxReader reader = null; Assert.Throws <ArgumentNullException>(() => GpxDocument.Load(reader)); }