164 lines
8.6 KiB
JavaScript
164 lines
8.6 KiB
JavaScript
"use strict";
|
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
};
|
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
};
|
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
};
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.TacticalController = void 0;
|
|
const common_1 = require("@nestjs/common");
|
|
const swagger_1 = require("@nestjs/swagger");
|
|
const api_key_guard_1 = require("../common/guards/api-key.guard");
|
|
const rate_limiter_guard_1 = require("../common/guards/rate-limiter.guard");
|
|
const line_of_sight_dto_1 = require("./dto/line-of-sight.dto");
|
|
const tactical_dto_1 = require("./dto/tactical.dto");
|
|
const tactical_service_1 = require("./tactical.service");
|
|
let TacticalController = class TacticalController {
|
|
tacticalService;
|
|
constructor(tacticalService) {
|
|
this.tacticalService = tacticalService;
|
|
}
|
|
async getLineOfSight(query) {
|
|
const { observerLat, observerLng, targetLat, targetLng, observerHeight = 2, targetHeight = 2, samples, stepMeters, compact = false, } = query;
|
|
if (observerLat == null || observerLng == null || targetLat == null || targetLng == null) {
|
|
throw new common_1.HttpException('Missing required parameters: observerLat, observerLng, targetLat, targetLng', common_1.HttpStatus.BAD_REQUEST);
|
|
}
|
|
return this.tacticalService.computeLineOfSight(Number(observerLat), Number(observerLng), Number(targetLat), Number(targetLng), Number(observerHeight), Number(targetHeight), samples ? Number(samples) : undefined, stepMeters ? Number(stepMeters) : undefined, Boolean(compact));
|
|
}
|
|
async getLosAlias(query) {
|
|
return this.getLineOfSight(query);
|
|
}
|
|
async postLineOfSight(body) {
|
|
const obsLat = body.observer?.lat ?? body.observerLat;
|
|
const obsLng = body.observer?.lng ?? body.observerLng;
|
|
const obsHeight = body.observer?.height ?? body.observerHeight ?? 2;
|
|
const tgtLat = body.target?.lat ?? body.targetLat;
|
|
const tgtLng = body.target?.lng ?? body.targetLng;
|
|
const tgtHeight = body.target?.height ?? body.targetHeight ?? 2;
|
|
const samples = body.samples;
|
|
const stepMeters = body.stepMeters;
|
|
const compact = body.compact ?? false;
|
|
if (obsLat == null || obsLng == null || tgtLat == null || tgtLng == null) {
|
|
throw new common_1.HttpException('Missing required parameters: observer coordinates (lat, lng) and target coordinates (lat, lng)', common_1.HttpStatus.BAD_REQUEST);
|
|
}
|
|
return this.tacticalService.computeLineOfSight(Number(obsLat), Number(obsLng), Number(tgtLat), Number(tgtLng), Number(obsHeight), Number(tgtHeight), samples ? Number(samples) : undefined, stepMeters ? Number(stepMeters) : undefined, Boolean(compact));
|
|
}
|
|
async postLosAlias(body) {
|
|
return this.postLineOfSight(body);
|
|
}
|
|
async calculateArtilleryFireMission(dto) {
|
|
return this.tacticalService.calculateArtilleryFireMission(dto);
|
|
}
|
|
async assessHLZ(lat, lng, radius) {
|
|
const latNum = parseFloat(lat || '31.95');
|
|
const lngNum = parseFloat(lng || '35.93');
|
|
const radiusNum = parseFloat(radius || '3000');
|
|
return this.tacticalService.assessHelicopterLandingZones(latNum, lngNum, radiusNum);
|
|
}
|
|
async saveScenario(body) {
|
|
return this.tacticalService.saveScenario(body.name || 'default', body.symbols || []);
|
|
}
|
|
async getScenario(name) {
|
|
return this.tacticalService.getScenario(name || 'default');
|
|
}
|
|
};
|
|
exports.TacticalController = TacticalController;
|
|
__decorate([
|
|
(0, common_1.Get)('line-of-sight'),
|
|
(0, swagger_1.ApiOperation)({
|
|
summary: 'Calculate Tactical Line of Sight & Intervisibility (تبادل الرؤية العسكري)',
|
|
description: 'Calculates line of sight between Observer (Point A) and Target (Point B) accounting for elevation profile, Earth curvature, atmospheric refraction, dead ground, and obstacle penetration.',
|
|
}),
|
|
__param(0, (0, common_1.Query)()),
|
|
__metadata("design:type", Function),
|
|
__metadata("design:paramtypes", [line_of_sight_dto_1.LineOfSightQueryDto]),
|
|
__metadata("design:returntype", Promise)
|
|
], TacticalController.prototype, "getLineOfSight", null);
|
|
__decorate([
|
|
(0, common_1.Get)('los'),
|
|
(0, swagger_1.ApiOperation)({ summary: 'Alias for line-of-sight GET' }),
|
|
__param(0, (0, common_1.Query)()),
|
|
__metadata("design:type", Function),
|
|
__metadata("design:paramtypes", [line_of_sight_dto_1.LineOfSightQueryDto]),
|
|
__metadata("design:returntype", Promise)
|
|
], TacticalController.prototype, "getLosAlias", null);
|
|
__decorate([
|
|
(0, common_1.Post)('line-of-sight'),
|
|
(0, swagger_1.ApiOperation)({
|
|
summary: 'Calculate Tactical Line of Sight via POST JSON body',
|
|
description: 'Accepts structured observer and target objects or flat coordinate keys.',
|
|
}),
|
|
__param(0, (0, common_1.Body)()),
|
|
__metadata("design:type", Function),
|
|
__metadata("design:paramtypes", [line_of_sight_dto_1.LineOfSightBodyDto]),
|
|
__metadata("design:returntype", Promise)
|
|
], TacticalController.prototype, "postLineOfSight", null);
|
|
__decorate([
|
|
(0, common_1.Post)('los'),
|
|
(0, swagger_1.ApiOperation)({ summary: 'Alias for line-of-sight POST' }),
|
|
__param(0, (0, common_1.Body)()),
|
|
__metadata("design:type", Function),
|
|
__metadata("design:paramtypes", [line_of_sight_dto_1.LineOfSightBodyDto]),
|
|
__metadata("design:returntype", Promise)
|
|
], TacticalController.prototype, "postLosAlias", null);
|
|
__decorate([
|
|
(0, common_1.Post)('artillery-fire-mission'),
|
|
(0, swagger_1.ApiOperation)({
|
|
summary: 'Calculate Artillery Fire Mission & Ballistic Trajectory / حساب رماية المدفعية ومسار القذيفة',
|
|
}),
|
|
__param(0, (0, common_1.Body)()),
|
|
__metadata("design:type", Function),
|
|
__metadata("design:paramtypes", [tactical_dto_1.ArtilleryMissionRequestDto]),
|
|
__metadata("design:returntype", Promise)
|
|
], TacticalController.prototype, "calculateArtilleryFireMission", null);
|
|
__decorate([
|
|
(0, common_1.Get)('hlz-assessment'),
|
|
(0, swagger_1.ApiOperation)({
|
|
summary: 'Assess Helicopter Landing Zones (HLZ) & MEDEVAC / كشف صلاحية مهابط المروحيات والإخلاء الطبي',
|
|
}),
|
|
__param(0, (0, common_1.Query)('lat')),
|
|
__param(1, (0, common_1.Query)('lng')),
|
|
__param(2, (0, common_1.Query)('radius')),
|
|
__metadata("design:type", Function),
|
|
__metadata("design:paramtypes", [String, String, String]),
|
|
__metadata("design:returntype", Promise)
|
|
], TacticalController.prototype, "assessHLZ", null);
|
|
__decorate([
|
|
(0, common_1.Post)('scenarios'),
|
|
(0, swagger_1.ApiOperation)({
|
|
summary: 'Save tactical symbols scenario / حفظ سيناريو الرموز التكتيكية',
|
|
}),
|
|
__param(0, (0, common_1.Body)()),
|
|
__metadata("design:type", Function),
|
|
__metadata("design:paramtypes", [tactical_dto_1.SaveScenarioDto]),
|
|
__metadata("design:returntype", Promise)
|
|
], TacticalController.prototype, "saveScenario", null);
|
|
__decorate([
|
|
(0, common_1.Get)('scenarios'),
|
|
(0, swagger_1.ApiOperation)({
|
|
summary: 'Get saved tactical symbols scenario / استرجاع سيناريو الرموز التكتيكية',
|
|
}),
|
|
__param(0, (0, common_1.Query)('name')),
|
|
__metadata("design:type", Function),
|
|
__metadata("design:paramtypes", [String]),
|
|
__metadata("design:returntype", Promise)
|
|
], TacticalController.prototype, "getScenario", null);
|
|
exports.TacticalController = TacticalController = __decorate([
|
|
(0, swagger_1.ApiTags)('tactical'),
|
|
(0, swagger_1.ApiHeader)({
|
|
name: 'x-api-key',
|
|
description: 'Multi-tenant API Key for Intaleq Maps SaaS',
|
|
required: true,
|
|
}),
|
|
(0, common_1.Controller)('tactical'),
|
|
(0, common_1.UseGuards)(api_key_guard_1.ApiKeyGuard, rate_limiter_guard_1.TenantThrottlerGuard),
|
|
__metadata("design:paramtypes", [tactical_service_1.TacticalService])
|
|
], TacticalController);
|
|
//# sourceMappingURL=tactical.controller.js.map
|