Esempio n. 1
0
        /// <summary>
        /// Parses .GPX file content and transposes it using provided calibration parameters.
        /// </summary>
        /// <param name="p">Calibration parameters used for transposing the points.</param>
        /// <param name="gpxFileContent">The string content of a .GPX file.</param>
        /// <returns>List of point objects as a JSON string.</returns>
        public static string TransposeToJSON(TransposerParams p, string gpxFileContent)
        {
            GpsPoints = Deserializer.ToGpsList(gpxFileContent);
            Transpose(p, GpsPoints);

            return(JSON.Serialize <List <ImgPoint> >(_imgPoints));
        }
        /// <summary>
        /// Parses .GPX file content and transposes it using provided calibration parameters.
        /// </summary>
        /// <param name="p">Calibration parameters used for transposing the points.</param>
        /// <param name="gpxFileContent">The string content of a .GPX file.</param>
        /// <returns>List of point objects as a JSON string.</returns>
        public static string TransposeToJSON(TransposerParams p, string gpxFileContent)
        {
            GpsPoints = Deserializer.ToGpsList(gpxFileContent);
            Transpose(p, GpsPoints);

            return JSON.Serialize<List<ImgPoint>>(_imgPoints);
        }
Esempio n. 3
0
        private static List <ImgPoint> Transpose(TransposerParams p, List <GpsPoint> pts)
        {
            _params = p;

            if (pts.Count > 0)
            {
                _maxLng = pts.Min(pl => pl.Lon);
                _maxLat = pts.Max(pl => pl.Lat);

                CalculateFactorAndOffset();
                PointDistanceOptimization();
            }

            return(_imgPoints);
        }
        public void TestTranspose()
        {
            var p = new TransposerParams(
                new ImgPoint(219, 686, null),
                new ImgPoint(1167, 64, null),
                new GpsPoint(2.42463, 39.577310000000004, null),
                new GpsPoint(3.07493, 39.90439000000001, null),
                1000);

            string filePath = Environment.CurrentDirectory + "\\GpxData.txt";
            StreamReader streamReader = new StreamReader(filePath);
            string gpxContent = streamReader.ReadToEnd();
            streamReader.Close();

            var transposed = GPSTransposer.TransposeToJSON(p, gpxContent);

            Assert.IsNotNull(transposed);
        }
Esempio n. 5
0
        private static double _offsetY;         // Offset for correct positioning of the starting point of the route (Y)
        //

        #endregion

        #region Factory methods

        /// <summary>
        /// Parses .GPX file content and transposes it using provided calibration parameters.
        /// </summary>
        /// <param name="p">Calibration parameters used for transposing the points.</param>
        /// <param name="gpxFileContent">The string content of a .GPX file.</param>
        /// <returns>List of point objects.</returns>
        public static List <ImgPoint> TransposeToList(TransposerParams p, string gpxFileContent)
        {
            GpsPoints = Deserializer.ToGpsList(gpxFileContent);
            return(Transpose(p, GpsPoints));
        }
 /// <summary>
 /// Parses .GPX file content and transposes it using provided calibration parameters.
 /// </summary>
 /// <param name="p">Calibration parameters used for transposing the points.</param>
 /// <param name="gpxFileContent">The string content of a .GPX file.</param>
 /// <returns>List of point objects.</returns>
 public static List<ImgPoint> TransposeToList(TransposerParams p, string gpxFileContent)
 {
     GpsPoints = Deserializer.ToGpsList(gpxFileContent);
     return Transpose(p, GpsPoints);
 }
        private static List<ImgPoint> Transpose(TransposerParams p, List<GpsPoint> pts)
        {
            _params = p;

            if (pts.Count > 0)
            {
                _maxLng = pts.Min(pl => pl.Lon);
                _maxLat = pts.Max(pl => pl.Lat);

                CalculateFactorAndOffset();
                PointDistanceOptimization();
            }

            return _imgPoints;
        }