From 1adafac35f90d564322ce75fb5901e463803d5ea Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Sun, 13 Feb 2022 14:22:57 -0800 Subject: [PATCH] Make lines_to_leaflet tolerant of single lines. --- qt_ui/widgets/map/model/shapelyutil.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/qt_ui/widgets/map/model/shapelyutil.py b/qt_ui/widgets/map/model/shapelyutil.py index 5dec00e1..958e27fd 100644 --- a/qt_ui/widgets/map/model/shapelyutil.py +++ b/qt_ui/widgets/map/model/shapelyutil.py @@ -34,6 +34,10 @@ class ShapelyUtil: @classmethod def lines_to_leaflet( - cls, lines: MultiLineString, theater: ConflictTheater + cls, line_string: MultiLineString | LineString, theater: ConflictTheater ) -> list[list[LeafletLatLon]]: - return [cls.line_to_leaflet(line, theater) for line in lines.geoms] + if isinstance(line_string, MultiLineString): + lines = line_string.geoms + else: + lines = [line_string] + return [cls.line_to_leaflet(line, theater) for line in lines]