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

Livemap demo #70

Closed
wants to merge 7 commits into from
Closed
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 raster tiles demo.
  • Loading branch information
ISeleznev-HORIS committed Dec 26, 2019
commit 947f2fa90cb7a8826f4c9b7170486f3b273cfb44
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ abstract class DemoModelBase(private val dimension: DoubleVector) {
return liveMapConfig {
size = dimension

tileService = internalTiles {}
tileService = internalTiles()

geocodingService = liveMapGeocoding {
host = "geo.datalore.io"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Copyright (c) 2019. JetBrains s.r.o.
* Use of this source code is governed by the MIT license that can be found in the LICENSE file.
*/

package jetbrains.livemap.demo

import jetbrains.datalore.base.geometry.DoubleVector
import jetbrains.livemap.DevParams
import jetbrains.livemap.api.LiveMapBuilder

class RasterTilesDemoModel(dimension: DoubleVector) : DemoModelBase(dimension) {

override fun createLiveMapSpec(): LiveMapBuilder {
return basicLiveMap {
params(
DevParams.RASTER_TILES.key to mapOf(
"host" to "a.tile.stamen.com/watercolor",
"protocol" to "http"
)
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ class RectDemoModel(dimension: DoubleVector) : DemoModelBase(dimension) {
polygon {
geometry(rect(-104.032789, 35.309947, -80.237456, 48.979166), isGeodesic = false)

fillColor = Color.parseColor("rgba(255, 175, 175, 153)")
strokeColor = Color.parseColor("rgba(128, 0, 128, 153)")
fillColor = Color(255, 175, 175, 153)
strokeColor = Color(128, 0, 128, 153)
strokeWidth = 6.0
}

polygon {
geometry(rect(170.0, 0.0, -170.0, 30.0), isGeodesic = false)

fillColor = Color.parseColor("rgba(255, 175, 175, 153)")
fillColor = Color(255, 175, 175, 153)
strokeWidth = 0.0
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
* Copyright (c) 2019. JetBrains s.r.o.
* Use of this source code is governed by the MIT license that can be found in the LICENSE file.
*/

package jetbrains.livemap.demo

@JsName("rasterTilesDemo")
fun rasterTilesDemo() {
DemoBaseJs(::RasterTilesDemoModel).show()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* Copyright (c) 2019. JetBrains s.r.o.
* Use of this source code is governed by the MIT license that can be found in the LICENSE file.
*/

package jetbrains.livemap.demo

private const val DEMO_PROJECT = "livemap-demo"
private const val CALL_FUN = "jetbrains.livemap.demo.rasterTilesDemo"
private val LIBS = BrowserDemoUtil.KOTLIN_LIBS + BrowserDemoUtil.BASE_MAPPER_LIBS + BrowserDemoUtil.PLOT_LIBS + BrowserDemoUtil.DEMO_COMMON_LIBS

fun main() {
BrowserDemoUtil.openInBrowser(DEMO_PROJECT) {
BrowserDemoUtil.mapperDemoHtml(DEMO_PROJECT, CALL_FUN, LIBS, "Raster tiles Demo")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* Copyright (c) 2019. JetBrains s.r.o.
* Use of this source code is governed by the MIT license that can be found in the LICENSE file.
*/

package jetbrains.livemap.demo

import javax.swing.SwingUtilities

object RasterTilesDemoJfx {
@JvmStatic
fun main(args: Array<String>) {
SwingUtilities.invokeLater {
DemoBaseJfx(::RasterTilesDemoModel).show()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -271,14 +271,12 @@ fun LiveMapBuilder.projection(block: Projection.() -> Unit) {
}
}

fun internalTiles(block: LiveMapTileServiceBuilder.() -> Unit): TileService {
return LiveMapTileServiceBuilder()
.apply {
fun internalTiles(): TileService {
return liveMapTiles {
theme = TileService.Theme.COLOR
host = "10.0.0.127"
port = 3933
}
.apply(block).build()
}

fun liveMapTiles(block: LiveMapTileServiceBuilder.() -> Unit) =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import jetbrains.livemap.DevParams.Companion.DEBUG_TILES
import jetbrains.livemap.DevParams.Companion.RASTER_TILES
import jetbrains.livemap.DevParams.Companion.VECTOR_TILES
import jetbrains.livemap.LiveMapContext
import jetbrains.livemap.api.internalTiles
import jetbrains.livemap.api.liveMapTiles
import jetbrains.livemap.core.ecs.AbstractSystem
import jetbrains.livemap.core.ecs.EcsComponentManager
import jetbrains.livemap.tiles.raster.RasterTileLoadingSystem
Expand Down Expand Up @@ -65,7 +65,7 @@ interface TileLoadingSystemFactory {
val vectorTiles = devParams.read(VECTOR_TILES)
return VectorTileLoadingSystemFactory(
devParams.read(COMPUTATION_PROJECTION_QUANT),
internalTiles {
liveMapTiles {
host = vectorTiles.host
port = vectorTiles.port
theme = vectorTiles.theme
Expand Down