simworld.citygen.dataclass package

Submodules

simworld.citygen.dataclass.dataclass module

Module for data classes defining various data structures for city generation.

class simworld.citygen.dataclass.dataclass.Bounds(x: float, y: float, width: float, height: float, rotation: float = 0.0)

Bases: object

A bounding box with x, y, width, height, and rotation.

(x, y) is the bottom-left corner of the bounding box width: width of the bounding box height: height of the bounding box

height: float
intersects(other: Bounds) bool

Checks if two Bounds objects’ bounding boxes intersect.

rotation: float = 0.0
to_dict()

Convert the bounds to dictionary representation.

width: float
x: float
y: float
class simworld.citygen.dataclass.dataclass.Building(building_type: BuildingType, bounds: Bounds, rotation: float = 0.0)

Bases: object

A building.

bounds: Bounds
building_type: BuildingType
center: Point
height: float
rotation: float = 0.0
to_dict()

Convert the building to dictionary representation.

width: float
class simworld.citygen.dataclass.dataclass.BuildingType(name: str, width: float, height: float, num_limit: int = -1)

Bases: object

A building type.

height: float
name: str
num_limit: int = -1
to_dict()

Convert the building type to dictionary representation.

width: float
class simworld.citygen.dataclass.dataclass.Element(element_type: ElementType, bounds: Bounds, rotation: float = 0.0, building: Building | None = None)

Bases: object

An element is a small object that can be placed in the city.

bounds: Bounds
building: Building = None
center: Point
element_type: ElementType
rotation: float = 0.0
to_dict()

Convert the element to dictionary representation.

class simworld.citygen.dataclass.dataclass.ElementType(name: str, width: float, height: float)

Bases: object

An element type.

height: float
name: str
to_dict()

Convert the element type to dictionary representation.

width: float
class simworld.citygen.dataclass.dataclass.Intersection(point: Point, segments: List[Segment])

Bases: object

A road intersection.

point: Point
segments: List[Segment]
class simworld.citygen.dataclass.dataclass.MetaInfo(highway: bool = False, t: float = 0.0)

Bases: object

Metadata for road segments.

highway: bool = False
t: float = 0.0
class simworld.citygen.dataclass.dataclass.Point(x: float, y: float)

Bases: object

A point in a 2D plane.

to_dict()

Convert the point to dictionary representation.

x: float
y: float
class simworld.citygen.dataclass.dataclass.Route(points: List[Point], start: Point, end: Point, bounds: Bounds = Bounds(x=0, y=0, width=0, height=0, rotation=0.0))

Bases: object

A route consisting of multiple points.

bounds: Bounds = Bounds(x=0, y=0, width=0, height=0, rotation=0.0)
end: Point
points: List[Point]
start: Point
class simworld.citygen.dataclass.dataclass.Segment(start: ~simworld.citygen.dataclass.dataclass.Point, end: ~simworld.citygen.dataclass.dataclass.Point, q: ~simworld.citygen.dataclass.dataclass.MetaInfo = <factory>, bounds: ~simworld.citygen.dataclass.dataclass.Bounds = Bounds(x=0, y=0, width=0, height=0, rotation=0.0))

Bases: object

A road segment connecting two points.

bounds: Bounds = Bounds(x=0, y=0, width=0, height=0, rotation=0.0)
end: Point
get_angle() float

Calculate the angle of the segment in degrees.

q: MetaInfo
start: Point
to_dict()

Convert the segment to dictionary representation.

Module contents

Dataclass module for the city generation.