mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Add culling exclusion zones display to the new map.
https://github.com/dcs-liberation/dcs_liberation/issues/2158
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
import { UnculledZone } from "../../api/liberationApi";
|
||||
import { selectUnculledZones } from "../../api/unculledZonesSlice";
|
||||
import { useAppSelector } from "../../app/hooks";
|
||||
import { LayerGroup, LayersControl, Circle } from "react-leaflet";
|
||||
|
||||
interface CullingExclusionCirclesProps {
|
||||
zones: UnculledZone[];
|
||||
}
|
||||
|
||||
const CullingExclusionCircles = (props: CullingExclusionCirclesProps) => {
|
||||
return (
|
||||
<>
|
||||
<LayerGroup>
|
||||
{props.zones.map((zone, idx) => {
|
||||
return (
|
||||
<Circle
|
||||
key={idx}
|
||||
center={zone.position}
|
||||
radius={zone.radius}
|
||||
color="#b4ff8c"
|
||||
fill={false}
|
||||
interactive={false}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</LayerGroup>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default function CullingExclusionZones() {
|
||||
const data = useAppSelector(selectUnculledZones).zones;
|
||||
var cez = <></>;
|
||||
|
||||
if (!data) {
|
||||
console.log("Empty response when loading culling exclusion zones");
|
||||
} else {
|
||||
cez = (
|
||||
<CullingExclusionCircles zones={data}></CullingExclusionCircles>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<LayersControl.Overlay name="Culling exclusion zones">
|
||||
{cez}
|
||||
</LayersControl.Overlay>
|
||||
);
|
||||
}
|
||||
1
client/src/components/cullingexclusionzones/index.ts
Normal file
1
client/src/components/cullingexclusionzones/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export { default } from "./CullingExclusionZones";
|
||||
@@ -18,6 +18,7 @@ import { useEffect, useRef } from "react";
|
||||
import { BasemapLayer } from "react-esri-leaflet";
|
||||
import { LayersControl, MapContainer, ScaleControl } from "react-leaflet";
|
||||
import Iadsnetworklayer from "../iadsnetworklayer";
|
||||
import CullingExclusionZones from "../cullingexclusionzones/CullingExclusionZones"
|
||||
import LeafletRuler from "../ruler/Ruler";
|
||||
|
||||
export default function LiberationMap() {
|
||||
@@ -109,6 +110,7 @@ export default function LiberationMap() {
|
||||
<NavMeshLayer blue={false} />
|
||||
</LayersControl.Overlay>
|
||||
<TerrainZonesLayers />
|
||||
<CullingExclusionZones />
|
||||
<WaypointDebugZonesControls />
|
||||
</LayersControl>
|
||||
</MapContainer>
|
||||
|
||||
Reference in New Issue
Block a user