private UpdateScaledDistanceFilterResult UpdateScaledDistanceFilter(double?currentAvgSpeed, Geocoordinate geocoordinate) { var result = new UpdateScaledDistanceFilterResult(_scaledDistanceFilter.HasValue ? _scaledDistanceFilter.Value : 0); var lastPosition = _positionPath.GetLastPosition(); result.Distance = lastPosition.DinstanceToPrevious; if (!lastPosition.Speed.HasValue || !currentAvgSpeed.HasValue) { _scaledDistanceFilter = _distanceFilter; return(result); } if (lastPosition.DinstanceToPrevious.HasValue && (lastPosition.DinstanceToPrevious.Value < _distanceFilter || lastPosition.DinstanceToPrevious.Value < _stationaryRadius)) { // too little movement, start Stationary and/or skip this position update if (lastPosition.DinstanceToPrevious.Value < _stationaryRadius) { _stationaryManager.StartStationary(lastPosition, geocoordinate); result.StartStationary = true; } result.SkipPositionBecauseOfDistance = true; return(result); } result.NewScaledDistanceFilter = CalculateNewScaledDistanceFilter(currentAvgSpeed.Value); _scaledDistanceFilter = result.NewScaledDistanceFilter; return(result); }
private PostionUpdateDebugData(PositionChangedEventArgs positionChangesEventArgs, double? currentAvgSpeed, UpdateScaledDistanceFilterResult updateScaledDistanceFilter, uint reportInterval, bool exitedFromStationary) { PositionUpdateType = exitedFromStationary ? PositionUpdateType.ExitStationary : PositionUpdateType.NewPosition; _currentAvgSpeed = currentAvgSpeed; _accuracy = positionChangesEventArgs.Position.Coordinate.Accuracy; _reportInterval = reportInterval; _scaledDistanceFilterChanged = updateScaledDistanceFilter.ScaledDistanceFilterChanged; _initialScaledDistanceFilter = updateScaledDistanceFilter.InitialScaledDistanceFilter; _newScaledDistanceFilter = updateScaledDistanceFilter.NewScaledDistanceFilter; }
private UpdateScaledDistanceFilterResult UpdateScaledDistanceFilter(double? currentAvgSpeed, Geocoordinate geocoordinate) { var result = new UpdateScaledDistanceFilterResult(_scaledDistanceFilter.HasValue ? _scaledDistanceFilter.Value : 0); var lastPosition = _positionPath.GetLastPosition(); result.Distance = lastPosition.DinstanceToPrevious; if (!lastPosition.Speed.HasValue || !currentAvgSpeed.HasValue) { _scaledDistanceFilter = _distanceFilter; return result; } if (lastPosition.DinstanceToPrevious.HasValue && (lastPosition.DinstanceToPrevious.Value < _distanceFilter || lastPosition.DinstanceToPrevious.Value < _stationaryRadius)) { // too little movement, start Stationary and/or skip this position update if (lastPosition.DinstanceToPrevious.Value < _stationaryRadius) { _stationaryManager.StartStationary(lastPosition, geocoordinate); result.StartStationary = true; } result.SkipPositionBecauseOfDistance = true; return result; } result.NewScaledDistanceFilter = CalculateNewScaledDistanceFilter(currentAvgSpeed.Value); _scaledDistanceFilter = result.NewScaledDistanceFilter; return result; }
private PostionUpdateDebugData(PositionChangedEventArgs positionChangesEventArgs, double?currentAvgSpeed, UpdateScaledDistanceFilterResult updateScaledDistanceFilter, uint reportInterval, bool exitedFromStationary) { PositionUpdateType = exitedFromStationary ? PositionUpdateType.ExitStationary : PositionUpdateType.NewPosition; _currentAvgSpeed = currentAvgSpeed; _accuracy = positionChangesEventArgs.Position.Coordinate.Accuracy; _reportInterval = reportInterval; _scaledDistanceFilterChanged = updateScaledDistanceFilter.ScaledDistanceFilterChanged; _initialScaledDistanceFilter = updateScaledDistanceFilter.InitialScaledDistanceFilter; _newScaledDistanceFilter = updateScaledDistanceFilter.NewScaledDistanceFilter; }
public static PostionUpdateDebugData ForNewPosition(PositionChangedEventArgs positionChangesEventArgs, double?currentAvgSpeed, UpdateScaledDistanceFilterResult updateScaledDistanceFilter, uint reportInterval, bool exitedFromStationary) { return(new PostionUpdateDebugData(positionChangesEventArgs, currentAvgSpeed, updateScaledDistanceFilter, reportInterval, exitedFromStationary)); }
public static PostionUpdateDebugData ForNewPosition(PositionChangedEventArgs positionChangesEventArgs, double? currentAvgSpeed, UpdateScaledDistanceFilterResult updateScaledDistanceFilter, uint reportInterval,bool exitedFromStationary) { return new PostionUpdateDebugData(positionChangesEventArgs, currentAvgSpeed, updateScaledDistanceFilter, reportInterval, exitedFromStationary); }