diff --git a/README.md b/README.md
index 60e2986..eb9525b 100644
--- a/README.md
+++ b/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 Preferences → Third tab on the left → Map Paint Styles.
+ * Active styles: press +.
+ * URL / File: set path to `out/roentgen_mapcss/roentgen.mapcss`.
+ * Ok → OK.
+
+To enable / disable Röntgen map paint style go to View → Map Paint Styles → Röntgen.
diff --git a/doc/readme.moi b/doc/readme.moi
index 52bfd03..96b6480 100644
--- a/doc/readme.moi
+++ b/doc/readme.moi
@@ -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}.
diff --git a/roentgen/mapcss.py b/roentgen/mapcss.py
index a472635..a77b2bf 100644
--- a/roentgen/mapcss.py
+++ b/roentgen/mapcss.py
@@ -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
diff --git a/roentgen/moire_manager.py b/roentgen/moire_manager.py
index 59cf2f3..3b2a19f 100644
--- a/roentgen/moire_manager.py
+++ b/roentgen/moire_manager.py
@@ -64,10 +64,19 @@ class ArgumentParser(argparse.ArgumentParser):
and option["default"]
and option["default"] != "==SUPPRESS=="
):
- default_value: Code = Tag("m", [str(option["default"])])
- if "type" in option and option["type"] in [int, float]:
- default_value = str(option["default"])
- help_value += [", default value: ", default_value]
+ 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"])
+ help_value += [", default value: ", default_value]
row.append(help_value)
else:
row.append([])
@@ -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"{self.clear(args[0])}"