Better json structure
This commit is contained in:
8
main.py
8
main.py
@@ -94,10 +94,10 @@ block_list = ["blue_concrete", "red_concrete", "green_concrete",
|
||||
|
||||
coordinates = [(0, 0, 0), (0, 0, 10), (0, 0, 20)]
|
||||
|
||||
# with open('networks/lines/lines.json') as f:
|
||||
# lines_type = json.load(f)
|
||||
# l = Line.Line(coordinates, lines_type.get('solid_white'))
|
||||
# print(l.get_surface())
|
||||
with open('networks/lines/lines.json') as f:
|
||||
lines_type = json.load(f)
|
||||
l = Line.Line(coordinates, lines_type.get('solid_white'))
|
||||
print(l.get_surface())
|
||||
|
||||
# with open('networks/lanes/lanes.json') as f:
|
||||
# lanes_type = json.load(f)
|
||||
|
||||
@@ -18,10 +18,11 @@ class Line:
|
||||
|
||||
pattern_length = 0
|
||||
pattern_materials = []
|
||||
for key, value in self.line_materials.items():
|
||||
pattern_length += int(key)
|
||||
for _ in range(int(key)):
|
||||
pattern_materials.append(value)
|
||||
|
||||
for pattern in self.line_materials:
|
||||
pattern_length += pattern[1]
|
||||
for _ in range(pattern[1]):
|
||||
pattern_materials.append(pattern[0])
|
||||
|
||||
pattern_iteration = 0
|
||||
for i in range(len(curve_points)-1):
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
{
|
||||
"solid_white": {
|
||||
"1": {"white_concrete": 3, "white_concrete_powder": 1}
|
||||
},
|
||||
"broken_white": {
|
||||
"3": {"white_concrete": 3, "white_concrete_powder": 1},
|
||||
"1": {"None": 1}
|
||||
}
|
||||
"solid_white": [
|
||||
[{"white_concrete": 3, "white_concrete_powder": 1}, 1]
|
||||
],
|
||||
|
||||
"broken_white": [
|
||||
[{"white_concrete": 3, "white_concrete_powder": 1}, 3],
|
||||
[{"None": 1}, 1]
|
||||
]
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
class Road:
|
||||
def __init__(self, coordinates):
|
||||
def __init__(self, coordinates, road_configuration):
|
||||
self.coordinates = coordinates # List of tuples (x1, y1, z1) in order
|
||||
self.road_type = road_type # 'road', 'highway'
|
||||
self.road_configuration = road_configuration # 'road', 'highway'
|
||||
|
||||
def place_roads(self):
|
||||
pass
|
||||
|
||||
10
networks/roads/roads.json
Normal file
10
networks/roads/roads.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"high_way": {
|
||||
"3": {"classic_lane": 3}
|
||||
|
||||
},
|
||||
"broken_white": {
|
||||
"3": {"white_concrete": 3, "white_concrete_powder": 1},
|
||||
"1": {"None": 1}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user