mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Draw front lines on the react map.
https://github.com/dcs-liberation/dcs_liberation/issues/2039
This commit is contained in:
14
client/src/components/frontline/FrontLine.tsx
Normal file
14
client/src/components/frontline/FrontLine.tsx
Normal file
@@ -0,0 +1,14 @@
|
||||
import { FrontLine as FrontLineModel } from "../../api/frontline";
|
||||
import { Polyline } from "react-leaflet";
|
||||
|
||||
interface FrontLineProps {
|
||||
front: FrontLineModel;
|
||||
}
|
||||
|
||||
function FrontLine(props: FrontLineProps) {
|
||||
return (
|
||||
<Polyline positions={props.front.extents} weight={8} color={"#fe7d0a"} />
|
||||
);
|
||||
}
|
||||
|
||||
export default FrontLine;
|
||||
1
client/src/components/frontline/index.ts
Normal file
1
client/src/components/frontline/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export { default } from "./FrontLine";
|
||||
15
client/src/components/frontlineslayer/FrontLinesLayer.tsx
Normal file
15
client/src/components/frontlineslayer/FrontLinesLayer.tsx
Normal file
@@ -0,0 +1,15 @@
|
||||
import FrontLine from "../frontline";
|
||||
import { LayerGroup } from "react-leaflet";
|
||||
import { selectFrontLines } from "../../api/frontLinesSlice";
|
||||
import { useAppSelector } from "../../app/hooks";
|
||||
|
||||
export default function SupplyRoutesLayer() {
|
||||
const fronts = useAppSelector(selectFrontLines).fronts;
|
||||
return (
|
||||
<LayerGroup>
|
||||
{fronts.map((front, idx) => {
|
||||
return <FrontLine key={idx} front={front} />;
|
||||
})}
|
||||
</LayerGroup>
|
||||
);
|
||||
}
|
||||
1
client/src/components/frontlineslayer/index.ts
Normal file
1
client/src/components/frontlineslayer/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export { default } from "./FrontLinesLayer";
|
||||
@@ -6,6 +6,7 @@ import AirDefenseRangeLayer from "../airdefenserangelayer";
|
||||
import { BasemapLayer } from "react-esri-leaflet";
|
||||
import ControlPointsLayer from "../controlpointslayer";
|
||||
import FlightPlansLayer from "../flightplanslayer";
|
||||
import FrontLinesLayer from "../frontlineslayer";
|
||||
import { LatLng } from "leaflet";
|
||||
import SupplyRoutesLayer from "../supplyrouteslayer";
|
||||
import { TgoType } from "../../api/tgo";
|
||||
@@ -42,6 +43,9 @@ export default function LiberationMap(props: GameProps) {
|
||||
<LayersControl.Overlay name="Supply routes" checked>
|
||||
<SupplyRoutesLayer />
|
||||
</LayersControl.Overlay>
|
||||
<LayersControl.Overlay name="Front lines" checked>
|
||||
<FrontLinesLayer />
|
||||
</LayersControl.Overlay>
|
||||
<LayersControl.Overlay name="Enemy SAM threat range" checked>
|
||||
<AirDefenseRangeLayer blue={false} />
|
||||
</LayersControl.Overlay>
|
||||
|
||||
Reference in New Issue
Block a user