simworld.citygen.building package

Submodules

simworld.citygen.building.building_generator module

Building generator module for generating buildings along road segments.

class simworld.citygen.building.building_generator.BuildingGenerator(config, building_types)

Bases: object

Building generator class for placing buildings along road segments.

check_building_road_overlap(building_bounds: Bounds, segments_quadtree: QuadTree[Segment]) bool

Check if building overlaps with roads.

Args:

building_bounds: Bounds of the building to check. segments_quadtree: Quadtree containing all road segments.

Returns:

True if the building overlaps with any road, False otherwise.

filter_overlapping_buildings(segments_quadtree: QuadTree[Segment])

Filter out buildings that overlap with roads after building generation.

Args:

segments_quadtree: Quadtree containing all road segments.

generate_buildings_along_segment(segment: Segment, road_quadtree: QuadTree[Segment])

Generate buildings along both sides of a road segment.

Args:

segment: Road segment to place buildings along. road_quadtree: Quadtree containing all road segments.

get_next_building_type()

Choose the next building type to generate.

Returns:

The next building type to be placed.

get_smallest_available_building_type()

From the smallest building to the largest, return the first building type that has not reached the limit.

Returns:

The smallest available building type or None if no types are available.

simworld.citygen.building.building_manager module

Building manager module for managing buildings in the city.

This module provides functionality to add, remove, and check for collisions with existing buildings in the city’s quadtree structure.

class simworld.citygen.building.building_manager.BuildingManager(config)

Bases: object

Building manager class for managing buildings in the city.

This class provides functionality to add, remove, and check for collisions with existing buildings in the city’s quadtree structure.

add_building(building: Building)

Add new building to manager.

Args:

building: Building to add.

can_place_building(bounds: Bounds, buffer: float | None = None) bool

Check if a building can be placed at the specified location.

Args:

bounds: Bounds of the building. buffer: Buffer distance.

Returns:

True if the building can be placed, False otherwise.

rebuild_quadtree()

Rebuild the quadtree.

remove_building(building: Building)

Remove a building from the quadtree and list.

Args:

building: Building to remove.

Module contents

Building generation and management package.

This package provides functionality for generating and managing buildings in the city. It includes tools for creating, modifying, and interacting with building structures and their properties.