mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Migrate IP placement to WaypointSolver.
This commit is contained in:
@@ -1,96 +0,0 @@
|
||||
import { useGetDebugIpZonesQuery } from "../../api/liberationApi";
|
||||
import { LayerGroup, Polygon, Polyline } from "react-leaflet";
|
||||
|
||||
interface IpZonesProps {
|
||||
flightId: string;
|
||||
}
|
||||
|
||||
function IpZones(props: IpZonesProps) {
|
||||
const { data, error, isLoading } = useGetDebugIpZonesQuery({
|
||||
flightId: props.flightId,
|
||||
});
|
||||
|
||||
if (isLoading) {
|
||||
return <></>;
|
||||
}
|
||||
|
||||
if (error) {
|
||||
console.error("Error while loading waypoint IP zone info", error);
|
||||
return <></>;
|
||||
}
|
||||
|
||||
if (!data) {
|
||||
console.log("Waypoint IP zone returned empty response");
|
||||
return <></>;
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Polygon
|
||||
positions={data.homeBubble}
|
||||
color="#ffff00"
|
||||
fillOpacity={0.1}
|
||||
interactive={false}
|
||||
/>
|
||||
<Polygon
|
||||
positions={data.ipBubble}
|
||||
color="#bb89ff"
|
||||
fillOpacity={0.1}
|
||||
interactive={false}
|
||||
/>
|
||||
<Polygon
|
||||
positions={data.permissibleZone}
|
||||
color="#ffffff"
|
||||
fillOpacity={0.1}
|
||||
interactive={false}
|
||||
/>
|
||||
|
||||
{data.safeZones.map((zone, idx) => {
|
||||
return (
|
||||
<Polygon
|
||||
key={idx}
|
||||
positions={zone}
|
||||
color="#80BA80"
|
||||
fillOpacity={0.1}
|
||||
interactive={false}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
|
||||
{data.preferredThreatenedZones.map((zone, idx) => {
|
||||
return (
|
||||
<Polygon
|
||||
key={idx}
|
||||
positions={zone}
|
||||
color="#fe7d0a"
|
||||
fillOpacity={0.1}
|
||||
interactive={false}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
|
||||
{data.tolerableThreatenedLines.map((line, idx) => {
|
||||
return (
|
||||
<Polyline
|
||||
key={idx}
|
||||
positions={line}
|
||||
color="#80BA80"
|
||||
interactive={false}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
interface IpZonesLayerProps {
|
||||
flightId: string | null;
|
||||
}
|
||||
|
||||
export function IpZonesLayer(props: IpZonesLayerProps) {
|
||||
return (
|
||||
<LayerGroup>
|
||||
{props.flightId ? <IpZones flightId={props.flightId} /> : <></>}
|
||||
</LayerGroup>
|
||||
);
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
import { selectSelectedFlightId } from "../../api/flightsSlice";
|
||||
import { useAppSelector } from "../../app/hooks";
|
||||
import { HoldZonesLayer } from "./HoldZones";
|
||||
import { IpZonesLayer } from "./IpZones";
|
||||
import { JoinZonesLayer } from "./JoinZones";
|
||||
import { LayersControl } from "react-leaflet";
|
||||
|
||||
@@ -16,9 +15,6 @@ export function WaypointDebugZonesControls() {
|
||||
|
||||
return (
|
||||
<>
|
||||
<LayersControl.Overlay name="IP zones">
|
||||
<IpZonesLayer flightId={selectedFlightId} />
|
||||
</LayersControl.Overlay>
|
||||
<LayersControl.Overlay name="Join zones">
|
||||
<JoinZonesLayer flightId={selectedFlightId} />
|
||||
</LayersControl.Overlay>
|
||||
|
||||
Reference in New Issue
Block a user