예제 #1
0
        private Distance CalculateTrackLength()
        {
            Position pos           = GeoFramework.Position.Empty;
            Distance totalDistance = new GeoFramework.Distance();

            for (int i = 0; i < _trackSegments.Count; i++)
            {
                for (int j = 0; j < _trackSegments[i].SegmentWaypoints.Count; j++)
                {
                    Position  current = GeoFramework.Position.Empty;
                    Latitude  lat     = new GeoFramework.Latitude((double)_trackSegments[i].SegmentWaypoints[j].Latitude);
                    Longitude lon     = new GeoFramework.Longitude((double)_trackSegments[i].SegmentWaypoints[j].Longitude);

                    if (pos == GeoFramework.Position.Empty)
                    {
                        pos = new GeoFramework.Position(lon, lat);
                    }
                    else
                    {
                        current = new GeoFramework.Position(lon, lat);
                        Distance distance = current.DistanceTo(pos);
                        totalDistance += distance;
                        pos            = current;
                    }
                }
            }
            return(totalDistance);
        }
예제 #2
0
        private Distance CalculateTrackLength()
        {
            Position pos = GeoFramework.Position.Empty;
            Distance totalDistance = new GeoFramework.Distance();

            for (int i = 0; i < _trackSegments.Count; i++)
            {
                for (int j = 0; j < _trackSegments[i].SegmentWaypoints.Count; j++)
                {
                    Position current = GeoFramework.Position.Empty;
                    Latitude lat = new GeoFramework.Latitude((double)_trackSegments[i].SegmentWaypoints[j].Latitude);
                    Longitude lon = new GeoFramework.Longitude((double)_trackSegments[i].SegmentWaypoints[j].Longitude);

                    if (pos == GeoFramework.Position.Empty)
                    {
                        pos = new GeoFramework.Position(lon, lat);
                    }
                    else
                    {
                        current = new GeoFramework.Position(lon, lat);
                        Distance distance = current.DistanceTo(pos);
                        totalDistance += distance;
                        pos = current;
                    }
                }
            }
            return totalDistance;
        }