SXXXXXXX_FlightMonitor/flightmonitor/map/map_constants.py
2025-05-27 07:33:08 +02:00

69 lines
2.4 KiB
Python

# flightmonitor/map/map_constants.py
"""
Constants related to map drawing, appearance, and behavior.
"""
from typing import Optional, Tuple
# --- Map Drawing Colors and Styles ---
# Colors for drawing boundaries on the map.
DEM_BOUNDARY_COLOR: str = "red"
DEM_BOUNDARY_THICKNESS_PX: int = 3
AREA_BOUNDARY_COLOR: str = "blue"
AREA_BOUNDARY_THICKNESS_PX: int = 2
# Colors for text labels drawn on tiles (e.g., DEM tile names).
TILE_TEXT_COLOR: str = "white"
# Use RGBA for transparency in background if supported by PIL/ImageDraw
TILE_TEXT_BG_COLOR: str = "rgba(0, 0, 0, 150)" # Semi-transparent black background
# --- Map Labeling Constants ---
# Base font size for map tile labels and the corresponding zoom level.
# Font size will be scaled based on the current map zoom relative to this base zoom.
DEM_TILE_LABEL_BASE_FONT_SIZE: int = 12
DEM_TILE_LABEL_BASE_ZOOM: int = 10
# Optional: Default font path for drawing text.
# If None, ImageFont.load_default() will be used as the primary font source.
# If a path is provided, MapCanvasManager/map_drawing might attempt to load
# a TrueType font from this path, falling back to default if it fails.
# Example: DEFAULT_LABEL_FONT_PATH = "/path/to/your/font.ttf"
DEFAULT_LABEL_FONT_PATH: Optional[str] = None
# --- Map Behavior Constants ---
# Default zoom level when the map is initialized or reset if no BBox is set.
DEFAULT_INITIAL_ZOOM: int = 7
# Minimum and maximum allowed zoom levels for interactive pan/zoom.
MIN_ZOOM_LEVEL: int = 0
# Note: Max zoom is often determined by the map tile service,
# this provides a fallback/hard limit if service info isn't available.
DEFAULT_MAX_ZOOM_FALLBACK: int = 19
# --- Placeholders and Fallbacks ---
# Default color for placeholder tile images when a tile cannot be loaded.
DEFAULT_PLACEHOLDER_COLOR_RGB: Tuple[int, int, int] = (220, 220, 220) # Light grey
# --- Map Information Panel Formatting ---
# Number of decimal places to display for coordinates in the info panel.
COORDINATE_DECIMAL_PLACES: int = 5
# MODIFIED: Add constant for decimal places for map size in km.
# WHY: Centralize formatting constant for map info panel.
# HOW: Added the constant.
MAP_SIZE_KM_DECIMAL_PLACES: int = 1 # Number of decimal places for map size in km.
# Define standard degree, minute, second symbols for DMS formatting
DMS_DEGREE_SYMBOL: str = "°"
DMS_MINUTE_SYMBOL: str = "'"
DMS_SECOND_SYMBOL: str = "''"