public IEnumerable <ENodebView> GetByTownArea(string city, string district, string town) { var list = new List <ENodebView>(); var townItem = _townRepository.GetAllList() .FirstOrDefault(x => x.CityName == city && x.DistrictName == district && x.TownName == town); if (townItem == null) { return(list); } var boudary = _boundaryRepository.FirstOrDefault(x => x.TownId == townItem.Id); if (boudary == null) { return(list); } foreach (var townEntity in _townRepository.GetAllList(x => x.CityName == city && x.DistrictName == district && x.TownName != town)) { var views = _eNodebRepository.GetAllList(x => x.TownId == townEntity.Id) .Where(x => boudary.IsInTownRange(x)) .MapTo <List <ENodebView> >(); views.ForEach(x => { x.CityName = city; x.DistrictName = district; x.TownName = townEntity.TownName; x.TownId = townItem.Id; }); list.AddRange(views); } return(list); }
protected void UpdateRoadRecords <TRecord>(List <int> townIds, int fileId, IEnumerable <TRecord> data, List <AreaTestInfo> results) where TRecord : IGeoPoint <double?>, ICoverage { foreach (var record in data) { if (record.Longtitute == null || record.Lattitute == null) { continue; } var point = new GeoPoint(record.Longtitute ?? 0, record.Lattitute ?? 0); foreach (var townId in townIds) { var coors = _boundaryRepository.FirstOrDefault(x => x.TownId == townId); if (coors == null) { continue; } if (!coors.IsInTownRange(point)) { continue; } UpdateCurrentTownId(results, townId, point, fileId, record.IsCoverage()); break; } } }
public IEnumerable <HighwayView> QueryAllHighwayViews() { var highways = _repository.GetAllList(x => x.HotspotType == HotspotType.Highway); return(highways.Select(info => { var highway = info.MapTo <HighwayView>(); var boundary = _boundaryRepository.FirstOrDefault(x => x.TownId == info.Id); if (boundary != null) { boundary.MapTo(highway); } highway.CoorList = boundary.CoorList(); return highway; })); }
private List<RoadRectangle> GenerateRoadRectangle(List<int> townIds) { return (from townId in townIds let coors = _boundaryRepository.FirstOrDefault(x => x.TownId == townId) where coors != null let west = coors.CoorList().Min(x => x.Longtitute) let east = coors.CoorList().Max(x => x.Longtitute) let south = coors.CoorList().Min(x => x.Lattitute) let north = coors.CoorList().Max(x => x.Lattitute) select new RoadRectangle { TownId = townId, West = west, East = east, South = south, North = north, Coors = coors }).ToList(); }
public IEnumerable <AreaBoundaryView> GetAreaBoundaryViews() { var areaDefs = _infrastructureRepository.GetAllList(x => x.HotspotType == HotspotType.AreaDef); return(areaDefs.Select(area => { var coor = _boundaryRepository.FirstOrDefault(x => x.TownId == area.Id); if (coor == null) { return null; } return new AreaBoundaryView { AreaName = area.HotspotName, AreaType = area.InfrastructureType.GetEnumDescription(), BoundaryGeoPoints = coor.CoorList() }; }).Where(x => x != null)); }