Helper for generating districts
Beispiel #1
0
        public static CityData GenerateCity(CitySettings settings, VoronoiDiagram voronoi)
        {
            if (voronoi.VoronoiCells.Count < 1)
            {
                return(null);
            }

            //Create helpers if none are created.
            if (_districtBuilder == null)
            {
                _districtBuilder = new DistrictBuilder();
            }

            //Generate the city
            var cityData = new CityData();

            voronoi.RefreshVoronoi();

            //divide the city into districts
            cityData.Districts = _districtBuilder.CreateCityDistricts(settings, voronoi);

            cityData.Bounds = MathHelpers.GetCityBounds(cityData);

            return(cityData);
        }
Beispiel #2
0
        public static CityData GenerateCity(CitySettings settings, VoronoiDiagram voronoi)
        {
            if (voronoi.VoronoiCells.Count < 1)
                return null;

            //Create helpers if none are created.
            if (_districtBuilder == null)
            {
                _districtBuilder = new DistrictBuilder();
            }

            //Generate the city
            var cityData = new CityData();

            voronoi.RefreshVoronoi();

            //divide the city into districts
            cityData.Districts = _districtBuilder.CreateCityDistricts(settings,voronoi);

            cityData.Bounds = MathHelpers.GetCityBounds(cityData);

            return cityData;
        }