public static GPSBounds getGPSBounds(IList <SplitGPSLocation> list) { IList <IGPSPoint> r = new List <IGPSPoint>(); foreach (SplitGPSLocation s in list) { r.Add(s); } return(GPSBounds.FromGPSPoints(r)); }
public void DoZoom(IGPSBounds area) { if (area != null) { double zoom = this.MapControl.Zoom; //An area slightly larger than requested, to avoid zoom to often float latOffset = area.LatitudeDegrees * 0.05F; float lonOffset = area.LongitudeDegrees * 0.05F; IGPSBounds area2 = new GPSBounds(new GPSLocation(area.NorthLatitudeDegrees + latOffset, area.WestLongitudeDegrees - lonOffset), new GPSLocation(area.SouthLatitudeDegrees - latOffset, area.EastLongitudeDegrees + lonOffset)); double newZoom = this.MapControl.ComputeZoomToFit(area2); //Avoid constantly calling SetLocation, slows down if (!this.MapControl.MapBounds.Contains(area) || Math.Abs(zoom - newZoom) > 2) { this.MapControl.SetLocation(area.Center, newZoom); } } }
public static IGPSBounds GpsBoundsCache(IActivity activity) { if (!activityGpss.ContainsKey(activity)) { if (!activityPropLists.Contains(activity)) { //activityGps controls if the property listener is added activity.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(Activity_PropertyChanged); activityPropLists.Add(activity); } activityGpss.Add(activity, null); } if (activityGpss[activity] == null) { activityGpss[activity] = GPSBounds.FromGPSRoute(activity.GPSRoute); } return(activityGpss[activity]); }
public static IGPSBounds GetBounds(IList <IList <IGPSPoint> > trks) { GPSBounds area = null; foreach (IList <IGPSPoint> trk in trks) { GPSBounds area2 = GPSBounds.FromGPSPoints(trk); if (area2 != null) { if (area == null) { area = area2; } else { area = (GPSBounds)area.Union(area2); } } } return(area); }
public static IGPSBounds getGPSBounds(IDictionary <string, MapPolyline> polylines) { IGPSBounds area = null; foreach (MapPolyline m in polylines.Values) { GPSBounds area2 = GPSBounds.FromGPSPoints(m.Locations); if (area2 != null) { if (area == null) { area = area2; } else { area = (GPSBounds)area.Union(area2); } } } return(area); }
private bool IsInBounds(IGPSBounds activityBounds) { if (null == activityBounds || this.TrailLocations.Count == 0) { return(false); } if (this.GpsBounds == null) { return(false); } //Have to adjust as ST will not consider i.e. 11,9453<11,92103<11,92104 IGPSBounds a2 = activityBounds; if (this.GpsBounds.NorthLatitudeDegrees == this.GpsBounds.SouthLatitudeDegrees || this.GpsBounds.WestLongitudeDegrees == this.GpsBounds.EastLongitudeDegrees) { a2 = new GPSBounds( new GPSLocation(activityBounds.NorthLatitudeDegrees + 0.01F, activityBounds.WestLongitudeDegrees - 0.01F), new GPSLocation(activityBounds.SouthLatitudeDegrees - 0.01F, activityBounds.EastLongitudeDegrees + 0.01F)); } return(a2.Contains(this.GpsBounds)); }