Blame view

src/main/kotlin/application/model/Vessel.kt 7.22 KB
b350f9dfe   lsagona   import vessels an...
1
  package application.model
53f01ecc3   lsagona   display message o...
2
  import java.util.*
b350f9dfe   lsagona   import vessels an...
3

f39d90e60   lsagona   Select/deselect MMSI
4
  class Vessel(val mmsi: String?) {
3b26be8f9   lsagona   controle the time...
5
      val messages: SortedMap<Long, Message> = sortedMapOf()
e220e082b   lsagona   graph binded to s...
6
7
8
9
      private val messageBeforeSelectedTime: Map<Long, Message>
          get() {
              return messages.filter { observableCurrentTime.value > it.key }
          }
3b26be8f9   lsagona   controle the time...
10
11
      var messageToDisplay: Message? = null
          get() {
78935bd62   lsagona   slider bind to al...
12
13
              field =
                  messages.asSequence().map { it }.firstOrNull { observableCurrentTime.value < it.key }.let { it?.value }
3b26be8f9   lsagona   controle the time...
14
15
              return field
          }
e220e082b   lsagona   graph binded to s...
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
      fun getAllTimeBeforeSelectedTime(): ArrayList<MessageData?> {
          val timeList = arrayListOf<MessageData?>()
          messageBeforeSelectedTime.forEach {
              timeList.add(it.value.time)
          }
  
          return timeList
      }
  
      fun getAllLatitudeBeforeSelectedTime(): ArrayList<MessageData?> {
          val latitudeList = arrayListOf<MessageData?>()
          messageBeforeSelectedTime.forEach {
              latitudeList.add(it.value.latitude)
          }
  
          return latitudeList
      }
  
      fun getAllLongitudeBeforeSelectedTime(): ArrayList<MessageData?> {
          val longitudeList = arrayListOf<MessageData?>()
          messageBeforeSelectedTime.forEach {
              longitudeList.add(it.value.longitude)
          }
  
          return longitudeList
      }
  
      fun getAllSpeedOverGroundBeforeSelectedTime(): ArrayList<MessageData?> {
          val speedOverGroundList = arrayListOf<MessageData?>()
          messageBeforeSelectedTime.forEach {
              speedOverGroundList.add(it.value.speedOverGround)
          }
  
          return speedOverGroundList
      }
  
      fun getAllCourseOverGroundBeforeSelectedTime(): ArrayList<MessageData?> {
          val res = arrayListOf<MessageData?>()
          messageBeforeSelectedTime.forEach {
              res.add(it.value.courseOverGround)
          }
  
          return res
      }
  
      fun getAllHeadingBeforeSelectedTime(): ArrayList<MessageData?> {
          val res = arrayListOf<MessageData?>()
          messageBeforeSelectedTime.forEach {
              res.add(it.value.heading)
          }
  
          return res
      }
  
      fun getAllVesselNameBeforeSelectedTime(): ArrayList<MessageData?> {
          val res = arrayListOf<MessageData?>()
          messageBeforeSelectedTime.forEach {
              res.add(it.value.vesselName)
          }
          return res
      }
  
      fun getAllIMOBeforeSelectedTime(): ArrayList<MessageData?> {
          val res = arrayListOf<MessageData?>()
          messageBeforeSelectedTime.forEach {
              res.add(it.value.imo)
          }
          return res
      }
  
      fun getAllCallSignBeforeSelectedTime(): ArrayList<MessageData?> {
          val res = arrayListOf<MessageData?>()
          messageBeforeSelectedTime.forEach {
              res.add(it.value.callSign)
          }
          return res
      }
  
      fun getAllVesselTypeBeforeSelectedTime(): ArrayList<MessageData?> {
          val res = arrayListOf<MessageData?>()
          messageBeforeSelectedTime.forEach {
              res.add(it.value.vesselType)
          }
          return res
      }
  
      fun getAllStatusBeforeSelectedTime(): ArrayList<MessageData?> {
          val res = arrayListOf<MessageData?>()
          messageBeforeSelectedTime.forEach {
              res.add(it.value.status)
          }
          return res
      }
  
      fun getAllLengthBeforeSelectedTime(): ArrayList<MessageData?> {
          val res = arrayListOf<MessageData?>()
          messageBeforeSelectedTime.forEach {
              res.add(it.value.length)
          }
          return res
      }
  
      fun getAllWidthBeforeSelectedTime(): ArrayList<MessageData?> {
          val res = arrayListOf<MessageData?>()
          messageBeforeSelectedTime.forEach {
              res.add(it.value.width)
          }
          return res
      }
  
      fun getAllDraftBeforeSelectedTime(): ArrayList<MessageData?> {
          val res = arrayListOf<MessageData?>()
          messageBeforeSelectedTime.forEach {
              res.add(it.value.draft)
          }
          return res
      }
  
      fun getAllCargoBeforeSelectedTime(): ArrayList<MessageData?> {
          val res = arrayListOf<MessageData?>()
          messageBeforeSelectedTime.forEach {
              res.add(it.value.cargo)
          }
          return res
      }
513c0341c   lsagona   add chart
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
      fun getAllTime(): ArrayList<MessageData?> {
          val timeList = arrayListOf<MessageData?>()
          messages.forEach {
              timeList.add(it.value.time)
          }
  
          return timeList
      }
  
      fun getAllLatitude(): ArrayList<MessageData?> {
          val latitudeList = arrayListOf<MessageData?>()
          messages.forEach {
              latitudeList.add(it.value.latitude)
          }
  
          return latitudeList
      }
  
      fun getAllLongitude(): ArrayList<MessageData?> {
          val longitudeList = arrayListOf<MessageData?>()
          messages.forEach {
              longitudeList.add(it.value.longitude)
          }
  
          return longitudeList
      }
  
      fun getAllSpeedOverGround(): ArrayList<MessageData?> {
          val speedOverGroundList = arrayListOf<MessageData?>()
          messages.forEach {
              speedOverGroundList.add(it.value.speedOverGround)
          }
  
          return speedOverGroundList
      }
  
      fun getAllCourseOverGround(): ArrayList<MessageData?> {
          val res = arrayListOf<MessageData?>()
          messages.forEach {
              res.add(it.value.courseOverGround)
          }
  
          return res
      }
  
      fun getAllHeading(): ArrayList<MessageData?> {
          val res = arrayListOf<MessageData?>()
          messages.forEach {
              res.add(it.value.heading)
          }
  
          return res
      }
  
      fun getAllVesselName(): ArrayList<MessageData?> {
          val res = arrayListOf<MessageData?>()
          messages.forEach {
              res.add(it.value.vesselName)
          }
          return res
      }
  
      fun getAllIMO(): ArrayList<MessageData?> {
          val res = arrayListOf<MessageData?>()
          messages.forEach {
              res.add(it.value.imo)
          }
          return res
      }
  
      fun getAllCallSign(): ArrayList<MessageData?> {
          val res = arrayListOf<MessageData?>()
          messages.forEach {
              res.add(it.value.callSign)
          }
          return res
      }
  
      fun getAllVesselType(): ArrayList<MessageData?> {
          val res = arrayListOf<MessageData?>()
          messages.forEach {
              res.add(it.value.vesselType)
          }
          return res
      }
  
      fun getAllStatus(): ArrayList<MessageData?> {
          val res = arrayListOf<MessageData?>()
          messages.forEach {
              res.add(it.value.status)
          }
          return res
      }
  
      fun getAllLength(): ArrayList<MessageData?> {
          val res = arrayListOf<MessageData?>()
          messages.forEach {
              res.add(it.value.length)
          }
          return res
      }
  
      fun getAllWidth(): ArrayList<MessageData?> {
          val res = arrayListOf<MessageData?>()
          messages.forEach {
              res.add(it.value.width)
          }
          return res
      }
  
      fun getAllDraft(): ArrayList<MessageData?> {
          val res = arrayListOf<MessageData?>()
          messages.forEach {
              res.add(it.value.draft)
          }
          return res
      }
  
      fun getAllCargo(): ArrayList<MessageData?> {
          val res = arrayListOf<MessageData?>()
          messages.forEach {
              res.add(it.value.cargo)
          }
          return res
      }
78935bd62   lsagona   slider bind to al...
266
      companion object {
3b26be8f9   lsagona   controle the time...
267
268
269
          var maxTime: Long = 0
          var minTime: Long = 0
      }
b350f9dfe   lsagona   import vessels an...
270
  }