Blame view

src/main/kotlin/application/controller/MapPanelController.kt 1.27 KB
53f01ecc3   lsagona   display message o...
1
  package application.controller
2bbe36a1b   lsagona   addd the possibil...
2
  import application.model.*
53f01ecc3   lsagona   display message o...
3
4
5
6
7
8
9
10
11
12
  import javafx.concurrent.Worker
  import javafx.fxml.FXML
  import javafx.fxml.Initializable
  import javafx.scene.layout.StackPane
  import map.LeafletMapView
  import map.MapConfig
  import map.displayMessageOnMap
  import java.net.URL
  import java.util.*
  import java.util.concurrent.CompletableFuture
2bbe36a1b   lsagona   addd the possibil...
13
  class MapPanelController : Initializable {
53f01ecc3   lsagona   display message o...
14
15
16
17
18
19
20
21
22
  
      @FXML
      private lateinit var map: StackPane
  
      private val mapView = LeafletMapView()
  
  
      override fun initialize(location: URL?, resources: ResourceBundle?) {
          val completeFutureMap: CompletableFuture<Worker.State> = mapView.displayMap(MapConfig())
2bbe36a1b   lsagona   addd the possibil...
23
24
25
26
27
28
29
30
31
32
33
          observableVessel.listeners.add(object : MessageListener {
              override fun onValueChanged(newValue: MutableMap<Int?, Vessel>) {
                  displayMessageOnMap(mapView)
              }
          })
  
          observableSelectedVessel.listeners.add(object : SelectedVesselListener {
              override fun onValueChanged(newValue: Vessel) {
                  displayMessageOnMap(mapView, newValue.mmsi!!)
              }
          })
53f01ecc3   lsagona   display message o...
34
35
36
37
38
39
40
41
  
          /*completeFutureMap.whenComplete{
              workerState, _ ->
              if (workerState == Worker.State.SUCCEEDED) {
              }
          }*/
          map.children.add(mapView)
      }
53f01ecc3   lsagona   display message o...
42
43
  
  }