Ejemplo n.º 1
0
        public FuzzyLocationFeed(GeoCoordinate currentLocation, IMoveStrategy moveStrategy, int movementThreshold)
        {
            _observable = moveStrategy.Scan(
                Tuple.Create(currentLocation, currentLocation), (acc, cur) =>
            {
                double distance = acc.Item1.GetDistanceTo(cur);
                if (distance >= movementThreshold)
                {
                    return(Tuple.Create(cur, cur));
                }

                return(Tuple.Create(acc.Item1, cur));
            }).Where(pair => pair.Item1 == pair.Item2).Select(pair => pair.Item1);
        }