mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Migrated "polygon" code to shapely
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import pickle
|
||||
|
||||
from dcs.mission import Mission
|
||||
from shapely import geometry
|
||||
|
||||
for terrain in ["cau", "nev", "syria", "channel", "normandy", "gulf"]:
|
||||
print("Terrain " + terrain)
|
||||
@@ -15,16 +16,16 @@ for terrain in ["cau", "nev", "syria", "channel", "normandy", "gulf"]:
|
||||
|
||||
if terrain == "cau" and inclusion_zones:
|
||||
# legacy
|
||||
exclusion_zones.append(zone)
|
||||
exclusion_zones.append(geometry.Polygon(zone))
|
||||
else:
|
||||
if plane_group.units[0].type == "F-15C":
|
||||
exclusion_zones.append(zone)
|
||||
exclusion_zones.append(geometry.Polygon(zone))
|
||||
else:
|
||||
inclusion_zones.append(zone)
|
||||
inclusion_zones.append(geometry.Polygon(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)
|
||||
seas_zones.append(geometry.Polygon(zone))
|
||||
|
||||
with open("../{}landmap.p".format(terrain), "wb") as f:
|
||||
print(len(inclusion_zones), len(exclusion_zones), len(seas_zones))
|
||||
|
||||
Reference in New Issue
Block a user