UNPKG

@tak-ps/node-cot

Version:

Lightweight JavaScript library for parsing and manipulating TAK messages

21 lines 665 B
import { Position, Polygon } from './types/feature.js'; import { SensorAttributes } from './types/types.js'; import { sector } from '@turf/sector'; export default class Sensor { center; sensor; constructor(center, sensor) { this.center = center; this.sensor = sensor; } to_geojson() { if (!this.sensor.range) return null; if (!this.sensor.azimuth) return null; if (!this.sensor.fov) return null; return sector(this.center, this.sensor.range / 1000, this.sensor.azimuth, this.sensor.azimuth + this.sensor.fov).geometry; } } //# sourceMappingURL=sensor.js.map