mirror of
https://github.com/enzet/map-machine.git
synced 2025-05-01 03:07:41 +02:00
Fix documentation.
This commit is contained in:
parent
0371172aef
commit
913ac05f23
4 changed files with 26 additions and 11 deletions
|
@ -128,12 +128,14 @@ class Grid:
|
||||||
return osm_way
|
return osm_way
|
||||||
|
|
||||||
def add_relation(self, tags: Tags, members: list[OSMMember]) -> OSMRelation:
|
def add_relation(self, tags: Tags, members: list[OSMMember]) -> OSMRelation:
|
||||||
|
"""Connect objects on the gird with relations."""
|
||||||
osm_relation: OSMRelation = OSMRelation(tags, self.relation_id, members)
|
osm_relation: OSMRelation = OSMRelation(tags, self.relation_id, members)
|
||||||
self.osm_data.add_relation(osm_relation)
|
self.osm_data.add_relation(osm_relation)
|
||||||
self.relation_id += 1
|
self.relation_id += 1
|
||||||
return osm_relation
|
return osm_relation
|
||||||
|
|
||||||
def add_text(self, text: str, i: int, j: int) -> None:
|
def add_text(self, text: str, i: int, j: int) -> None:
|
||||||
|
"""Add simple text label to the grid."""
|
||||||
self.texts.append((text, i, j))
|
self.texts.append((text, i, j))
|
||||||
|
|
||||||
def get_boundary_box(self) -> BoundaryBox:
|
def get_boundary_box(self) -> BoundaryBox:
|
||||||
|
@ -178,7 +180,9 @@ class Grid:
|
||||||
|
|
||||||
def draw_overlapped_ways(types: list[dict[str, str]], path: Path) -> None:
|
def draw_overlapped_ways(types: list[dict[str, str]], path: Path) -> None:
|
||||||
"""
|
"""
|
||||||
Draw two sets of ways intersecting each other to show how they overlapping.
|
Draw two sets of ways intersecting each other.
|
||||||
|
|
||||||
|
The goal is to show check priority.
|
||||||
"""
|
"""
|
||||||
grid: Grid = Grid(0.00012, 0.00012)
|
grid: Grid = Grid(0.00012, 0.00012)
|
||||||
|
|
||||||
|
|
|
@ -230,7 +230,7 @@ class MapMachineHTML(MapMachineMoire, DefaultHTML):
|
||||||
|
|
||||||
class MapMachineOSMWiki(MapMachineMoire, DefaultWiki):
|
class MapMachineOSMWiki(MapMachineMoire, DefaultWiki):
|
||||||
"""
|
"""
|
||||||
OpenStreetMap wiki.
|
Moire convertor to OpenStreetMap wiki markup.
|
||||||
|
|
||||||
See https://wiki.openstreetmap.org/wiki/Main_Page
|
See https://wiki.openstreetmap.org/wiki/Main_Page
|
||||||
"""
|
"""
|
||||||
|
@ -243,7 +243,7 @@ class MapMachineOSMWiki(MapMachineMoire, DefaultWiki):
|
||||||
)
|
)
|
||||||
|
|
||||||
def osm(self, arg: Arguments) -> str:
|
def osm(self, arg: Arguments) -> str:
|
||||||
"""OSM tag key or key–value pair of tag."""
|
"""Add special OSM tag key or key–value pair of tag."""
|
||||||
spec: str = self.clear(arg[0])
|
spec: str = self.clear(arg[0])
|
||||||
if "=" in spec:
|
if "=" in spec:
|
||||||
key, tag = spec.split("=")
|
key, tag = spec.split("=")
|
||||||
|
@ -252,11 +252,11 @@ class MapMachineOSMWiki(MapMachineMoire, DefaultWiki):
|
||||||
return f"{{{{Tag|{spec}}}}}"
|
return f"{{{{Tag|{spec}}}}}"
|
||||||
|
|
||||||
def color(self, arg: Arguments) -> str:
|
def color(self, arg: Arguments) -> str:
|
||||||
"""Simple color sample."""
|
"""Add color box on the wiki page with specified color."""
|
||||||
return f"{{{{Color box|{self.clear(arg[0])}}}}}"
|
return f"{{{{Color box|{self.clear(arg[0])}}}}}"
|
||||||
|
|
||||||
def icon(self, arg: Arguments) -> str:
|
def icon(self, arg: Arguments) -> str:
|
||||||
"""Image with Röntgen icon."""
|
"""Process image with Röntgen icon."""
|
||||||
size: str = self.clear(arg[1]) if len(arg) > 1 else "16"
|
size: str = self.clear(arg[1]) if len(arg) > 1 else "16"
|
||||||
shape_id: str = self.clear(arg[0])
|
shape_id: str = self.clear(arg[0])
|
||||||
name: str = self.extractor.get_shape(shape_id).name
|
name: str = self.extractor.get_shape(shape_id).name
|
||||||
|
@ -269,15 +269,15 @@ class MapMachineMarkdown(MapMachineMoire, DefaultMarkdown):
|
||||||
images = {}
|
images = {}
|
||||||
|
|
||||||
def color(self, arg: Arguments) -> str:
|
def color(self, arg: Arguments) -> str:
|
||||||
"""Simple color sample."""
|
"""Ignore colors in Markdown."""
|
||||||
return self.clear(arg[0])
|
return self.clear(arg[0])
|
||||||
|
|
||||||
def icon(self, arg: Arguments) -> str:
|
def icon(self, arg: Arguments) -> str:
|
||||||
"""Image with Röntgen icon."""
|
"""Process image with Röntgen icon."""
|
||||||
return f"[{self.clear(arg[0])}]"
|
return f"[{self.clear(arg[0])}]"
|
||||||
|
|
||||||
def kbd(self, arg: Arguments) -> str:
|
def kbd(self, arg: Arguments) -> str:
|
||||||
"""Keyboard key."""
|
"""Process keyboard key."""
|
||||||
return f"<kbd>{self.clear(arg[0])}</kbd>"
|
return f"<kbd>{self.clear(arg[0])}</kbd>"
|
||||||
|
|
||||||
def no_wrap(self, arg: Arguments) -> str:
|
def no_wrap(self, arg: Arguments) -> str:
|
||||||
|
@ -285,7 +285,7 @@ class MapMachineMarkdown(MapMachineMoire, DefaultMarkdown):
|
||||||
return f'<span style="white-space: nowrap;">{self.parse(arg[0])}</span>'
|
return f'<span style="white-space: nowrap;">{self.parse(arg[0])}</span>'
|
||||||
|
|
||||||
def formal(self, arg: Arguments) -> str:
|
def formal(self, arg: Arguments) -> str:
|
||||||
"""Formal variable."""
|
"""Process formal variable."""
|
||||||
return f"<{self.parse(arg[0])}>"
|
return f"<{self.parse(arg[0])}>"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,9 @@ DEFAULT_ANGLE: float = np.pi / 30.0
|
||||||
|
|
||||||
def parse_vector(text: str) -> Optional[np.ndarray]:
|
def parse_vector(text: str) -> Optional[np.ndarray]:
|
||||||
"""
|
"""
|
||||||
Parse vector from text representation: compass points or 360-degree
|
Parse vector from text representation.
|
||||||
notation. E.g. "NW", "270".
|
|
||||||
|
Compass points or 360-degree notation. E.g. "NW", "270".
|
||||||
|
|
||||||
:param text: vector text representation
|
:param text: vector text representation
|
||||||
:return: parsed normalized vector
|
:return: parsed normalized vector
|
||||||
|
@ -58,6 +59,8 @@ class Sector:
|
||||||
|
|
||||||
def __init__(self, text: str, angle: Optional[float] = None) -> None:
|
def __init__(self, text: str, angle: Optional[float] = None) -> None:
|
||||||
"""
|
"""
|
||||||
|
Construct sector from text representation.
|
||||||
|
|
||||||
:param text: sector text representation (e.g. "70-210", "N-NW")
|
:param text: sector text representation (e.g. "70-210", "N-NW")
|
||||||
:param angle: angle in degrees
|
:param angle: angle in degrees
|
||||||
"""
|
"""
|
||||||
|
@ -125,6 +128,8 @@ class DirectionSet:
|
||||||
|
|
||||||
def __init__(self, text: str) -> None:
|
def __init__(self, text: str) -> None:
|
||||||
"""
|
"""
|
||||||
|
Construct direction set from text representation.
|
||||||
|
|
||||||
:param text: direction tag value
|
:param text: direction tag value
|
||||||
"""
|
"""
|
||||||
self.sectors: Iterator[Optional[Sector]] = map(Sector, text.split(";"))
|
self.sectors: Iterator[Optional[Sector]] = map(Sector, text.split(";"))
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
"""
|
||||||
|
Drawing tree features on the map.
|
||||||
|
|
||||||
|
If radius of trunk or crown are specified they are displayed with simple
|
||||||
|
circles.
|
||||||
|
"""
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from colour import Color
|
from colour import Color
|
||||||
from svgwrite import Drawing
|
from svgwrite import Drawing
|
||||||
|
|
Loading…
Add table
Reference in a new issue