Compare View
Commits (2)
Diff
Showing 2 changed files Inline Diff
src/main/kotlin/application/controller/MenuBarController.kt
View file @
6b2760a
package application.controller | 1 | 1 | package application.controller | |
2 | 2 | |||
import application.model.MapState.* | 3 | 3 | import application.model.MapState.* | |
import application.model.createVesselCollection | 4 | 4 | import application.model.createVesselCollection | |
import application.model.observableIsReplayState | 5 | 5 | import application.model.observableIsReplayState | |
import application.model.observableMapState | 6 | 6 | import application.model.observableMapState | |
import application.model.observableVessel | 7 | 7 | import application.model.observableVessel | |
import javafx.event.EventHandler | 8 | 8 | import javafx.event.EventHandler | |
import javafx.fxml.FXML | 9 | 9 | import javafx.fxml.FXML | |
import javafx.fxml.Initializable | 10 | 10 | import javafx.fxml.Initializable | |
import javafx.scene.control.* | 11 | 11 | import javafx.scene.control.* | |
import javafx.stage.FileChooser | 12 | 12 | import javafx.stage.FileChooser | |
13 | import java.io.* | |||
import java.net.URL | 13 | 14 | import java.net.URL | |
import java.util.* | 14 | 15 | import java.util.* | |
15 | 16 | |||
17 | ||||
class MenuBarController : Initializable { | 16 | 18 | class MenuBarController : Initializable { | |
17 | 19 | |||
@FXML | 18 | 20 | @FXML | |
var menuBar: MenuBar = MenuBar() | 19 | 21 | var menuBar: MenuBar = MenuBar() | |
20 | 22 | |||
@FXML | 21 | 23 | @FXML | |
var import: MenuItem = MenuItem() | 22 | 24 | var import: MenuItem = MenuItem() | |
23 | 25 | |||
@FXML | 24 | 26 | @FXML | |
var allMessages: CheckMenuItem = CheckMenuItem() | 25 | 27 | var allMessages: CheckMenuItem = CheckMenuItem() | |
26 | 28 | |||
@FXML | 27 | 29 | @FXML | |
var clusteredMessage: CheckMenuItem = CheckMenuItem() | 28 | 30 | var clusteredMessage: CheckMenuItem = CheckMenuItem() | |
29 | 31 | |||
@FXML | 30 | 32 | @FXML | |
var heatMap: CheckMenuItem = CheckMenuItem() | 31 | 33 | var heatMap: CheckMenuItem = CheckMenuItem() | |
32 | 34 | |||
@FXML | 33 | 35 | @FXML | |
var activateReplayButton: RadioMenuItem = RadioMenuItem() | 34 | 36 | var activateReplayButton: RadioMenuItem = RadioMenuItem() | |
35 | 37 | |||
override fun initialize(location: URL?, resources: ResourceBundle?) { | 36 | 38 | override fun initialize(location: URL?, resources: ResourceBundle?) { | |
37 | 39 | |||
setOnActionImportButton() | 38 | 40 | setOnActionImportButton() | |
39 | 41 | |||
setOnActionAllMessageButton() | 40 | 42 | setOnActionAllMessageButton() | |
setOnActionClusteredMessageButton() | 41 | 43 | setOnActionClusteredMessageButton() | |
setOnActionHeatMapButton() | 42 | 44 | setOnActionHeatMapButton() | |
setOnActionActivateReplayButton() | 43 | 45 | setOnActionActivateReplayButton() | |
observableMapState.state = CLUSTERED_MESSAGES | 44 | 46 | observableMapState.state = CLUSTERED_MESSAGES | |
allMessages.isSelected = false | 45 | 47 | allMessages.isSelected = false | |
clusteredMessage.isSelected = true | 46 | 48 | clusteredMessage.isSelected = true | |
heatMap.isSelected = false | 47 | 49 | heatMap.isSelected = false | |
48 | 50 | |||
} | 49 | 51 | } | |
50 | 52 | |||
private fun setOnActionActivateReplayButton() { | 51 | 53 | private fun setOnActionActivateReplayButton() { | |
activateReplayButton.onAction = EventHandler { | 52 | 54 | activateReplayButton.onAction = EventHandler { | |
observableIsReplayState.value = activateReplayButton.isSelected | 53 | 55 | observableIsReplayState.value = activateReplayButton.isSelected | |
} | 54 | 56 | } | |
} | 55 | 57 | } | |
56 | 58 | |||
private fun setOnActionImportButton() { | 57 | 59 | private fun setOnActionImportButton() { | |
import.onAction = EventHandler { | 58 | 60 | import.onAction = EventHandler { | |
val fileChooser = FileChooser() | 59 | 61 | val fileChooser = FileChooser() | |
fileChooser.title = "Choose a file to import" | 60 | 62 | fileChooser.title = "Choose a file to import" | |
val window = menuBar.scene.window | 61 | 63 | val window = menuBar.scene.window | |
val file = fileChooser.showOpenDialog(window) | 62 | 64 | val file = fileChooser.showOpenDialog(window) | |
65 | ||||
try { | 63 | 66 | try { | |
if (file.extension != "csv") { | 64 | 67 | if (file.extension != "csv") { | |
val alert = Alert(Alert.AlertType.WARNING) | 65 | 68 | val alert = Alert(Alert.AlertType.WARNING) | |
alert.title = "Warning Alert" | 66 | 69 | alert.title = "Warning Alert" | |
alert.headerText = "Wrong file format." | 67 | 70 | alert.headerText = "Wrong file format." | |
alert.contentText = "Please choose à .csv file." | 68 | 71 | alert.contentText = "Please choose à .csv file." | |
alert.showAndWait() | 69 | 72 | alert.showAndWait() | |
} | 70 | 73 | } | |
val vessels = createVesselCollection(file) | 71 | |||
observableVessel.vessels.clear() | 72 | 74 | observableVessel.vessels.clear() | |
observableVessel.vessels = vessels | 73 | 75 | if(toMuchVessel(file)){ | |
76 | observableVessel.vessels = mutableMapOf() | |||
77 | }else { | |||
78 | val vessels = createVesselCollection(file) | |||
79 | observableVessel.vessels = vessels | |||
80 | } | |||
} catch (ignore: IllegalStateException) { | 74 | 81 | } catch (ignore: IllegalStateException) { | |
75 | 82 | |||
} | 76 | 83 | } | |
} | 77 | 84 | } | |
} | 78 | 85 | } | |
79 | 86 | |||
87 | private fun toMuchVessel(file: File): Boolean { | |||
88 | val nbLine = file.readLines().size | |||
89 | if (nbLine > 50000) { | |||
90 | val alert = Alert(Alert.AlertType.CONFIRMATION) | |||
91 | alert.title = "Warning!!" | |||
92 | alert.headerText = "Warning: This file contain a lot of messages." | |||
93 | alert.contentText = "Are you sure you want to continue." | |||
94 | val buttonTypeYes = ButtonType("Yes") | |||
95 | val buttonTypeNo = ButtonType("No ") | |||
96 | alert.buttonTypes.setAll(buttonTypeYes, buttonTypeNo) | |||
97 | val result = alert.showAndWait() | |||
98 | ||||
99 | return result.get() != buttonTypeYes | |||
100 | } | |||
101 | return false | |||
102 | } | |||
103 | ||||
private fun setOnActionAllMessageButton() { | 80 | 104 | private fun setOnActionAllMessageButton() { | |
allMessages.onAction = EventHandler { | 81 | 105 | allMessages.onAction = EventHandler { | |
observableMapState.state = ALL_MESSAGES | 82 | 106 | observableMapState.state = ALL_MESSAGES | |
allMessages.isSelected = true | 83 | 107 | allMessages.isSelected = true | |
clusteredMessage.isSelected = false | 84 | 108 | clusteredMessage.isSelected = false | |
heatMap.isSelected = false | 85 | 109 | heatMap.isSelected = false | |
} | 86 | 110 | } | |
} | 87 | 111 | } | |
88 | 112 | |||
private fun setOnActionClusteredMessageButton() { | 89 | 113 | private fun setOnActionClusteredMessageButton() { |
src/main/kotlin/application/model/Vessel.kt
View file @
6b2760a
package application.model | 1 | 1 | package application.model | |
2 | 2 | |||
import java.util.* | 3 | 3 | import java.util.* | |
4 | 4 | |||
class Vessel(val mmsi: String?) { | 5 | 5 | class Vessel(val mmsi: String?) { | |
val messages: SortedMap<Long, Message> = sortedMapOf() | 6 | 6 | val messages: SortedMap<Long, Message> = sortedMapOf() | |
private val messageBeforeSelectedTime: Map<Long, Message> | 7 | 7 | private val messageBeforeSelectedTime: Map<Long, Message> | |
get() { | 8 | 8 | get() { | |
return messages.filter { observableCurrentTime.value > it.key } | 9 | 9 | return messages.filter { observableCurrentTime.value > it.key } | |
} | 10 | 10 | } | |
11 | 11 | |||
var messageToDisplay: Message? = null | 12 | 12 | var messageToDisplay: Message? = null | |
get() { | 13 | 13 | get() { | |
field = | 14 | 14 | field = | |
messages.asSequence().map { it }.firstOrNull { observableCurrentTime.value < it.key }.let { it?.value } | 15 | 15 | messages.asSequence().map { it }.firstOrNull { observableCurrentTime.value < it.key }.let { it?.value } | |
return field | 16 | 16 | return field | |
} | 17 | 17 | } | |
18 | 18 | |||
fun getAllTimeBeforeSelectedTime(): ArrayList<String> { | 19 | 19 | fun getAllTimeBeforeSelectedTime(): ArrayList<String> { | |
val timeList = arrayListOf<String>() | 20 | 20 | val timeList = arrayListOf<String>() | |
messageBeforeSelectedTime.forEach { | 21 | 21 | messageBeforeSelectedTime.forEach { | |
if (it.value.time.value != null) | 22 | 22 | if (it.value.time.value != null) | |
23 | timeList.add(it.value.time.value!!) | |||
timeList.add(it.value.time.value!!) | 23 | 24 | } | |
} | 24 | 25 | ||
25 | 26 | return timeList | ||
return timeList | 26 | 27 | } | |
} | 27 | 28 | ||
28 | 29 | fun getAllLatitudeBeforeSelectedTime(): ArrayList<Double> { | ||
fun getAllLatitudeBeforeSelectedTime(): ArrayList<Double> { | 29 | 30 | val latitudeList = arrayListOf<Double>() | |
val latitudeList = arrayListOf<Double>() | 30 | 31 | messageBeforeSelectedTime.forEach { | |
messageBeforeSelectedTime.forEach { | 31 | 32 | if (it.value.latitude.value != null) | |
33 | latitudeList.add(it.value.latitude.value!!) | |||
if (it.value.latitude.value != null) | 32 | 34 | } | |
latitudeList.add(it.value.latitude.value!!) | 33 | 35 | ||
} | 34 | 36 | return latitudeList | |
35 | 37 | } | ||
return latitudeList | 36 | 38 | ||
} | 37 | 39 | fun getAllLongitudeBeforeSelectedTime(): ArrayList<Double> { | |
38 | 40 | val longitudeList = arrayListOf<Double>() | ||
fun getAllLongitudeBeforeSelectedTime(): ArrayList<Double> { | 39 | 41 | messageBeforeSelectedTime.forEach { | |
val longitudeList = arrayListOf<Double>() | 40 | 42 | if (it.value.longitude.value != null) | |
43 | longitudeList.add(it.value.longitude.value!!) | |||
messageBeforeSelectedTime.forEach { | 41 | 44 | } | |
if (it.value.longitude.value != null) | 42 | 45 | ||
longitudeList.add(it.value.longitude.value!!) | 43 | 46 | return longitudeList | |
} | 44 | 47 | } | |
45 | 48 | |||
return longitudeList | 46 | 49 | fun getAllSpeedOverGroundBeforeSelectedTime(): ArrayList<Double> { | |
} | 47 | 50 | val speedOverGroundList = arrayListOf<Double>() | |
48 | 51 | messageBeforeSelectedTime.forEach { | ||
fun getAllSpeedOverGroundBeforeSelectedTime(): ArrayList<Double> { | 49 | 52 | if (it.value.speedOverGround.value != null) | |
53 | speedOverGroundList.add(it.value.speedOverGround.value!!) | |||
val speedOverGroundList = arrayListOf<Double>() | 50 | 54 | } | |
messageBeforeSelectedTime.forEach { | 51 | 55 | ||
if (it.value.speedOverGround.value != null) | 52 | 56 | return speedOverGroundList | |
speedOverGroundList.add(it.value.speedOverGround.value!!) | 53 | 57 | } | |
} | 54 | 58 | ||
55 | 59 | fun getAllCourseOverGroundBeforeSelectedTime(): ArrayList<Double> { | ||
return speedOverGroundList | 56 | 60 | val res = arrayListOf<Double>() | |
} | 57 | 61 | messageBeforeSelectedTime.forEach { | |
58 | 62 | if (it.value.courseOverGround.value != null) | ||
63 | res.add(it.value.courseOverGround.value!!) | |||
fun getAllCourseOverGroundBeforeSelectedTime(): ArrayList<Double> { | 59 | 64 | } | |
val res = arrayListOf<Double>() | 60 | 65 | ||
messageBeforeSelectedTime.forEach { | 61 | 66 | return res | |
if (it.value.courseOverGround.value != null) | 62 | 67 | } | |
res.add(it.value.courseOverGround.value!!) | 63 | 68 | ||
} | 64 | 69 | fun getAllHeadingBeforeSelectedTime(): ArrayList<Double> { | |
65 | 70 | val res = arrayListOf<Double>() | ||
return res | 66 | 71 | messageBeforeSelectedTime.forEach { | |
} | 67 | 72 | if (it.value.heading.value != null) | |
73 | res.add(it.value.heading.value!!) | |||
68 | 74 | } | ||
fun getAllHeadingBeforeSelectedTime(): ArrayList<Double> { | 69 | 75 | ||
val res = arrayListOf<Double>() | 70 | 76 | return res | |
messageBeforeSelectedTime.forEach { | 71 | 77 | } | |
if (it.value.heading.value != null) | 72 | 78 | ||
res.add(it.value.heading.value!!) | 73 | 79 | fun getAllVesselNameBeforeSelectedTime(): ArrayList<String> { | |
} | 74 | 80 | val res = arrayListOf<String>() | |
75 | 81 | messageBeforeSelectedTime.forEach { | ||
return res | 76 | 82 | if (it.value.vesselName.value != null) | |
83 | res.add(it.value.vesselName.value!!) | |||
} | 77 | 84 | } | |
78 | 85 | return res | ||
fun getAllVesselNameBeforeSelectedTime(): ArrayList<String> { | 79 | 86 | } | |
val res = arrayListOf<String>() | 80 | 87 | ||
messageBeforeSelectedTime.forEach { | 81 | 88 | fun getAllIMOBeforeSelectedTime(): ArrayList<String> { | |
if (it.value.vesselName.value != null) | 82 | 89 | val res = arrayListOf<String>() | |
res.add(it.value.vesselName.value!!) | 83 | 90 | messageBeforeSelectedTime.forEach { | |
} | 84 | 91 | if (it.value.imo.value != null) | |
92 | res.add(it.value.imo.value!!) | |||
return res | 85 | 93 | } | |
} | 86 | 94 | return res | |
87 | 95 | } | ||
fun getAllIMOBeforeSelectedTime(): ArrayList<String> { | 88 | 96 | ||
val res = arrayListOf<String>() | 89 | 97 | fun getAllCallSignBeforeSelectedTime(): ArrayList<String> { | |
messageBeforeSelectedTime.forEach { | 90 | 98 | val res = arrayListOf<String>() | |
if (it.value.imo.value != null) | 91 | 99 | messageBeforeSelectedTime.forEach { | |
res.add(it.value.imo.value!!) | 92 | 100 | if (it.value.callSign.value != null) | |
101 | res.add(it.value.callSign.value!!) | |||
} | 93 | 102 | } | |
return res | 94 | 103 | return res | |
} | 95 | 104 | } | |
96 | 105 | |||
fun getAllCallSignBeforeSelectedTime(): ArrayList<String> { | 97 | 106 | fun getAllVesselTypeBeforeSelectedTime(): ArrayList<Double> { | |
val res = arrayListOf<String>() | 98 | 107 | val res = arrayListOf<Double>() | |
messageBeforeSelectedTime.forEach { | 99 | 108 | messageBeforeSelectedTime.forEach { | |
if (it.value.callSign.value != null) | 100 | 109 | if (it.value.vesselType.value != null) | |
110 | res.add(it.value.vesselType.value!!) | |||
res.add(it.value.callSign.value!!) | 101 | 111 | } | |
} | 102 | 112 | return res | |
return res | 103 | 113 | } | |
} | 104 | 114 | ||
105 | 115 | fun getAllStatusBeforeSelectedTime(): ArrayList<String> { | ||
fun getAllVesselTypeBeforeSelectedTime(): ArrayList<Double> { | 106 | 116 | val res = arrayListOf<String>() | |
val res = arrayListOf<Double>() | 107 | 117 | messageBeforeSelectedTime.forEach { | |
messageBeforeSelectedTime.forEach { | 108 | 118 | if (it.value.status.value != null) | |
119 | res.add(it.value.status.value!!) | |||
if (it.value.vesselType.value != null) | 109 | 120 | } | |
res.add(it.value.vesselType.value!!) | 110 | 121 | return res | |
} | 111 | 122 | } | |
return res | 112 | 123 | ||
} | 113 | 124 | fun getAllLengthBeforeSelectedTime(): ArrayList<Double> { | |
114 | 125 | val res = arrayListOf<Double>() | ||
fun getAllStatusBeforeSelectedTime(): ArrayList<String> { | 115 | 126 | messageBeforeSelectedTime.forEach { | |
val res = arrayListOf<String>() | 116 | 127 | if (it.value.length.value != null) | |
128 | res.add(it.value.length.value!!) | |||
messageBeforeSelectedTime.forEach { | 117 | 129 | } | |
if (it.value.status.value != null) | 118 | 130 | return res | |
res.add(it.value.status.value!!) | 119 | 131 | } | |
} | 120 | 132 | ||
return res | 121 | 133 | fun getAllWidthBeforeSelectedTime(): ArrayList<Double> { | |
} | 122 | 134 | val res = arrayListOf<Double>() | |
123 | 135 | messageBeforeSelectedTime.forEach { | ||
fun getAllLengthBeforeSelectedTime(): ArrayList<Double> { | 124 | 136 | if (it.value.width.value != null) | |
137 | res.add(it.value.width.value!!) | |||
val res = arrayListOf<Double>() | 125 | 138 | } | |
messageBeforeSelectedTime.forEach { | 126 | 139 | return res | |
if (it.value.length.value != null) | 127 | 140 | } | |
res.add(it.value.length.value!!) | 128 | 141 | ||
} | 129 | 142 | fun getAllDraftBeforeSelectedTime(): ArrayList<Double> { | |
return res | 130 | 143 | val res = arrayListOf<Double>() | |
} | 131 | 144 | messageBeforeSelectedTime.forEach { | |
132 | 145 | if (it.value.draft.value != null) | ||
146 | res.add(it.value.draft.value!!) | |||
fun getAllWidthBeforeSelectedTime(): ArrayList<Double> { | 133 | 147 | } | |
val res = arrayListOf<Double>() | 134 | 148 | return res | |
messageBeforeSelectedTime.forEach { | 135 | 149 | } | |
if (it.value.width.value != null) | 136 | 150 | ||
res.add(it.value.width.value!!) | 137 | 151 | fun getAllCargoBeforeSelectedTime(): ArrayList<Double> { | |
} | 138 | 152 | val res = arrayListOf<Double>() | |
return res | 139 | 153 | messageBeforeSelectedTime.forEach { | |
} | 140 | 154 | if (it.value.cargo.value != null) | |
155 | res.add(it.value.cargo.value!!) | |||
141 | 156 | } | ||
fun getAllDraftBeforeSelectedTime(): ArrayList<Double> { | 142 | 157 | return res | |
val res = arrayListOf<Double>() | 143 | 158 | } | |
messageBeforeSelectedTime.forEach { | 144 | 159 | ||
if (it.value.draft.value != null) | 145 | 160 | fun getAllTime(): ArrayList<String> { | |
res.add(it.value.draft.value!!) | 146 | 161 | val timeList = arrayListOf<String>() | |
} | 147 | 162 | messages.forEach { | |
return res | 148 | 163 | if (it.value.time.value != null) | |
164 | timeList.add(it.value.time.value!!) | |||
} | 149 | 165 | } | |
150 | 166 | |||
fun getAllCargoBeforeSelectedTime(): ArrayList<Double> { | 151 | 167 | return timeList | |
val res = arrayListOf<Double>() | 152 | 168 | } | |
messageBeforeSelectedTime.forEach { | 153 | 169 | ||
if (it.value.cargo.value != null) | 154 | 170 | fun getAllLatitude(): ArrayList<Double> { | |
res.add(it.value.cargo.value!!) | 155 | 171 | val latitudeList = arrayListOf<Double>() | |
} | 156 | 172 | messages.forEach { | |
return res | 157 | 173 | if (it.value.latitude.value != null) | |
174 | latitudeList.add(it.value.latitude.value!!) | |||
} | 158 | 175 | } | |
159 | 176 | |||
fun getAllTime(): ArrayList<String> { | 160 | 177 | return latitudeList | |
val timeList = arrayListOf<String>() | 161 | 178 | } | |
messages.forEach { | 162 | 179 | ||
if (it.value.time.value != null) | 163 | 180 | fun getAllLongitude(): ArrayList<Double> { | |
timeList.add(it.value.time.value!!) | 164 | 181 | val longitudeList = arrayListOf<Double>() | |
} | 165 | 182 | messages.forEach { | |
166 | 183 | if (it.value.longitude.value != null) | ||
184 | longitudeList.add(it.value.longitude.value!!) | |||
return timeList | 167 | 185 | } | |
} | 168 | 186 | ||
169 | 187 | return longitudeList | ||
fun getAllLatitude(): ArrayList<Double> { | 170 | 188 | } | |
val latitudeList = arrayListOf<Double>() | 171 | 189 | ||
messages.forEach { | 172 | 190 | fun getAllSpeedOverGround(): ArrayList<Double> { | |
if (it.value.latitude.value != null) | 173 | 191 | val speedOverGroundList = arrayListOf<Double>() | |
latitudeList.add(it.value.latitude.value!!) | 174 | 192 | messages.forEach { | |
} | 175 | 193 | if (it.value.speedOverGround.value != null) | |
194 | speedOverGroundList.add(it.value.speedOverGround.value!!) | |||
176 | 195 | } | ||
return latitudeList | 177 | 196 | ||
} | 178 | 197 | return speedOverGroundList | |
179 | 198 | } | ||
fun getAllLongitude(): ArrayList<Double> { | 180 | 199 | ||
val longitudeList = arrayListOf<Double>() | 181 | 200 | fun getAllCourseOverGround(): ArrayList<Double> { | |
messages.forEach { | 182 | 201 | val res = arrayListOf<Double>() | |
if (it.value.longitude.value != null) | 183 | 202 | messages.forEach { | |
longitudeList.add(it.value.longitude.value!!) | 184 | 203 | if (it.value.courseOverGround.value != null) | |
204 | res.add(it.value.courseOverGround.value!!) | |||
} | 185 | 205 | } | |
186 | 206 | |||
return longitudeList | 187 | 207 | return res | |
} | 188 | 208 | } | |
189 | 209 | |||
fun getAllSpeedOverGround(): ArrayList<Double> { | 190 | 210 | fun getAllHeading(): ArrayList<Double> { | |
val speedOverGroundList = arrayListOf<Double>() | 191 | 211 | val res = arrayListOf<Double>() | |
messages.forEach { | 192 | 212 | messages.forEach { | |
213 | if (it.value.heading.value != null) | |||
if (it.value.speedOverGround.value != null) | 193 | 214 | res.add(it.value.heading.value!!) | |
speedOverGroundList.add(it.value.speedOverGround.value!!) | 194 | 215 | } | |
} | 195 | 216 | ||
196 | 217 | return res | ||
return speedOverGroundList | 197 | 218 | } | |
} | 198 | 219 | ||
199 | 220 | fun getAllVesselName(): ArrayList<String> { | ||
fun getAllCourseOverGround(): ArrayList<Double> { | 200 | 221 | val res = arrayListOf<String>() | |
val res = arrayListOf<Double>() | 201 | 222 | messages.forEach { | |
messages.forEach { | 202 | 223 | if (it.value.vesselName.value != null) | |
224 | res.add(it.value.vesselName.value!!) | |||
if (it.value.courseOverGround.value != null) | 203 | 225 | } | |
res.add(it.value.courseOverGround.value!!) | 204 | 226 | return res | |
} | 205 | 227 | } | |
206 | 228 | |||
return res | 207 | 229 | fun getAllIMO(): ArrayList<String> { | |
} | 208 | 230 | val res = arrayListOf<String>() | |
209 | 231 | messages.forEach { | ||
fun getAllHeading(): ArrayList<Double> { | 210 | 232 | if (it.value.imo.value != null) | |
233 | res.add(it.value.imo.value!!) | |||
val res = arrayListOf<Double>() | 211 | 234 | } | |
messages.forEach { | 212 | 235 | return res | |
if (it.value.heading.value != null) | 213 | 236 | } | |
res.add(it.value.heading.value!!) | 214 | 237 | ||
} | 215 | 238 | fun getAllCallSign(): ArrayList<String> { | |
216 | 239 | val res = arrayListOf<String>() | ||
return res | 217 | 240 | messages.forEach { | |
} | 218 | 241 | if (it.value.callSign.value != null) | |
242 | res.add(it.value.callSign.value!!) | |||
219 | 243 | } | ||
fun getAllVesselName(): ArrayList<String> { | 220 | 244 | return res | |
val res = arrayListOf<String>() | 221 | 245 | } | |
messages.forEach { | 222 | 246 | ||
if (it.value.vesselName.value != null) | 223 | 247 | fun getAllVesselType(): ArrayList<Double> { | |
res.add(it.value.vesselName.value!!) | 224 | 248 | val res = arrayListOf<Double>() | |
} | 225 | 249 | messages.forEach { | |
return res | 226 | 250 | if (it.value.vesselType.value != null) | |
251 | res.add(it.value.vesselType.value!!) | |||
} | 227 | 252 | } | |
228 | 253 | return res | ||
fun getAllIMO(): ArrayList<String> { | 229 | 254 | } | |
val res = arrayListOf<String>() | 230 | 255 | ||
messages.forEach { | 231 | 256 | fun getAllStatus(): ArrayList<String> { | |
if (it.value.imo.value != null) | 232 | 257 | val res = arrayListOf<String>() | |
res.add(it.value.imo.value!!) | 233 | 258 | messages.forEach { | |
} | 234 | 259 | if (it.value.status.value != null) | |
260 | res.add(it.value.status.value!!) | |||
return res | 235 | 261 | } | |
} | 236 | 262 | return res | |
237 | 263 | } | ||
fun getAllCallSign(): ArrayList<String> { | 238 | 264 | ||
val res = arrayListOf<String>() | 239 | 265 | fun getAllLength(): ArrayList<Double> { | |
messages.forEach { | 240 | 266 | val res = arrayListOf<Double>() | |
if (it.value.callSign.value != null) | 241 | 267 | messages.forEach { | |
res.add(it.value.callSign.value!!) | 242 | 268 | if (it.value.length.value != null) | |
269 | res.add(it.value.length.value!!) | |||
} | 243 | 270 | } | |
return res | 244 | 271 | return res | |
} | 245 | 272 | } | |
246 | 273 | |||
fun getAllVesselType(): ArrayList<Double> { | 247 | 274 | fun getAllWidth(): ArrayList<Double> { | |
val res = arrayListOf<Double>() | 248 | 275 | val res = arrayListOf<Double>() | |
messages.forEach { | 249 | 276 | messages.forEach { | |
if (it.value.vesselType.value != null) | 250 | 277 | if (it.value.width.value != null) | |
278 | res.add(it.value.width.value!!) | |||
res.add(it.value.vesselType.value!!) | 251 | 279 | } | |
} | 252 | 280 | return res | |
return res | 253 | 281 | } | |
} | 254 | 282 | ||
255 | 283 | fun getAllDraft(): ArrayList<Double> { | ||
fun getAllStatus(): ArrayList<String> { | 256 | 284 | val res = arrayListOf<Double>() | |
val res = arrayListOf<String>() | 257 | 285 | messages.forEach { | |
messages.forEach { | 258 | 286 | if (it.value.draft.value != null) | |
287 | res.add(it.value.draft.value!!) | |||
if (it.value.status.value != null) | 259 | 288 | } | |
res.add(it.value.status.value!!) | 260 | 289 | return res | |
} | 261 | 290 | } | |
return res | 262 | 291 | ||
} | 263 | 292 | fun getAllCargo(): ArrayList<Double> { | |
264 | 293 | val res = arrayListOf<Double>() | ||
fun getAllLength(): ArrayList<Double> { | 265 | 294 | messages.forEach { | |
val res = arrayListOf<Double>() | 266 | 295 | if (it.value.cargo.value != null) | |
296 | res.add(it.value.cargo.value!!) | |||
297 | ||||
messages.forEach { | 267 | 298 | } | |
if (it.value.length.value != null) | 268 | 299 | return res | |
res.add(it.value.length.value!!) | 269 | 300 | } | |
} | 270 | 301 | ||
return res | 271 | 302 | companion object { | |
} | 272 | 303 | var maxTime: Long = 0 | |
273 | 304 | var minTime: Long = 0 | ||
fun getAllWidth(): ArrayList<Double> { | 274 | 305 | } | |
val res = arrayListOf<Double>() | 275 | 306 | ||
messages.forEach { | 276 | 307 | } | |
if (it.value.width.value != null) | 277 | |||
res.add(it.value.width.value!!) | 278 | |||
} | 279 | |||
return res | 280 | |||
} | 281 | |||
282 | ||||
fun getAllDraft(): ArrayList<Double> { | 283 | |||
val res = arrayListOf<Double>() | 284 | |||
messages.forEach { | 285 | |||
if (it.value.draft.value != null) | 286 | |||
res.add(it.value.draft.value!!) | 287 | |||
} | 288 |