Blame view

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