Example #1
0
        public bool IsPointInFence(ILocation point, IGeoFence fence)
        {
            var points = (from p in fence.Fence select new GeoFence.Point(p.Lat.Point, p.Lon.Point)).ToList();
            var f      = new GeoFence(points);
            var coord  = new Coordinate(point.Lat.Point, point.Lon.Point);

            return(f.IsPointInPolygon(coord));
        }
Example #2
0
 public Bus(string[] messages, int id, IGeoFence fence, int SequenceNr, string IconUrl, PredictionManager predictionManager = null)
 {
     _predictionManager = predictionManager;
     _geoFence          = fence;
     _messages          = messages;
     Id             = id;
     SequenceNumber = SequenceNr;
     this.IconUrl   = IconUrl;
 }
Example #3
0
        public BusManager(ILocationGetter locationGetter, IOptions <AppConfiguration> config, IGeoFence geoFence)
        {
            _predictionManager = new PredictionManager();
            _config            = config.Value;
            _locationGetter    = locationGetter;
            Busses             = new List <Bus>();
            int seqCounter = 1;

            foreach (var id in _config.BusIds)
            {
                Busses.Add(new Bus(_config.BusStatusMsgs, id, geoFence, seqCounter++, _config.BusIcons[seqCounter - 2], _predictionManager));
            }

            _timer = new Timer(UpdateBusses, null, 1000, _config.UpdateIntervalMs);
        }