Skip to content
Open
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
1 change: 1 addition & 0 deletions api/android-for-mappls.api
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ public final class com.mapconductor.mappls.MapplsOverlayStacking {
public final com.mapconductor.core.controller.OverlayStacking$Key key(com.mapconductor.core.controller.OverlayKind, int);
public final com.mapconductor.core.controller.OverlayStacking$Key getMARKER_TILE();
public final com.mapconductor.core.controller.OverlayStacking$Key getPOLYGON_TILE();
public final com.mapconductor.core.controller.OverlayStacking$Key getPOLYLINE_TILE();
public final com.mapconductor.core.controller.OverlayStacking$Key getMARKER_DRAG();
public final void add(com.mappls.sdk.maps.MapplsMap, com.mappls.sdk.maps.Style, com.mappls.sdk.maps.style.layers.Layer, com.mapconductor.core.controller.OverlayStacking$Key);
public final void remove(com.mappls.sdk.maps.MapplsMap, com.mappls.sdk.maps.Style, java.lang.String);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ internal object MapplsOverlayStacking {
/** ポリゴンのタイル(ラスター): ポリゴンの帯の一番下。 */
val POLYGON_TILE = key(OverlayKind.Polygon, Int.MIN_VALUE)

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

/** ドラッグ中のマーカーの層: マーカーの帯の一番上。 */
val MARKER_DRAG = key(OverlayKind.Marker, Int.MAX_VALUE)

Expand Down
15 changes: 15 additions & 0 deletions src/main/java/com/mapconductor/mappls/MapplsViewController.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ import com.mapconductor.core.polygon.PolygonState
import com.mapconductor.core.polygon.PolygonTiler
import com.mapconductor.core.polygon.polygonTileRasterLayerState
import com.mapconductor.core.polyline.OnPolylineEventHandler
import com.mapconductor.core.polyline.POLYLINE_TILE_LAYER_ID
import com.mapconductor.core.polyline.PolylineTiler
import com.mapconductor.core.polyline.polylineTileRasterLayerState
import com.mapconductor.mappls.circle.MapplsCircleController
import com.mapconductor.mappls.groundimage.MapplsGroundImageController
import com.mapconductor.mappls.marker.MapplsMarkerController
Expand Down Expand Up @@ -121,6 +124,18 @@ class MapplsViewController(
}
}
}

// Many polylines too: the same raster layer path, in the polyline band.
polylineController.tiler =
PolylineTiler().apply {
onTemplate = { template, tileSize ->
if (template != null) {
rasterLayerController.upsert(polylineTileRasterLayerState(template, tileSize))
} else {
rasterLayerController.removeById(POLYLINE_TILE_LAYER_ID)
}
}
}
}

fun setupListeners() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ class MapplsPolylineOverlayRenderer(
private fun getAllPolylineEntities(): List<PolylineEntityInterface<MapplsActualPolyline>> {
// This would need access to the polyline manager
// For now, we'll implement a simple workaround
return polylineManager.allEntities()
return polylineManager.allEntities().filter { (it.polyline as MapplsActualPolyline?) != null }
}

fun redraw() {
val entities = polylineManager.allEntities()
val entities = polylineManager.allEntities().filter { (it.polyline as MapplsActualPolyline?) != null }
holder.map.style?.let {
coroutine.launch {
layer.draw(entities, it)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.mapconductor.mappls.raster

import com.mapconductor.core.controller.OverlayKind
import com.mapconductor.core.polygon.POLYGON_TILE_LAYER_ID
import com.mapconductor.core.polyline.POLYLINE_TILE_LAYER_ID
import com.mapconductor.core.raster.RasterLayerEntityInterface
import com.mapconductor.core.raster.RasterLayerOverlayRendererInterface
import com.mapconductor.core.raster.RasterLayerSource
Expand Down Expand Up @@ -29,6 +30,8 @@ class MapplsRasterLayerOverlayRenderer(

private fun isPolygonTileRaster(state: RasterLayerState): Boolean = state.id == POLYGON_TILE_LAYER_ID

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

override suspend fun onAdd(
data: List<RasterLayerOverlayRendererInterface.AddParamsInterface>,
): List<MapplsRasterLayerHandle?> =
Expand Down Expand Up @@ -117,6 +120,8 @@ class MapplsRasterLayerOverlayRenderer(
MapplsOverlayStacking.MARKER_TILE
} else if (isPolygonTileRaster(state)) {
MapplsOverlayStacking.POLYGON_TILE
} else if (isPolylineTileRaster(state)) {
MapplsOverlayStacking.POLYLINE_TILE
} else {
MapplsOverlayStacking.key(OverlayKind.RasterLayer, state.zIndex)
}
Expand Down Expand Up @@ -152,7 +157,7 @@ class MapplsRasterLayerOverlayRenderer(
val ordered =
stateById.values
.asSequence()
.filter { !isMarkerTileRaster(it) && !isPolygonTileRaster(it) }
.filter { !isMarkerTileRaster(it) && !isPolygonTileRaster(it) && !isPolylineTileRaster(it) }
.sortedBy { it.zIndex }
.mapNotNull { state -> handleById[state.id]?.let { handle -> state to handle } }
.toList()
Expand Down
Loading