コード例 #1
0
 public TrackPointGpx(GeographicLocation gc, Elevation ele, TimeMeasure t, bool gcValid = true, bool eleValid = true)
 {
     _geoCoord       = gc;
     _elevation      = ele;
     _time           = t;
     _geoCoordValid  = gcValid;
     _elevationValid = eleValid;
 }
コード例 #2
0
        public TrackPointGpx ReadTrackPointGpx()
        {
            // Start by reading in the Track Point line (which will have the Lat and Lon on it)
            string currentString = _gpxLines.ElementAt <string>(_lineNumber);

            int startLat  = currentString.IndexOf("lat=") + 5;
            int startLong = currentString.IndexOf("lon=") + 5;;

            string latStr  = "";
            string longStr = "";

            int idx = startLat;

            while (currentString[idx] != '"')
            {
                latStr += currentString[idx]; ++idx;
            }

            idx = startLong;
            while (currentString[idx] != '"')
            {
                longStr += currentString[idx]; ++idx;
            }

            double             latitude  = Convert.ToDouble(latStr);
            double             longitude = Convert.ToDouble(longStr);
            GeographicLocation geo       = new GeographicLocation(latitude, longitude);

            // Now move forward and do the Elevation and Time lines
            // For now, will not worry about allowing the order to come in differently
            // Both Suunto and Garmin seem to send the data in this order
            // NOTE: Strava premium GPX downoads do not include time stamps!!
            ++_lineNumber;
            Elevation ele = ReadElevation();

            ++LineNumber;

            TimeMeasure tm        = new TimeMeasure();
            string      nextToken = IdentifyToken();

            if (nextToken == "time")
            {
                tm = ReadTimeMeasure();
                ++LineNumber;
            }

            // have read in the data we want
            // DCL To Do: Do I want to get the distance extension for the Suunto watches?
            nextToken = "";
            do
            {
                nextToken = IdentifyToken();
                ++_lineNumber;
            } while (nextToken != "/trkpt");


            return(new TrackPointGpx(geo, ele, tm));
        }