mirror of
https://github.com/enzet/map-machine.git
synced 2025-05-22 13:36:26 +02:00
Move data files; fix way combination.
This commit is contained in:
parent
c53b257aaf
commit
173a553877
10 changed files with 24 additions and 13 deletions
|
@ -95,21 +95,21 @@ def glue(ways: list[OSMWay]) -> list[list[OSMNode]]:
|
|||
:param ways: ways to glue
|
||||
"""
|
||||
result: list[list[OSMNode]] = []
|
||||
to_process: set[list[OSMNode]] = set()
|
||||
to_process: set[tuple[OSMNode]] = set()
|
||||
|
||||
for way in ways:
|
||||
if way.is_cycle():
|
||||
result.append(way.nodes)
|
||||
else:
|
||||
to_process.add(way.nodes)
|
||||
to_process.add(tuple(way.nodes))
|
||||
|
||||
while to_process:
|
||||
nodes: list[OSMNode] = to_process.pop()
|
||||
nodes: list[OSMNode] = list(to_process.pop())
|
||||
glued: Optional[list[OSMNode]] = None
|
||||
other_nodes: Optional[list[OSMNode]] = None
|
||||
other_nodes: Optional[tuple[OSMNode]] = None
|
||||
|
||||
for other_nodes in to_process:
|
||||
glued = try_to_glue(nodes, other_nodes)
|
||||
glued = try_to_glue(nodes, list(other_nodes))
|
||||
if glued is not None:
|
||||
break
|
||||
|
||||
|
@ -118,7 +118,7 @@ def glue(ways: list[OSMWay]) -> list[list[OSMNode]]:
|
|||
if is_cycle(glued):
|
||||
result.append(glued)
|
||||
else:
|
||||
to_process.add(glued)
|
||||
to_process.add(tuple(glued))
|
||||
else:
|
||||
result.append(nodes)
|
||||
|
||||
|
|
|
@ -34,9 +34,8 @@ class Figure(Tagged):
|
|||
inners: list[list[OSMNode]],
|
||||
outers: list[list[OSMNode]],
|
||||
) -> None:
|
||||
super().__init__()
|
||||
super().__init__(tags)
|
||||
|
||||
self.tags: dict[str, str] = tags
|
||||
self.inners: list[list[OSMNode]] = list(map(make_clockwise, inners))
|
||||
self.outers: list[list[OSMNode]] = list(
|
||||
map(make_counter_clockwise, outers)
|
||||
|
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 1.3 MiB After Width: | Height: | Size: 1.3 MiB |
|
@ -145,6 +145,9 @@ class OSMNode(Tagged):
|
|||
coordinates=np.array((structure["lat"], structure["lon"])),
|
||||
)
|
||||
|
||||
def __hash__(self) -> int:
|
||||
return self.id_
|
||||
|
||||
|
||||
@dataclass
|
||||
class OSMWay(Tagged):
|
||||
|
|
|
@ -6,6 +6,8 @@ from pathlib import Path
|
|||
__author__ = "Sergey Vartanov"
|
||||
__email__ = "me@enzet.ru"
|
||||
|
||||
HERE: Path = Path(__file__).parent
|
||||
|
||||
|
||||
def check_and_create(directory: Path) -> Path:
|
||||
"""Create directory if it doesn't exist and return it."""
|
||||
|
@ -21,12 +23,11 @@ class Workspace:
|
|||
|
||||
# Project directories and files, that are the part of the repository.
|
||||
|
||||
SCHEME_PATH: Path = Path("scheme")
|
||||
SCHEME_PATH: Path = HERE / Path("scheme")
|
||||
DEFAULT_SCHEME_PATH: Path = SCHEME_PATH / "default.yml"
|
||||
ICONS_PATH: Path = Path("icons/icons.svg")
|
||||
ICONS_CONFIG_PATH: Path = Path("icons/config.json")
|
||||
ICONS_PATH: Path = HERE / Path("icons/icons.svg")
|
||||
ICONS_CONFIG_PATH: Path = HERE / Path("icons/config.json")
|
||||
GITHUB_TEST_PATH: Path = Path(".github/workflows/test.yml")
|
||||
DATA_PATH: Path = Path("data")
|
||||
|
||||
# Generated directories and files.
|
||||
|
||||
|
|
10
setup.py
10
setup.py
|
@ -5,7 +5,7 @@ from setuptools import setup
|
|||
|
||||
setup(
|
||||
name="roentgen-map",
|
||||
version="0.1.1",
|
||||
version="0.1.2",
|
||||
packages=["roentgen"],
|
||||
url="https://github.com/enzet/Roentgen",
|
||||
project_urls={
|
||||
|
@ -26,6 +26,14 @@ setup(
|
|||
entry_points={
|
||||
"console_scripts": ["roentgen=roentgen.main:main"],
|
||||
},
|
||||
package_data={
|
||||
"roentgen": [
|
||||
"icons/icons.svg",
|
||||
"icons/config.json",
|
||||
"icons/LICENSE",
|
||||
"scheme/default.yml",
|
||||
],
|
||||
},
|
||||
python_requires=">=3.9",
|
||||
install_requires=[
|
||||
"CairoSVG>=2.5.0",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue