mirror of
https://github.com/enzet/map-machine.git
synced 2025-05-17 19:16:22 +02:00
Reorganize the project.
This commit is contained in:
parent
c07e4b4de7
commit
dfbc2691d3
39 changed files with 86 additions and 78 deletions
|
@ -17,8 +17,8 @@ from map_machine.figure import (
|
|||
StyledFigure,
|
||||
Tree,
|
||||
)
|
||||
from map_machine.flinger import Flinger
|
||||
from map_machine.icon import (
|
||||
from map_machine.geometry.flinger import Flinger
|
||||
from map_machine.pictogram.icon import (
|
||||
DEFAULT_SMALL_SHAPE_ID,
|
||||
Icon,
|
||||
IconSet,
|
||||
|
@ -27,18 +27,18 @@ from map_machine.icon import (
|
|||
ShapeSpecification,
|
||||
)
|
||||
from map_machine.map_configuration import DrawingMode, MapConfiguration
|
||||
from map_machine.osm_reader import (
|
||||
from map_machine.osm.osm_reader import (
|
||||
OSMData,
|
||||
OSMNode,
|
||||
OSMRelation,
|
||||
OSMWay,
|
||||
parse_levels,
|
||||
)
|
||||
from map_machine.point import Point
|
||||
from map_machine.road import Road, Roads
|
||||
from map_machine.pictogram.point import Point
|
||||
from map_machine.feature.road import Road, Roads
|
||||
from map_machine.scheme import DEFAULT_COLOR, LineStyle, RoadMatcher, Scheme
|
||||
from map_machine.text import Label
|
||||
from map_machine.ui import BuildingMode
|
||||
from map_machine.ui.cli import BuildingMode
|
||||
from map_machine.util import MinMax
|
||||
|
||||
__author__ = "Sergey Vartanov"
|
||||
|
|
|
@ -9,8 +9,8 @@ import numpy as np
|
|||
import svgwrite
|
||||
from svgwrite.path import Path as SVGPath
|
||||
|
||||
from map_machine.icon import ShapeExtractor
|
||||
from map_machine.point import Point
|
||||
from map_machine.pictogram.icon import ShapeExtractor
|
||||
from map_machine.pictogram.point import Point
|
||||
from map_machine.scheme import LineStyle, Scheme
|
||||
from map_machine.text import Label
|
||||
from map_machine.workspace import workspace
|
||||
|
|
0
map_machine/feature/__init__.py
Normal file
0
map_machine/feature/__init__.py
Normal file
|
@ -13,10 +13,10 @@ from svgwrite.path import Path
|
|||
from svgwrite.shapes import Circle
|
||||
|
||||
from map_machine.drawing import PathCommands
|
||||
from map_machine.flinger import Flinger
|
||||
from map_machine.osm_reader import OSMNode, Tagged
|
||||
from map_machine.geometry.flinger import Flinger
|
||||
from map_machine.osm.osm_reader import OSMNode, Tagged
|
||||
from map_machine.scheme import RoadMatcher
|
||||
from map_machine.vector import (
|
||||
from map_machine.geometry.vector import (
|
||||
Line,
|
||||
Polyline,
|
||||
compute_angle,
|
|
@ -10,16 +10,16 @@ from svgwrite.container import Group
|
|||
from svgwrite.gradients import RadialGradient
|
||||
from svgwrite.path import Path
|
||||
|
||||
from map_machine.direction import DirectionSet, Sector
|
||||
from map_machine.feature.direction import DirectionSet, Sector
|
||||
from map_machine.drawing import PathCommands
|
||||
from map_machine.flinger import Flinger
|
||||
from map_machine.osm_reader import OSMNode, Tagged
|
||||
from map_machine.geometry.flinger import Flinger
|
||||
from map_machine.osm.osm_reader import OSMNode, Tagged
|
||||
from map_machine.scheme import LineStyle, Scheme
|
||||
|
||||
__author__ = "Sergey Vartanov"
|
||||
__email__ = "me@enzet.ru"
|
||||
|
||||
from map_machine.vector import Polyline
|
||||
from map_machine.geometry.vector import Polyline
|
||||
|
||||
BUILDING_HEIGHT_SCALE: float = 2.5
|
||||
BUILDING_MINIMAL_HEIGHT: float = 8.0
|
||||
|
|
0
map_machine/geometry/__init__.py
Normal file
0
map_machine/geometry/__init__.py
Normal file
|
@ -5,7 +5,7 @@ from typing import Optional
|
|||
|
||||
import numpy as np
|
||||
|
||||
from map_machine.boundary_box import BoundaryBox
|
||||
from map_machine.geometry.boundary_box import BoundaryBox
|
||||
|
||||
__author__ = "Sergey Vartanov"
|
||||
__email__ = "me@enzet.ru"
|
|
@ -6,7 +6,7 @@ import logging
|
|||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
from map_machine.ui import parse_arguments
|
||||
from map_machine.ui.cli import parse_arguments
|
||||
from map_machine.workspace import Workspace
|
||||
|
||||
__author__ = "Sergey Vartanov"
|
||||
|
@ -32,12 +32,12 @@ def main() -> None:
|
|||
mapper.ui(arguments)
|
||||
|
||||
elif arguments.command == "tile":
|
||||
from map_machine import tile
|
||||
from map_machine.slippy import tile
|
||||
|
||||
tile.ui(arguments)
|
||||
|
||||
elif arguments.command == "icons":
|
||||
from map_machine.grid import draw_icons
|
||||
from map_machine.pictogram.icon_collection import draw_icons
|
||||
|
||||
draw_icons()
|
||||
|
||||
|
@ -52,7 +52,7 @@ def main() -> None:
|
|||
draw_element(arguments)
|
||||
|
||||
elif arguments.command == "server":
|
||||
from map_machine import server
|
||||
from map_machine.slippy import server
|
||||
|
||||
server.ui(arguments)
|
||||
|
||||
|
|
|
@ -9,9 +9,9 @@ from typing import Optional, TextIO
|
|||
from colour import Color
|
||||
|
||||
from map_machine import __project__, __url__
|
||||
from map_machine.grid import IconCollection
|
||||
from map_machine.icon import ShapeExtractor
|
||||
from map_machine.osm_reader import STAGES_OF_DECAY
|
||||
from map_machine.pictogram.icon_collection import IconCollection
|
||||
from map_machine.pictogram.icon import ShapeExtractor
|
||||
from map_machine.osm.osm_reader import STAGES_OF_DECAY
|
||||
from map_machine.scheme import Matcher, Scheme
|
||||
from map_machine.workspace import workspace
|
||||
|
||||
|
|
|
@ -13,18 +13,18 @@ from svgwrite.container import Group
|
|||
from svgwrite.path import Path as SVGPath
|
||||
from svgwrite.shapes import Rect
|
||||
|
||||
from map_machine.boundary_box import BoundaryBox
|
||||
from map_machine.geometry.boundary_box import BoundaryBox
|
||||
from map_machine.constructor import Constructor
|
||||
from map_machine.figure import StyledFigure
|
||||
from map_machine.flinger import Flinger
|
||||
from map_machine.icon import ShapeExtractor
|
||||
from map_machine.geometry.flinger import Flinger
|
||||
from map_machine.pictogram.icon import ShapeExtractor
|
||||
from map_machine.map_configuration import LabelMode, MapConfiguration
|
||||
from map_machine.osm_getter import NetworkError, get_osm
|
||||
from map_machine.osm_reader import OSMData, OSMNode
|
||||
from map_machine.point import Occupied, Point
|
||||
from map_machine.road import Intersection, Road, RoadPart
|
||||
from map_machine.osm.osm_getter import NetworkError, get_osm
|
||||
from map_machine.osm.osm_reader import OSMData, OSMNode
|
||||
from map_machine.pictogram.point import Occupied, Point
|
||||
from map_machine.feature.road import Intersection, Road, RoadPart
|
||||
from map_machine.scheme import Scheme
|
||||
from map_machine.ui import BuildingMode
|
||||
from map_machine.ui.cli import BuildingMode
|
||||
from map_machine.workspace import workspace
|
||||
|
||||
__author__ = "Sergey Vartanov"
|
||||
|
|
|
@ -9,9 +9,9 @@ from typing import Any, Union
|
|||
from moire.default import Default, DefaultHTML, DefaultMarkdown, DefaultWiki
|
||||
from moire.moire import Tag
|
||||
|
||||
from map_machine import ui
|
||||
from map_machine.icon import ShapeExtractor
|
||||
from map_machine.ui import COMMAND_LINES
|
||||
from map_machine.ui import cli
|
||||
from map_machine.pictogram.icon import ShapeExtractor
|
||||
from map_machine.ui.cli import COMMAND_LINES
|
||||
from map_machine.workspace import workspace
|
||||
|
||||
__author__ = "Sergey Vartanov"
|
||||
|
@ -154,17 +154,17 @@ class MapMachineMoire(Default, ABC):
|
|||
parser: ArgumentParser = ArgumentParser()
|
||||
command: str = self.clear(args[0])
|
||||
if command == "render":
|
||||
ui.add_render_arguments(parser)
|
||||
cli.add_render_arguments(parser)
|
||||
elif command == "server":
|
||||
ui.add_server_arguments(parser)
|
||||
cli.add_server_arguments(parser)
|
||||
elif command == "tile":
|
||||
ui.add_tile_arguments(parser)
|
||||
cli.add_tile_arguments(parser)
|
||||
elif command == "map":
|
||||
ui.add_map_arguments(parser)
|
||||
cli.add_map_arguments(parser)
|
||||
elif command == "element":
|
||||
ui.add_element_arguments(parser)
|
||||
cli.add_element_arguments(parser)
|
||||
elif command == "mapcss":
|
||||
ui.add_mapcss_arguments(parser)
|
||||
cli.add_mapcss_arguments(parser)
|
||||
else:
|
||||
raise NotImplementedError(
|
||||
"no separate function for parser creation"
|
||||
|
|
0
map_machine/osm/__init__.py
Normal file
0
map_machine/osm/__init__.py
Normal file
|
@ -8,7 +8,7 @@ from pathlib import Path
|
|||
|
||||
import urllib3
|
||||
|
||||
from map_machine.boundary_box import BoundaryBox
|
||||
from map_machine.geometry.boundary_box import BoundaryBox
|
||||
|
||||
__author__ = "Sergey Vartanov"
|
||||
__email__ = "me@enzet.ru"
|
|
@ -13,7 +13,7 @@ from xml.etree.ElementTree import Element
|
|||
|
||||
import numpy as np
|
||||
|
||||
from map_machine.boundary_box import BoundaryBox
|
||||
from map_machine.geometry.boundary_box import BoundaryBox
|
||||
from map_machine.util import MinMax
|
||||
|
||||
__author__ = "Sergey Vartanov"
|
0
map_machine/pictogram/__init__.py
Normal file
0
map_machine/pictogram/__init__.py
Normal file
|
@ -11,7 +11,12 @@ from colour import Color
|
|||
from svgwrite import Drawing
|
||||
from svgwrite.shapes import Rect
|
||||
|
||||
from map_machine.icon import Icon, Shape, ShapeExtractor, ShapeSpecification
|
||||
from map_machine.pictogram.icon import (
|
||||
Icon,
|
||||
Shape,
|
||||
ShapeExtractor,
|
||||
ShapeSpecification,
|
||||
)
|
||||
from map_machine.scheme import NodeMatcher, Scheme
|
||||
from map_machine.workspace import workspace
|
||||
|
|
@ -7,9 +7,9 @@ import numpy as np
|
|||
import svgwrite
|
||||
from colour import Color
|
||||
|
||||
from map_machine.icon import Icon, IconSet
|
||||
from map_machine.pictogram.icon import Icon, IconSet
|
||||
from map_machine.map_configuration import LabelMode
|
||||
from map_machine.osm_reader import Tagged
|
||||
from map_machine.osm.osm_reader import Tagged
|
||||
from map_machine.text import Label
|
||||
|
||||
__author__ = "Sergey Vartanov"
|
|
@ -12,8 +12,8 @@ import numpy as np
|
|||
import yaml
|
||||
from colour import Color
|
||||
|
||||
from map_machine.direction import DirectionSet
|
||||
from map_machine.icon import (
|
||||
from map_machine.feature.direction import DirectionSet
|
||||
from map_machine.pictogram.icon import (
|
||||
DEFAULT_COLOR,
|
||||
DEFAULT_SHAPE_ID,
|
||||
Icon,
|
||||
|
|
0
map_machine/slippy/__init__.py
Normal file
0
map_machine/slippy/__init__.py
Normal file
|
@ -9,7 +9,7 @@ from typing import Optional
|
|||
|
||||
import cairosvg
|
||||
|
||||
from map_machine.tile import Tile
|
||||
from map_machine.slippy.tile import Tile
|
||||
from map_machine.workspace import workspace
|
||||
|
||||
__author__ = "Sergey Vartanov"
|
|
@ -15,14 +15,14 @@ import numpy as np
|
|||
import svgwrite
|
||||
from PIL import Image
|
||||
|
||||
from map_machine.boundary_box import BoundaryBox
|
||||
from map_machine.geometry.boundary_box import BoundaryBox
|
||||
from map_machine.constructor import Constructor
|
||||
from map_machine.flinger import Flinger
|
||||
from map_machine.icon import ShapeExtractor
|
||||
from map_machine.geometry.flinger import Flinger
|
||||
from map_machine.pictogram.icon import ShapeExtractor
|
||||
from map_machine.map_configuration import MapConfiguration
|
||||
from map_machine.mapper import Map
|
||||
from map_machine.osm_getter import NetworkError, get_osm
|
||||
from map_machine.osm_reader import OSMData
|
||||
from map_machine.osm.osm_getter import NetworkError, get_osm
|
||||
from map_machine.osm.osm_reader import OSMData
|
||||
from map_machine.scheme import Scheme
|
||||
from map_machine.workspace import workspace
|
||||
|
0
map_machine/ui/__init__.py
Normal file
0
map_machine/ui/__init__.py
Normal file
|
@ -6,7 +6,7 @@ import sys
|
|||
|
||||
from map_machine import __version__
|
||||
from map_machine.map_configuration import BuildingMode, DrawingMode, LabelMode
|
||||
from map_machine.osm_reader import STAGES_OF_DECAY
|
||||
from map_machine.osm.osm_reader import STAGES_OF_DECAY
|
||||
|
||||
__author__ = "Sergey Vartanov"
|
||||
__email__ = "me@enzet.ru"
|
|
@ -7,8 +7,8 @@ import argparse
|
|||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from map_machine import ui
|
||||
from map_machine.ui import COMMANDS
|
||||
from map_machine.ui import cli
|
||||
from map_machine.ui.cli import COMMANDS
|
||||
|
||||
|
||||
class ArgumentParser(argparse.ArgumentParser):
|
||||
|
@ -64,17 +64,17 @@ def completion_commands() -> str:
|
|||
continue
|
||||
parser: ArgumentParser = ArgumentParser()
|
||||
if command == "render":
|
||||
ui.add_render_arguments(parser)
|
||||
ui.add_map_arguments(parser)
|
||||
cli.add_render_arguments(parser)
|
||||
cli.add_map_arguments(parser)
|
||||
elif command == "server":
|
||||
ui.add_server_arguments(parser)
|
||||
cli.add_server_arguments(parser)
|
||||
elif command == "tile":
|
||||
ui.add_tile_arguments(parser)
|
||||
ui.add_map_arguments(parser)
|
||||
cli.add_tile_arguments(parser)
|
||||
cli.add_map_arguments(parser)
|
||||
elif command == "element":
|
||||
ui.add_element_arguments(parser)
|
||||
cli.add_element_arguments(parser)
|
||||
elif command == "mapcss":
|
||||
ui.add_mapcss_arguments(parser)
|
||||
cli.add_mapcss_arguments(parser)
|
||||
else:
|
||||
raise NotImplementedError(
|
||||
f"no separate function for parser creation for {command}"
|
|
@ -3,7 +3,7 @@ Tests for Map Machine project.
|
|||
"""
|
||||
from pathlib import Path
|
||||
|
||||
from map_machine.icon import ShapeExtractor
|
||||
from map_machine.pictogram.icon import ShapeExtractor
|
||||
from map_machine.scheme import Scheme
|
||||
from map_machine.workspace import Workspace
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""
|
||||
Test boundary box.
|
||||
"""
|
||||
from map_machine.boundary_box import BoundaryBox
|
||||
from map_machine.geometry.boundary_box import BoundaryBox
|
||||
|
||||
__author__ = "Sergey Vartanov"
|
||||
__email__ = "me@enzet.ru"
|
||||
|
|
|
@ -10,7 +10,7 @@ __email__ = "me@enzet.ru"
|
|||
from xml.etree import ElementTree
|
||||
from xml.etree.ElementTree import Element
|
||||
|
||||
from map_machine.ui import COMMAND_LINES
|
||||
from map_machine.ui.cli import COMMAND_LINES
|
||||
|
||||
LOG: bytes = (
|
||||
b"INFO Constructing ways...\n"
|
||||
|
|
|
@ -3,7 +3,7 @@ Test direction processing.
|
|||
"""
|
||||
import numpy as np
|
||||
|
||||
from map_machine.direction import DirectionSet, parse_vector, Sector
|
||||
from map_machine.feature.direction import DirectionSet, parse_vector, Sector
|
||||
|
||||
__author__ = "Sergey Vartanov"
|
||||
__email__ = "me@enzet.ru"
|
||||
|
|
|
@ -8,13 +8,13 @@ from typing import Optional
|
|||
import numpy as np
|
||||
from svgwrite import Drawing
|
||||
|
||||
from map_machine.boundary_box import BoundaryBox
|
||||
from map_machine.geometry.boundary_box import BoundaryBox
|
||||
from map_machine.constructor import Constructor
|
||||
from map_machine.flinger import Flinger
|
||||
from map_machine.icon import ShapeExtractor
|
||||
from map_machine.geometry.flinger import Flinger
|
||||
from map_machine.pictogram.icon import ShapeExtractor
|
||||
from map_machine.map_configuration import MapConfiguration
|
||||
from map_machine.mapper import Map
|
||||
from map_machine.osm_reader import OSMData, OSMNode, OSMWay
|
||||
from map_machine.osm.osm_reader import OSMData, OSMNode, OSMWay
|
||||
from map_machine.scheme import Scheme
|
||||
from map_machine.workspace import Workspace
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ Test coordinates computation.
|
|||
"""
|
||||
import numpy as np
|
||||
|
||||
from map_machine.flinger import (
|
||||
from map_machine.geometry.flinger import (
|
||||
osm_zoom_level_to_pixels_per_meter,
|
||||
pseudo_mercator,
|
||||
)
|
||||
|
|
|
@ -6,8 +6,8 @@ from typing import Optional
|
|||
import pytest
|
||||
from colour import Color
|
||||
|
||||
from map_machine.grid import IconCollection
|
||||
from map_machine.icon import IconSet
|
||||
from map_machine.pictogram.icon_collection import IconCollection
|
||||
from map_machine.pictogram.icon import IconSet
|
||||
from tests import SCHEME, SHAPE_EXTRACTOR, workspace
|
||||
|
||||
__author__ = "Sergey Vartanov"
|
||||
|
|
|
@ -3,7 +3,7 @@ Test OSM XML parsing.
|
|||
"""
|
||||
import numpy as np
|
||||
|
||||
from map_machine.osm_reader import (
|
||||
from map_machine.osm.osm_reader import (
|
||||
OSMData,
|
||||
OSMNode,
|
||||
OSMRelation,
|
||||
|
|
|
@ -3,7 +3,7 @@ Tests for length tag parsing.
|
|||
"""
|
||||
from typing import Optional
|
||||
|
||||
from map_machine.osm_reader import Tagged
|
||||
from map_machine.osm.osm_reader import Tagged
|
||||
|
||||
__author__ = "Sergey Vartanov"
|
||||
__email__ = "me@enzet.ru"
|
||||
|
|
|
@ -3,7 +3,7 @@ Test vector operations.
|
|||
"""
|
||||
import numpy as np
|
||||
|
||||
from map_machine.vector import compute_angle, turn_by_angle
|
||||
from map_machine.geometry.vector import compute_angle, turn_by_angle
|
||||
|
||||
__author__ = "Sergey Vartanov"
|
||||
__email__ = "me@enzet.ru"
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
"""
|
||||
Test zoom level specification parsing.
|
||||
"""
|
||||
from map_machine.tile import ScaleConfigurationException, parse_zoom_level
|
||||
from map_machine.slippy.tile import (
|
||||
ScaleConfigurationException,
|
||||
parse_zoom_level,
|
||||
)
|
||||
|
||||
__author__ = "Sergey Vartanov"
|
||||
__email__ = "me@enzet.ru"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue