Esempio n. 1
0
        // Fills the Points list box with the track points
        // from the selected track and computes totals for the track.
        public void DisplayPoints(GPXAnalyzer frm, int whichTrack)
        {
            if (whichTrack < 0) return;
            trkType track = gpxInfo.trk[whichTrack];
            if (track == null) return;
            trksegType seg = track.trkseg[0];
            wptType wpt;
            wptType wptPrev = null;

            SetupTrackData( whichTrack );
            frm.SetPointsText(string.Format("{0} Points", seg.trkpt.Length));

            for (int iPoint = 0; iPoint < seg.trkpt.Length; iPoint++)
            {
                wpt = seg.trkpt[iPoint];
                string spt;

                if (wpt.name != null && !(wpt.name == string.Empty))
                {
                    spt = string.Format("{0,-5} {1}", iPoint + 1, wpt.name);
                }
                else
                {
                    spt = string.Format("{0,-5} {1}", iPoint + 1,
                      GPXUtils.LatLonToString((double)wpt.lat, (double)wpt.lon));
                }

                frm.AddPointsName(spt);
                wptPrev = wpt;
            }
        }