Skip to content

Add Dynamic CoT to SIDC Mapping for Missing Icons#800

Open
Christian Elsen (chriselsen) wants to merge 7 commits intomainfrom
cot-to-sidc-mapping
Open

Add Dynamic CoT to SIDC Mapping for Missing Icons#800
Christian Elsen (chriselsen) wants to merge 7 commits intomainfrom
cot-to-sidc-mapping

Conversation

@chriselsen
Copy link
Copy Markdown
Contributor

@chriselsen Christian Elsen (chriselsen) commented Jul 30, 2025

Overview

This PR implements dynamic icon generation for CoT (Cursor on Target) types that have SIDC (Symbol Identification Coding) mappings. When the map encounters a missing icon, it now attempts to map the CoT type to a SIDC code and generate the appropriate military symbol on-demand.

Changes

Core Functionality

  • CoT to SIDC Mapping: New utility functions to map CoT types to SIDC codes
  • Dynamic Icon Generation: Enhanced styleimagemissing event handler to generate military symbols
  • Icon Source Detection: Utility functions to identify icon types and capabilities

Files Added

  • api/web/src/base/utils/cot-sidc-mapping.ts - Core mapping functionality
  • api/web/src/base/utils/icon-utils.ts - Icon utility functions
  • api/web/src/base/utils/__tests__/cot-sidc-mapping.test.ts - Comprehensive test coverage

Files Modified

  • api/web/src/stores/map.ts - Enhanced styleimagemissing handler
  • api/web/tsconfig.json - Added Vitest globals for testing

Benefits

  • Reduced Sprite Dependencies: Military symbols generated dynamically instead of requiring sprite assets
  • Better Icon Coverage: CoT types with SIDC mappings now display proper military symbols
  • Graceful Fallback: Unknown icons fall back to existing behavior
  • Performance: Icons generated once and cached by MapLibre

Testing

Added comprehensive test suite covering:

  • CoT to SIDC mapping functionality
  • Icon source type detection
  • SIDC code extraction
  • Dynamic generation capability detection

Fixes #799 : Civilian tug symbol, missing in sprite is being displayed.
image

Backward Compatibility

Fully backward compatible - existing icon handling remains unchanged, this only adds support for previously missing icons.

- Add CoT to SIDC mapping utility with comprehensive test coverage
- Enhance styleimagemissing handler to dynamically generate military symbols
- Add icon utility functions for source type detection and SIDC extraction
- Configure Vitest globals for testing infrastructure

Resolves missing military symbol icons by mapping CoT types to SIDC codes
and generating them on-demand using milsymbol library.
@codecov
Copy link
Copy Markdown

codecov bot commented Jul 30, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Correct expected SIDC code for 'a-f-G-U-C-I' from '10031000001211000000'
to '13060000121100000000000000000000' to match actual mapping function output.
Correct expected SIDC code for 'a-h-A-M-F-Q' from '01044000001211000000'
to '14010000121100000000000000000000' to match actual mapping function output.
@chriselsen Christian Elsen (chriselsen) added web-frontend-map Issues affecting the Vue.js web interface mapping Map display, layers, and geospatial features labels Aug 18, 2025
@chriselsen Christian Elsen (chriselsen) force-pushed the cot-to-sidc-mapping branch 2 times, most recently from 4e9eb03 to 50d0d36 Compare August 23, 2025 03:18
@chriselsen
Copy link
Copy Markdown
Contributor Author

Nick (@ingalls) We can close this in favor of just extending the sprite with missing icons.

These are the only icons that I see missing right now:

a-u-G-U-i-s a-h-G-U-i-s a-n-G-U-i-s a-f-G-U-i-s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mapping Map display, layers, and geospatial features web-frontend-map Issues affecting the Vue.js web interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: Sprite for MIL-STD-2525 iconset is missing surface/non military vessels (a-.-S-X)

1 participant