Skip to content

Commit

Permalink
Implemented id's
Browse files Browse the repository at this point in the history
  • Loading branch information
kostyaHrytsyuk committed Dec 8, 2018
1 parent b086f7a commit 6a1d9da
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions Buildings/Building.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def __init__(self, general_information, structure, left_top_corner=None):
self.save_structure(structure)
self.coordinates = self.mathematical()
self.size = self.get_building_size()
self.id = None

def save_structure(self, structure):
for i in range(len(structure)-1):
Expand Down
Binary file modified Buildings/__pycache__/Building.cpython-37.pyc
Binary file not shown.
9 changes: 7 additions & 2 deletions City.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def __init__(self, data):
self.possible_residentials = City.sort_buildings(self.possible_residentials)
self.possible_utilities = City.sort_buildings(self.possible_utilities)
self.city = []
self.curr_proj_id = 0

def build(self):
for i in range(self.rows):
Expand Down Expand Up @@ -76,18 +77,22 @@ def __build_house(self, house, top_left_corner):
project = copy.deepcopy(house)
project.left_top_corner = top_left_corner
project.coordinates = project.mathematical()
project.id = self.curr_proj_id
self.curr_proj_id += 1

for i in range(project.rows):
for coordinate in project.coordinates[i]:
coordinate.id = project.id
coordinate.build_type = project.type
coordinate.project_number = project.project_number
self.city[coordinate.point[0]][coordinate.point[1]] = coordinate

if project.type == 'R':
self.look_around(project)
# self.residentials.update({project.id: project})
self.residentials.update({project.id: project})
else:
self.look_around(project)
# self.utilities.update({project.id: project})
self.utilities.update({project.id: project})

def look_around(self, project):
edge1_lst = project.coordinates[0]
Expand Down
1 change: 1 addition & 0 deletions Coordinate/CityCoordinate.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ def __init__(self, x, y, content, build_type, project_number=0):
super().__init__(x, y, content)
self.build_type = build_type
self.project_number = project_number
self.id = None
Binary file modified Coordinate/__pycache__/CityCoordinate.cpython-37.pyc
Binary file not shown.
Binary file modified __pycache__/City.cpython-37.pyc
Binary file not shown.

0 comments on commit 6a1d9da

Please sign in to comment.