This document outlines the unified heatmap architecture that consolidates all heatmap generation into a single, cohesive pipeline.
- Previously:
HeatmapTile(now renamed toHeatmapEngine) - Role: Core heatmap computation and rendering engine
- Key Features:
- Implements
HeatmapRendererinterface for pure data operations - Cache invalidation on
maxHeatchanges (fixed) - Uses shared
HeatmapMappingfor seam-safe coordinate conversion - Supports both color array and byte array output
- Maintains backward compatibility via deprecated
HeatmapTiletypealias
- Implements
- Architecture: All layers now extend
HeatmapTileProviderBaseand useHeatmapLayerSpec - Layers Using Unified Pipeline:
LocationHeatmapLayer(uses TileProviderV2)CellHeatmapLayerSpeedHeatmapLayerWifiHeatmapLayerWifiCountHeatmapLayer
- Benefits:
- Consistent neighborhood-based saturation harmonization
- Shared radius computation and stamp generation
- Unified quality scaling and performance management
- Single data query and aggregation path
- Location:
map/heatmap/creators/HeatmapTileData.kt - Features:
- Dynamic stamp providers for per-point customization
- Ambient stamp support for sparse data continuity
- Configurable padding and saturation overrides
- Pluggable render policies per layer
- Centralized Logic:
NormalizationPolicyhandles percentile selection and robust estimation - Per-Layer Customization:
RenderPolicyallows layers to customize blur and cutoff behavior - Harmonization: Neighborhood-based saturation override ensures consistent rendering across adjacent tiles
- HeatmapRenderer: Pure data interface for normalized arrays and color generation
- HeatmapBitmapAdapter: Android-specific bitmap handling for Google Maps integration
- Benefits: Enables non-Android rendering targets, easier testing, cleaner architecture
- HeatmapMapping: Seam-safe coordinate conversion (floor-epsilon approach)
- HeatmapStamp: Gaussian and other stamp generation
- BitmapPool: Memory-efficient bitmap management
- Renamed
HeatmapTile→HeatmapEnginewith backward compatibility - Updated all layer implementations to use
HeatmapEngine - Created
HeatmapRendererinterface for data/presentation separation - Added shared
HeatmapMappingutility - Fixed cache invalidation on
maxHeatchanges - Unified all layers to use
HeatmapTileProviderBase(already complete)
- Legacy
HeatmapTileProvider(no longer present in codebase) - Legacy
HeatmapTileCreator(no longer present in codebase) - Legacy
HeatmapLayerLogic(no longer present in codebase)
- Single Sort: Points sorted once by time and passed to
addAllSorted() - Cached Normalization: Render context cached until invalidated by data or parameter changes
- Bitmap Pooling: Consistent use of
BitmapPoolfor memory efficiency - Neighborhood Harmonization: 3x3 tile saturation override reduces visual discontinuities
- Consider moving Gaussian blur behind
RenderPolicyfor pluggable blur implementations - Potential for GPU-accelerated rendering via
HeatmapRendererinterface - Additional stamp types and dynamic sizing policies
- Quality-adaptive blur and normalization parameters