Commit df68a9fdcc44bce10a158df2905bf566f2245627

Authored by lsagona
1 parent 93534e6934
Exists in master and in 1 other branch dev

refactor graph minor optimization

Showing 5 changed files with 211 additions and 183 deletions Side-by-side Diff

src/main/kotlin/application/controller/DataPanelController.kt View file @ df68a9f
... ... @@ -20,35 +20,34 @@
20 20  
21 21  
22 22 class DataPanelController : Initializable, SelectedVesselListener {
23   - private var dataList: ObservableList<Pair<String, ArrayList<MessageData?>>> = FXCollections.observableArrayList()
24   - private lateinit var timeData: ArrayList<MessageData?>
  23 + private var dataList: ObservableList<String> = FXCollections.observableArrayList()
  24 + private lateinit var timeData: ArrayList<String>
25 25  
26   - private val latitude: ArrayList<MessageData?> = arrayListOf()
27   - private val longitude: ArrayList<MessageData?> = arrayListOf()
28   - private val speedOverGround: ArrayList<MessageData?> = arrayListOf()
29   - private val courseOverGround: ArrayList<MessageData?> = arrayListOf()
30   - private val heading: ArrayList<MessageData?> = arrayListOf()
31   - private val vesselName: ArrayList<MessageData?> = arrayListOf()
32   - private val imo: ArrayList<MessageData?> = arrayListOf()
33   - private val callSign: ArrayList<MessageData?> = arrayListOf()
34   - private val vesselType: ArrayList<MessageData?> = arrayListOf()
35   - private val status: ArrayList<MessageData?> = arrayListOf()
36   - private val length: ArrayList<MessageData?> = arrayListOf()
37   - private val width: ArrayList<MessageData?> = arrayListOf()
38   - private val draft: ArrayList<MessageData?> = arrayListOf()
39   - private val cargo: ArrayList<MessageData?> = arrayListOf()
  26 + private val latitude: ArrayList<Double> = arrayListOf()
  27 + private val longitude: ArrayList<Double> = arrayListOf()
  28 + private val speedOverGround: ArrayList<Double> = arrayListOf()
  29 + private val courseOverGround: ArrayList<Double> = arrayListOf()
  30 + private val heading: ArrayList<Double> = arrayListOf()
  31 + private val vesselName: ArrayList<String> = arrayListOf()
  32 + private val imo: ArrayList<String> = arrayListOf()
  33 + private val callSign: ArrayList<String> = arrayListOf()
  34 + private val vesselType: ArrayList<Double> = arrayListOf()
  35 + private val status: ArrayList<String> = arrayListOf()
  36 + private val length: ArrayList<Double> = arrayListOf()
  37 + private val width: ArrayList<Double> = arrayListOf()
  38 + private val draft: ArrayList<Double> = arrayListOf()
  39 + private val cargo: ArrayList<Double> = arrayListOf()
40 40  
41   - private var selectedItem: Pair<String, ArrayList<MessageData?>>? = null
  41 + private var selectedItem: String? = null
42 42  
43 43 @FXML
44   - var dataListView = ListView<Pair<String, ArrayList<MessageData?>>>()
  44 + var dataListView = ListView<String>()
45 45  
46 46 @FXML
47 47 var dataViewer = JavaFxDataViewer()
48 48  
49 49 private val plotData = PlotData()
50 50 private val config = DataViewerConfiguration()
51   -
52 51 override fun initialize(location: URL?, resources: ResourceBundle?) {
53 52 setObservableSelectedVesselListener()
54 53 dataListView.items = dataList
55 54  
... ... @@ -61,13 +60,13 @@
61 60 setObservableCurrentTimeListener()
62 61  
63 62 dataListView.setCellFactory {
64   - object : ListCell<Pair<String, ArrayList<MessageData?>>?>() {
65   - override fun updateItem(item: Pair<String, ArrayList<MessageData?>>?, empty: Boolean) {
  63 + object : ListCell<String?>() {
  64 + override fun updateItem(item: String?, empty: Boolean) {
66 65 super.updateItem(item, empty)
67 66 text = if (empty) {
68 67 null
69 68 } else {
70   - item?.first
  69 + item
71 70 }
72 71 }
73 72 }
... ... @@ -98,7 +97,9 @@
98 97 }
99 98 }
100 99  
101   - private fun plot(data: Pair<String, ArrayList<MessageData?>>?) {
  100 +
  101 +
  102 + private fun plot(data: String?) {
102 103 if (data == null) {
103 104 plotData.allTraces.clear()
104 105 config.setxAxisTitle("")
105 106  
106 107  
107 108  
... ... @@ -108,39 +109,62 @@
108 109 dataViewer.resetPlot()
109 110  
110 111 return
111   - }else if (data.second.size < timeData.size) return
112   -
113   - val getValueVisitorX = GetValueVisitor()
114   - val getValueVisitorY = GetValueVisitor()
115   -
116   - val arrayListStringX = arrayListOf<String>()
117   -// val arrayListDoubleX = arrayListOf<Double>()
118   - val arrayListStringY = arrayListOf<String>()
119   - val arrayListDoubleY = arrayListOf<Double>()
120   -
121   - for (x in 0 until timeData.size) {
122   - timeData[x]?.accept(getValueVisitorX)
123   - data.second[x]?.accept(getValueVisitorY)
124   -
125   - if (getValueVisitorY.value.toDoubleOrNull() == null) {
126   - arrayListStringX.add(getValueVisitorX.value)
127   - arrayListStringY.add(getValueVisitorY.value)
128   - } else {
129   - arrayListStringX.add(getValueVisitorX.value)
130   - arrayListDoubleY.add(getValueVisitorY.value.toDouble())
131   - }
132 112 }
133 113  
134 114 val scatterTrace = ScatterTrace<Any>()
135 115 scatterTrace.traceColour = TraceColour.RED
136 116 scatterTrace.traceVisibility = TraceVisibility.TRUE
137 117  
138   - val serieStringX: Array<String> = arrayListStringX.toTypedArray()
  118 + val serieStringX: Array<String> = timeData.toTypedArray()
139 119 // val serieDoubleX: Array<Double> = arrayListDoubleX.toTypedArray()
140   - val serieStringY: Array<String> = arrayListStringY.toTypedArray()
141   - val serieDoubleY: Array<Double> = arrayListDoubleY.toTypedArray()
  120 + var serieStringY: Array<String> = arrayOf()
  121 + var serieDoubleY: Array<Double> = arrayOf()
  122 + when (data) {
  123 + "Latitude" -> {
  124 + serieDoubleY = latitude.toTypedArray()
  125 + }
  126 + "Longitude" -> {
  127 + serieDoubleY = longitude.toTypedArray()
  128 + }
  129 + "Speed Over Ground" -> {
  130 + serieDoubleY = speedOverGround.toTypedArray()
  131 + }
  132 + "Course Over Ground" -> {
  133 + serieDoubleY = courseOverGround.toTypedArray()
  134 + }
  135 + "Heading" -> {
  136 + serieDoubleY = heading.toTypedArray()
  137 + }
  138 + "Vessel Name" -> {
  139 + serieStringY = vesselName.toTypedArray()
  140 + }
  141 + "IMO" -> {
  142 + serieStringY = imo.toTypedArray()
  143 + }
  144 + "Call Sign" -> {
  145 + serieStringY = callSign.toTypedArray()
  146 + }
  147 + "Vessel Type" -> {
  148 + serieDoubleY = vesselType.toTypedArray()
  149 + }
  150 + "Status" -> {
  151 + serieStringY = status.toTypedArray()
  152 + }
  153 + "Length" -> {
  154 + serieDoubleY = length.toTypedArray()
  155 + }
  156 + "Width" -> {
  157 + serieDoubleY = width.toTypedArray()
  158 + }
  159 + "Draft" -> {
  160 + serieDoubleY = draft.toTypedArray()
  161 + }
  162 + "Cargo" -> {
  163 + serieDoubleY = cargo.toTypedArray()
  164 + }
  165 + }
142 166  
143   - if (getValueVisitorY.value.toDoubleOrNull() == null) {
  167 + if (serieStringY.isNotEmpty()) {
144 168 scatterTrace.setxArray(serieStringX)
145 169 scatterTrace.setyArray(serieStringY)
146 170 } else {
... ... @@ -150,7 +174,7 @@
150 174  
151 175 config.plotTitle = ""
152 176 config.setxAxisTitle("Time (s)")
153   - config.setyAxisTitle(data.first)
  177 + config.setyAxisTitle(data)
154 178 dataViewer.resetPlot()
155 179 plotData.allTraces.clear()
156 180 plotData.addTrace(scatterTrace)
157 181  
... ... @@ -159,12 +183,11 @@
159 183  
160 184 }
161 185  
162   -
163 186 private fun setObservableSelectedVesselListener() {
164 187 observableSelectedVessel.listeners.add(this)
165 188 }
166 189  
167   - private fun populateTime(vessel: Vessel): ArrayList<MessageData?> {
  190 + private fun populateTime(vessel: Vessel): ArrayList<String> {
168 191 return if (observableIsReplayState.value) {
169 192 vessel.getAllTimeBeforeSelectedTime()
170 193 } else {
... ... @@ -172,8 +195,7 @@
172 195 }
173 196 }
174 197  
175   -
176   - private fun populateLatitude(vessel: Vessel): ArrayList<MessageData?> {
  198 + private fun populateLatitude(vessel: Vessel): ArrayList<Double> {
177 199 return if (observableIsReplayState.value) {
178 200 vessel.getAllLatitudeBeforeSelectedTime()
179 201 } else {
... ... @@ -181,7 +203,7 @@
181 203 }
182 204 }
183 205  
184   - private fun populateLongitude(vessel: Vessel): ArrayList<MessageData?> {
  206 + private fun populateLongitude(vessel: Vessel): ArrayList<Double> {
185 207 return if (observableIsReplayState.value) {
186 208 vessel.getAllLongitudeBeforeSelectedTime()
187 209 } else {
... ... @@ -189,7 +211,7 @@
189 211 }
190 212 }
191 213  
192   - private fun populateSpeedOverGround(vessel: Vessel): ArrayList<MessageData?> {
  214 + private fun populateSpeedOverGround(vessel: Vessel): ArrayList<Double> {
193 215 return if (observableIsReplayState.value) {
194 216 vessel.getAllSpeedOverGroundBeforeSelectedTime()
195 217 } else {
... ... @@ -197,7 +219,7 @@
197 219 }
198 220 }
199 221  
200   - private fun populateCourseOverGround(vessel: Vessel): ArrayList<MessageData?> {
  222 + private fun populateCourseOverGround(vessel: Vessel): ArrayList<Double> {
201 223 return if (observableIsReplayState.value) {
202 224 vessel.getAllCourseOverGroundBeforeSelectedTime()
203 225 } else {
... ... @@ -205,7 +227,7 @@
205 227 }
206 228 }
207 229  
208   - private fun populateHeading(vessel: Vessel): ArrayList<MessageData?> {
  230 + private fun populateHeading(vessel: Vessel): ArrayList<Double> {
209 231 return if (observableIsReplayState.value) {
210 232 vessel.getAllHeadingBeforeSelectedTime()
211 233 } else {
... ... @@ -213,7 +235,7 @@
213 235 }
214 236 }
215 237  
216   - private fun populateVesselName(vessel: Vessel): ArrayList<MessageData?> {
  238 + private fun populateVesselName(vessel: Vessel): ArrayList<String> {
217 239 return if (observableIsReplayState.value) {
218 240 vessel.getAllVesselNameBeforeSelectedTime()
219 241 } else {
... ... @@ -221,7 +243,7 @@
221 243 }
222 244 }
223 245  
224   - private fun populateIMO(vessel: Vessel): ArrayList<MessageData?> {
  246 + private fun populateIMO(vessel: Vessel): ArrayList<String> {
225 247 return if (observableIsReplayState.value) {
226 248 vessel.getAllIMOBeforeSelectedTime()
227 249 } else {
... ... @@ -229,7 +251,7 @@
229 251 }
230 252 }
231 253  
232   - private fun populateCallSign(vessel: Vessel): ArrayList<MessageData?> {
  254 + private fun populateCallSign(vessel: Vessel): ArrayList<String> {
233 255 return if (observableIsReplayState.value) {
234 256 vessel.getAllCallSignBeforeSelectedTime()
235 257 } else {
... ... @@ -237,7 +259,7 @@
237 259 }
238 260 }
239 261  
240   - private fun populateVesselType(vessel: Vessel): ArrayList<MessageData?> {
  262 + private fun populateVesselType(vessel: Vessel): ArrayList<Double> {
241 263 return if (observableIsReplayState.value) {
242 264 vessel.getAllVesselTypeBeforeSelectedTime()
243 265 } else {
... ... @@ -245,7 +267,7 @@
245 267 }
246 268 }
247 269  
248   - private fun populateStatus(vessel: Vessel): ArrayList<MessageData?> {
  270 + private fun populateStatus(vessel: Vessel): ArrayList<String> {
249 271 return if (observableIsReplayState.value) {
250 272 vessel.getAllStatusBeforeSelectedTime()
251 273 } else {
... ... @@ -253,7 +275,7 @@
253 275 }
254 276 }
255 277  
256   - private fun populateLength(vessel: Vessel): ArrayList<MessageData?> {
  278 + private fun populateLength(vessel: Vessel): ArrayList<Double> {
257 279 return if (observableIsReplayState.value) {
258 280 vessel.getAllLengthBeforeSelectedTime()
259 281 } else {
... ... @@ -261,7 +283,7 @@
261 283 }
262 284 }
263 285  
264   - private fun populateWidth(vessel: Vessel): ArrayList<MessageData?> {
  286 + private fun populateWidth(vessel: Vessel): ArrayList<Double> {
265 287 return if (observableIsReplayState.value) {
266 288 vessel.getAllWidthBeforeSelectedTime()
267 289 } else {
... ... @@ -269,7 +291,7 @@
269 291 }
270 292 }
271 293  
272   - private fun populateDraft(vessel: Vessel): ArrayList<MessageData?> {
  294 + private fun populateDraft(vessel: Vessel): ArrayList<Double> {
273 295 return if (observableIsReplayState.value) {
274 296 vessel.getAllDraftBeforeSelectedTime()
275 297 } else {
... ... @@ -277,7 +299,7 @@
277 299 }
278 300 }
279 301  
280   - private fun populateCargo(vessel: Vessel): ArrayList<MessageData?> {
  302 + private fun populateCargo(vessel: Vessel): ArrayList<Double> {
281 303 return if (observableIsReplayState.value) {
282 304 vessel.getAllCargoBeforeSelectedTime()
283 305 } else {
284 306  
... ... @@ -286,22 +308,22 @@
286 308 }
287 309  
288 310 private fun initDataList() {
289   - val data = arrayListOf<Pair<String, ArrayList<MessageData?>>>()
  311 + val data = arrayListOf<String>()
290 312  
291   - data.add(Pair("Latitude", latitude))
292   - data.add(Pair("Longitude", longitude))
293   - data.add(Pair("Speed Over Ground", speedOverGround))
294   - data.add(Pair("Course Over Ground", courseOverGround))
295   - data.add(Pair("Heading", heading))
296   - data.add(Pair("Vessel Name", vesselName))
297   - data.add(Pair("IMO", imo))
298   - data.add(Pair("Call Sign", callSign))
299   - data.add(Pair("Vessel Type", vesselType))
300   - data.add(Pair("Status", status))
301   - data.add(Pair("Length", length))
302   - data.add(Pair("Width", width))
303   - data.add(Pair("Draft", draft))
304   - data.add(Pair("Cargo", cargo))
  313 + data.add("Latitude")
  314 + data.add("Longitude")
  315 + data.add("Speed Over Ground")
  316 + data.add("Course Over Ground")
  317 + data.add("Heading")
  318 + data.add("Vessel Name")
  319 + data.add("IMO")
  320 + data.add("Call Sign")
  321 + data.add("Vessel Type")
  322 + data.add("Status")
  323 + data.add("Length")
  324 + data.add("Width")
  325 + data.add("Draft")
  326 + data.add("Cargo")
305 327  
306 328 dataList.addAll(data)
307 329 }
... ... @@ -309,9 +331,9 @@
309 331 private fun updateDataList(vessel: Vessel) {
310 332 timeData = populateTime(vessel)
311 333  
312   - if(dataListView.selectionModel.selectedItem == null) return
313   -
314   - when (dataListView.selectionModel.selectedItem.first) {
  334 + if (dataListView.selectionModel.selectedItem == null) return
  335 +//NOTE: Ajouter les nouvelles donnรฉe ร  la fin
  336 + when (dataListView.selectionModel.selectedItem) {
315 337 "Latitude" -> {
316 338 latitude.clear()
317 339 latitude.addAll(populateLatitude(vessel))
src/main/kotlin/application/model/Message.kt View file @ df68a9f
... ... @@ -13,12 +13,12 @@
13 13 val vesselName = VesselName(if (split[7] == "") null else split[7])
14 14 val imo = IMO(if (split[8] == "") null else split[8])
15 15 val callSign = CallSign(if (split[9] == "") null else split[9])
16   - val vesselType = VesselType(split[10].toIntOrNull())
  16 + val vesselType = VesselType(split[10].toDoubleOrNull())
17 17 val status = Status(if (split[11] == "") null else split[11])
18 18 val length = Length(split[12].toDoubleOrNull())
19 19 val width = Width(split[13].toDoubleOrNull())
20 20 val draft = Draft(split[14].toDoubleOrNull())
21   - val cargo = Cargo(split[15].toIntOrNull())
  21 + val cargo = Cargo(split[15].toDoubleOrNull())
22 22  
23 23 fun getHexColorStroke(): String {
24 24 var hex = Integer.toHexString(this.mmsi.value?.toInt()!!)
src/main/kotlin/application/model/MessageData.kt View file @ df68a9f
... ... @@ -31,7 +31,13 @@
31 31 override fun accept(visitor: MessageDataVisitor) = visitor.visit(messageData = this)
32 32 }
33 33  
34   -data class Time(val value: LocalDateTime) : MessageData {
  34 +data class Time(val date: LocalDateTime) : MessageData {
  35 + val value: String?
  36 +
  37 + init {
  38 + value = date.toString()
  39 + }
  40 +
35 41 override fun accept(visitor: MessageDataVisitor) = visitor.visit(messageData = this)
36 42 }
37 43  
... ... @@ -67,7 +73,7 @@
67 73 override fun accept(visitor: MessageDataVisitor) = visitor.visit(messageData = this)
68 74 }
69 75  
70   -data class VesselType(val value: Int?) : MessageData {
  76 +data class VesselType(val value: Double?) : MessageData {
71 77 override fun accept(visitor: MessageDataVisitor) = visitor.visit(messageData = this)
72 78 }
73 79  
... ... @@ -87,7 +93,7 @@
87 93 override fun accept(visitor: MessageDataVisitor) = visitor.visit(messageData = this)
88 94 }
89 95  
90   -data class Cargo(val value: Int?) : MessageData {
  96 +data class Cargo(val value: Double?) : MessageData {
91 97 override fun accept(visitor: MessageDataVisitor) = visitor.visit(messageData = this)
92 98 }
93 99  
src/main/kotlin/application/model/Vessel.kt View file @ df68a9f
... ... @@ -16,254 +16,254 @@
16 16 return field
17 17 }
18 18  
19   - fun getAllTimeBeforeSelectedTime(): ArrayList<MessageData?> {
20   - val timeList = arrayListOf<MessageData?>()
  19 + fun getAllTimeBeforeSelectedTime(): ArrayList<String> {
  20 + val timeList = arrayListOf<String>()
21 21 messageBeforeSelectedTime.forEach {
22   - timeList.add(it.value.time)
  22 + timeList.add(it.value.time.value!!)
23 23 }
24 24  
25 25 return timeList
26 26 }
27 27  
28   - fun getAllLatitudeBeforeSelectedTime(): ArrayList<MessageData?> {
29   - val latitudeList = arrayListOf<MessageData?>()
  28 + fun getAllLatitudeBeforeSelectedTime(): ArrayList<Double> {
  29 + val latitudeList = arrayListOf<Double>()
30 30 messageBeforeSelectedTime.forEach {
31   - latitudeList.add(it.value.latitude)
  31 + latitudeList.add(it.value.latitude.value!!)
32 32 }
33 33  
34 34 return latitudeList
35 35 }
36 36  
37   - fun getAllLongitudeBeforeSelectedTime(): ArrayList<MessageData?> {
38   - val longitudeList = arrayListOf<MessageData?>()
  37 + fun getAllLongitudeBeforeSelectedTime(): ArrayList<Double> {
  38 + val longitudeList = arrayListOf<Double>()
39 39 messageBeforeSelectedTime.forEach {
40   - longitudeList.add(it.value.longitude)
  40 + longitudeList.add(it.value.longitude.value!!)
41 41 }
42 42  
43 43 return longitudeList
44 44 }
45 45  
46   - fun getAllSpeedOverGroundBeforeSelectedTime(): ArrayList<MessageData?> {
47   - val speedOverGroundList = arrayListOf<MessageData?>()
  46 + fun getAllSpeedOverGroundBeforeSelectedTime(): ArrayList<Double> {
  47 + val speedOverGroundList = arrayListOf<Double>()
48 48 messageBeforeSelectedTime.forEach {
49   - speedOverGroundList.add(it.value.speedOverGround)
  49 + speedOverGroundList.add(it.value.speedOverGround.value!!)
50 50 }
51 51  
52 52 return speedOverGroundList
53 53 }
54 54  
55   - fun getAllCourseOverGroundBeforeSelectedTime(): ArrayList<MessageData?> {
56   - val res = arrayListOf<MessageData?>()
  55 + fun getAllCourseOverGroundBeforeSelectedTime(): ArrayList<Double> {
  56 + val res = arrayListOf<Double>()
57 57 messageBeforeSelectedTime.forEach {
58   - res.add(it.value.courseOverGround)
  58 + res.add(it.value.courseOverGround.value!!)
59 59 }
60 60  
61 61 return res
62 62 }
63 63  
64   - fun getAllHeadingBeforeSelectedTime(): ArrayList<MessageData?> {
65   - val res = arrayListOf<MessageData?>()
  64 + fun getAllHeadingBeforeSelectedTime(): ArrayList<Double> {
  65 + val res = arrayListOf<Double>()
66 66 messageBeforeSelectedTime.forEach {
67   - res.add(it.value.heading)
  67 + res.add(it.value.heading.value!!)
68 68 }
69 69  
70 70 return res
71 71 }
72 72  
73   - fun getAllVesselNameBeforeSelectedTime(): ArrayList<MessageData?> {
74   - val res = arrayListOf<MessageData?>()
  73 + fun getAllVesselNameBeforeSelectedTime(): ArrayList<String> {
  74 + val res = arrayListOf<String>()
75 75 messageBeforeSelectedTime.forEach {
76   - res.add(it.value.vesselName)
  76 + res.add(it.value.vesselName.value!!)
77 77 }
78 78 return res
79 79 }
80 80  
81   - fun getAllIMOBeforeSelectedTime(): ArrayList<MessageData?> {
82   - val res = arrayListOf<MessageData?>()
  81 + fun getAllIMOBeforeSelectedTime(): ArrayList<String> {
  82 + val res = arrayListOf<String>()
83 83 messageBeforeSelectedTime.forEach {
84   - res.add(it.value.imo)
  84 + res.add(it.value.imo.value!!)
85 85 }
86 86 return res
87 87 }
88 88  
89   - fun getAllCallSignBeforeSelectedTime(): ArrayList<MessageData?> {
90   - val res = arrayListOf<MessageData?>()
  89 + fun getAllCallSignBeforeSelectedTime(): ArrayList<String> {
  90 + val res = arrayListOf<String>()
91 91 messageBeforeSelectedTime.forEach {
92   - res.add(it.value.callSign)
  92 + res.add(it.value.callSign.value!!)
93 93 }
94 94 return res
95 95 }
96 96  
97   - fun getAllVesselTypeBeforeSelectedTime(): ArrayList<MessageData?> {
98   - val res = arrayListOf<MessageData?>()
  97 + fun getAllVesselTypeBeforeSelectedTime(): ArrayList<Double> {
  98 + val res = arrayListOf<Double>()
99 99 messageBeforeSelectedTime.forEach {
100   - res.add(it.value.vesselType)
  100 + res.add(it.value.vesselType.value!!)
101 101 }
102 102 return res
103 103 }
104 104  
105   - fun getAllStatusBeforeSelectedTime(): ArrayList<MessageData?> {
106   - val res = arrayListOf<MessageData?>()
  105 + fun getAllStatusBeforeSelectedTime(): ArrayList<String> {
  106 + val res = arrayListOf<String>()
107 107 messageBeforeSelectedTime.forEach {
108   - res.add(it.value.status)
  108 + res.add(it.value.status.value!!)
109 109 }
110 110 return res
111 111 }
112 112  
113   - fun getAllLengthBeforeSelectedTime(): ArrayList<MessageData?> {
114   - val res = arrayListOf<MessageData?>()
  113 + fun getAllLengthBeforeSelectedTime(): ArrayList<Double> {
  114 + val res = arrayListOf<Double>()
115 115 messageBeforeSelectedTime.forEach {
116   - res.add(it.value.length)
  116 + res.add(it.value.length.value!!)
117 117 }
118 118 return res
119 119 }
120 120  
121   - fun getAllWidthBeforeSelectedTime(): ArrayList<MessageData?> {
122   - val res = arrayListOf<MessageData?>()
  121 + fun getAllWidthBeforeSelectedTime(): ArrayList<Double> {
  122 + val res = arrayListOf<Double>()
123 123 messageBeforeSelectedTime.forEach {
124   - res.add(it.value.width)
  124 + res.add(it.value.width.value!!)
125 125 }
126 126 return res
127 127 }
128 128  
129   - fun getAllDraftBeforeSelectedTime(): ArrayList<MessageData?> {
130   - val res = arrayListOf<MessageData?>()
  129 + fun getAllDraftBeforeSelectedTime(): ArrayList<Double> {
  130 + val res = arrayListOf<Double>()
131 131 messageBeforeSelectedTime.forEach {
132   - res.add(it.value.draft)
  132 + res.add(it.value.draft.value!!)
133 133 }
134 134 return res
135 135 }
136 136  
137   - fun getAllCargoBeforeSelectedTime(): ArrayList<MessageData?> {
138   - val res = arrayListOf<MessageData?>()
  137 + fun getAllCargoBeforeSelectedTime(): ArrayList<Double> {
  138 + val res = arrayListOf<Double>()
139 139 messageBeforeSelectedTime.forEach {
140   - res.add(it.value.cargo)
  140 + res.add(it.value.cargo.value!!)
141 141 }
142 142 return res
143 143 }
144 144  
145   - fun getAllTime(): ArrayList<MessageData?> {
146   - val timeList = arrayListOf<MessageData?>()
  145 + fun getAllTime(): ArrayList<String> {
  146 + val timeList = arrayListOf<String>()
147 147 messages.forEach {
148   - timeList.add(it.value.time)
  148 + timeList.add(it.value.time.value!!)
149 149 }
150 150  
151 151 return timeList
152 152 }
153 153  
154   - fun getAllLatitude(): ArrayList<MessageData?> {
155   - val latitudeList = arrayListOf<MessageData?>()
  154 + fun getAllLatitude(): ArrayList<Double> {
  155 + val latitudeList = arrayListOf<Double>()
156 156 messages.forEach {
157   - latitudeList.add(it.value.latitude)
  157 + latitudeList.add(it.value.latitude.value!!)
158 158 }
159 159  
160 160 return latitudeList
161 161 }
162 162  
163   - fun getAllLongitude(): ArrayList<MessageData?> {
164   - val longitudeList = arrayListOf<MessageData?>()
  163 + fun getAllLongitude(): ArrayList<Double> {
  164 + val longitudeList = arrayListOf<Double>()
165 165 messages.forEach {
166   - longitudeList.add(it.value.longitude)
  166 + longitudeList.add(it.value.longitude.value!!)
167 167 }
168 168  
169 169 return longitudeList
170 170 }
171 171  
172   - fun getAllSpeedOverGround(): ArrayList<MessageData?> {
173   - val speedOverGroundList = arrayListOf<MessageData?>()
  172 + fun getAllSpeedOverGround(): ArrayList<Double> {
  173 + val speedOverGroundList = arrayListOf<Double>()
174 174 messages.forEach {
175   - speedOverGroundList.add(it.value.speedOverGround)
  175 + speedOverGroundList.add(it.value.speedOverGround.value!!)
176 176 }
177 177  
178 178 return speedOverGroundList
179 179 }
180 180  
181   - fun getAllCourseOverGround(): ArrayList<MessageData?> {
182   - val res = arrayListOf<MessageData?>()
  181 + fun getAllCourseOverGround(): ArrayList<Double> {
  182 + val res = arrayListOf<Double>()
183 183 messages.forEach {
184   - res.add(it.value.courseOverGround)
  184 + res.add(it.value.courseOverGround.value!!)
185 185 }
186 186  
187 187 return res
188 188 }
189 189  
190   - fun getAllHeading(): ArrayList<MessageData?> {
191   - val res = arrayListOf<MessageData?>()
  190 + fun getAllHeading(): ArrayList<Double> {
  191 + val res = arrayListOf<Double>()
192 192 messages.forEach {
193   - res.add(it.value.heading)
  193 + res.add(it.value.heading.value!!)
194 194 }
195 195  
196 196 return res
197 197 }
198 198  
199   - fun getAllVesselName(): ArrayList<MessageData?> {
200   - val res = arrayListOf<MessageData?>()
  199 + fun getAllVesselName(): ArrayList<String> {
  200 + val res = arrayListOf<String>()
201 201 messages.forEach {
202   - res.add(it.value.vesselName)
  202 + res.add(it.value.vesselName.value!!)
203 203 }
204 204 return res
205 205 }
206 206  
207   - fun getAllIMO(): ArrayList<MessageData?> {
208   - val res = arrayListOf<MessageData?>()
  207 + fun getAllIMO(): ArrayList<String> {
  208 + val res = arrayListOf<String>()
209 209 messages.forEach {
210   - res.add(it.value.imo)
  210 + res.add(it.value.imo.value!!)
211 211 }
212 212 return res
213 213 }
214 214  
215   - fun getAllCallSign(): ArrayList<MessageData?> {
216   - val res = arrayListOf<MessageData?>()
  215 + fun getAllCallSign(): ArrayList<String> {
  216 + val res = arrayListOf<String>()
217 217 messages.forEach {
218   - res.add(it.value.callSign)
  218 + res.add(it.value.callSign.value!!)
219 219 }
220 220 return res
221 221 }
222 222  
223   - fun getAllVesselType(): ArrayList<MessageData?> {
224   - val res = arrayListOf<MessageData?>()
  223 + fun getAllVesselType(): ArrayList<Double> {
  224 + val res = arrayListOf<Double>()
225 225 messages.forEach {
226   - res.add(it.value.vesselType)
  226 + res.add(it.value.vesselType.value!!)
227 227 }
228 228 return res
229 229 }
230 230  
231   - fun getAllStatus(): ArrayList<MessageData?> {
232   - val res = arrayListOf<MessageData?>()
  231 + fun getAllStatus(): ArrayList<String> {
  232 + val res = arrayListOf<String>()
233 233 messages.forEach {
234   - res.add(it.value.status)
  234 + res.add(it.value.status.value!!)
235 235 }
236 236 return res
237 237 }
238 238  
239   - fun getAllLength(): ArrayList<MessageData?> {
240   - val res = arrayListOf<MessageData?>()
  239 + fun getAllLength(): ArrayList<Double> {
  240 + val res = arrayListOf<Double>()
241 241 messages.forEach {
242   - res.add(it.value.length)
  242 + res.add(it.value.length.value!!)
243 243 }
244 244 return res
245 245 }
246 246  
247   - fun getAllWidth(): ArrayList<MessageData?> {
248   - val res = arrayListOf<MessageData?>()
  247 + fun getAllWidth(): ArrayList<Double> {
  248 + val res = arrayListOf<Double>()
249 249 messages.forEach {
250   - res.add(it.value.width)
  250 + res.add(it.value.width.value!!)
251 251 }
252 252 return res
253 253 }
254 254  
255   - fun getAllDraft(): ArrayList<MessageData?> {
256   - val res = arrayListOf<MessageData?>()
  255 + fun getAllDraft(): ArrayList<Double> {
  256 + val res = arrayListOf<Double>()
257 257 messages.forEach {
258   - res.add(it.value.draft)
  258 + res.add(it.value.draft.value!!)
259 259 }
260 260 return res
261 261 }
262 262  
263   - fun getAllCargo(): ArrayList<MessageData?> {
264   - val res = arrayListOf<MessageData?>()
  263 + fun getAllCargo(): ArrayList<Double> {
  264 + val res = arrayListOf<Double>()
265 265 messages.forEach {
266   - res.add(it.value.cargo)
  266 + res.add(it.value.cargo.value!!)
267 267 }
268 268 return res
269 269 }
src/main/kotlin/application/model/VesselGenerator.kt View file @ df68a9f
... ... @@ -18,7 +18,7 @@
18 18 if (!vessels.containsKey(message.mmsi.value)) {
19 19 vessels[message.mmsi.value] = Vessel(message.mmsi.value!!)
20 20 }
21   - val time = message.time.value.toEpochSecond(ZoneOffset.UTC)
  21 + val time = message.time.date.toEpochSecond(ZoneOffset.UTC)
22 22 vessels[message.mmsi.value]?.messages?.set(time, message)
23 23 if (time > maxTime) {
24 24 maxTime = time