Exemple #1
0
        private void btnCenterTracks_Click(object sender, EventArgs e)
        {
            GMapOverlay tracksPolygonsOverlay = TracksOptimiser.FindOverlay(Constants.TracksPolygonsId, gMap);

            if (tracksPolygonsOverlay != null && tracksPolygonsOverlay.Routes.Count > 0)
            {
                gMap.ZoomAndCenterRoutes(tracksPolygonsOverlay.Id);
            }
        }
Exemple #2
0
        private void LoadTrackToMap(int idx, bool zoomTrack)
        {
            if (Tracks == null || idx >= Tracks.Count)
            {
                return;
            }

            lblTracksPosition.Text = (idx + 1) + " of " + Tracks.Count;

            TracksOptimiser tracksOptimiser = new TracksOptimiser();

            tracksOptimiser.Run(gMapTracksBrowser, new List <Track>()
            {
                this.Tracks[idx]
            }, TracksOptimiserOptions);

            if (tracksOptimiser != null)
            {
                lblMapPoints.Text = tracksOptimiser.Info;
            }

            GMapOverlay tracksPolygonsOverlay = TracksOptimiser.FindOverlay(Constants.TracksPolygonsId, gMapTracksBrowser);

            if (tracksPolygonsOverlay != null && tracksPolygonsOverlay.Routes.Count > 0)
            {
                Track         track = this.Tracks[idx];
                StringBuilder text  = new StringBuilder();
                text.AppendLine("Distance: " + (track.GetLength().SiValue / 1000).ToString("F2") + "km");

                TimeSpan TotalTime = track.GetDuration();
                text.Append("Time: ");
                if (TotalTime.Days > 0)
                {
                    text.Append(TotalTime.Days + "d ");
                }
                if (TotalTime.Hours > 0)
                {
                    text.Append(TotalTime.Hours + "h ");
                }
                if (TotalTime.Minutes > 0)
                {
                    text.Append(TotalTime.Minutes + "m ");
                }
                text.AppendLine();

                text.AppendLine("Avg. speed: " + track.GetAverageSpeed().ConvertTo(Geo.Measure.SpeedUnit.Kph).Value.ToString("F2") + "km/h");
                txtTracksBrowserInfo.Text = text.ToString();

                if (zoomTrack)
                {
                    gMapTracksBrowser.ZoomAndCenterRoutes(tracksPolygonsOverlay.Id);
                }
            }
        }
Exemple #3
0
        private TracksOptimiser UpdateTracksPlot()
        {
            if (Tracks == null)
            {
                return(null);
            }

            TracksOptimiser tracksOptimiser = new TracksOptimiser();

            tracksOptimiser.Run(this.gMap, this.Tracks, GetTrackOptions());

            return(tracksOptimiser);
        }
Exemple #4
0
        private void LoadTracksToMap()
        {
            if (Tracks == null)
            {
                return;
            }

            TracksOptimiser tracksOptimiser = UpdateTracksPlot();

            if (tracksOptimiser != null)
            {
                lblMapPoints.Text = tracksOptimiser.Info;
            }
        }
Exemple #5
0
        private void ExportForm_Load(object sender, EventArgs e)
        {
            gMapExport.Zoom = exportZoom;

            int ratio = Convert.ToInt32(Math.Pow(2, gMapExport.Zoom - gmap.Zoom));

            gMapExport.Size = new Size(gmap.Size.Width * ratio, gmap.Size.Height * ratio);

            TracksOptimiser tracksOptimiser = new TracksOptimiser();

            tracksOptimiser.ZoomRatio = Math.Round(exportZoom - gmap.Zoom, 1);
            tracksOptimiser.Run(gMapExport, this.Tracks, this.TracksOptimiserOptions);

            gMapExport.Position   = gmap.Position;
            gMapExport.ScaleMode  = ScaleModes.Integer;
            gMapExport.ShowCenter = false;

            gMapExport.MapProvider = gmap.MapProvider;

            gMapExport.ReloadMap();
            gMapExport.Refresh();

            StartPrefetch();
        }