Ejemplo n.º 1
0
        public async Task EntireRouteSegmentCalculation()
        {
            GpxFileParser gpxFileParse = new GpxFileParser();

            CoordinatePointsList = await gpxFileParse.GetGpxCoordinateData();

            int    i                = 0;
            int    j                = 1;
            double totalDistance    = 0;
            Task   routeSegmentTask = new Task(() =>
            {
                while (j < CoordinatePointsList.Count())
                {
                    Waypoint p1 = new Waypoint();
                    Waypoint p2 = new Waypoint();

                    RouteSegmentVector routevector = new RouteSegmentVector();

                    p1             = CoordinatePointsList[i];
                    p2             = CoordinatePointsList[j];
                    routevector    = SegmentCalculations(p1, p2);
                    totalDistance += routevector.Gcd;
                    routevector.AccumulativeGcd = totalDistance;
                    routevector.Elevation       = routevector.Point1.Elevation;
                    routevector.Index           = i;

                    RouteSegmentVectors.Add(routevector);
                    ++i;
                    ++j;
                }
            });

            routeSegmentTask.GetAwaiter();
        }
Ejemplo n.º 2
0
 public RouteModel()
 {
     CoordinatePoint      = new Waypoint();
     CoordinatePointsList = new List <Waypoint>();
     PostionSegment       = new RouteSegmentVector();
     RouteSegmentVectors  = new List <RouteSegmentVector>();
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Calculates the segment characteristics namely GCD, Slope and Azimuth
        /// </summary>
        /// <param name="point1"></param>
        /// <param name="point2"></param>
        /// <returns>RouteSegment</returns>
        private RouteSegmentVector SegmentCalculations(Waypoint point1, Waypoint point2)
        {
            RouteSegmentVector routeSegment = new RouteSegmentVector();

            routeSegment.Point1    = new Waypoint();
            routeSegment.Point2    = new Waypoint();
            routeSegment.Gcd       = SegmentGcd(point1, point2);
            routeSegment.Elevation = point1.Elevation;
            routeSegment.Slope     = SegmentSlope(point1, point2);
            routeSegment.Azimuth   = SegmentAzimuth(point1, point2);
            routeSegment.Point1    = point1;
            routeSegment.Point2    = point2;

            return(routeSegment);
        }