mirror of
https://github.com/enzet/map-machine.git
synced 2025-06-06 21:01:53 +02:00
Issue #63: add documentation.
This commit is contained in:
parent
c2b1e986ed
commit
96aaa92535
4 changed files with 57 additions and 15 deletions
18
README.md
18
README.md
|
@ -195,9 +195,21 @@ Command: `mapcss`.
|
|||
|
||||
`python roentgen.py mapcss` will create `out/roentgen_mapcss` directory with simple MapCSS 0.2 scheme adding icons from Röntgen icon set to nodes and areas: `.mapcss` file and directory with icons.
|
||||
|
||||
To create MapCSS with only Röntgen icons run `python roentgen.py mapcss --no-ways`.
|
||||
|
||||
| Option | Description |
|
||||
|---|---|
|
||||
| `--icons` | add icons for nodes and areas, default value: `True` |
|
||||
| `--ways` | add style for ways and relations, default value: `True` |
|
||||
| `--lifecycle` | add icons for lifecycle tags, default value: `True` |
|
||||
| `--icons` | add icons for nodes and areas, set by default |
|
||||
| `--ways` | add style for ways and relations, set by default |
|
||||
| `--lifecycle` | add icons for lifecycle tags, set by default |
|
||||
|
||||
### Use Röntgen as JOSM map paint style ###
|
||||
|
||||
* Open [JOSM](https://josm.openstreetmap.de/).
|
||||
* Go to <kbd>Preferences</kbd> → Third tab on the left → <kbd>Map Paint Styles</kbd>.
|
||||
* Active styles: press <kbd>+</kbd>.
|
||||
* URL / File: set path to `out/roentgen_mapcss/roentgen.mapcss`.
|
||||
* <kbd>Ok</kbd> → <kbd>OK</kbd>.
|
||||
|
||||
To enable / disable Röntgen map paint style go to <kbd>View</kbd> → <kbd>Map Paint Styles</kbd> → <kbd>Röntgen</kbd>.
|
||||
|
||||
|
|
|
@ -211,4 +211,17 @@ Command\: \m {mapcss}.
|
|||
|
||||
\m {python roentgen.py mapcss} will create \m {out/roentgen_mapcss} directory with simple MapCSS 0.2 scheme adding icons from Röntgen icon set to nodes and areas\: \m {.mapcss} file and directory with icons.
|
||||
|
||||
To create MapCSS with only Röntgen icons run \m {python roentgen.py mapcss --no-ways}.
|
||||
|
||||
\options {mapcss}
|
||||
|
||||
\3 {Use Röntgen as JOSM map paint style}
|
||||
|
||||
\list
|
||||
{Open \ref {https://josm.openstreetmap.de/} {JOSM}.}
|
||||
{Go to \kbd {Preferences} → Third tab on the left → \kbd {Map Paint Styles}.}
|
||||
{Active styles: press \kbd {+}.}
|
||||
{URL / File: set path to \m {out/roentgen_mapcss/roentgen.mapcss}.}
|
||||
{\kbd {Ok} → \kbd {OK}.}
|
||||
|
||||
To enable / disable Röntgen map paint style go to \kbd {View} → \kbd {Map Paint Styles} → \kbd {Röntgen}.
|
||||
|
|
|
@ -7,6 +7,7 @@ from typing import List, Optional, Dict
|
|||
import logging
|
||||
from colour import Color
|
||||
|
||||
from roentgen import __project__, __url__
|
||||
from roentgen.workspace import workspace
|
||||
from roentgen.grid import IconCollection
|
||||
from roentgen.icon import ShapeExtractor
|
||||
|
@ -50,18 +51,18 @@ relation[building] {
|
|||
opacity: 1;
|
||||
}"""
|
||||
|
||||
HEADER: str = """
|
||||
HEADER: str = f"""
|
||||
/*
|
||||
Map paint style that adds icons from Röntgen icon set
|
||||
*/
|
||||
|
||||
meta {
|
||||
title: "Röntgen icons";
|
||||
description: "Icons from Röntgen icon set for JOSM";
|
||||
author: "Sergey Vartanov";
|
||||
meta {{
|
||||
title: "{__project__}";
|
||||
description: "Röntgen map paint style for JOSM";
|
||||
author: "{__author__}";
|
||||
version: "0.1";
|
||||
link: "https://github.com/enzet/Roentgen";
|
||||
}"""
|
||||
link: "{__url__}";
|
||||
}}"""
|
||||
|
||||
|
||||
class MapCSSWriter:
|
||||
|
@ -77,7 +78,6 @@ class MapCSSWriter:
|
|||
self.add_ways: bool = add_ways
|
||||
self.add_icons_for_lifecycle: bool = add_icons_for_lifecycle
|
||||
self.icon_directory_name: str = icon_directory_name
|
||||
print(self.add_icons, self.add_ways, self.add_icons_for_lifecycle)
|
||||
|
||||
self.point_matchers: List[Matcher] = scheme.node_matchers
|
||||
self.line_matchers: List[Matcher] = scheme.way_matchers
|
||||
|
|
|
@ -64,6 +64,15 @@ class ArgumentParser(argparse.ArgumentParser):
|
|||
and option["default"]
|
||||
and option["default"] != "==SUPPRESS=="
|
||||
):
|
||||
if (
|
||||
"action" in option
|
||||
and option["action"] == argparse.BooleanOptionalAction
|
||||
):
|
||||
if option["default"] is True:
|
||||
help_value += [", set by default"]
|
||||
elif option["default"] is False:
|
||||
help_value += [", not set by default"]
|
||||
else:
|
||||
default_value: Code = Tag("m", [str(option["default"])])
|
||||
if "type" in option and option["type"] in [int, float]:
|
||||
default_value = str(option["default"])
|
||||
|
@ -158,6 +167,10 @@ class RoentgenMoire(Default, ABC):
|
|||
)
|
||||
return self.parse(parser.get_moire_help())
|
||||
|
||||
def kbd(self, args: Arguments) -> str:
|
||||
"""Keyboard key."""
|
||||
return self.m(args)
|
||||
|
||||
|
||||
class RoentgenHTML(RoentgenMoire, DefaultHTML):
|
||||
"""
|
||||
|
@ -229,3 +242,7 @@ class RoentgenMarkdown(RoentgenMoire, DefaultMarkdown):
|
|||
def icon(self, args: Arguments) -> str:
|
||||
"""Image with Röntgen icon."""
|
||||
return f"[{self.clear(args[0])}]"
|
||||
|
||||
def kbd(self, args: Arguments) -> str:
|
||||
"""Keyboard key."""
|
||||
return f"<kbd>{self.clear(args[0])}</kbd>"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue