From 2d80cbdae05707d6b959f4ff781b49f35f11aba3 Mon Sep 17 00:00:00 2001 From: Masashi Katsumata Date: Tue, 10 Nov 2026 16:16:50 -0800 Subject: [PATCH] Support bulk Circles with raster tiles --- .../openmobilemaps/OpenMobileMapsLayers.kt | 8 ++++++-- .../OpenMobileMapsMapViewController.kt | 13 +++++++++++++ .../openmobilemaps/OpenMobileMapsOverlays.kt | 6 +++++- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/mapconductor/openmobilemaps/OpenMobileMapsLayers.kt b/src/main/java/com/mapconductor/openmobilemaps/OpenMobileMapsLayers.kt index 11f42f6..cc973b8 100644 --- a/src/main/java/com/mapconductor/openmobilemaps/OpenMobileMapsLayers.kt +++ b/src/main/java/com/mapconductor/openmobilemaps/OpenMobileMapsLayers.kt @@ -75,6 +75,7 @@ class OpenMobileMapsLayers { private val rasterBand = Band(RASTER_INDEX_FIRST, GROUND_IMAGE_INDEX_FIRST) private val groundImageBand = Band(GROUND_IMAGE_INDEX_FIRST, POLYGON_TILE_INDEX_FIRST) private val polygonTileBand = Band(POLYGON_TILE_INDEX_FIRST, FIXED_INDEX_FIRST) + private val circleTileBand = Band(FIXED_INDEX_FIRST + 2, FIXED_INDEX_FIRST + 6) private val polylineTileBand = Band(POLYLINE_TILE_INDEX_FIRST, POLYLINE_INDEX) private val markerTileBand = Band(MARKER_TILE_INDEX_FIRST, ICON_INDEX) private val bandOfLayer = mutableMapOf() @@ -83,8 +84,8 @@ class OpenMobileMapsLayers { listOf( polygonFillLayer.asLayerInterface() to FIXED_INDEX_FIRST, polygonOutlineLayer.asLayerInterface() to FIXED_INDEX_FIRST + 1, - circleFillLayer.asLayerInterface() to FIXED_INDEX_FIRST + 2, - circleOutlineLayer.asLayerInterface() to FIXED_INDEX_FIRST + 3, + circleFillLayer.asLayerInterface() to FIXED_INDEX_FIRST + 6, + circleOutlineLayer.asLayerInterface() to FIXED_INDEX_FIRST + 7, polylineLayer.asLayerInterface() to POLYLINE_INDEX, iconLayer.asLayerInterface() to ICON_INDEX, ) @@ -148,6 +149,9 @@ class OpenMobileMapsLayers { ): LayerInterface = insertInBand(map, layer, polygonTileBand) /** ポリラインのタイル: ポリラインの帯の一番下(サークルの上、ネイティブのポリラインの下)。 */ + fun insertCircleTile(map: MapInterface, layer: LayerInterface): LayerInterface = + insertInBand(map, layer, circleTileBand) + fun insertPolylineTile( map: MapInterface, layer: LayerInterface, diff --git a/src/main/java/com/mapconductor/openmobilemaps/OpenMobileMapsMapViewController.kt b/src/main/java/com/mapconductor/openmobilemaps/OpenMobileMapsMapViewController.kt index 394693a..e409ce2 100644 --- a/src/main/java/com/mapconductor/openmobilemaps/OpenMobileMapsMapViewController.kt +++ b/src/main/java/com/mapconductor/openmobilemaps/OpenMobileMapsMapViewController.kt @@ -1,5 +1,8 @@ package com.mapconductor.openmobilemaps +import com.mapconductor.core.circle.CIRCLE_TILE_LAYER_ID +import com.mapconductor.core.circle.CircleTiler +import com.mapconductor.core.circle.circleTileRasterLayerState import com.mapconductor.core.controller.BaseMapViewController import com.mapconductor.core.features.GeoPoint import com.mapconductor.core.features.GeoPointInterface @@ -195,6 +198,16 @@ class OpenMobileMapsMapViewController( } } } + circleController.tiler = + CircleTiler().apply { + onTemplate = { template, tileSize -> + if (template != null) { + rasterLayerController.upsert(circleTileRasterLayerState(template, tileSize)) + } else { + rasterLayerController.removeById(CIRCLE_TILE_LAYER_ID) + } + } + } } /** diff --git a/src/main/java/com/mapconductor/openmobilemaps/OpenMobileMapsOverlays.kt b/src/main/java/com/mapconductor/openmobilemaps/OpenMobileMapsOverlays.kt index 087e6a8..46089e3 100644 --- a/src/main/java/com/mapconductor/openmobilemaps/OpenMobileMapsOverlays.kt +++ b/src/main/java/com/mapconductor/openmobilemaps/OpenMobileMapsOverlays.kt @@ -25,6 +25,7 @@ import com.mapconductor.core.marker.MarkerManager import com.mapconductor.core.marker.MarkerOverlayRendererInterface import com.mapconductor.core.polygon.AbstractPolygonOverlayRenderer import com.mapconductor.core.polygon.POLYGON_TILE_LAYER_ID +import com.mapconductor.core.circle.CIRCLE_TILE_LAYER_ID import com.mapconductor.core.polyline.POLYLINE_TILE_LAYER_ID import com.mapconductor.core.polygon.PolygonController import com.mapconductor.core.polygon.PolygonEntityInterface @@ -553,7 +554,8 @@ class OpenMobileMapsCircleOverlayRenderer( override suspend fun removeCircle(entity: CircleEntityInterface) = Unit override suspend fun onPostProcess() { - val entities = circleManager.allEntities().sortedBy { it.state.zIndex ?: 0 } + // Tiled circles have no native fill or outline handle. + val entities = circleManager.nativeEntities().sortedBy { it.state.zIndex ?: 0 } fillLayer.setPolygons(entities.flatMapTo(ArrayList()) { it.circle.fills }, RENDER_ORIGIN) outlineLayer.setLines(entities.flatMapTo(ArrayList()) { it.circle.outlines }) } @@ -715,6 +717,8 @@ class OpenMobileMapsRasterLayerOverlayRenderer( } else if (state.id == POLYGON_TILE_LAYER_ID) { // ポリゴンのタイルはポリゴンの帯の一番下(画像になったポリゴンであって、地図の画像ではない)。 layers.insertPolygonTile(holder.map, layer.asLayerInterface()) + } else if (state.id == CIRCLE_TILE_LAYER_ID) { + layers.insertCircleTile(holder.map, layer.asLayerInterface()) } else if (state.id == POLYLINE_TILE_LAYER_ID) { // ポリラインのタイルはポリラインの帯の一番下(サークルの上、ネイティブのポリラインの下)。 layers.insertPolylineTile(holder.map, layer.asLayerInterface())