コード例 #1
0
        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));
        }
コード例 #2
0
ファイル: GpxIOFactory.cs プロジェクト: TestKarle/Gpx
        public static IDisposable CreateReader(MemoryStream stream, out IGpxReader reader)
        {
            var result = new GpxReader(stream);

            reader = result;
            return(result);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
ファイル: GpxIOFactory.cs プロジェクト: macias/Gpx
        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));
        }
コード例 #5
0
ファイル: GpxIOFactory.cs プロジェクト: macias/Gpx
        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);
        }
コード例 #6
0
        /// <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);
        }
コード例 #7
0
        /// <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;
                }
            }
        }
コード例 #8
0
ファイル: GpxIOFactory.cs プロジェクト: macias/Gpx
 public static IDisposable CreateReader(string filepath, out IGpxReader reader, out IStreamProgress streamProgress)
 {
     return(CreateReader <GpxTrackPoint>(filepath, trackPointReader: null, reader: out reader, streamProgress: out streamProgress));
 }
コード例 #9
0
ファイル: GpxIOFactory.cs プロジェクト: macias/Gpx
 public static IDisposable CreateReader(MemoryStream stream, out IGpxReader reader, out IStreamProgress streamProgress)
 {
     return(CreateReader <GpxTrackPoint>(stream, trackPointReader: null, reader: out reader, streamProgress: out streamProgress));
 }
コード例 #10
0
 public GpxToKmlConverter(ICommandLineParserService commandLineParserService, IGpxReader gpxReader, IKmlWriter kmlWriter)
 {
     CommandLineParserService = commandLineParserService;
     GpxReader = gpxReader;
     KmlWriter = kmlWriter;
 }
コード例 #11
0
ファイル: GpxDocument.cs プロジェクト: najira/spatiallite-net
        /// <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;
        }
コード例 #12
0
ファイル: GpxDocument.cs プロジェクト: najira/spatiallite-net
 /// <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;
         }
     }
 }
コード例 #13
0
        public void Load_IGpxReader_ThrowsExceptionIfReaderIsNull()
        {
            IGpxReader reader = null;

            Assert.Throws <ArgumentNullException>(() => GpxDocument.Load(reader));
        }