Region module

class Region.Region(district, vertices)

Bases: src.Backend.Polygon.Polygon

Region storing a list of Vertices and a District with functions to determine what the Region is in

Attributes
districtDistrict

The district of the Region

verticeslist of Points

The points that define the boarders of the Region

Methods

get_district()

Gets the district value of the Region

set_district(new_district)

Sets the district value of the Region

get_vertices()

Gets the vertices value of the Region

set_vertices(new_vertices)

Sets the vertices value of the Region

in_wall(wall)

Determines if the Region is inside the provided wall

find_neighbors(regions)

Finds the neighboring regions of the polygon

Parameters
regionslist of Regions

All other regions on the map

Returns
neighbors:

A list of neighboring regions

get_district()

Gets the ‘district’ of the region

Returns
district

The ‘district’ of the region

get_neighbors()
Returns
List

Returns a list of the neighbors

get_vertices()

Gets the ‘vertices’ of a Region

Returns
list of Points

Returns the ‘vertices’ of the Region

in_city(city)

Determines if a Region is inside of the given City

Parameters
cityPolygon

The City to check if the Region is inside of

Returns
bool

True if the Region is inside the City, false otherwise

in_walls(wall)

Determines if a Region is inside of the given Wall

Parameters
wallWall

The wall to check if the Region is inside of

Returns
bool

True if the Region is inside the wall, false otherwise

set_district(new_district)

Sets the value of ‘district’ for a region

Parameters
new_districtdistrict

The new value of ‘district’ of the region

set_vertices(new_vertices)

Sets the value of ‘vertices’ for a Region

Parameters
new_verticesList of Points

The new value of ‘vertices’ for the Region