Helper for generating districts
Exemplo n.º 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);
        }
Exemplo n.º 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;
        }