Added sea zones for each map, and display it in polygon map mode.

This commit is contained in:
Khopa 2020-10-14 23:21:16 +02:00
parent 883a66a792
commit bc825f760d
14 changed files with 16 additions and 4 deletions

View File

@ -40,6 +40,7 @@ COLORS: Dict[str, QColor] = {
"light_blue": QColor(105, 182, 240, 90), "light_blue": QColor(105, 182, 240, 90),
"blue": QColor(0, 132, 255), "blue": QColor(0, 132, 255),
"dark_blue": QColor(45, 62, 80), "dark_blue": QColor(45, 62, 80),
"sea_blue": QColor(52, 68, 85),
"blue_transparent": QColor(0, 132, 255, 20), "blue_transparent": QColor(0, 132, 255, 20),
"purple": QColor(187, 137, 255), "purple": QColor(187, 137, 255),

View File

@ -507,6 +507,11 @@ class QLiberationMap(QGraphicsView):
# Polygon display mode # Polygon display mode
if self.game.theater.landmap is not None: if self.game.theater.landmap is not None:
for sea_zone in self.game.theater.landmap[2]:
print(sea_zone)
poly = QPolygonF([QPointF(*self._transform_point(Point(point[0], point[1]))) for point in sea_zone])
scene.addPolygon(poly, CONST.COLORS["sea_blue"], CONST.COLORS["sea_blue"])
for inclusion_zone in self.game.theater.landmap[0]: for inclusion_zone in self.game.theater.landmap[0]:
poly = QPolygonF([QPointF(*self._transform_point(Point(point[0], point[1]))) for point in inclusion_zone]) poly = QPolygonF([QPointF(*self._transform_point(Point(point[0], point[1]))) for point in inclusion_zone])
scene.addPolygon(poly, CONST.COLORS["grey"], CONST.COLORS["dark_grey"]) scene.addPolygon(poly, CONST.COLORS["grey"], CONST.COLORS["dark_grey"])
@ -516,3 +521,5 @@ class QLiberationMap(QGraphicsView):
scene.addPolygon(poly, CONST.COLORS["grey"], CONST.COLORS["dark_dark_grey"]) scene.addPolygon(poly, CONST.COLORS["grey"], CONST.COLORS["dark_dark_grey"])

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,15 +1,15 @@
import pickle import pickle
from dcs.mission import Mission from dcs.mission import Mission
from dcs.planes import A_10C
for terrain in ["cau"]: for terrain in ["cau", "nev", "syria", "channel", "normandy", "gulf"]:
print("Terrain " + terrain) print("Terrain " + terrain)
m = Mission() m = Mission()
m.load_file("./{}_terrain.miz".format(terrain)) m.load_file("./{}_terrain.miz".format(terrain))
inclusion_zones = [] inclusion_zones = []
exclusion_zones = [] exclusion_zones = []
seas_zones = []
for plane_group in m.country("USA").plane_group: for plane_group in m.country("USA").plane_group:
zone = [(x.position.x, x.position.y) for x in plane_group.points] zone = [(x.position.x, x.position.y) for x in plane_group.points]
@ -22,6 +22,10 @@ for terrain in ["cau"]:
else: else:
inclusion_zones.append(zone) inclusion_zones.append(zone)
for ship_group in m.country("USA").ship_group:
zone = [(x.position.x, x.position.y) for x in ship_group.points]
seas_zones.append(zone)
with open("../{}landmap.p".format(terrain), "wb") as f: with open("../{}landmap.p".format(terrain), "wb") as f:
print(len(inclusion_zones), len(exclusion_zones)) print(len(inclusion_zones), len(exclusion_zones), len(seas_zones))
pickle.dump((inclusion_zones, exclusion_zones), f) pickle.dump((inclusion_zones, exclusion_zones, seas_zones), f)

Binary file not shown.

Binary file not shown.

Binary file not shown.