public MapPoint UpdateUiPosition(double speedMPS, double seconds) { SingleRoute route = Route; if (route == null) { return(Graphic.Geometry as MapPoint); } double partDistPerc = speedMPS * seconds / route.Length; route.Progress += partDistPerc; if (route.Progress > 1.0) { Console.WriteLine("{0} finished route", this.ToString()); route.Progress = 1.0; State = MobileUnitState.FINISHED; } double sumDistDegrees = route.Progress * route.Length * GeoUtil.TEMP_METER_TO_DEGREE; MapPoint newPos = GeometryEngine.CreatePointAlong(route.Graphic.Geometry as Polyline, sumDistDegrees); Graphic.Geometry = newPos; return(newPos); }
private void setRouteInternal(SingleRoute newRoute) { if (newRoute != null) { route = newRoute; route.Graphic = new Graphic(); route.Graphic.Geometry = route.Geom.ToEsriPolyline(); State = MobileUnitState.EN_ROUTE; } else { if (route != null) { route.Delete(); route = null; } State = MobileUnitState.FREE; } }