public LapTelemetryInfo(DriverInfo driverInfo, SimulatorDataSet dataSet, LapInfo lapInfo, TimeSpan snapshotInterval, SimulatorSourceInfo simulatorSourceInfo) { LapStarSnapshot = new TelemetrySnapshot(driverInfo, dataSet.SessionInfo.WeatherInfo, dataSet.InputInfo, simulatorSourceInfo); LapInfo = lapInfo; PortionTimes = new LapPortionTimes(10, dataSet.SessionInfo.TrackInfo.LayoutLength.InMeters, lapInfo); TimedTelemetrySnapshots = new TimedTelemetrySnapshots(snapshotInterval); }
public void UpdateTelemetry(SimulatorDataSet dataSet) { if (IsPurged) { throw new InvalidOperationException("Cannot update Telemetry on a purged TelemetryInfo"); } PortionTimes.UpdateLapPortions(); if (!dataSet.PlayerInfo.InPits) { TimedTelemetrySnapshots.AddNextSnapshot(LapInfo.CurrentlyValidProgressTime, dataSet.PlayerInfo, dataSet.SessionInfo.WeatherInfo, dataSet.InputInfo, dataSet.SimulatorSourceInfo); } }
private List <TimedTelemetrySnapshot> Filter(TimedTelemetrySnapshots timedTelemetrySnapshots) { List <TimedTelemetrySnapshot> filteredSnapshots = new List <TimedTelemetrySnapshot>(); TimeSpan nextSnapShot = TimeSpan.Zero;; foreach (TimedTelemetrySnapshot snapshot in timedTelemetrySnapshots.Snapshots) { if (snapshot.LapTime < nextSnapShot) { continue; } filteredSnapshots.Add(snapshot); nextSnapShot += MapsPointsInterval; } return(filteredSnapshots); }
public TrackGeometryDto BuildTrackGeometryDto(TimedTelemetrySnapshots timedTelemetrySnapshots) { List <TimedTelemetrySnapshot> filteredPoints = Filter(timedTelemetrySnapshots); TrackGeometryDto trackGeometryDto = new TrackGeometryDto { ExporterVersion = ExporterVersion, FullMapGeometry = GetGeometry(filteredPoints, true), Sector1Geometry = GetSectorGeometry(filteredPoints, x => x.PlayerData.Timing.CurrentSector == 1), Sector2Geometry = GetSectorGeometry(filteredPoints, x => x.PlayerData.Timing.CurrentSector == 2), Sector3Geometry = GetSectorGeometry(filteredPoints, x => x.PlayerData.Timing.CurrentSector == 3), StartLineGeometry = ExtractFinishLine(filteredPoints), LeftOffset = filteredPoints.Min(x => x.PlayerData.WorldPosition.X.InMeters) - TrackBounds, TopOffset = filteredPoints.Min(x => x.PlayerData.WorldPosition.Z.InMeters) - TrackBounds, }; trackGeometryDto.Width = filteredPoints.Max(x => x.PlayerData.WorldPosition.X.InMeters) + TrackBounds - trackGeometryDto.LeftOffset; trackGeometryDto.Height = filteredPoints.Max(x => x.PlayerData.WorldPosition.Z.InMeters) + TrackBounds - trackGeometryDto.TopOffset; return(trackGeometryDto); }
public void Complete(Distance lapDistance) { TimedTelemetrySnapshots.TrimInvalid(lapDistance); }