mirror of
https://github.com/enzet/map-machine.git
synced 2025-07-11 13:47:52 +02:00
Support subway colors.
This commit is contained in:
parent
e5c8c1e9c2
commit
b99a2ae87e
2 changed files with 42 additions and 24 deletions
|
@ -257,43 +257,60 @@ class Constructor:
|
||||||
self.roads.append(Road(line.tags, inners, outers, road_matcher))
|
self.roads.append(Road(line.tags, inners, outers, road_matcher))
|
||||||
return
|
return
|
||||||
|
|
||||||
|
processed: set[str] = set()
|
||||||
|
|
||||||
|
recolor: Optional[Color] = None
|
||||||
|
|
||||||
|
if line.tags.get("railway") == "subway":
|
||||||
|
for color_tag_key in ["color", "colour"]:
|
||||||
|
if color_tag_key in line.tags:
|
||||||
|
recolor = self.scheme.get_color(line.tags[color_tag_key])
|
||||||
|
processed.add(color_tag_key)
|
||||||
|
|
||||||
line_styles: list[LineStyle] = self.scheme.get_style(line.tags)
|
line_styles: list[LineStyle] = self.scheme.get_style(line.tags)
|
||||||
|
|
||||||
for line_style in line_styles:
|
for line_style in line_styles:
|
||||||
|
if recolor is not None:
|
||||||
|
new_style: dict[str, Union[float, int, str]] = dict(
|
||||||
|
line_style.style
|
||||||
|
)
|
||||||
|
new_style["stroke"] = recolor.hex
|
||||||
|
line_style = LineStyle(new_style, line_style.priority)
|
||||||
|
|
||||||
self.figures.append(
|
self.figures.append(
|
||||||
StyledFigure(line.tags, inners, outers, line_style)
|
StyledFigure(line.tags, inners, outers, line_style)
|
||||||
)
|
)
|
||||||
if (
|
if not (
|
||||||
line.get_tag("area") == "yes"
|
line.get_tag("area") == "yes"
|
||||||
or is_cycle(outers[0])
|
or is_cycle(outers[0])
|
||||||
and line.get_tag("area") != "no"
|
and line.get_tag("area") != "no"
|
||||||
and self.scheme.is_area(line.tags)
|
and self.scheme.is_area(line.tags)
|
||||||
):
|
):
|
||||||
processed: set[str] = set()
|
continue
|
||||||
|
|
||||||
priority: int
|
priority: int
|
||||||
icon_set: IconSet
|
icon_set: IconSet
|
||||||
icon_set, priority = self.scheme.get_icon(
|
icon_set, priority = self.scheme.get_icon(
|
||||||
self.extractor,
|
self.extractor,
|
||||||
|
line.tags,
|
||||||
|
processed,
|
||||||
|
self.configuration,
|
||||||
|
)
|
||||||
|
if icon_set is not None:
|
||||||
|
labels: list[Label] = self.scheme.construct_text(
|
||||||
|
line.tags, "all", processed
|
||||||
|
)
|
||||||
|
point: Point = Point(
|
||||||
|
icon_set,
|
||||||
|
labels,
|
||||||
line.tags,
|
line.tags,
|
||||||
processed,
|
processed,
|
||||||
self.configuration,
|
center_point,
|
||||||
|
is_for_node=False,
|
||||||
|
priority=priority,
|
||||||
|
add_tooltips=self.configuration.show_tooltips,
|
||||||
)
|
)
|
||||||
if icon_set is not None:
|
self.points.append(point)
|
||||||
labels: list[Label] = self.scheme.construct_text(
|
|
||||||
line.tags, "all", processed
|
|
||||||
)
|
|
||||||
point: Point = Point(
|
|
||||||
icon_set,
|
|
||||||
labels,
|
|
||||||
line.tags,
|
|
||||||
processed,
|
|
||||||
center_point,
|
|
||||||
is_for_node=False,
|
|
||||||
priority=priority,
|
|
||||||
add_tooltips=self.configuration.show_tooltips,
|
|
||||||
)
|
|
||||||
self.points.append(point)
|
|
||||||
|
|
||||||
if not line_styles:
|
if not line_styles:
|
||||||
if DEBUG:
|
if DEBUG:
|
||||||
|
|
|
@ -1843,8 +1843,9 @@ ways:
|
||||||
|
|
||||||
- tags: {railway: subway}
|
- tags: {railway: subway}
|
||||||
style:
|
style:
|
||||||
stroke-width: 10
|
stroke-width: 3.5
|
||||||
stroke: "#DDDDDD"
|
opacity: 0.7
|
||||||
|
stroke: "#AAAAAA"
|
||||||
priority: 41
|
priority: 41
|
||||||
- tags: {railway: rail}
|
- tags: {railway: rail}
|
||||||
style:
|
style:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue