dcs-retribution/qt_ui/widgets/map/model/unculledzonejs.py
Dan Albert 1a9930b93a Remove our old lat/lon support code.
pydcs provides this now.
2022-02-22 17:40:35 -08:00

34 lines
922 B
Python

from __future__ import annotations
from typing import Iterator
from PySide2.QtCore import Property, QObject, Signal
from game import Game
from game.server.leaflet import LeafletLatLon
class UnculledZone(QObject):
positionChanged = Signal()
radiusChanged = Signal()
def __init__(self, position: LeafletLatLon, radius: float) -> None:
super().__init__()
self._position = position
self._radius = radius
@Property(list, notify=positionChanged)
def position(self) -> LeafletLatLon:
return self._position
@Property(float, notify=radiusChanged)
def radius(self) -> float:
return self._radius
@classmethod
def each_from_game(cls, game: Game) -> Iterator[UnculledZone]:
for zone in game.get_culling_zones():
yield UnculledZone(
zone.latlng().as_list(), game.settings.perf_culling_distance * 1000
)