mirror of
https://github.com/enzet/map-machine.git
synced 2025-06-06 04:41:54 +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.
|
`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 |
|
| Option | Description |
|
||||||
|---|---|
|
|---|---|
|
||||||
| `--icons` | add icons for nodes and areas, default value: `True` |
|
| `--icons` | add icons for nodes and areas, set by default |
|
||||||
| `--ways` | add style for ways and relations, default value: `True` |
|
| `--ways` | add style for ways and relations, set by default |
|
||||||
| `--lifecycle` | add icons for lifecycle tags, default value: `True` |
|
| `--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.
|
\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}
|
\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
|
import logging
|
||||||
from colour import Color
|
from colour import Color
|
||||||
|
|
||||||
|
from roentgen import __project__, __url__
|
||||||
from roentgen.workspace import workspace
|
from roentgen.workspace import workspace
|
||||||
from roentgen.grid import IconCollection
|
from roentgen.grid import IconCollection
|
||||||
from roentgen.icon import ShapeExtractor
|
from roentgen.icon import ShapeExtractor
|
||||||
|
@ -50,18 +51,18 @@ relation[building] {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}"""
|
}"""
|
||||||
|
|
||||||
HEADER: str = """
|
HEADER: str = f"""
|
||||||
/*
|
/*
|
||||||
Map paint style that adds icons from Röntgen icon set
|
Map paint style that adds icons from Röntgen icon set
|
||||||
*/
|
*/
|
||||||
|
|
||||||
meta {
|
meta {{
|
||||||
title: "Röntgen icons";
|
title: "{__project__}";
|
||||||
description: "Icons from Röntgen icon set for JOSM";
|
description: "Röntgen map paint style for JOSM";
|
||||||
author: "Sergey Vartanov";
|
author: "{__author__}";
|
||||||
version: "0.1";
|
version: "0.1";
|
||||||
link: "https://github.com/enzet/Roentgen";
|
link: "{__url__}";
|
||||||
}"""
|
}}"""
|
||||||
|
|
||||||
|
|
||||||
class MapCSSWriter:
|
class MapCSSWriter:
|
||||||
|
@ -77,7 +78,6 @@ class MapCSSWriter:
|
||||||
self.add_ways: bool = add_ways
|
self.add_ways: bool = add_ways
|
||||||
self.add_icons_for_lifecycle: bool = add_icons_for_lifecycle
|
self.add_icons_for_lifecycle: bool = add_icons_for_lifecycle
|
||||||
self.icon_directory_name: str = icon_directory_name
|
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.point_matchers: List[Matcher] = scheme.node_matchers
|
||||||
self.line_matchers: List[Matcher] = scheme.way_matchers
|
self.line_matchers: List[Matcher] = scheme.way_matchers
|
||||||
|
|
|
@ -64,6 +64,15 @@ class ArgumentParser(argparse.ArgumentParser):
|
||||||
and option["default"]
|
and option["default"]
|
||||||
and option["default"] != "==SUPPRESS=="
|
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"])])
|
default_value: Code = Tag("m", [str(option["default"])])
|
||||||
if "type" in option and option["type"] in [int, float]:
|
if "type" in option and option["type"] in [int, float]:
|
||||||
default_value = str(option["default"])
|
default_value = str(option["default"])
|
||||||
|
@ -158,6 +167,10 @@ class RoentgenMoire(Default, ABC):
|
||||||
)
|
)
|
||||||
return self.parse(parser.get_moire_help())
|
return self.parse(parser.get_moire_help())
|
||||||
|
|
||||||
|
def kbd(self, args: Arguments) -> str:
|
||||||
|
"""Keyboard key."""
|
||||||
|
return self.m(args)
|
||||||
|
|
||||||
|
|
||||||
class RoentgenHTML(RoentgenMoire, DefaultHTML):
|
class RoentgenHTML(RoentgenMoire, DefaultHTML):
|
||||||
"""
|
"""
|
||||||
|
@ -229,3 +242,7 @@ class RoentgenMarkdown(RoentgenMoire, DefaultMarkdown):
|
||||||
def icon(self, args: Arguments) -> str:
|
def icon(self, args: Arguments) -> str:
|
||||||
"""Image with Röntgen icon."""
|
"""Image with Röntgen icon."""
|
||||||
return f"[{self.clear(args[0])}]"
|
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