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
17 changes: 17 additions & 0 deletions src/main/java/com/mapconductor/longdo/LongdoMapViewController.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package com.mapconductor.longdo

import com.longdo.sdk3.LongdoMap
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.circle.CircleCapableInterface
import com.mapconductor.core.circle.OnCircleEventHandler
import com.mapconductor.core.controller.BaseMapViewController
Expand Down Expand Up @@ -129,6 +132,20 @@ class LongdoMapViewController(
}
}

// Many circles too: the same raster layer path, in the circle band.
circleController.tiler =
CircleTiler().apply {
onTemplate = { template, tileSize ->
if (template != null) {
// Returns once the tile layer is on the page's map: the tiled
// circles' onAdded is called on the return.
mountRasterLayerOnMap(circleTileRasterLayerState(template, tileSize))
} else {
unmountRasterLayer(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
@@ -1,5 +1,6 @@
package com.mapconductor.longdo

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 @@ -45,6 +46,8 @@ private fun rasterAddLayerJs(
): String =
if (state.id == POLYGON_TILE_LAYER_ID) {
LongdoOverlayStacking.addPolygonTileLayerJs(layerSpec)
} else if (state.id == CIRCLE_TILE_LAYER_ID) {
LongdoOverlayStacking.addCircleTileLayerJs(layerSpec)
} else if (state.id == POLYLINE_TILE_LAYER_ID) {
LongdoOverlayStacking.addPolylineTileLayerJs(layerSpec)
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ internal object LongdoOverlayStacking {
/** ポリゴンのタイル: ポリゴンの帯の一番下(画像になったポリゴンであって、地図の画像ではない)。 */
fun addPolygonTileLayerJs(layerSpec: String): String = addLayerJs(layerSpec, OverlayKind.Polygon, Int.MIN_VALUE)

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

/** ポリラインのタイル: ポリラインの帯の一番下(サークルの上、ネイティブのポリラインの下)。 */
fun addPolylineTileLayerJs(layerSpec: String): String = addLayerJs(layerSpec, OverlayKind.Polyline, Int.MIN_VALUE)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ class LongdoCircleController(
override val renderer: LongdoCircleOverlayRenderer,
circleManager: CircleManagerInterface<LongdoCircleHandle> = CircleManager(),
) : CircleController<LongdoCircleHandle>(circleManager, renderer) {
/** 既知の円を再適用する(地図 `ready` 後の復元用)。 */
/** 既知の円を再適用する(地図 `ready` 後の復元用)。タイルで描く円(ハンドル無し)は飛ばす。 */
fun reapply() {
renderer.reapply(circleManager.allEntities().map { it.circle })
renderer.reapply(circleManager.nativeEntities().mapNotNull { it.circle as LongdoCircleHandle? })
}
}
Loading