mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
It would probably be more accurate to have the icon based on the
aircraft type and use the modifier to indicate the mission, but this
will do for now (I also might have that backwards, I can't find the
guidance because it's in STANAG 1241 which isn't free).
I also increased the icon size a bit in the UI because the longest icon
text ("SEAD") was hard to read.
33 lines
680 B
TypeScript
33 lines
680 B
TypeScript
import { Flight } from "../../api/liberationApi";
|
|
import { Icon, Point } from "leaflet";
|
|
import { Symbol } from "milsymbol";
|
|
import { Marker } from "react-leaflet";
|
|
|
|
function iconForFlight(flight: Flight) {
|
|
const symbol = new Symbol(flight.sidc, {
|
|
size: 20,
|
|
});
|
|
|
|
return new Icon({
|
|
iconUrl: symbol.toDataURL(),
|
|
iconAnchor: new Point(symbol.getAnchor().x, symbol.getAnchor().y),
|
|
});
|
|
}
|
|
|
|
interface AircraftProps {
|
|
flight: Flight;
|
|
}
|
|
|
|
export default function Aircraft(props: AircraftProps) {
|
|
if (!props.flight.position) {
|
|
return <></>;
|
|
}
|
|
|
|
return (
|
|
<Marker
|
|
position={props.flight.position}
|
|
icon={iconForFlight(props.flight)}
|
|
/>
|
|
);
|
|
}
|