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
13 changes: 13 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.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 @@ -200,6 +203,16 @@ class HereMapViewController(
}
}
}
circleController.tiler =
CircleTiler().apply {
onTemplate = { template, tileSize ->
if (template != null) {
rasterLayerController.upsert(circleTileRasterLayerState(template, tileSize))
} else {
rasterLayerController.removeById(CIRCLE_TILE_LAYER_ID)
}
}
}
}

override fun moveCamera(position: MapCameraPosition) = handleMoveCamera(position)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ 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.circle.CIRCLE_TILE_LAYER_ID
import com.mapconductor.core.polyline.POLYLINE_TILE_LAYER_ID
import com.mapconductor.core.raster.RasterLayerEntityInterface
import com.mapconductor.core.raster.RasterLayerOverlayRendererInterface
Expand Down Expand Up @@ -171,20 +172,26 @@ class HereRasterLayerOverlayRenderer(
if (state.id.startsWith("marker-tile-")) {
MapLayerPriorityBuilder().renderedLast().build()
} else if (state.id == POLYGON_TILE_LAYER_ID) {
HereOverlayStacking.polygonTilePriority(
beforeLayer = layerNameOf(CIRCLE_TILE_LAYER_ID).takeIf { CIRCLE_TILE_LAYER_ID in shapeTileLayers }
?: layerNameOf(POLYLINE_TILE_LAYER_ID).takeIf { POLYLINE_TILE_LAYER_ID in shapeTileLayers },
)
} else if (state.id == CIRCLE_TILE_LAYER_ID) {
HereOverlayStacking.polygonTilePriority(
beforeLayer = layerNameOf(POLYLINE_TILE_LAYER_ID).takeIf { POLYLINE_TILE_LAYER_ID in shapeTileLayers },
)
} else if (state.id == POLYLINE_TILE_LAYER_ID) {
HereOverlayStacking.polylineTilePriority(
afterLayer = layerNameOf(POLYGON_TILE_LAYER_ID).takeIf { POLYGON_TILE_LAYER_ID in shapeTileLayers },
afterLayer = layerNameOf(CIRCLE_TILE_LAYER_ID).takeIf { CIRCLE_TILE_LAYER_ID in shapeTileLayers }
?: layerNameOf(POLYGON_TILE_LAYER_ID).takeIf { POLYGON_TILE_LAYER_ID in shapeTileLayers },
)
} else {
HereOverlayStacking.rasterPriority()
}

private fun layerNameOf(id: String) = "raster-layer-$id"

private fun isShapeTileLayer(id: String) = id == POLYGON_TILE_LAYER_ID || id == POLYLINE_TILE_LAYER_ID
private fun isShapeTileLayer(id: String) = id == POLYGON_TILE_LAYER_ID || id == CIRCLE_TILE_LAYER_ID || id == POLYLINE_TILE_LAYER_ID

private fun updateLayer(
handle: HereRasterLayerHandle,
Expand Down
Loading