diff --git a/map_machine/color.py b/map_machine/color.py
index 0984aea..8eac388 100644
--- a/map_machine/color.py
+++ b/map_machine/color.py
@@ -35,7 +35,7 @@ def get_gradient_color(
scale: list[Color] = colors + [Color("black")]
range_coefficient: float = (
- 0 if bounds.is_empty() else (value - bounds.min_) / bounds.delta()
+ 0.0 if bounds.is_empty() else (value - bounds.min_) / bounds.delta()
)
# If value is out of range, set it to boundary value.
range_coefficient = min(1.0, max(0.0, range_coefficient))
diff --git a/map_machine/constructor.py b/map_machine/constructor.py
index 5da18e1..113b1bd 100644
--- a/map_machine/constructor.py
+++ b/map_machine/constructor.py
@@ -189,7 +189,7 @@ class Constructor:
self.craters: list[Crater] = []
self.direction_sectors: list[DirectionSector] = []
- self.heights: set[float] = {2, 4}
+ self.heights: set[float] = {2.0, 4.0}
def add_building(self, building: Building) -> None:
"""Add building and update levels."""
@@ -327,10 +327,10 @@ class Constructor:
style: dict[str, Any] = {
"fill": "none",
"stroke": Color("red").hex,
- "stroke-width": 1,
+ "stroke-width": 1.0,
}
figure: StyledFigure = StyledFigure(
- line.tags, inners, outers, LineStyle(style, 1000)
+ line.tags, inners, outers, LineStyle(style, 1000.0)
)
self.figures.append(figure)
@@ -453,6 +453,7 @@ class Constructor:
)
if icon_set is None:
return
+
labels: list[Label] = self.scheme.construct_text(
tags, processed, self.configuration.label_mode
)
@@ -498,7 +499,7 @@ def check_level_overground(tags: Tags) -> bool:
if "level" in tags:
try:
for level in map(float, tags["level"].replace(",", ".").split(";")):
- if level < 0:
+ if level < 0.0:
return False
except ValueError:
pass
diff --git a/map_machine/doc/moire_manager.py b/map_machine/doc/moire_manager.py
index 762deac..2464674 100644
--- a/map_machine/doc/moire_manager.py
+++ b/map_machine/doc/moire_manager.py
@@ -206,7 +206,7 @@ class MapMachineHTML(MapMachineMoire, DefaultHTML):
def icon(self, arg: Arguments) -> str:
"""Image with Röntgen icon."""
- size: str = self.clear(arg[1]) if len(arg) > 1 else 16
+ size: str = self.clear(arg[1]) if len(arg) > 1 else "16"
return (
f'
'
@@ -261,7 +261,7 @@ class MapMachineOSMWiki(MapMachineMoire, DefaultWiki):
def icon(self, arg: Arguments) -> str:
"""Image with Röntgen icon."""
- size: str = self.clear(arg[1]) if len(arg) > 1 else 16
+ size: str = self.clear(arg[1]) if len(arg) > 1 else "16"
shape_id: str = self.clear(arg[0])
name: str = self.extractor.get_shape(shape_id).name
return f"[[File:Röntgen {name}.svg|{size}px]]"
diff --git a/map_machine/drawing.py b/map_machine/drawing.py
index 4433beb..ccf963c 100644
--- a/map_machine/drawing.py
+++ b/map_machine/drawing.py
@@ -27,7 +27,7 @@ class Style:
fill: Optional[Color] = None
stroke: Optional[Color] = None
- width: float = 1
+ width: float = 1.0
def update_svg_element(self, element: BaseElement) -> None:
"""Set style for SVG element."""
@@ -41,7 +41,7 @@ class Style:
def draw_png_fill(self, context: Context) -> None:
"""Set style for context and draw fill."""
context.set_source_rgba(
- self.fill.get_red(), self.fill.get_green(), self.fill.get_blue(), 1
+ self.fill.get_red(), self.fill.get_green(), self.fill.get_blue()
)
context.fill()
@@ -51,7 +51,6 @@ class Style:
self.stroke.get_red(),
self.stroke.get_green(),
self.stroke.get_blue(),
- 1,
)
context.set_line_width(self.width)
context.stroke()
@@ -176,7 +175,7 @@ class PNGDrawing(Drawing):
def _do_path(self, commands: PathCommands) -> None:
"""Draw path."""
- current: np.ndarray = np.array((0, 0))
+ current: np.ndarray = np.array((0.0, 0.0))
start_point: Optional[np.ndarray] = None
command: str = "M"
is_absolute: bool = True
@@ -231,14 +230,14 @@ class PNGDrawing(Drawing):
point: np.ndarray
if is_absolute:
if command == "v":
- point = np.array((0, commands[index]))
+ point = np.array((0.0, commands[index]))
else:
- point = np.array((commands[index], 0))
+ point = np.array((commands[index], 0.0))
else:
if command == "v":
- point = current + np.array((0, commands[index]))
+ point = current + np.array((0.0, commands[index]))
else:
- point = current + np.array((commands[index], 0))
+ point = current + np.array((commands[index], 0.0))
current = point
self.context.line_to(point[0], point[1])
if start_point is None:
diff --git a/map_machine/element.py b/map_machine/element.py
index acc315c..bb5b5f3 100644
--- a/map_machine/element.py
+++ b/map_machine/element.py
@@ -51,13 +51,13 @@ def draw_element(options: argparse.Namespace) -> None:
labels,
tags,
processed,
- np.array((32, 32)),
+ np.array((32.0, 32.0)),
is_for_node=is_for_node,
draw_outline=is_for_node,
)
- border: np.ndarray = np.array((16, 16))
+ border: np.ndarray = np.array((16.0, 16.0))
size: np.ndarray = point.get_size() + border
- point.point = np.array((size[0] / 2, 16 / 2 + border[1] / 2))
+ point.point = np.array((size[0] / 2.0, 16.0 / 2.0 + border[1] / 2.0))
output_file_path: Path = workspace.output_path / "element.svg"
svg: svgwrite.Drawing = svgwrite.Drawing(
diff --git a/map_machine/feature/direction.py b/map_machine/feature/direction.py
index f42d47f..eb2b3b7 100644
--- a/map_machine/feature/direction.py
+++ b/map_machine/feature/direction.py
@@ -11,9 +11,9 @@ from map_machine.drawing import PathCommands
__author__ = "Sergey Vartanov"
__email__ = "me@enzet.ru"
-SHIFT: float = -np.pi / 2
-SMALLEST_ANGLE: float = np.pi / 15
-DEFAULT_ANGLE: float = np.pi / 30
+SHIFT: float = -np.pi / 2.0
+SMALLEST_ANGLE: float = np.pi / 15.0
+DEFAULT_ANGLE: float = np.pi / 30.0
def parse_vector(text: str) -> Optional[np.ndarray]:
@@ -66,13 +66,13 @@ class Sector:
parts: list[str] = text.split("-")
self.start = parse_vector(parts[0])
self.end = parse_vector(parts[1])
- self.main_direction = (self.start + self.end) / 2
+ self.main_direction = (self.start + self.end) / 2.0
else:
result_angle: float
if angle is None:
result_angle = DEFAULT_ANGLE
else:
- result_angle = max(SMALLEST_ANGLE, np.radians(angle) / 2)
+ result_angle = max(SMALLEST_ANGLE, np.radians(angle) / 2.0)
vector: Optional[np.ndarray] = parse_vector(text)
self.main_direction = vector
@@ -105,9 +105,9 @@ class Sector:
None otherwise.
"""
if self.main_direction is not None:
- if np.allclose(self.main_direction[0], 0):
+ if np.allclose(self.main_direction[0], 0.0):
return None
- if self.main_direction[0] > 0:
+ if self.main_direction[0] > 0.0:
return True
return False
diff --git a/map_machine/feature/road.py b/map_machine/feature/road.py
index 7f70509..a7560b3 100644
--- a/map_machine/feature/road.py
+++ b/map_machine/feature/road.py
@@ -435,7 +435,7 @@ class Road(Tagged):
lane.get_width(self.scale)
for lane in self.lanes[: lane_number - 1]
)
- - self.width * self.scale / 2
+ - self.width * self.scale / 2.0
)
if place == "left_of":
pass
@@ -525,7 +525,7 @@ class Road(Tagged):
"""Get road main color."""
color: Color = self.matcher.color
if self.tags.get("tunnel") == "yes":
- color = Color(color, luminance=min(1, color.luminance + 0.2))
+ color = Color(color, luminance=min(1.0, color.luminance + 0.2))
return color
def get_border_color(self) -> Color:
@@ -546,7 +546,7 @@ class Road(Tagged):
for index in range(1, len(self.lanes)):
lane_offset: float = self.scale * (
- -self.width / 2 + index * self.width / len(self.lanes)
+ -self.width / 2.0 + index * self.width / len(self.lanes)
)
path: Path = Path(
d=self.line.get_path(self.placement_offset + lane_offset)
@@ -555,7 +555,7 @@ class Road(Tagged):
"fill": "none",
"stroke": color.hex,
"stroke-linejoin": "round",
- "stroke-width": 1,
+ "stroke-width": 1.0,
"opacity": 0.5,
}
path.update(style)
@@ -568,7 +568,7 @@ class Road(Tagged):
return
path: Path = svg.path(
- d=self.line.get_path(self.placement_offset + 3), fill="none"
+ d=self.line.get_path(self.placement_offset + 3.0), fill="none"
)
svg.add(path)
@@ -580,7 +580,7 @@ class Road(Tagged):
method="align",
spacing="exact",
font_family="Roboto",
- font_size=10,
+ font_size=10.0,
)
text.add(text_path)
@@ -668,7 +668,7 @@ class SimpleConnector(Connector):
"""Draw connection fill."""
circle: Circle = svg.circle(
self.point,
- self.road_1.width * self.scale / 2,
+ self.road_1.width * self.scale / 2.0,
fill=self.road_1.get_color().hex,
)
svg.add(circle)
@@ -677,7 +677,7 @@ class SimpleConnector(Connector):
"""Draw connection outline."""
circle: Circle = svg.circle(
self.point,
- self.road_1.width * self.scale / 2 + 1,
+ self.road_1.width * self.scale / 2.0 + 1.0,
fill=self.road_1.matcher.border_color.hex,
)
svg.add(circle)
@@ -706,7 +706,7 @@ class ComplexConnector(Connector):
point_1: np.ndarray = flinger.fling(node_1.coordinates)
node_2: OSMNode = self.road_2.nodes[self.index_2]
point_2: np.ndarray = flinger.fling(node_2.coordinates)
- point = (point_1 + point_2) / 2
+ point = (point_1 + point_2) / 2.0
points_1: list[np.ndarray] = get_curve_points(
self.road_1,
@@ -765,7 +765,9 @@ class SimpleIntersection(Connector):
node: OSMNode = self.road_1.nodes[self.index_1]
point: np.ndarray = self.flinger.fling(node.coordinates)
circle: Circle = svg.circle(
- point, road.width * self.scale / 2, fill=road.matcher.color.hex
+ point,
+ road.width * self.scale / 2.0,
+ fill=road.matcher.color.hex,
)
svg.add(circle)
@@ -776,7 +778,7 @@ class SimpleIntersection(Connector):
point: np.ndarray = self.flinger.fling(node.coordinates)
circle: Circle = svg.circle(
point,
- road.width * self.scale / 2 + 1,
+ road.width * self.scale / 2.0 + 1.0,
fill=road.matcher.border_color.hex,
)
svg.add(circle)
diff --git a/map_machine/figure.py b/map_machine/figure.py
index f8ad915..d372e29 100644
--- a/map_machine/figure.py
+++ b/map_machine/figure.py
@@ -42,7 +42,7 @@ class Figure(Tagged):
)
def get_path(
- self, flinger: Flinger, offset: np.ndarray = np.array((0, 0))
+ self, flinger: Flinger, offset: np.ndarray = np.array((0.0, 0.0))
) -> str:
"""
Get SVG path commands.
@@ -365,13 +365,13 @@ def is_clockwise(polygon: list[OSMNode]) -> bool:
:param polygon: list of OpenStreetMap nodes
"""
- count: float = 0
+ count: float = 0.0
for index, node in enumerate(polygon):
next_index: int = 0 if index == len(polygon) - 1 else index + 1
count += (polygon[next_index].coordinates[0] - node.coordinates[0]) * (
polygon[next_index].coordinates[1] + node.coordinates[1]
)
- return count >= 0
+ return count >= 0.0
def make_clockwise(polygon: list[OSMNode]) -> list[OSMNode]:
diff --git a/map_machine/geometry/boundary_box.py b/map_machine/geometry/boundary_box.py
index 0cb60da..e35706d 100644
--- a/map_machine/geometry/boundary_box.py
+++ b/map_machine/geometry/boundary_box.py
@@ -95,15 +95,15 @@ class BoundaryBox:
n: float = 2.0 ** (zoom_level + 8.0)
x: int = int((coordinates[1] + 180.0) / 360.0 * n)
- left: float = (x - width / 2) / n * 360.0 - 180.0
- right: float = (x + width / 2) / n * 360.0 - 180.0
+ left: float = (x - width / 2.0) / n * 360.0 - 180.0
+ right: float = (x + width / 2.0) / n * 360.0 - 180.0
y: int = (1.0 - np.arcsinh(np.tan(lat_rad)) / np.pi) / 2.0 * n
bottom_radians = np.arctan(
- np.sinh((1.0 - (y + height / 2) * 2.0 / n) * np.pi)
+ np.sinh((1.0 - (y + height / 2.0) * 2.0 / n) * np.pi)
)
top_radians = np.arctan(
- np.sinh((1.0 - (y - height / 2) * 2.0 / n) * np.pi)
+ np.sinh((1.0 - (y - height / 2.0) * 2.0 / n) * np.pi)
)
return cls(
@@ -131,17 +131,17 @@ class BoundaryBox:
def round(self) -> "BoundaryBox":
"""Round boundary box."""
- self.left = round(self.left * 1000) / 1000 - 0.001
- self.bottom = round(self.bottom * 1000) / 1000 - 0.001
- self.right = round(self.right * 1000) / 1000 + 0.001
- self.top = round(self.top * 1000) / 1000 + 0.001
+ self.left = round(self.left * 1000.0) / 1000.0 - 0.001
+ self.bottom = round(self.bottom * 1000.0) / 1000.0 - 0.001
+ self.right = round(self.right * 1000.0) / 1000.0 + 0.001
+ self.top = round(self.top * 1000.0) / 1000.0 + 0.001
return self
def center(self) -> np.ndarray:
"""Return center point of boundary box."""
return np.array(
- ((self.top + self.bottom) / 2, (self.left + self.right) / 2)
+ ((self.top + self.bottom) / 2.0, (self.left + self.right) / 2.0)
)
def get_format(self) -> str:
@@ -150,10 +150,10 @@ class BoundaryBox:
,,,. Coordinates are
rounded to three digits after comma.
"""
- left: float = np.floor(self.left * 1000) / 1000
- bottom: float = np.floor(self.bottom * 1000) / 1000
- right: float = np.ceil(self.right * 1000) / 1000
- top: float = np.ceil(self.top * 1000) / 1000
+ left: float = np.floor(self.left * 1000.0) / 1000.0
+ bottom: float = np.floor(self.bottom * 1000.0) / 1000.0
+ right: float = np.ceil(self.right * 1000.0) / 1000.0
+ top: float = np.ceil(self.top * 1000.0) / 1000.0
return f"{left:.3f},{bottom:.3f},{right:.3f},{top:.3f}"
diff --git a/map_machine/geometry/flinger.py b/map_machine/geometry/flinger.py
index c3be23e..b8f541a 100644
--- a/map_machine/geometry/flinger.py
+++ b/map_machine/geometry/flinger.py
@@ -20,7 +20,9 @@ def pseudo_mercator(coordinates: np.ndarray) -> np.ndarray:
:return: position on the plane in the form of (x, y)
"""
y: float = (
- 180 / np.pi * np.log(np.tan(np.pi / 4 + coordinates[0] * np.pi / 360))
+ 180.0
+ / np.pi
+ * np.log(np.tan(np.pi / 4.0 + coordinates[0] * np.pi / 360.0))
)
return np.array((coordinates[1], y))
@@ -36,7 +38,7 @@ def osm_zoom_level_to_pixels_per_meter(
function allows any non-negative float value
:param equator_length: celestial body equator length in meters
"""
- return 2 ** zoom_level / equator_length * 256
+ return 2.0 ** zoom_level / equator_length * 256.0
class Flinger:
@@ -54,7 +56,7 @@ class Flinger:
:param equator_length: celestial body equator length in meters
"""
self.geo_boundaries: BoundaryBox = geo_boundaries
- self.ratio: float = 2 ** zoom_level * 256 / 360
+ self.ratio: float = 2.0 ** zoom_level * 256.0 / 360.0
self.size: np.ndarray = self.ratio * (
pseudo_mercator(self.geo_boundaries.max_())
- pseudo_mercator(self.geo_boundaries.min_())
@@ -90,5 +92,5 @@ class Flinger:
# Get pixels per meter ratio for the center of the boundary box.
coordinates = self.geo_boundaries.center()
- scale_factor: float = abs(1 / np.cos(coordinates[0] / 180 * np.pi))
+ scale_factor: float = abs(1.0 / np.cos(coordinates[0] / 180.0 * np.pi))
return self.pixels_per_meter * scale_factor
diff --git a/map_machine/geometry/vector.py b/map_machine/geometry/vector.py
index 6e12c03..7398ded 100644
--- a/map_machine/geometry/vector.py
+++ b/map_machine/geometry/vector.py
@@ -14,14 +14,14 @@ def compute_angle(vector: np.ndarray) -> float:
For the given vector compute an angle between it and (1, 0) vector. The
result is in [0, 2π].
"""
- if vector[0] == 0:
- if vector[1] > 0:
- return np.pi / 2
- return np.pi + np.pi / 2
- if vector[0] < 0:
+ if vector[0] == 0.0:
+ if vector[1] > 0.0:
+ return np.pi / 2.0
+ return np.pi + np.pi / 2.0
+ if vector[0] < 0.0:
return np.arctan(vector[1] / vector[0]) + np.pi
- if vector[1] < 0:
- return np.arctan(vector[1] / vector[0]) + 2 * np.pi
+ if vector[1] < 0.0:
+ return np.arctan(vector[1] / vector[0]) + 2.0 * np.pi
return np.arctan(vector[1] / vector[0])
@@ -46,10 +46,10 @@ class Polyline:
def __init__(self, points: list[np.ndarray]) -> None:
self.points: list[np.ndarray] = points
- def get_path(self, parallel_offset: float = 0) -> str:
+ def get_path(self, parallel_offset: float = 0.0) -> str:
"""Construct SVG path commands."""
points: list[np.ndarray]
- if np.allclose(parallel_offset, 0):
+ if np.allclose(parallel_offset, 0.0):
points = self.points
else:
try:
@@ -98,12 +98,12 @@ class Line:
def is_parallel(self, other: "Line") -> bool:
"""If lines are parallel or equal."""
- return np.allclose(other.a * self.b - self.a * other.b, 0)
+ return np.allclose(other.a * self.b - self.a * other.b, 0.0)
def get_intersection_point(self, other: "Line") -> np.ndarray:
"""Get point of intersection current line with other."""
- if other.a * self.b - self.a * other.b == 0:
- return np.array((0, 0))
+ if other.a * self.b - self.a * other.b == 0.0:
+ return np.array((0.0, 0.0))
x: float = -(self.b * other.c - other.b * self.c) / (
other.a * self.b - self.a * other.b
diff --git a/map_machine/mapcss.py b/map_machine/mapcss.py
index 0e1108f..21a56cd 100644
--- a/map_machine/mapcss.py
+++ b/map_machine/mapcss.py
@@ -166,7 +166,7 @@ class MapCSSWriter:
return
for index, stage_of_decay in enumerate(STAGES_OF_DECAY):
- opacity: float = 0.6 - 0.4 * index / (len(STAGES_OF_DECAY) - 1)
+ opacity: float = 0.6 - 0.4 * index / (len(STAGES_OF_DECAY) - 1.0)
for matcher in self.point_matchers:
if len(matcher.tags) > 1:
continue
diff --git a/map_machine/mapper.py b/map_machine/mapper.py
index 19ecf9f..384ff19 100644
--- a/map_machine/mapper.py
+++ b/map_machine/mapper.py
@@ -54,7 +54,7 @@ class Map:
def draw(self, constructor: Constructor) -> None:
"""Draw map."""
self.svg.add(
- Rect((0, 0), self.flinger.size, fill=self.background_color)
+ Rect((0.0, 0.0), self.flinger.size, fill=self.background_color)
)
ways: list[StyledFigure] = sorted(
constructor.figures, key=lambda x: x.line_style.priority
@@ -130,7 +130,7 @@ class Map:
building.draw_shade(building_shade, self.flinger)
self.svg.add(building_shade)
- previous_height: float = 0
+ previous_height: float = 0.0
for height in sorted(constructor.heights):
for building in constructor.buildings:
if building.height < height or building.min_height > height:
diff --git a/map_machine/pictogram/icon.py b/map_machine/pictogram/icon.py
index 289e251..190435d 100644
--- a/map_machine/pictogram/icon.py
+++ b/map_machine/pictogram/icon.py
@@ -93,8 +93,8 @@ class Shape:
def get_path(
self,
point: np.ndarray,
- offset: np.ndarray = np.array((0, 0)),
- scale: np.ndarray = np.array((1, 1)),
+ offset: np.ndarray = np.array((0.0, 0.0)),
+ scale: np.ndarray = np.array((1.0, 1.0)),
) -> SVGPath:
"""
Draw icon into SVG file.
@@ -108,7 +108,7 @@ class Shape:
transformations.append(f"translate({shift[0]},{shift[1]})")
- if not np.allclose(scale, np.array((1, 1))):
+ if not np.allclose(scale, np.array((1.0, 1.0))):
transformations.append(f"scale({scale[0]},{scale[1]})")
transformations.append(f"translate({self.offset[0]},{self.offset[1]})")
@@ -221,7 +221,7 @@ class ShapeExtractor:
def get_offset(value: str) -> float:
"""Get negated icon offset from the origin."""
return (
- -int(float(value) / GRID_STEP) * GRID_STEP - GRID_STEP / 2
+ -int(float(value) / GRID_STEP) * GRID_STEP - GRID_STEP / 2.0
)
point: np.ndarray = np.array(
@@ -259,7 +259,7 @@ class ShapeSpecification:
shape: Shape
color: Color = DEFAULT_COLOR
- offset: np.ndarray = np.array((0, 0))
+ offset: np.ndarray = np.array((0.0, 0.0))
flip_horizontally: bool = False
flip_vertically: bool = False
use_outline: bool = True
@@ -401,7 +401,7 @@ class Icon:
shape_specification.color = color
shape_specification.draw(
svg,
- np.array((8, 8)),
+ np.array((8.0, 8.0)),
outline=outline,
outline_opacity=outline_opacity,
)
@@ -409,7 +409,7 @@ class Icon:
for shape_specification in self.shape_specifications:
if color:
shape_specification.color = color
- shape_specification.draw(svg, np.array((8, 8)))
+ shape_specification.draw(svg, np.array((8.0, 8.0)))
with file_name.open("w", encoding="utf-8") as output_file:
svg.write(output_file)
diff --git a/map_machine/pictogram/icon_collection.py b/map_machine/pictogram/icon_collection.py
index 38ec89b..566bcde 100644
--- a/map_machine/pictogram/icon_collection.py
+++ b/map_machine/pictogram/icon_collection.py
@@ -161,7 +161,7 @@ class IconCollection:
self,
file_name: Path,
columns: int = 16,
- step: float = 24,
+ step: float = 24.0,
background_color: Color = Color("white"),
scale: float = 1.0,
) -> None:
@@ -174,19 +174,19 @@ class IconCollection:
:param background_color: background color
:param scale: scale icon by the magnitude
"""
- point: np.ndarray = np.array((step / 2 * scale, step / 2 * scale))
+ point: np.ndarray = np.array((step / 2.0 * scale, step / 2.0 * scale))
width: float = step * columns * scale
- height: int = int(int(len(self.icons) / columns + 1) * step * scale)
+ height: int = int(int(len(self.icons) / columns + 1.0) * step * scale)
svg: Drawing = Drawing(str(file_name), (width, height))
svg.add(svg.rect((0, 0), (width, height), fill=background_color.hex))
for icon in self.icons:
icon.draw(svg, point, scale=scale)
- point += np.array((step * scale, 0))
- if point[0] > width - 8:
- point[0] = step / 2 * scale
- point += np.array((0, step * scale))
+ point += np.array((step * scale, 0.0))
+ if point[0] > width - 8.0:
+ point[0] = step / 2.0 * scale
+ point += np.array((0.0, step * scale))
height += step * scale
with file_name.open("w", encoding="utf-8") as output_file:
diff --git a/map_machine/pictogram/point.py b/map_machine/pictogram/point.py
index 88af53a..c70dbcf 100644
--- a/map_machine/pictogram/point.py
+++ b/map_machine/pictogram/point.py
@@ -32,13 +32,13 @@ class Occupied:
def check(self, point: np.ndarray) -> bool:
"""Check whether point is already occupied by other elements."""
- if 0 <= point[0] < self.width and 0 <= point[1] < self.height:
+ if 0.0 <= point[0] < self.width and 0.0 <= point[1] < self.height:
return self.matrix[point[0], point[1]]
return True
def register(self, point: np.ndarray) -> None:
"""Register that point is occupied by an element."""
- if 0 <= point[0] < self.width and 0 <= point[1] < self.height:
+ if 0.0 <= point[0] < self.width and 0.0 <= point[1] < self.height:
self.matrix[point[0], point[1]] = True
assert self.matrix[point[0], point[1]]
@@ -57,7 +57,7 @@ class Point(Tagged):
tags: dict[str, str],
processed: set[str],
point: np.ndarray,
- priority: float = 0,
+ priority: float = 0.0,
is_for_node: bool = True,
draw_outline: bool = True,
add_tooltips: bool = False,
@@ -71,12 +71,12 @@ class Point(Tagged):
self.processed: set[str] = processed
self.point: np.ndarray = point
self.priority: float = priority
- self.layer: float = 0
+ self.layer: float = 0.0
self.is_for_node: bool = is_for_node
self.draw_outline: bool = draw_outline
self.add_tooltips: bool = add_tooltips
- self.y = 0
+ self.y: float = 0.0
self.main_icon_painted: bool = False
def draw_main_shapes(
@@ -91,7 +91,7 @@ class Point(Tagged):
):
return
- position: np.ndarray = self.point + np.array((0, self.y))
+ position: np.ndarray = self.point + np.array((0.0, self.y))
tags: Optional[dict[str, str]] = (
self.tags if self.add_tooltips else None
)
@@ -99,7 +99,7 @@ class Point(Tagged):
svg, self.icon_set.main_icon, position, occupied, tags=tags
)
if self.main_icon_painted:
- self.y += 16
+ self.y += 16.0
def draw_extra_shapes(
self, svg: svgwrite.Drawing, occupied: Optional[Occupied] = None
@@ -110,7 +110,7 @@ class Point(Tagged):
is_place_for_extra: bool = True
if occupied:
- left: float = -(len(self.icon_set.extra_icons) - 1) * 8
+ left: float = -(len(self.icon_set.extra_icons) - 1.0) * 8.0
for _ in self.icon_set.extra_icons:
point: np.ndarray = np.array(
(int(self.point[0] + left), int(self.point[1] + self.y))
@@ -118,16 +118,16 @@ class Point(Tagged):
if occupied.check(point):
is_place_for_extra = False
break
- left += 16
+ left += 16.0
if is_place_for_extra:
- left: float = -(len(self.icon_set.extra_icons) - 1) * 8
+ left: float = -(len(self.icon_set.extra_icons) - 1.0) * 8.0
for icon in self.icon_set.extra_icons:
point: np.ndarray = self.point + np.array((left, self.y))
self.draw_point_shape(svg, icon, point, occupied=occupied)
- left += 16
+ left += 16.0
if self.icon_set.extra_icons:
- self.y += 16
+ self.y += 16.0
def draw_point_shape(
self,
@@ -180,7 +180,7 @@ class Point(Tagged):
text = text.replace(""", '"')
text = text.replace("&", "&")
text = text[:26] + ("..." if len(text) > 26 else "")
- point = self.point + np.array((0, self.y + 2))
+ point = self.point + np.array((0.0, self.y + 2.0))
self.draw_text(
svg, text, point, occupied, label.fill, size=label.size
)
@@ -212,9 +212,9 @@ class Point(Tagged):
if occupied:
is_occupied: bool = False
- for i in range(-int(length / 2), int(length / 2)):
+ for i in range(-int(length / 2.0), int(length / 2.0)):
text_position: np.ndarray = np.array(
- (int(point[0] + i), int(point[1] - 4))
+ (int(point[0] + i), int(point[1] - 4.0))
)
if occupied.check(text_position):
is_occupied = True
@@ -223,7 +223,7 @@ class Point(Tagged):
if is_occupied:
return
- for i in range(-int(length / 2), int(length / 2)):
+ for i in range(-int(length / 2.0), int(length / 2.0)):
for j in range(-12, 5):
occupied.register(
np.array((int(point[0] + i), int(point[1] + j)))
@@ -233,24 +233,40 @@ class Point(Tagged):
if out_fill_2:
text_element = svg.text(
- text, point, font_size=size, text_anchor="middle",
- font_family=DEFAULT_FONT, fill=out_fill_2.hex,
- stroke_linejoin="round", stroke_width=5, stroke=out_fill_2.hex,
- opacity=out_opacity_2
- ) # fmt: skip
+ text,
+ point,
+ font_size=size,
+ text_anchor="middle",
+ font_family=DEFAULT_FONT,
+ fill=out_fill_2.hex,
+ stroke_linejoin="round",
+ stroke_width=5.0,
+ stroke=out_fill_2.hex,
+ opacity=out_opacity_2,
+ )
svg.add(text_element)
if out_fill:
text_element = svg.text(
- text, point, font_size=size, text_anchor="middle",
- font_family=DEFAULT_FONT, fill=out_fill.hex,
- stroke_linejoin="round", stroke_width=3, stroke=out_fill.hex,
+ text,
+ point,
+ font_size=size,
+ text_anchor="middle",
+ font_family=DEFAULT_FONT,
+ fill=out_fill.hex,
+ stroke_linejoin="round",
+ stroke_width=3.0,
+ stroke=out_fill.hex,
opacity=out_opacity,
- ) # fmt: skip
+ )
svg.add(text_element)
text_element = svg.text(
- text, point, font_size=size, text_anchor="middle",
- font_family=DEFAULT_FONT, fill=fill.hex,
- ) # fmt: skip
+ text,
+ point,
+ font_size=size,
+ text_anchor="middle",
+ font_family=DEFAULT_FONT,
+ fill=fill.hex,
+ )
svg.add(text_element)
self.y += 11
@@ -264,7 +280,9 @@ class Point(Tagged):
width: int = icon_size * (
1 + max(2, len(self.icon_set.extra_icons) - 1)
)
- height: int = icon_size * (1 + int(len(self.icon_set.extra_icons) / 3))
+ height: int = icon_size * (
+ 1 + np.ceil(len(self.icon_set.extra_icons) / 3.0)
+ )
if len(self.labels):
height += 4 + 11 * len(self.labels)
return np.array((width, height))
diff --git a/map_machine/scheme.py b/map_machine/scheme.py
index 2e93bcd..b27bd37 100644
--- a/map_machine/scheme.py
+++ b/map_machine/scheme.py
@@ -289,16 +289,16 @@ class RoadMatcher(Matcher):
if "color" in structure:
self.color = Color(scheme.get_color(structure["color"]))
self.default_width: float = structure["default_width"]
- self.priority: float = 0
+ self.priority: float = 0.0
if "priority" in structure:
self.priority = structure["priority"]
def get_priority(self, tags: Tags) -> float:
"""Get priority for drawing order."""
- layer: float = 0
+ layer: float = 0.0
if "layer" in tags:
layer = float(tags.get("layer"))
- return 1000 * layer + self.priority
+ return 1000.0 * layer + self.priority
class Scheme:
@@ -598,7 +598,7 @@ class Scheme:
"""
shape: Shape = extractor.get_shape(DEFAULT_SHAPE_ID)
color: Color = color
- offset: np.ndarray = np.array((0, 0))
+ offset: np.ndarray = np.array((0.0, 0.0))
flip_horizontally: bool = False
flip_vertically: bool = False
use_outline: bool = True
diff --git a/map_machine/scheme/default.yml b/map_machine/scheme/default.yml
index bd66889..636eeb7 100644
--- a/map_machine/scheme/default.yml
+++ b/map_machine/scheme/default.yml
@@ -122,7 +122,7 @@ node_icons:
draw: false
- group: "Huge transport hubs"
- start_zoom_level: 10
+ start_zoom_level: 10.0
tags:
- tags: {amenity: ferry_terminal}
shapes: [anchor]
@@ -138,7 +138,7 @@ node_icons:
shapes: [rocket_on_launch_pad]
- group: "Normal transport hubs"
- start_zoom_level: 11
+ start_zoom_level: 11.0
tags:
- tags: {aeroway: launchpad}
shapes: [rocket_flying]
@@ -186,7 +186,7 @@ node_icons:
shapes: [taxi]
- group: "Big territory"
- start_zoom_level: 12
+ start_zoom_level: 12.0
tags:
- tags: {leisure: fishing}
shapes: [fishing_angle]
@@ -228,7 +228,7 @@ node_icons:
shapes: [{shape: pear, color: orchard_border_color}]
- group: "Bigger objects"
- start_zoom_level: 13
+ start_zoom_level: 13.0
tags:
- tags: {waterway: waterfall}
shapes: [{shape: waterfall, color: water_border_color}]
@@ -314,7 +314,7 @@ node_icons:
shapes: [slide_and_water]
- group: "Important big objects"
- start_zoom_level: 14
+ start_zoom_level: 14.0
tags:
- tags: {amenity: fire_station}
location_restrictions: {include: [jp]}
@@ -410,7 +410,7 @@ node_icons:
location_restrictions: {include: [jp]}
- group: "Normal big objects"
- start_zoom_level: 15
+ start_zoom_level: 15.0
tags:
- tags: {shop: supermarket}
shapes: [supermarket_cart]
@@ -473,7 +473,7 @@ node_icons:
- tags: {leisure: playground}
shapes: [toy_horse]
- tags: {amenity: theatre}
- shapes: [theatre]
+ shapes: [curtains]
- tags: {amenity: bar}
shapes: [cocktail_glass]
- tags: {amenity: pub}
@@ -597,7 +597,7 @@ node_icons:
shapes: [table]
- group: "Big objects not for all"
- start_zoom_level: 15
+ start_zoom_level: 15.0
tags:
- tags: {building: apartments}
shapes: [apartments]
@@ -624,7 +624,7 @@ node_icons:
shapes: [telephone]
- group: "Not important big objects"
- start_zoom_level: 15
+ start_zoom_level: 15.0
tags:
- tags: {building: garage}
shapes: [garages]
@@ -649,7 +649,7 @@ node_icons:
shapes: [crane]
- group: "Emergency"
- start_zoom_level: 15
+ start_zoom_level: 15.0
tags:
- tags: {emergency: defibrillator}
shapes: [{shape: defibrillator, color: emergency_color}]
@@ -663,7 +663,7 @@ node_icons:
shapes: [{shape: sos_phone, color: emergency_color}]
- group: "Transport-important middle objects"
- start_zoom_level: 16
+ start_zoom_level: 16.0
tags:
- tags: {ford: "yes"}
shapes: [ford]
@@ -724,7 +724,7 @@ node_icons:
shapes: [double_dip]
- group: "Important middle objects"
- start_zoom_level: 16
+ start_zoom_level: 16.0
tags:
- tags: {tourism: attraction, attraction: amusement_ride}
shapes: [amusement_ride]
@@ -734,7 +734,7 @@ node_icons:
shapes: [shelter]
- group: "Normal middle objects"
- start_zoom_level: 17
+ start_zoom_level: 17.0
tags:
- tags: {shop: kiosk}
shapes: [kiosk]
@@ -743,7 +743,7 @@ node_icons:
- tags: {amenity: shop, shop: kiosk}
shapes: [kiosk]
- tags: {amenity: stage}
- shapes: [theatre]
+ shapes: [curtains]
- tags: {amenity: hunting_stand}
shapes: [hunting_stand]
- tags: {natural: cave_entrance}
@@ -759,7 +759,7 @@ node_icons:
shapes: [pipeline]
- group: "Towers, poles, masts"
- start_zoom_level: 15
+ start_zoom_level: 15.0
tags:
- tags: {building: ventilation_shaft}
shapes: [ventilation]
@@ -851,6 +851,8 @@ node_icons:
shapes: [tower_defensive]
- tags: {man_made: tower, tower:type: pagoda}
shapes: [pagoda]
+ - tags: {man_made: tower, tower:type: observation}
+ shapes: [tower_observation]
- tags: {man_made: mast}
shapes: [tube]
@@ -1024,7 +1026,7 @@ node_icons:
add_shapes: [phone]
- group: "Moon small objects"
- start_zoom_level: 0
+ start_zoom_level: 0.0
tags:
- tags: {man_made: rover}
shapes: [lunokhod]
@@ -1078,7 +1080,7 @@ node_icons:
set_opacity: 0.5
- group: "Important small objects"
- start_zoom_level: 17
+ start_zoom_level: 17.0
tags:
- tags: {highway: elevator}
shapes: [elevator]
@@ -1193,7 +1195,7 @@ node_icons:
shapes: {christmas_tree}
- group: "Normal small objects"
- start_zoom_level: 18
+ start_zoom_level: 18.0
tags:
- tags: {railway: switch}
shapes: [y]
@@ -1247,7 +1249,7 @@ node_icons:
shapes: [golf_pin]
- group: "Entrances"
- start_zoom_level: 18
+ start_zoom_level: 18.0
tags:
- tags: {amenity: parking_entrance}
shapes:
@@ -1283,7 +1285,7 @@ node_icons:
shapes: [no_door]
- group: "Not important small objects"
- start_zoom_level: 18
+ start_zoom_level: 18.0
tags:
- tags: {amenity: bench}
shapes: [bench]
@@ -1376,7 +1378,7 @@ node_icons:
shapes: [kerb]
- group: "Trees"
- start_zoom_level: 18
+ start_zoom_level: 18.0
tags:
- tags: {natural: tree}
shapes: [{shape: tree, color: tree_color, outline: no}]
@@ -1428,7 +1430,7 @@ node_icons:
add_shapes: [{shape: pear, color: tree_color}]
- group: "Indoor"
- start_zoom_level: 18
+ start_zoom_level: 18.0
tags:
- tags: {door: "yes"}
shapes: [entrance]
@@ -1520,147 +1522,147 @@ node_icons:
roads:
- tags: {highway: motorway}
- default_width: 7
+ default_width: 7.0
border_color: motorway_border_color
color: motorway_color
priority: 41.8
- tags: {highway: trunk}
- default_width: 7
+ default_width: 7.0
border_color: motorway_border_color
color: motorway_color
- priority: 41
+ priority: 41.0
- tags: {highway: trunk_link}
- default_width: 7
+ default_width: 7.0
border_color: motorway_border_color
color: motorway_color
- priority: 41
+ priority: 41.0
- tags: {highway: primary}
- default_width: 7
+ default_width: 7.0
border_color: primary_border_color
color: primary_color
priority: 41.7
- tags: {highway: motorway_link}
- default_width: 7
+ default_width: 7.0
border_color: motorway_border_color
color: motorway_color
priority: 41.8
- tags: {highway: secondary}
- default_width: 7
+ default_width: 7.0
border_color: secondary_border_color
priority: 41.6
color: secondary_color
- tags: {highway: secondary_link}
- default_width: 7
+ default_width: 7.0
border_color: secondary_border_color
priority: 41.6
color: secondary_color
- tags: {highway: tertiary}
- default_width: 7
+ default_width: 7.0
border_color: tertiary_border_color
priority: 41.5
color: tertiary_color
- tags: {highway: tertiary_link}
- default_width: 7
+ default_width: 7.0
border_color: tertiary_border_color
priority: 41.5
color: tertiary_color
- tags: {highway: unclassified}
- default_width: 5
+ default_width: 5.0
border_color: road_border_color
- priority: 41
+ priority: 41.0
- tags: {highway: residential}
- default_width: 5
+ default_width: 5.0
border_color: road_border_color
- priority: 41
+ priority: 41.0
- tags: {highway: living_street}
- default_width: 4
+ default_width: 4.0
border_color: road_border_color
- priority: 41
+ priority: 41.0
- tags: {highway: service}
exception: {service: parking_aisle}
- default_width: 3
+ default_width: 3.0
border_color: road_border_color
- priority: 41
+ priority: 41.0
- tags: {highway: service, service: parking_aisle}
- default_width: 2
+ default_width: 2.0
border_color: road_border_color
- priority: 41
+ priority: 41.0
- tags: {leisure: track}
color: pitch_color
border_color: pitch_border_color
- default_width: 5
- priority: 21
+ default_width: 5.0
+ priority: 21.0
- tags: {highway: raceway}
color: pitch_color
border_color: pitch_border_color
- default_width: 7
- priority: 21
+ default_width: 7.0
+ priority: 21.0
ways:
- tags: {man_made: bridge}
style: {fill: "#AAAAAA"}
- priority: 22
+ priority: 22.0
- tags: {indoor: area}
style:
stroke: indoor_border_color
- stroke-width: 1
+ stroke-width: 1.0
fill: indoor_color
- priority: 10
+ priority: 10.0
- tags: {indoor: corridor}
style:
stroke: indoor_color
- stroke-width: 1
+ stroke-width: 1.0
fill: indoor_color
- priority: 11
+ priority: 11.0
- tags: {highway: corridor}
style:
stroke: "#00FF00"
- stroke-width: 5
- priority: 11
+ stroke-width: 5.0
+ priority: 11.0
- tags: {indoor: "yes", area: "yes"}
style:
stroke: indoor_color
- stroke-width: 1
+ stroke-width: 1.0
fill: indoor_color
- priority: 12
+ priority: 12.0
- tags: {indoor: room, area: "yes"}
style:
stroke: indoor_color
- stroke-width: 1
+ stroke-width: 1.0
fill: indoor_color
- priority: 12
+ priority: 12.0
- tags: {indoor: elevator, area: "yes"}
style:
stroke: indoor_color
- stroke-width: 1
+ stroke-width: 1.0
fill: indoor_color
- priority: 12
+ priority: 12.0
- tags: {indoor: column}
style:
stroke: indoor_color
- stroke-width: 1
+ stroke-width: 1.0
fill: indoor_color
- priority: 13
+ priority: 13.0
- tags: {power: line}
style:
stroke: "#000000"
- stroke-width: 1
+ stroke-width: 1.0
opacity: 0.2
- priority: 80
+ priority: 80.0
- tags: {power: cable}
style:
stroke: "#000000"
- stroke-width: 1
+ stroke-width: 1.0
opacity: 0.1
- priority: 80
+ priority: 80.0
- tags: {golf: hole}
style:
stroke: "#000000"
- stroke-width: 1
+ stroke-width: 1.0
opacity: 0.3
- priority: 80
+ priority: 80.0
- tags: {man_made: pipeline}
style: {stroke: "#888888", stroke-width: 1, stroke-dasharray: "12,1.5"}
priority: 80
@@ -1674,189 +1676,189 @@ ways:
stroke: track_color
stroke-linecap: round
stroke-linejoin: round
- priority: 41
+ priority: 41.0
- tags: {highway: footway}
exception: {area: "yes", type: "multipolygon"}
style:
- stroke-width: 3
+ stroke-width: 3.0
stroke: foot_border_color
stroke-linecap: round
stroke-linejoin: round
- priority: 41
+ priority: 41.0
- tags: {highway: pedestrian}
exception: {area: "yes"}
style:
- stroke-width: 3
+ stroke-width: 3.0
stroke: foot_border_color
stroke-linecap: round
stroke-linejoin: round
- priority: 41
+ priority: 41.0
- tags: {highway: cycleway}
exception: {area: "yes"}
style:
- stroke-width: 3
+ stroke-width: 3.0
stroke: foot_border_color
stroke-linecap: round
stroke-linejoin: round
- priority: 41
+ priority: 41.0
- tags: {highway: steps}
style:
- stroke-width: 6
+ stroke-width: 6.0
stroke: foot_border_color
stroke-linecap: butt
- tags: {highway: path}
style:
- stroke-width: 3
+ stroke-width: 3.0
stroke: foot_border_color
- priority: 41
+ priority: 41.0
- tags: {highway: footway}
exception: {area: "yes", type: "multipolygon"}
style:
stroke-width: 1.5
- stroke-dasharray: 7,3
+ stroke-dasharray: 7.0,3.0
stroke-linecap: round
stroke-linejoin: round
stroke: foot_color
- priority: 42
+ priority: 42.0
- tags: {highway: pedestrian}
exception: {area: "yes"}
style:
stroke-width: 1.5
- stroke-dasharray: 7,3
+ stroke-dasharray: 7.0,3.0
stroke-linecap: round
stroke-linejoin: round
stroke: foot_color
- priority: 42
+ priority: 42.0
- tags: {highway: footway, area: "yes"}
style:
stroke: "#BBBBBB"
fill: "#DDDDDD"
stroke-linecap: round
stroke-linejoin: round
- priority: 55
+ priority: 55.0
- tags: {highway: footway, type: "multipolygon"}
style:
stroke: "#BBBBBB"
fill: "#DDDDDD"
stroke-linecap: round
stroke-linejoin: round
- priority: 55
+ priority: 55.0
- tags: {highway: pedestrian, area: "yes"}
style:
stroke: none
fill: "#DDDDDD"
stroke-linecap: round
stroke-linejoin: round
- priority: -55 # FIXME
+ priority: -55.0 # FIXME
- tags: {highway: cycleway}
exception: {area: "yes"}
style:
- stroke-width: 1
+ stroke-width: 1.0
stroke: cycle_color
- stroke-dasharray: 8,2
+ stroke-dasharray: 8.0,2.0
stroke-linecap: butt
- priority: 42
+ priority: 42.0
- tags: {highway: steps, conveying: "*"}
style:
- stroke-width: 5
- stroke-dasharray: 1.5,2
+ stroke-width: 5.0
+ stroke-dasharray: 1.5,2.0
stroke-linecap: butt
stroke: "#888888"
- priority: 42
+ priority: 42.0
- tags: {highway: steps}
exception: {conveying: "*"}
style:
- stroke-width: 5
- stroke-dasharray: 1.5,2
+ stroke-width: 5.0
+ stroke-dasharray: 1.5,2.0
stroke-linecap: butt
stroke: foot_color
- priority: 42
+ priority: 42.0
- tags: {highway: path}
style:
stroke-width: 1.5
- stroke-dasharray: 5,3
+ stroke-dasharray: 5.0,3.0
stroke-linecap: butt
stroke: foot_color
- priority: 42
+ priority: 42.0
- tags: {aeroway: runway}
style:
- stroke-width: 50
+ stroke-width: 50.0
stroke: runway_color
- priority: 22
+ priority: 22.0
- tags: {aeroway: taxiway}
style:
- stroke-width: 50
+ stroke-width: 50.0
stroke: taxiway_color
- priority: 21
+ priority: 21.0
- tags: {aeroway: runway}
style:
- stroke-width: 2
+ stroke-width: 2.0
stroke: "#DDDDDD"
- stroke-dasharray: 40,20
- priority: 23
+ stroke-dasharray: 40.0,20.0
+ priority: 23.0
- tags: {aeroway: taxiway}
style:
- stroke-width: 1
+ stroke-width: 1.0
stroke: "#CCCCCC"
- priority: 23
+ priority: 23.0
- tags: {aeroway: parking_position}
style:
- stroke-width: 1
+ stroke-width: 1.0
stroke: "#DDCC00"
- priority: 23
+ priority: 23.0
- tags: {area:aeroway: taxiway}
style:
fill: "#CCCCCC"
- priority: 20
+ priority: 20.0
- tags: {natural: wood}
style:
fill: wood_color
- priority: 21
+ priority: 21.0
- tags: {natural: wetland}
style:
fill: wetland_color
- priority: 21
+ priority: 21.0
- tags: {natural: grassland}
style:
fill: grass_color
stroke: grass_border_color
- priority: 20
+ priority: 20.0
- tags: {natural: scrub}
style:
fill: wood_color
- priority: 21
+ priority: 21.0
- tags: {natural: sand}
style:
fill: sand_color
- priority: 20
+ priority: 20.0
- tags: {natural: beach}
style:
fill: beach_color
- priority: 20
+ priority: 20.0
- tags: {natural: heath}
style:
fill: "#DDDDDD"
- priority: 20
+ priority: 20.0
- tags: {natural: glacier}
style:
fill: "#FFFFFF"
- priority: 20
+ priority: 20.0
- tags: {natural: desert}
style:
fill: desert_color
- priority: 20
+ priority: 20.0
- tags: {natural: forest}
style:
fill: wood_color
- priority: 21
+ priority: 21.0
- tags: {natural: tree_row}
- priority: 21
+ priority: 21.0
style:
stroke: wood_color
- stroke-width: 5
+ stroke-width: 5.0
stroke-linecap: round
stroke-linejoin: round
- tags: {natural: water}
@@ -1864,33 +1866,33 @@ ways:
style:
fill: water_color
# stroke: water_border_color
- # stroke-width: 1
- priority: 21
+ # stroke-width: 1.0
+ priority: 21.0
- tags: {natural: water, intermittent: "yes"}
style:
fill: water_color
opacity: 0.5
# stroke: water_border_color
- # stroke-width: 1
- priority: 21
+ # stroke-width: 1.0
+ priority: 21.0
- tags: {natural: coastline}
style:
# fill: water_color
stroke: water_border_color
- stroke-width: 1
- priority: 21
+ stroke-width: 1.0
+ priority: 21.0
- tags: {natural: ridge}
style:
- stroke-width: 2
+ stroke-width: 2.0
opacity: 0.3
stroke: ridge_color
- priority: 21
+ priority: 21.0
- tags: {natural: bare_rock}
style:
fill: rock_color
- tags: {natural: cliff}
style:
- stroke-width: 1
+ stroke-width: 1.0
stroke: "#BBBBBB"
- tags: {natural: scree}
style:
@@ -1899,48 +1901,48 @@ ways:
- tags: {landuse: allotments}
style:
fill: allotments_color
- priority: 20
+ priority: 20.0
- tags: {landuse: conservation}
style:
fill: grass_color
- priority: 20
+ priority: 20.0
- tags: {landuse: construction}
style:
fill: construction_color
- tags: {landuse: farmland}
style: {fill: farmland_color, stroke: farmland_border_color}
- priority: 20
+ priority: 20.0
- tags: {landuse: farmland, crop: wheat}
style: {fill: wheat_color, stroke: wheat_border_color}
- priority: 20
+ priority: 20.0
- tags: {landuse: farmland, crop: barley}
style: {fill: barley_color, stroke: barley_border_color}
- priority: 20
+ priority: 20.0
- tags: {landuse: farmland, crop: rye}
style: {fill: rye_color, stroke: rye_dark_color}
- priority: 20
+ priority: 20.0
- tags: {landuse: forest}
style:
fill: wood_color
- priority: 20
+ priority: 20.0
- tags: {landuse: garages}
style:
fill: parking_color
- priority: 21
+ priority: 21.0
- tags: {landuse: grass}
style:
fill: grass_color
stroke: grass_border_color
- priority: 20
+ priority: 20.0
- tags: {landuse: orchard}
style:
fill: orchard_color
- priority: 21
+ priority: 21.0
- tags: {landuse: meadow}
style:
fill: meadow_color
stroke: meadow_border_color
- priority: 20
+ priority: 20.0
# Hidden land use
@@ -1948,42 +1950,42 @@ ways:
style:
fill: hidden_color
opacity: 0.05
- priority: 1
+ priority: 1.0
- tags: {landuse: commercial}
style:
fill: hidden_color
opacity: 0.05
- priority: 1
+ priority: 1.0
- tags: {landuse: industrial}
style:
fill: hidden_color
opacity: 0.05
- priority: 1
+ priority: 1.0
- tags: {landuse: military}
style:
fill: hidden_color
opacity: 0.05
- priority: 1
+ priority: 1.0
- tags: {landuse: railway}
style:
fill: hidden_color
opacity: 0.05
- priority: 1
+ priority: 1.0
- tags: {landuse: residential}
style:
fill: hidden_color
opacity: 0.05
- priority: 1
+ priority: 1.0
- tags: {power: substation}
style:
fill: hidden_color
opacity: 0.05
- priority: 1
+ priority: 1.0
- tags: {amenity: ferry_terminal}
style:
fill: ferry_terminal_color
- priority: 50
+ priority: 50.0
- tags: {amenity: parking}
style:
fill: parking_color
@@ -2009,7 +2011,7 @@ ways:
- tags: {waterway: canal}
style:
stroke: water_color
- stroke-width: 2
+ stroke-width: 2.0
- tags: {waterway: stream}
style:
stroke: water_color
@@ -2018,100 +2020,100 @@ ways:
style:
fill: water_color
stroke: water_border_color
- stroke-width: 1
+ stroke-width: 1.0
- tags: {waterway: ditch}
style:
fill: water_color
stroke: water_color
- stroke-width: 2
+ stroke-width: 2.0
- tags: {railway: subway}
style:
stroke-width: 3.5
opacity: 0.7
stroke: "#AAAAAA"
- priority: 41
+ priority: 41.0
- tags: {railway: rail}
style:
- stroke-width: 3
+ stroke-width: 3.0
stroke: "#BBBBBB"
- priority: 42
+ priority: 42.0
- tags: {railway: light_rail}
style:
- stroke-width: 3
+ stroke-width: 3.0
stroke: "#CCCCCC"
- priority: 42
+ priority: 42.0
- tags: {railway: monorail}
style:
- stroke-width: 3
+ stroke-width: 3.0
stroke: "#CCCCCC"
- priority: 42
+ priority: 42.0
- tags: {railway: funicular}
style:
- stroke-width: 3
+ stroke-width: 3.0
stroke: "#CCCCCC"
- priority: 42
+ priority: 42.0
- tags: {railway: narrow_gauge}
style:
- stroke-width: 3
+ stroke-width: 3.0
stroke: "#DDDDDD"
- priority: 42
+ priority: 42.0
- tags: {railway: tram}
style:
- stroke-width: 3
+ stroke-width: 3.0
stroke: "#BBBBBB"
- priority: 42
+ priority: 42.0
- tags: {railway: rail}
style:
- stroke-width: 1
+ stroke-width: 1.0
stroke: "#444444"
- priority: 43
+ priority: 43.0
- tags: {railway: light_rail}
style:
- stroke-width: 1
+ stroke-width: 1.0
stroke: "#444444"
- priority: 43
+ priority: 43.0
- tags: {railway: monorail}
style:
- stroke-width: 1
+ stroke-width: 1.0
stroke: "#444444"
- priority: 43
+ priority: 43.0
- tags: {railway: funicular}
style:
- stroke-width: 1
+ stroke-width: 1.0
stroke: "#444444"
- priority: 43
+ priority: 43.0
- tags: {railway: narrow_gauge}
style:
- stroke-width: 1
+ stroke-width: 1.0
stroke: "#444444"
- priority: 43
+ priority: 43.0
- tags: {railway: tram}
style:
- stroke-width: 1
+ stroke-width: 1.0
stroke: "#444444"
- priority: 43
+ priority: 43.0
- tags: {railway: platform}
style:
fill: platform_color
- stroke-width: 1
+ stroke-width: 1.0
stroke: platform_border_color
- priority: 41
+ priority: 41.0
- tags: {route: ferry}
style:
- stroke-width: 1
- stroke-dasharray: 3,3
+ stroke-width: 1.0
+ stroke-dasharray: 3.0,3.0
stroke-linecap: butt
stroke: route_color
- priority: 42
+ priority: 42.0
- tags: {leisure: garden}
style:
fill: grass_color
- priority: 21
+ priority: 21.0
- tags: {leisure: park}
style:
fill: park_color
@@ -2132,106 +2134,106 @@ ways:
style:
fill: pitch_color
stroke: pitch_border_color
- stroke-width: 1
- priority: 21
+ stroke-width: 1.0
+ priority: 21.0
- tags: {leisure: bleachers}
style:
fill: pitch_color
stroke: pitch_border_color
- stroke-width: 1
- priority: 21
+ stroke-width: 1.0
+ priority: 21.0
- tags: {leisure: track, area: "yes"}
style:
fill: pitch_color
stroke: pitch_border_color
- stroke-width: 1
- priority: 21
+ stroke-width: 1.0
+ priority: 21.0
- tags: {leisure: fitness_station}
style:
fill: pitch_color
stroke: pitch_border_color
- stroke-width: 1
- priority: 21
+ stroke-width: 1.0
+ priority: 21.0
- tags: {leisure: playground}
style:
fill: playground_color
stroke: playground_border_color
- priority: 21
+ priority: 21.0
- tags: {leisure: swimming_pool}
style:
fill: water_color
stroke: water_border_color
- stroke-width: 1
+ stroke-width: 1.0
- tags: {barrier: hedge}
style:
fill: none
stroke: wood_color
- stroke-width: 4
- priority: 40
+ stroke-width: 4.0
+ priority: 40.0
- tags: {barrier: city_wall}
style:
fill: none
stroke: "#000000"
stroke-width: 2.0
opacity: 0.5
- priority: 40
+ priority: 40.0
- tags: {barrier: wall}
style:
fill: none
stroke: "#000000"
stroke-width: 1.5
opacity: 0.4
- priority: 40
+ priority: 40.0
- tags: {man_made: embankment}
style:
fill: none
stroke: "#000000"
- stroke-width: 1
+ stroke-width: 1.0
opacity: 0.3
- priority: 40
+ priority: 40.0
- tags: {barrier: fence}
style:
fill: none
stroke: "#000000"
- stroke-width: 1
+ stroke-width: 1.0
opacity: 0.25
- priority: 40
+ priority: 40.0
- tags: {barrier: retaining_wall}
style:
fill: none
stroke: "#000000"
- stroke-width: 1
+ stroke-width: 1.0
opacity: 0.25
- priority: 40
+ priority: 40.0
- tags: {barrier: handrail}
style:
fill: none
stroke: "#000000"
- stroke-width: 1
+ stroke-width: 1.0
opacity: 0.2
- priority: 40
+ priority: 40.0
- tags: {barrier: kerb}
style:
fill: none
stroke: "#000000"
- stroke-width: 1
+ stroke-width: 1.0
opacity: 0.15
- priority: 40
+ priority: 40.0
- tags: {border: "*"}
style:
stroke: "#FF0000"
stroke-width: 0.5
- stroke-dasharray: 10,20
+ stroke-dasharray: 10.0,20.0
- tags: {"area:highway": "*"}
- tags: {boundary: "*"}
# style:
# stroke: boundary_color
# stroke-width: 0.3
- # stroke-dasharray: 10,5
- priority: 60
+ # stroke-dasharray: 10.0,5.0
+ priority: 60.0
area_tags:
- tags: {aeroway: "*"}
diff --git a/map_machine/slippy/server.py b/map_machine/slippy/server.py
index fbaba34..f447d80 100644
--- a/map_machine/slippy/server.py
+++ b/map_machine/slippy/server.py
@@ -9,7 +9,7 @@ from typing import Optional
import cairosvg
-from map_configuration import MapConfiguration
+from map_machine.map_configuration import MapConfiguration
from map_machine.slippy.tile import Tile
from map_machine.workspace import workspace
diff --git a/map_machine/text.py b/map_machine/text.py
index f11eba5..c34039b 100644
--- a/map_machine/text.py
+++ b/map_machine/text.py
@@ -151,7 +151,7 @@ def construct_text(
processed.add("route_ref")
if "cladr:code" in tags:
- texts.append(Label(tags["cladr:code"], size=7))
+ texts.append(Label(tags["cladr:code"], size=7.0))
processed.add("cladr:code")
if "website" in tags:
diff --git a/map_machine/ui/cli.py b/map_machine/ui/cli.py
index 0ec5fd3..f7fdfcd 100644
--- a/map_machine/ui/cli.py
+++ b/map_machine/ui/cli.py
@@ -293,7 +293,7 @@ def add_render_arguments(parser: argparse.ArgumentParser) -> None:
type=float,
metavar="",
help="OSM zoom level",
- default=18,
+ default=18.0,
)
parser.add_argument(
"-c",
@@ -354,6 +354,7 @@ def progress_bar(
fill_length: int = int(parts / BOXES_LENGTH)
box: str = BOXES[int(parts - fill_length * BOXES_LENGTH)]
sys.stdout.write(
- f"{str(int(int(ratio * 1000) / 10)):>3} % {fill_length * '█'}{box}"
+ f"{str(int(int(ratio * 1000.0) / 10.0)):>3} % "
+ f"{fill_length * '█'}{box}"
f"{int(length - fill_length - 1) * ' '}▏{text}\n\033[F"
)
diff --git a/map_machine/util.py b/map_machine/util.py
index 62bd2b2..e92efd7 100644
--- a/map_machine/util.py
+++ b/map_machine/util.py
@@ -26,7 +26,7 @@ class MinMax:
def center(self) -> Any:
"""Get middle point between minimum and maximum."""
- return (self.min_ + self.max_) / 2
+ return (self.min_ + self.max_) / 2.0
def is_empty(self) -> bool:
"""Check if interval is empty."""
diff --git a/tests/test_completion.py b/tests/test_completion.py
index 6d33130..513adc3 100644
--- a/tests/test_completion.py
+++ b/tests/test_completion.py
@@ -5,5 +5,6 @@ from map_machine.ui.completion import completion_commands
def test_completion() -> None:
+ """Test Fish shell completion generation."""
commands: str = completion_commands()
assert commands.startswith("set -l")