Blame view

src/main/kotlin/application/model/Vessel.kt 4.25 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
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
      val messages: SortedMap<Long, Message> = sortedMapOf()
      var messageToDisplay: Message? = null
          get() {
              //            messages.forEach { (key, value) ->
  //                if(observableCurrentTime.value < key) {
  //                    field = value
  //                    return@forEach
  //                }
  //            }
              field = messages.asSequence().map{ it }.firstOrNull {observableCurrentTime.value < it.key}.let { it?.value }
              return field
          }
  
      //    val timesNormalized : SortedMap<Long, LocalDateTime> = sortedMapOf()
  
  //    fun getAllNormalizedDate(): SortedMap<Long, LocalDateTime> {
  //        var offset: Long? = null
  //        if(timesNormalized.size == 0){
  //            messages.keys.forEach {
  //                val currentTime = it.toEpochSecond(ZoneOffset.UTC)
  //                if(offset == null){
  //                  offset = currentTime
  //                }
  //                timesNormalized[currentTime - offset!!]= it
  //            }
  //        }
  //        return timesNormalized
  //    }
513c0341c   lsagona   add chart
33

513c0341c   lsagona   add chart
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
      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
      }
3b26be8f9   lsagona   controle the time...
159
160
161
162
      companion object{
          var maxTime: Long = 0
          var minTime: Long = 0
      }
b350f9dfe   lsagona   import vessels an...
163
  }