public override bool ShouldCull(MapRegion region)
        {
            if (Positions == null || Positions.Count == 0)
            {
                return(true);
            }

            return(Positions.All(x => !region.Contains(x)));
        }
Beispiel #2
0
 public static bool Contains(
     this MapRegion region,
     Position position)
 {
     if (region == null)
     {
         return(false);
     }
     return(region.ToBounds().Contains(position));
 }
Beispiel #3
0
        public static bool Contains(
            this MapRegion region,
            Bounds bounds)
        {
            if (region == null || bounds == null)
            {
                return(false);
            }

            return(region.ToBounds().Intersects(bounds));
        }
        public override void UpdateMapRegion(MapRegion region)
        {
            base.UpdateMapRegion(region);
            Region = region;

            if (region == null)
            {
                return;
            }

            if (!IsVisible)
            {
                return;
            }


            Center = region.GetCenter();

            if (lastCullCenter.HasValue && CullUpdateThreshold.Meters > 0 &&
                MapLocationSystem.CalculateDistance(Center, lastCullCenter.Value) < CullUpdateThreshold)
            {
                return;
            }

            if (MaxRunningTasks.HasValue && activeTasksCount >= MaxRunningTasks)
            {
                Push();
                return;
            }

            if (lastQueryCenter.HasValue && QueryThreshold.Meters > 0 &&
                MapLocationSystem.CalculateDistance(Center, lastQueryCenter.Value) < QueryThreshold)
            {
                Push();
                return;
            }

            lastQueryCenter = Center;
            Task.Run(DoAsync);
        }
Beispiel #5
0
        public static Bounds ToBounds(this MapRegion region)
        {
            var points = new[]
            {
                region.NearLeft,
                region.NearRight,
                region.FarLeft,
                region.FarRight
            };

            var min = (
                lat : points.Min(x => x.Latitude),
                lng : points.Min(x => x.Longitude));

            var max = (
                lat : points.Max(x => x.Latitude),
                lng : points.Max(x => x.Longitude));

            return(new Bounds(
                       new Position(min.lat, min.lng),
                       new Position(max.lat, max.lng)));
        }
Beispiel #6
0
 public override bool ShouldCull(MapRegion region)
 {
     return(!region.Contains(Bounds));
 }