From 6d84235ceb4cc89bf7b047cf1772d7c9c8e7ffb0 Mon Sep 17 00:00:00 2001 From: Masashi Katsumata Date: Tue, 10 Nov 2026 16:16:50 -0800 Subject: [PATCH 1/2] Support bulk Circles with raster tiles --- .../tomtom/TomTomMapViewControllerRaster.kt | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/mapconductor/tomtom/TomTomMapViewControllerRaster.kt b/src/main/java/com/mapconductor/tomtom/TomTomMapViewControllerRaster.kt index e586846..9a095a0 100644 --- a/src/main/java/com/mapconductor/tomtom/TomTomMapViewControllerRaster.kt +++ b/src/main/java/com/mapconductor/tomtom/TomTomMapViewControllerRaster.kt @@ -1,5 +1,7 @@ package com.mapconductor.tomtom +import com.mapconductor.core.circle.CIRCLE_TILE_LAYER_ID +import com.mapconductor.core.circle.CircleTiler import com.mapconductor.core.polygon.POLYGON_TILE_LAYER_ID import com.mapconductor.core.polygon.PolygonTiler import com.mapconductor.core.polyline.POLYLINE_TILE_LAYER_ID @@ -73,6 +75,16 @@ fun TomTomMapViewController.setupMarkerTileRaster( } } } + circleController.tiler = + CircleTiler().apply { + onTemplate = { template, tileSize -> + if (template != null) { + upsertRasterLayer(CIRCLE_TILE_LAYER_ID, template, 1.0, tileSize, null, null) + } else { + removeRasterLayer(CIRCLE_TILE_LAYER_ID) + } + } + } } internal suspend fun TomTomMapViewController.applyPublicRasterLayer(state: RasterLayerState) { @@ -132,12 +144,13 @@ internal suspend fun TomTomMapViewController.applyComposedStyle() { val (markerTiles, others) = composedRasterLayers.values.partition { it.id == TomTomMapViewController.MARKER_RASTER_ID } val (polylineTiles, rest) = others.partition { it.id == POLYLINE_TILE_LAYER_ID } - val (polygonTiles, appRasters) = rest.partition { it.id == POLYGON_TILE_LAYER_ID } + val (circleTiles, remaining) = rest.partition { it.id == CIRCLE_TILE_LAYER_ID } + val (polygonTiles, appRasters) = remaining.partition { it.id == POLYGON_TILE_LAYER_ID } val uri = TomTomStyleComposer.composeStackedRasterStyle( apiKey = apiKey, cacheDir = cacheDir, - belowOverlays = appRasters.sortedBy { composedRasterZIndex[it.id] ?: 0 } + polygonTiles, + belowOverlays = appRasters.sortedBy { composedRasterZIndex[it.id] ?: 0 } + polygonTiles + circleTiles, aboveOverlays = markerTiles, outFile = outFile, withoutBasemap = withoutBasemap, From a058fdcac7f5e596868e1b6a21f5cb5ad86537d1 Mon Sep 17 00:00:00 2001 From: Masashi Katsumata Date: Tue, 10 Nov 2026 23:15:01 -0800 Subject: [PATCH 2/2] Do not restack tiled circles restackCircles() clears every circle and adds them again, on every new ground image, polygon or circle. With the circles in tiles that tiled all of them again: at the nationwide example's 723,800 circles on a tablet, the first tiles came 24 s after the data instead of 17 s, and restoring a carrier took 13 s instead of 6 s, the tile layer gone meanwhile. The tile layer has its own order; skip the restack while circles are tiled, as restackPolylines() already does. --- .../java/com/mapconductor/tomtom/TomTomMapViewController.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/com/mapconductor/tomtom/TomTomMapViewController.kt b/src/main/java/com/mapconductor/tomtom/TomTomMapViewController.kt index 2158ce9..bd8bb17 100644 --- a/src/main/java/com/mapconductor/tomtom/TomTomMapViewController.kt +++ b/src/main/java/com/mapconductor/tomtom/TomTomMapViewController.kt @@ -277,6 +277,9 @@ class TomTomMapViewController internal constructor( } private suspend fun restackCircles() { + // Drawn as tiles: the tile layer has its own order, and clearing would tile them all again + // (6 s for 700k circles on a tablet, with the tiles gone meanwhile), as for polylines. + if (circleController.tiler?.tiledStates()?.isNotEmpty() == true) return val states = circleController.circleManager.allEntities().map { it.state } if (states.isEmpty()) return circleController.clear()