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
1 change: 1 addition & 0 deletions api/android-for-here.api
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ public final class com.mapconductor.here.HereOverlayStacking {
public final int polylineDrawOrder(int);
public final com.here.sdk.mapview.MapLayerPriority rasterPriority();
public final com.here.sdk.mapview.MapLayerPriority groundImagePriority();
public final com.here.sdk.mapview.MapLayerPriority polygonTilePriority();
}
public final class com.mapconductor.here.HereTypeAliasKt {
}
Expand Down
16 changes: 16 additions & 0 deletions src/main/java/com/mapconductor/here/HereMapViewController.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package com.mapconductor.here

import com.mapconductor.core.polygon.POLYGON_TILE_LAYER_ID
import com.mapconductor.core.polygon.PolygonTiler
import com.mapconductor.core.polygon.polygonTileRasterLayerState
import HereMapDesignTypeChangeHandler
import HereMapViewControllerInterface
import com.here.sdk.core.Point2D
Expand Down Expand Up @@ -169,6 +172,19 @@ class HereMapViewController(
}
},
)

// 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)
}
}
}
}

override fun moveCamera(position: MapCameraPosition) = handleMoveCamera(position)
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/com/mapconductor/here/HereOverlayStacking.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ internal object HereOverlayStacking {
/** GroundImage: "traffic_on_route" レイヤーの手前(ラスターより上、map item より下)。 */
fun groundImagePriority(): MapLayerPriority = MapLayerPriorityBuilder().renderedBeforeLayer(GROUND_IMAGE_ANCHOR).build()

/**
* ポリゴンのタイル(SDK が描くラスター): ポリゴンの帯の一番下。GroundImage のアンカー
* "traffic_on_route" の直後(GroundImage より上、map item より下)。
*/
fun polygonTilePriority(): MapLayerPriority = MapLayerPriorityBuilder().renderedAfterLayer(GROUND_IMAGE_ANCHOR).build()

private const val RASTER_ANCHOR = "route"
private const val GROUND_IMAGE_ANCHOR = "traffic_on_route"
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import com.here.sdk.mapview.datasource.TileSource
import com.here.sdk.mapview.datasource.TileUrlProviderCallback
import com.here.sdk.mapview.datasource.TileUrlProviderFactory
import com.here.sdk.mapview.datasource.TilingScheme
import com.mapconductor.core.polygon.POLYGON_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 @@ -156,11 +157,14 @@ class HereRasterLayerOverlayRenderer(

/**
* アプリのラスターはラスターの帯(GroundImage・map item の下)。マーカーのタイルは
* マーカーの帯なので、ポリゴン等の map item より上(最後に描く)。
* マーカーの帯なので、ポリゴン等の map item より上(最後に描く)。ポリゴンのタイルは
* ポリゴンの帯の一番下(GroundImage の上、map item の下)。
*/
private fun priorityFor(state: RasterLayerState): MapLayerPriority =
if (state.id.startsWith("marker-tile-")) {
MapLayerPriorityBuilder().renderedLast().build()
} else if (state.id == POLYGON_TILE_LAYER_ID) {
HereOverlayStacking.polygonTilePriority()
} else {
HereOverlayStacking.rasterPriority()
}
Expand Down
Loading