feat: Improve aircraft legend clarity and icon differentiation

Resolves issue #13 by implementing comprehensive aircraft legend improvements:

## New Features
- **Size-based aircraft icons**: Created distinct SVG icons for light, medium, large, and heavy aircraft with progressively larger visual representations
- **Visual aircraft icons in legend**: Replaced colored squares with actual aircraft silhouettes showing relative sizes and types
- **Enhanced categorization**: Added military category to legend and improved icon selection logic

## Improvements
- **Better differentiation**: Each weight class now has a unique icon shape, not just color
- **Accurate ADS-B mapping**: Icons correctly map to decoded ADS-B emitter categories
- **Clearer legend display**: Users can now see actual aircraft shapes instead of generic colored rectangles

## Technical Changes
- Created 4 new SVG icons: light.svg, medium.svg, large.svg, heavy.svg
- Updated legend HTML to embed aircraft SVG icons inline
- Enhanced JavaScript logic to better match categories to appropriate icon types
- Simplified color mapping function for cleaner code

This addresses the original concerns about confusing legend entries and lack of visual differentiation between aircraft types.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Ole-Morten Duesund 2025-09-01 09:57:39 +02:00
commit 7461d881cf
7 changed files with 276 additions and 64 deletions

View file

@ -331,60 +331,48 @@ export class AircraftManager {
}
getAircraftIconType(aircraft) {
// For icon selection, we still need basic categories
// This determines which SVG shape to use
// For icon selection, determine which SVG shape to use based on category
if (aircraft.OnGround) return 'ground';
if (aircraft.Category) {
const cat = aircraft.Category.toLowerCase();
// Map to basic icon types for visual representation
// Specialized aircraft types
if (cat.includes('helicopter') || cat.includes('rotorcraft')) return 'helicopter';
if (cat.includes('military') || cat.includes('fighter') || cat.includes('bomber')) return 'military';
if (cat.includes('cargo') || cat.includes('heavy') || cat.includes('super')) return 'cargo';
if (cat.includes('light') || cat.includes('glider') || cat.includes('ultralight')) return 'ga';
if (cat.includes('glider') || cat.includes('ultralight')) return 'ga';
// Weight-based categories with specific icons
if (cat.includes('light') && cat.includes('7000')) return 'light';
if (cat.includes('medium') && cat.includes('7000-34000')) return 'medium';
if (cat.includes('large') && cat.includes('34000-136000')) return 'large';
if (cat.includes('heavy') && cat.includes('136000')) return 'heavy';
if (cat.includes('high vortex')) return 'large'; // Use large icon for high vortex
// Fallback category matching
if (cat.includes('heavy') || cat.includes('super')) return 'heavy';
if (cat.includes('large')) return 'large';
if (cat.includes('medium')) return 'medium';
if (cat.includes('light')) return 'light';
}
// Default commercial icon for everything else
return 'commercial';
// Default to medium icon for unknown aircraft
return 'medium';
}
getAircraftColor(type, aircraft) {
// Special colors for specific types
if (type === 'military') return '#ff4444';
if (type === 'helicopter') return '#ff00ff';
if (type === 'ground') return '#888888';
if (type === 'ga') return '#ffff00';
// For commercial and cargo types, use weight-based colors
if (aircraft && aircraft.Category) {
const cat = aircraft.Category.toLowerCase();
// Check for specific weight ranges in the category string
// Light aircraft (< 7000kg) - Sky blue
if (cat.includes('light')) {
return '#00bfff';
}
// Medium aircraft (7000-34000kg) - Green
if (cat.includes('medium')) {
return '#00ff88';
}
// High Vortex Large - Red-orange (special wake turbulence category)
if (cat.includes('high vortex')) {
return '#ff4500';
}
// Large aircraft (34000-136000kg) - Orange
if (cat.includes('large')) {
return '#ff8c00';
}
// Heavy aircraft (> 136000kg) - Red
if (cat.includes('heavy') || cat.includes('super')) {
return '#ff0000';
}
// Color mapping based on aircraft type/size
switch (type) {
case 'military': return '#ff4444'; // Red-orange for military
case 'helicopter': return '#ff00ff'; // Magenta for helicopters
case 'ground': return '#888888'; // Gray for ground vehicles
case 'ga': return '#ffff00'; // Yellow for general aviation
case 'light': return '#00bfff'; // Sky blue for light aircraft
case 'medium': return '#00ff88'; // Green for medium aircraft
case 'large': return '#ff8c00'; // Orange for large aircraft
case 'heavy': return '#ff0000'; // Red for heavy aircraft
default: return '#00ff88'; // Default green for unknown
}
// Default to green for unknown commercial aircraft
return '#00ff88';
}