Blame view
src/main/kotlin/map/CircleMarkerGenerator.kt
1.21 KB
53f01ecc3 display message o... |
1 |
package map |
2bbe36a1b addd the possibil... |
2 |
import application.model.observableVessel |
53f01ecc3 display message o... |
3 |
|
43370abfe 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 display message o... |
9 10 11 |
} fun displayMessageOnMap(map: LeafletMapView) { |
43370abfe clear map canvas ... |
12 |
clearMapCanvas(map) |
2bbe36a1b addd the possibil... |
13 |
observableVessel.vessels.forEach { (_, value) -> |
53f01ecc3 display message o... |
14 |
value.messages.forEach { (_, message) -> |
52321443a different color f... |
15 |
map.execScript("L.circleMarker([${message.latitude}, ${message.longitude}], {renderer: myRenderer, radius: 0.01, color: '#${message.getHexColor()}'}).addTo(myMap)") |
53f01ecc3 display message o... |
16 17 |
} } |
2bbe36a1b addd the possibil... |
18 19 20 21 22 23 24 25 26 27 28 29 30 |
} fun displayMessageOnMap(map: LeafletMapView, selectedMMSI: Int) { clearMapCanvas(map) observableVessel.vessels.forEach { (_, value) -> value.messages.forEach { (_, message) -> if(selectedMMSI == message.mmsi){ map.execScript("L.circleMarker([${message.latitude}, ${message.longitude}], {renderer: myRenderer, radius: 4, color: '#ff001e'}).addTo(myMap)") }else{ map.execScript("L.circleMarker([${message.latitude}, ${message.longitude}], {renderer: myRenderer, radius: 0.01, color: '#${message.getHexColor()}'}).addTo(myMap)") } } } |
53f01ecc3 display message o... |
31 |
} |