예제 #1
0
 private void addRegionGroup()
 {
     foreach (CityGroup cg in citygroups)
     {
         foreach (Region r in regions)
         {
             if (MapTools.isPointInPolygon(cg.city.location, r.vertices))
             {
                 //add the region group name to city
                 cg.city.regionName = r.name;
                 break;
             }
         }
     }
 }
예제 #2
0
 private void groupStationsByRegion()
 {
     foreach (Result res in stationResults)
     {
         bool inside = false;
         foreach (Region r in regions)
         {
             if (MapTools.isPointInPolygon(res.location, r.vertices))
             {
                 inside = true;
                 var group = stationsByRegion.Find(x => x.name == r.name);
                 group.stations.Add(res);
                 break;
             }
         }
         //for the ones that fall outside
         if (!inside)
         {
             var groupOut = stationsByRegion.Find(x => x.name == "outside");
             groupOut.stations.Add(res);
         }
     }
 }
예제 #3
0
        public StationReader()
        {
            getStationList();
            readResults();
            regions = MapTools.readRegions();
            JSONout.regionsToGEOJSON(regions);
            //set up regional groups
            StationGroup sg = new StationGroup();

            foreach (Region r in regions)
            {
                sg      = new StationGroup();
                sg.name = r.name;
                stationsByRegion.Add(sg);
            }
            sg      = new StationGroup();
            sg.name = "outside";
            stationsByRegion.Add(sg);

            groupStationsByRegion();

            cities = MapTools.readCities();
            //set up city groups
            foreach (City city in cities)
            {
                CityGroup cg = new CityGroup();
                cg.city = city;
                citygroups.Add(cg);
            }

            addRegionGroup();
            getLocalStations();
            outputNumeric();
            outputRegionalGroups();
            JSONout.writeRegional(stationsByRegion);
            JSONout.writeCityGroups(citygroups);
        }