mirror of
https://github.com/enzet/map-machine.git
synced 2025-06-06 04:41:54 +02:00
Fix grid generation.
Fix creation combined icons.
This commit is contained in:
parent
2b601b94a6
commit
f61aabac8b
2 changed files with 16 additions and 16 deletions
BIN
doc/grid.png
BIN
doc/grid.png
Binary file not shown.
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 72 KiB |
|
@ -38,42 +38,42 @@ def draw_all_icons(
|
||||||
icons_file_name: str = "icons/icons.svg"
|
icons_file_name: str = "icons/icons.svg"
|
||||||
extractor: ShapeExtractor = ShapeExtractor(icons_file_name)
|
extractor: ShapeExtractor = ShapeExtractor(icons_file_name)
|
||||||
|
|
||||||
|
def add():
|
||||||
|
specifications = [
|
||||||
|
ShapeSpecification.from_structure(x, extractor, scheme)
|
||||||
|
for x in current_set
|
||||||
|
]
|
||||||
|
icon: Icon = Icon(specifications)
|
||||||
|
icon.recolor(Color("#444444"), exclude=Color("white"))
|
||||||
|
if icon not in icons:
|
||||||
|
icons.append(icon)
|
||||||
|
|
||||||
for element in scheme.icons: # type: Dict[str, Any]
|
for element in scheme.icons: # type: Dict[str, Any]
|
||||||
for key in ["icon", "add_icon"]:
|
for key in ["icon", "add_icon"]:
|
||||||
if key in element:
|
if key in element:
|
||||||
specifications = [
|
current_set = element[key]
|
||||||
ShapeSpecification.from_structure(x, extractor, scheme)
|
add()
|
||||||
for x in element[key]
|
|
||||||
]
|
|
||||||
icon: Icon = Icon(specifications)
|
|
||||||
icon.recolor(Color("#444444"), exclude=Color("white"))
|
|
||||||
if icon not in icons:
|
|
||||||
icons.append(icon)
|
|
||||||
continue
|
|
||||||
if "over_icon" not in element:
|
if "over_icon" not in element:
|
||||||
continue
|
continue
|
||||||
if "under_icon" in element:
|
if "under_icon" in element:
|
||||||
for icon_id in element["under_icon"]: # type: str
|
for icon_id in element["under_icon"]: # type: str
|
||||||
current_set = set([icon_id] + element["over_icon"])
|
current_set = set([icon_id] + element["over_icon"])
|
||||||
if current_set not in icons:
|
add()
|
||||||
icons.append(current_set)
|
|
||||||
if not ("under_icon" in element and "with_icon" in element):
|
if not ("under_icon" in element and "with_icon" in element):
|
||||||
continue
|
continue
|
||||||
for icon_id in element["under_icon"]: # type: str
|
for icon_id in element["under_icon"]: # type: str
|
||||||
for icon_2_id in element["with_icon"]: # type: str
|
for icon_2_id in element["with_icon"]: # type: str
|
||||||
current_set: Set[str] = set(
|
current_set: Set[str] = set(
|
||||||
[icon_id] + [icon_2_id] + element["over_icon"])
|
[icon_id] + [icon_2_id] + element["over_icon"])
|
||||||
if current_set not in icons:
|
add()
|
||||||
icons.append(current_set)
|
|
||||||
for icon_2_id in element["with_icon"]: # type: str
|
for icon_2_id in element["with_icon"]: # type: str
|
||||||
for icon_3_id in element["with_icon"]: # type: str
|
for icon_3_id in element["with_icon"]: # type: str
|
||||||
current_set = set(
|
current_set = set(
|
||||||
[icon_id] + [icon_2_id] + [icon_3_id] +
|
[icon_id] + [icon_2_id] + [icon_3_id] +
|
||||||
element["over_icon"])
|
element["over_icon"])
|
||||||
if (icon_2_id != icon_3_id and icon_2_id != icon_id and
|
if (icon_2_id != icon_3_id and icon_2_id != icon_id and
|
||||||
icon_3_id != icon_id and
|
icon_3_id != icon_id):
|
||||||
current_set not in icons):
|
add()
|
||||||
icons.append(current_set)
|
|
||||||
|
|
||||||
specified_ids: Set[str] = set()
|
specified_ids: Set[str] = set()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue