Esempio n. 1
0
        public PointF[] GenerateElevationGraphic(GPXAnalyzer frm, int Trackidx, int width, int height, int borderWidth)
        {
            trkType track = gpxInfo.trk[Trackidx];
            trksegType seg = track.trkseg[0];
            wptType wpt;
            wptType wptPrev = seg.trkpt[0];
            double runningDist = 0;
            PointF[] Points = new PointF[seg.trkpt.Length];

            SetupTrackData(Trackidx);
            // Compute scale factor
            // Determine elevation difference.
            double dele = maxEle - minEle;
            double xScale = (width - 2 * borderWidth) / totalDist;
            double yScale = (height - 2 * borderWidth) / dele;

            // Calculate graphics code
            for (int iPoint = 0; iPoint < seg.trkpt.Length; iPoint++)
            {
                wpt = seg.trkpt[iPoint];
                runningDist += distances[iPoint];    //stored geo calc
                PointF pt = frm.DistEleToScreen(runningDist, (double)wpt.ele, minEle, xScale, yScale);
                Points[iPoint] = pt;
                wptPrev = wpt;
            }
            // Draw the lines between the points
            return Points;
        }