コード例 #1
0
ファイル: GPSData.cs プロジェクト: damy90/uvarovite
 /// <summary>
 /// Returns the distance traveled until the current time in meters.
 /// </summary>
 /// <param name="time">Time in seconds</param>
 /// <returns>Distance in meters</returns>
 public double GetDistance(float time)
 {
     int index = this.GetTrackPointIndex(time);
     double distance = this.gpsPoints[index].Distance;
     GPSCoord lastPosition = this.GetPosition(time);
     GPSPoint interpolatedPos = new GPSPoint(lastPosition.Longitude, lastPosition.Latitude, lastPosition.Elevation, 0, 0);
     return distance += interpolatedPos.DistanceFromPoint(this.gpsPoints[index]);
 }
コード例 #2
0
ファイル: WidgetMap.cs プロジェクト: damy90/uvarovite
        private int UnscaledMapImageHeight(double routeHeightLat, int zoomLevel)
        {
            //m/px
            double[] zoomScales =
            {
                    21282,
                    16355,
                    10064,
                    5540,
                    2909,
                    1485,
                    752,
                    378,
                    190,
                    95,
                    48,
                    24,
                    12,
                    6,
                    3,
                    1.48,
                    0.74,
                    0.37,
                    0.19
            };
            var origin = new GPSPoint(0, 0, 0, 0);
            var height = new GPSPoint(0, routeHeightLat, 0, 0);
            double distance = origin.DistanceFromPoint(height);
            double scale = zoomScales[zoomLevel - 1];
            var result = (int)Math.Round(distance / scale);

            //TODO: real fix, remove this hack.
            var quickDemoHack = new Dictionary<int, int>();
            quickDemoHack.Add(12, 10);
            quickDemoHack.Add(13, 29);
            quickDemoHack.Add(14, 75);

            return result;// - quickDemoHack[zoomLevel];
        }