예제 #1
0
    void GetMove(GpxTools.Gpx.GpxTrack track)
    {
        // Type
        ActivityType type = ActivityType.car;

        Enum.TryParse(track.Type, out type);

        // Track points
        List <XmlTimeline.Coordinates> coords = new List <XmlTimeline.Coordinates>();

        GpxTools.Gpx.GpxPointCollection <GpxTools.Gpx.GpxPoint> points = new GpxTools.Gpx.GpxPointCollection <GpxTools.Gpx.GpxPoint>();

        points = track.ToGpxPoints();
        foreach (var item in points)
        {
            coords.Add(new XmlTimeline.Coordinates(item.Latitude, item.Longitude, item.Elevation, item.Time));
        }

        if (coords.Count >= 2)
        {
            if (timelineItems.Count > 0 &&
                timelineItems[timelineItems.Count - 1].type == XmlTimeline.TimelineItemType.activity &&
                timelineItems[timelineItems.Count - 1].activity.activity == type)
            {
                timelineItems[timelineItems.Count - 1].activity.MargeWithNew(coords.ToArray());
            }
            else
            {
                XmlTimeline.Activity newActivity = new XmlTimeline.Activity(type, coords.ToArray());
                AddTimeToPreviousPlace(newActivity);
                timelineItems.Add(new XmlTimeline.TimelineItem(newActivity));
                AddTimeToPreviousPlace(newActivity);
            }
        }
    }
예제 #2
0
        public GpxPointCollection <GpxPoint> ToGpxPoints()
        {
            GpxPointCollection <GpxPoint> points = new GpxPointCollection <GpxPoint>();

            foreach (T gpxPoint in Points_)
            {
                GpxPoint point = new GpxPoint
                {
                    Longitude = gpxPoint.Longitude,
                    Latitude  = gpxPoint.Latitude,
                    Elevation = gpxPoint.Elevation,
                    Time      = gpxPoint.Time
                };

                points.Add(point);
            }

            return(points);
        }