From ea4e7eddac602187be37e49740d1197bbbc62987 Mon Sep 17 00:00:00 2001 From: Masashi Katsumata Date: Sat, 7 Nov 2026 05:40:54 -0800 Subject: [PATCH 1/2] Draw large polygon sets as raster tiles (PolygonTiler) The polygon controller gets a PolygonTiler, whose tiles are shown through the raster layer path the marker tiles use (upsert / removeById, outside the app's RasterLayer composition). Tiled polygons stay registered for taps and give the map SDK nothing. The polygon renderer skips tiled entities, which have no native polygon. --- .../OpenMobileMapsMapViewController.kt | 16 ++++++++++++++++ .../openmobilemaps/OpenMobileMapsOverlays.kt | 12 +++++++++--- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/mapconductor/openmobilemaps/OpenMobileMapsMapViewController.kt b/src/main/java/com/mapconductor/openmobilemaps/OpenMobileMapsMapViewController.kt index 05e3ee1..90761ae 100644 --- a/src/main/java/com/mapconductor/openmobilemaps/OpenMobileMapsMapViewController.kt +++ b/src/main/java/com/mapconductor/openmobilemaps/OpenMobileMapsMapViewController.kt @@ -19,6 +19,9 @@ import com.mapconductor.core.marker.MarkerRenderingStrategyInterface import com.mapconductor.core.marker.OnMarkerEventHandler import com.mapconductor.core.marker.StrategyMarkerController import com.mapconductor.core.marker.dispatchGeoMarkerClick +import com.mapconductor.core.polygon.POLYGON_TILE_LAYER_ID +import com.mapconductor.core.polygon.PolygonTiler +import com.mapconductor.core.polygon.polygonTileRasterLayerState import com.mapconductor.openmobilemaps.marker.OpenMobileMapsMarkerController import com.mapconductor.openmobilemaps.tile.WebMercatorTileLayerConfig import com.mapconductor.openmobilemaps.zoom.ZoomAltitudeConverter @@ -164,6 +167,19 @@ class OpenMobileMapsMapViewController( .forEach { rasterLayerController.removeById(it.state.id) } } } + + // Many polygons are drawn as raster tiles, shown through the same RasterLayer + // controller as the marker tiles (upsert / removeById, never the app's layers). + polygonController.tiler = + PolygonTiler().apply { + onTemplate = { template, tileSize -> + if (template != null) { + rasterLayerController.upsert(polygonTileRasterLayerState(template, tileSize)) + } else { + rasterLayerController.removeById(POLYGON_TILE_LAYER_ID) + } + } + } } /** SDK のイベントをコアの受け口へ転送する。 */ diff --git a/src/main/java/com/mapconductor/openmobilemaps/OpenMobileMapsOverlays.kt b/src/main/java/com/mapconductor/openmobilemaps/OpenMobileMapsOverlays.kt index 51886c4..58af687 100644 --- a/src/main/java/com/mapconductor/openmobilemaps/OpenMobileMapsOverlays.kt +++ b/src/main/java/com/mapconductor/openmobilemaps/OpenMobileMapsOverlays.kt @@ -475,13 +475,19 @@ class OpenMobileMapsPolygonOverlayRenderer( override suspend fun removePolygon(entity: PolygonEntityInterface) = Unit override suspend fun onPostProcess() { - val entities = polygonManager.allEntities() + // Polygons drawn as tiles (PolygonController.tiler) stay in the manager + // for taps with no native polygon. + val entities = polygonManager.allEntities().mapNotNull { nativePolygonOf(it) } // add / addAll ではなく setPolygons を使うこと。4.0 の PolygonLayer は // 原点(第 2 引数)を持つようになっていて、setPolygons を一度も通っていない // レイヤに add すると**何も描かれない**(例外も警告も出ない)。 - fillLayer.setPolygons(entities.flatMapTo(ArrayList()) { it.polygon.fills }, RENDER_ORIGIN) - outlineLayer.setLines(entities.flatMapTo(ArrayList()) { it.polygon.outlines }) + fillLayer.setPolygons(entities.flatMapTo(ArrayList()) { it.fills }, RENDER_ORIGIN) + outlineLayer.setLines(entities.flatMapTo(ArrayList()) { it.outlines }) } + + @Suppress("USELESS_CAST") + private fun nativePolygonOf(entity: PolygonEntityInterface): OpenMobileMapsActualPolygon? = + entity.polygon as OpenMobileMapsActualPolygon? } // ── 円 ──────────────────────────────────────────────────────────────────── From f15c1b304135f99de4f0720199853acf3d9aba20 Mon Sep 17 00:00:00 2001 From: Masashi Katsumata Date: Mon, 9 Nov 2026 06:55:04 -0800 Subject: [PATCH 2/2] Update the API baseline Additions only: the polygon tiles' stacking key, and declarations develop added without running apiDump (TILE_REFRESH_COALESCE, and on ArcGIS the marker controller's constructor that takes a boolean). --- api/android-for-openmobilemaps.api | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/api/android-for-openmobilemaps.api b/api/android-for-openmobilemaps.api index f1d5491..770ea7a 100644 --- a/api/android-for-openmobilemaps.api +++ b/api/android-for-openmobilemaps.api @@ -124,6 +124,7 @@ public final class com.mapconductor.openmobilemaps.OpenMobileMapsLayers { public static final int RASTER_INDEX_FIRST; public static final int BELOW_INDEX_FIRST; public static final int GROUND_IMAGE_INDEX_FIRST; + public static final int POLYGON_TILE_INDEX_FIRST; public static final int FIXED_INDEX_FIRST; public static final int MARKER_TILE_INDEX_FIRST; public static final int ICON_INDEX; @@ -138,6 +139,7 @@ public final class com.mapconductor.openmobilemaps.OpenMobileMapsLayers { public final void setDesignLayer(io.openmobilemaps.mapscore.shared.map.MapInterface, io.openmobilemaps.mapscore.shared.map.LayerInterface); public final io.openmobilemaps.mapscore.shared.map.LayerInterface insertBelowOverlays(io.openmobilemaps.mapscore.shared.map.MapInterface, io.openmobilemaps.mapscore.shared.map.LayerInterface); public final io.openmobilemaps.mapscore.shared.map.LayerInterface insertGroundImage(io.openmobilemaps.mapscore.shared.map.MapInterface, io.openmobilemaps.mapscore.shared.map.LayerInterface); + public final io.openmobilemaps.mapscore.shared.map.LayerInterface insertPolygonTile(io.openmobilemaps.mapscore.shared.map.MapInterface, io.openmobilemaps.mapscore.shared.map.LayerInterface); public final io.openmobilemaps.mapscore.shared.map.LayerInterface insertMarkerTile(io.openmobilemaps.mapscore.shared.map.MapInterface, io.openmobilemaps.mapscore.shared.map.LayerInterface); public final void remove(io.openmobilemaps.mapscore.shared.map.MapInterface, io.openmobilemaps.mapscore.shared.map.LayerInterface); public final void clearAll(); @@ -354,6 +356,9 @@ public final class com.mapconductor.openmobilemaps.marker.OpenMobileMapsMarkerCo public void destroy(); public java.lang.Object update(java.lang.Object, kotlin.coroutines.Continuation); } +final class com.mapconductor.openmobilemaps.marker.OpenMobileMapsMarkerController$Companion { + public final long getTILE_REFRESH_COALESCE-UwyO8pc(); +} public final class com.mapconductor.openmobilemaps.tile.WebMercatorTileLayerConfig extends io.openmobilemaps.mapscore.shared.map.layers.tiled.Tiled2dMapLayerConfig { public static final double WORLD_WIDTH_METERS; public static final double HALF_WORLD;