mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Supply route styling, line weight rebalancing.
This commit is contained in:
parent
1a65b1affb
commit
3e01953a3a
@ -158,14 +158,37 @@ class GroundObjectJs(QObject):
|
|||||||
|
|
||||||
|
|
||||||
class SupplyRouteJs(QObject):
|
class SupplyRouteJs(QObject):
|
||||||
def __init__(self, points: List[LeafletLatLon]) -> None:
|
def __init__(
|
||||||
|
self,
|
||||||
|
a: ControlPoint,
|
||||||
|
b: ControlPoint,
|
||||||
|
points: List[LeafletLatLon],
|
||||||
|
sea_route: bool,
|
||||||
|
) -> None:
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
self.control_point_a = a
|
||||||
|
self.control_point_b = b
|
||||||
self._points = points
|
self._points = points
|
||||||
|
self.sea_route = sea_route
|
||||||
|
|
||||||
@Property(list)
|
@Property(list)
|
||||||
def points(self) -> List[LeafletLatLon]:
|
def points(self) -> List[LeafletLatLon]:
|
||||||
return self._points
|
return self._points
|
||||||
|
|
||||||
|
@Property(bool)
|
||||||
|
def frontActive(self) -> bool:
|
||||||
|
if self.sea_route:
|
||||||
|
return False
|
||||||
|
return self.control_point_a.front_is_active(self.control_point_b)
|
||||||
|
|
||||||
|
@Property(bool)
|
||||||
|
def isSea(self) -> bool:
|
||||||
|
return self.sea_route
|
||||||
|
|
||||||
|
@Property(bool)
|
||||||
|
def blue(self) -> bool:
|
||||||
|
return self.control_point_a.captured
|
||||||
|
|
||||||
|
|
||||||
class WaypointJs(QObject):
|
class WaypointJs(QObject):
|
||||||
def __init__(
|
def __init__(
|
||||||
@ -400,10 +423,13 @@ class MapModel(QObject):
|
|||||||
continue
|
continue
|
||||||
self._supply_routes.append(
|
self._supply_routes.append(
|
||||||
SupplyRouteJs(
|
SupplyRouteJs(
|
||||||
|
control_point,
|
||||||
|
destination,
|
||||||
[
|
[
|
||||||
self.leaflet_coord_for(p, self.game.theater)
|
self.leaflet_coord_for(p, self.game.theater)
|
||||||
for p in convoy_route
|
for p in convoy_route
|
||||||
]
|
],
|
||||||
|
sea_route=False,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
for destination, shipping_lane in control_point.shipping_lanes.items():
|
for destination, shipping_lane in control_point.shipping_lanes.items():
|
||||||
@ -412,10 +438,13 @@ class MapModel(QObject):
|
|||||||
if control_point.is_friendly(destination.captured):
|
if control_point.is_friendly(destination.captured):
|
||||||
self._supply_routes.append(
|
self._supply_routes.append(
|
||||||
SupplyRouteJs(
|
SupplyRouteJs(
|
||||||
|
control_point,
|
||||||
|
destination,
|
||||||
[
|
[
|
||||||
self.leaflet_coord_for(p, self.game.theater)
|
self.leaflet_coord_for(p, self.game.theater)
|
||||||
for p in shipping_lane
|
for p in shipping_lane
|
||||||
]
|
],
|
||||||
|
sea_route=True,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
self.supplyRoutesChanged.emit()
|
self.supplyRoutesChanged.emit()
|
||||||
|
|||||||
@ -148,7 +148,7 @@ function drawSamThreatsAt(tgo) {
|
|||||||
radius: range,
|
radius: range,
|
||||||
color: detectionColor,
|
color: detectionColor,
|
||||||
fill: false,
|
fill: false,
|
||||||
weight: 2,
|
weight: 1,
|
||||||
}).addTo(detectionLayer);
|
}).addTo(detectionLayer);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -157,7 +157,7 @@ function drawSamThreatsAt(tgo) {
|
|||||||
radius: range,
|
radius: range,
|
||||||
color: threatColor,
|
color: threatColor,
|
||||||
fill: false,
|
fill: false,
|
||||||
weight: 2,
|
weight: 1,
|
||||||
}).addTo(threatLayer);
|
}).addTo(threatLayer);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -185,7 +185,18 @@ function drawGroundObjects() {
|
|||||||
function drawSupplyRoutes() {
|
function drawSupplyRoutes() {
|
||||||
supplyRoutesLayer.clearLayers();
|
supplyRoutesLayer.clearLayers();
|
||||||
game.supplyRoutes.forEach((route) => {
|
game.supplyRoutes.forEach((route) => {
|
||||||
L.polyline(route.points).addTo(supplyRoutesLayer);
|
var color;
|
||||||
|
if (route.frontActive) {
|
||||||
|
color = Colors.Red;
|
||||||
|
} else if (route.blue) {
|
||||||
|
color = "#2d3e50";
|
||||||
|
} else {
|
||||||
|
color = "#8c1414";
|
||||||
|
}
|
||||||
|
L.polyline(route.points, {
|
||||||
|
color: color,
|
||||||
|
weight: route.isSea ? 4 : 6,
|
||||||
|
}).addTo(supplyRoutesLayer);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -217,11 +228,12 @@ function drawFlightPlan(flight) {
|
|||||||
.addTo(selectedFlightPlansLayer);
|
.addTo(selectedFlightPlansLayer);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (flight.selected) {
|
if (flight.selected) {
|
||||||
L.polyline(points, { color: highlight }).addTo(selectedFlightPlansLayer);
|
L.polyline(points, { color: highlight }).addTo(selectedFlightPlansLayer);
|
||||||
L.polyline(points, { color: highlight }).addTo(layer);
|
L.polyline(points, { color: highlight }).addTo(layer);
|
||||||
} else {
|
} else {
|
||||||
L.polyline(points, { color: color }).addTo(layer);
|
L.polyline(points, { color: color, weight: 1 }).addTo(layer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user