private Route TrackToRoute(Track track) { Route res = new Route("Исходный трек"); TrackItem[] items = track.TrackItems; for (int i = 0; i < items.Length; i++) { RoutePoint rp = new RoutePoint(items[i].Latitude, items[i].Longitude, items[i].Date, i + 1); res.AddPoint(rp); } return res; }
private Route ProccessedTrackToRoute(ProccessedTrack pTrack) { Route res = new Route(pTrack.MethodName); ProccessedTrackItem[] pItems = pTrack.ProccessedTrackItems; for (int i = 0; i < pItems.Length; i++) { RoutePoint rp = new RoutePoint(pItems[i].ProccessedLatitude, pItems[i].ProccessedLongitude, pItems[i].MeasureDate, i + 1); res.AddPoint(rp); } return res; }
private String CreateFragmentFromRoute(Route route) { StringBuilder sb = new StringBuilder(); StringBuilder markersSB = new StringBuilder(); sb.Append("L.polyline(["); for (int i = 0; i < route.Length-1; i ++) { RoutePoint rp = route.Points[i]; String popupHtml = route.NameOfRoute+": <b>" + rp.number.ToString() + "</b><br/>Широта: <b>" + rp.lat.ToString() + "</b><br/>Долгота: <b>" + rp.lon.ToString() + "</b><br/>Время: <b>" + rp.PointDate.ToString() + "</b>"; markersSB.AppendLine("L.marker([" + rp.lat.ToString().Replace(',', '.') + ", " + rp.lon.ToString().Replace(',', '.') + "],{icon:L.divIcon({html:'<div style=\"width:2px;height:2px;font-size:6pt\">" + rp.number.ToString() + "</div>'})}).bindPopup('" + popupHtml + "').addTo(map);"); sb.Append("[" + rp.lat.ToString().Replace(',', '.') + ", " + rp.lon.ToString().Replace(',', '.') + "], "); } String popupHtmlLast = "Исходный трек: <b>" + route.Points[route.Length - 1].number.ToString() + "</b><br/>Широта: <b>" + route.Points[route.Length - 1].lat.ToString() + "</b><br/>Долгота: <b>" + route.Points[route.Length - 1].lon.ToString() + "</b><br/>Время: <b>" + route.Points[route.Length - 1].PointDate.ToString() + "</b>"; markersSB.AppendLine("L.marker([" + route.Points[route.Length - 1].lat.ToString().Replace(',', '.') + ", " + route.Points[route.Length - 1].lon.ToString().Replace(',', '.') + "],{icon:L.divIcon({html:'<div style=\"width:2px;height:2px;font-size:6pt\">" + route.Points[route.Length - 1].number.ToString() + "</div>'})}).bindPopup('" + popupHtmlLast + "').addTo(map);"); sb.AppendLine("[" + route.Points[route.Length - 1].lat.ToString().Replace(',', '.') + ", " + route.Points[route.Length - 1].lon.ToString().Replace(',', '.') + "]],{color:'" + HexConverter(route.RS.ColPen) + "'}).addTo(map);"); sb.Append(markersSB.ToString()); return sb.ToString(); }
private void CalcGeoFrontiers(Route r) { if (r.latMax > latMax) latMax = r.latMax; if (r.latMin < latMin) latMin = r.latMin; if (r.lonMax > lonMax) lonMax = r.lonMax; if (r.lonMin < lonMin) lonMin = r.lonMin; }
public Route CreateAndRoute(Route SourceRoute, int ibeg, int ifin) { string NameOfSector = SourceRoute.NameOfRoute + "(" + (ibeg+1).ToString() + "-" + (ifin+1).ToString() + ")"; if(CheckRoute(NameOfSector)==false) return null; Route rm = new Route(NameOfSector); for(int i=ibeg; i<=ifin;i++) rm.AddPoint(SourceRoute[i]); AddRoute(rm); return rm; }
public void AddRoute(Route route) { Routes.Add(route); CalcGeoFrontiers(route); CalcDists(); }