Blame view

src/main/kotlin/map/CircleMarkerGenerator.kt 573 Bytes
53f01ecc3   lsagona   display message o...
1
2
3
  package map
  
  import application.model.observableMessages
43370abfe   lsagona   clear map canvas ...
4
5
6
7
8
  fun clearMapCanvas(map: LeafletMapView) {
      map.execScript("""
          |myRenderer.removeFrom(myMap)
          |var myRenderer = L.canvas({ padding: 0.5 });
      """.trimMargin())
53f01ecc3   lsagona   display message o...
9
10
11
  }
  
  fun displayMessageOnMap(map: LeafletMapView) {
43370abfe   lsagona   clear map canvas ...
12
      clearMapCanvas(map)
53f01ecc3   lsagona   display message o...
13
14
15
16
17
18
      observableMessages.vessels.forEach { (_, value) ->
          value.messages.forEach { (_, message) ->
              map.execScript("L.circleMarker([${message.latitude}, ${message.longitude}], {renderer: myRenderer, radius: 0.01}).addTo(myMap)")
          }
      }
  }