Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev branch #66

Merged
merged 15 commits into from
Dec 18, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Added throwing error on geocoding failure.
  • Loading branch information
ISeleznev-HORIS authored and IKupriyanov-HORIS committed Dec 18, 2019
commit 86629c7e69024b91fb56b7276efa4aee8d0bf567
3 changes: 2 additions & 1 deletion livemap/src/commonMain/kotlin/jetbrains/livemap/LiveMap.kt
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ class LiveMap(
myContext = LiveMapContext(
myMapProjection,
canvasControl,
MapRenderContext(viewport, canvasControl)
MapRenderContext(viewport, canvasControl),
::fireThrowable
)

myUiService = UiService(componentManager, ResourceManager(myContext.mapRenderContext.canvasProvider))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ import jetbrains.livemap.projections.MapProjection
open class LiveMapContext(
open val mapProjection: MapProjection,
eventSource: MouseEventSource,
open val mapRenderContext: MapRenderContext
open val mapRenderContext: MapRenderContext,
val showError: (Throwable) -> Unit
) : EcsContext(eventSource)
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,14 @@ class RegionIdGeocodingSystem(
requested.forEach { it.add(WaitingGeocodingComponent()) }

myGeocodingProvider.geocodeRegions(names)
.map { regionIdByNames ->
getMutableEntities(GEOCODED_FEATURE_COMPONENTS).forEach { entity ->
entity.add(RegionIdComponent(regionIdByNames.getValue(entity.get<MapIdComponent>().mapId)))
entity.remove<MapIdComponent>()
.apply {
onSuccess { regionIdByNames ->
getMutableEntities(GEOCODED_FEATURE_COMPONENTS).forEach { entity ->
entity.add(RegionIdComponent(regionIdByNames.getValue(entity.get<MapIdComponent>().mapId)))
entity.remove<MapIdComponent>()
}
}
onFailure { context.showError(it) }
}
}

Expand Down