Move front lines out of MapModel.

This commit is contained in:
Dan Albert
2022-03-03 01:52:53 -08:00
parent 89b987fc87
commit ccb510fe47
20 changed files with 252 additions and 87 deletions

View File

@@ -1,32 +0,0 @@
from __future__ import annotations
from typing import List
from PySide2.QtCore import Property, QObject, Signal, Slot
from game.server.leaflet import LeafletLatLon
from game.theater import FrontLine
from game.utils import nautical_miles
from qt_ui.dialogs import Dialog
class FrontLineJs(QObject):
extentsChanged = Signal()
def __init__(self, front_line: FrontLine) -> None:
super().__init__()
self.front_line = front_line
@Property(list, notify=extentsChanged)
def extents(self) -> List[LeafletLatLon]:
a = self.front_line.position.point_from_heading(
self.front_line.attack_heading.right.degrees, nautical_miles(2).meters
).latlng()
b = self.front_line.position.point_from_heading(
self.front_line.attack_heading.left.degrees, nautical_miles(2).meters
).latlng()
return [a.as_list(), b.as_list()]
@Slot()
def showPackageDialog(self) -> None:
Dialog.open_new_package_dialog(self.front_line)