Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/main/java/com/mapconductor/mapbox/MapboxMapViewController.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package com.mapconductor.mapbox

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.polygon.POLYGON_TILE_LAYER_ID
import com.mapconductor.core.polygon.PolygonTiler
import com.mapconductor.core.polygon.polygonTileRasterLayerState
Expand Down Expand Up @@ -136,6 +139,18 @@ class MapboxMapViewController internal constructor(
}
}

// Many circles too: the same raster layer path, in the circle band.
circleController.tiler =
CircleTiler().apply {
onTemplate = { template, tileSize ->
if (template != null) {
rasterLayerController.upsert(circleTileRasterLayerState(template, tileSize))
} else {
rasterLayerController.removeById(CIRCLE_TILE_LAYER_ID)
}
}
}

// Many polylines too: the same raster layer path, in the polyline band.
polylineController.tiler =
PolylineTiler().apply {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ internal object MapboxOverlayStacking {
/** ポリゴンのタイル(ラスター): ポリゴンの帯の一番下。 */
val POLYGON_TILE = key(OverlayKind.Polygon, Int.MIN_VALUE)

/** 円のタイル(ラスター): サークルの帯の一番下(ポリゴンの上、ネイティブの円とポリラインのタイルの下)。 */
val CIRCLE_TILE = key(OverlayKind.Circle, Int.MIN_VALUE)

/** ポリラインのタイル(ラスター): ポリラインの帯の一番下(サークルの上、ネイティブのポリラインの下)。 */
val POLYLINE_TILE = key(OverlayKind.Polyline, Int.MIN_VALUE)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class MapboxCircleOverlayRenderer(
}

override suspend fun onPostProcess() {
val circles = circleManager.allEntities()
val circles = circleManager.nativeEntities().filter { (it.circle as MapboxActualCircle?) != null }
coroutine.launch {
layer.draw(circles)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.mapconductor.mapbox.raster
import com.mapbox.maps.extension.style.layers.generated.rasterLayer
import com.mapbox.maps.extension.style.sources.addSource
import com.mapbox.maps.extension.style.sources.generated.rasterSource
import com.mapconductor.core.circle.CIRCLE_TILE_LAYER_ID
import com.mapconductor.core.controller.OverlayKind
import com.mapconductor.core.polygon.POLYGON_TILE_LAYER_ID
import com.mapconductor.core.polyline.POLYLINE_TILE_LAYER_ID
Expand Down Expand Up @@ -31,6 +32,8 @@ class MapboxRasterLayerOverlayRenderer(

private fun isPolylineTileRaster(state: RasterLayerState): Boolean = state.id == POLYLINE_TILE_LAYER_ID

private fun isCircleTileRaster(state: RasterLayerState): Boolean = state.id == CIRCLE_TILE_LAYER_ID

/** Mapbox Android はタイル要求を書き換える公開 API を持たない。 */
override suspend fun onAdd(
data: List<RasterLayerOverlayRendererInterface.AddParamsInterface>,
Expand Down Expand Up @@ -181,6 +184,8 @@ class MapboxRasterLayerOverlayRenderer(
MapboxOverlayStacking.MARKER_TILE
} else if (isPolygonTileRaster(state)) {
MapboxOverlayStacking.POLYGON_TILE
} else if (isCircleTileRaster(state)) {
MapboxOverlayStacking.CIRCLE_TILE
} else if (isPolylineTileRaster(state)) {
MapboxOverlayStacking.POLYLINE_TILE
} else {
Expand All @@ -193,7 +198,7 @@ class MapboxRasterLayerOverlayRenderer(
val ordered =
stateById.values
.asSequence()
.filter { !isMarkerTileRaster(it) && !isPolygonTileRaster(it) && !isPolylineTileRaster(it) }
.filter { !isMarkerTileRaster(it) && !isPolygonTileRaster(it) && !isPolylineTileRaster(it) && !isCircleTileRaster(it) }
.sortedBy { it.zIndex }
.mapNotNull { state -> handleById[state.id]?.let { handle -> state to handle } }
.toList()
Expand Down
Loading