Update pydcs, adapt to new Point APIs.

This is briefly moving us over to my fork of pydcs while we wait for
https://github.com/pydcs/dcs/pull/206 to be merged. The adaptation is
invasive enough that I don't want it lingering for long.
This commit is contained in:
Dan Albert
2022-02-21 18:14:49 -08:00
parent ff12b37431
commit 9e2e4ffa74
29 changed files with 155 additions and 186 deletions

View File

@@ -4,7 +4,7 @@ from typing import TYPE_CHECKING
import shapely.ops
from dcs import Point
from shapely.geometry import Point as ShapelyPoint, Polygon, MultiPolygon
from shapely.geometry import MultiPolygon, Point as ShapelyPoint, Polygon
from game.utils import nautical_miles
@@ -29,6 +29,7 @@ class HoldZoneGeometry:
coalition: Coalition,
theater: ConflictTheater,
) -> None:
self._target = target
# Hold points are placed one of two ways. Either approach guarantees:
#
# * Safe hold point.
@@ -105,4 +106,4 @@ class HoldZoneGeometry:
hold, _ = shapely.ops.nearest_points(self.permissible_zones, self.home)
else:
hold, _ = shapely.ops.nearest_points(self.preferred_lines, self.join)
return Point(hold.x, hold.y)
return self._target.new_in_same_map(hold.x, hold.y)