コード例 #1
0
 public override bool ShouldCull(Position position, Distance distance)
 {
     if (Bounds == null)
     {
         return(true);
     }
     return(MapLocationSystem.CalculateDistance(position, Bounds.Center) <= distance);
 }
コード例 #2
0
        public override bool ShouldCull(Position position, Distance distance)
        {
            if (Positions == null || Positions.Count == 0)
            {
                return(true);
            }

            return(Positions.All(x =>
                                 MapLocationSystem.CalculateDistance(position, x) > distance));
        }
コード例 #3
0
        internal override Position?GetRelativePosition(Position reference)
        {
            if (Positions == null || Positions.Count == 0)
            {
                return(null);
            }

            return(Positions
                   .OrderBy(x => MapLocationSystem.CalculateDistance(reference, x))
                   .First());
        }
コード例 #4
0
 internal override Position?GetRelativePosition(Position reference)
 {
     return(new Position[]
     {
         Bounds.NorthEast,
         Bounds.NorthWest,
         Bounds.SouthEast,
         Bounds.SouthWest,
         Bounds.Center
     }
            .OrderBy(x => MapLocationSystem.CalculateDistance(reference, x))
            .First());
 }
        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);
        }