Commit 867a0df4617a6c1355868b60f50a41b9e74d0140
1 parent
e220e082b5
Exists in
master
and in
1 other branch
populate plot when the property is selected
Showing 1 changed file with 63 additions and 44 deletions Side-by-side Diff
src/main/kotlin/application/controller/DataPanelController.kt
View file @
867a0df
... | ... | @@ -55,7 +55,7 @@ |
55 | 55 | |
56 | 56 | |
57 | 57 | |
58 | - config.showLegend(true) | |
58 | + config.showLegend(false) | |
59 | 59 | config.setLegendInsidePlot(false) |
60 | 60 | |
61 | 61 | setObservableCurrentTimeListener() |
... | ... | @@ -75,6 +75,7 @@ |
75 | 75 | |
76 | 76 | dataListView.selectionModel.selectedItemProperty().addListener { _, _, newValue -> |
77 | 77 | selectedItem = newValue |
78 | + updateDataList(observableSelectedVessel.value) | |
78 | 79 | plot(newValue) |
79 | 80 | } |
80 | 81 | |
... | ... | @@ -90,7 +91,7 @@ |
90 | 91 | } |
91 | 92 | |
92 | 93 | private fun plot() { |
93 | - if (selectedItem != null) { | |
94 | + if (selectedItem != null || observableSelectedVessel.value == Vessel(null)) { | |
94 | 95 | GlobalScope.launch { |
95 | 96 | plot(selectedItem) |
96 | 97 | } |
... | ... | @@ -107,7 +108,7 @@ |
107 | 108 | dataViewer.resetPlot() |
108 | 109 | |
109 | 110 | return |
110 | - } | |
111 | + }else if (data.second.size < timeData.size) return | |
111 | 112 | |
112 | 113 | val getValueVisitorX = GetValueVisitor() |
113 | 114 | val getValueVisitorY = GetValueVisitor() |
114 | 115 | |
... | ... | @@ -308,48 +309,66 @@ |
308 | 309 | private fun updateDataList(vessel: Vessel) { |
309 | 310 | timeData = populateTime(vessel) |
310 | 311 | |
311 | - latitude.clear() | |
312 | - latitude.addAll(populateLatitude(vessel)) | |
312 | + if(dataListView.selectionModel.selectedItem == null) return | |
313 | 313 | |
314 | - longitude.clear() | |
315 | - longitude.addAll(populateLongitude(vessel)) | |
316 | - | |
317 | - speedOverGround.clear() | |
318 | - speedOverGround.addAll(populateSpeedOverGround(vessel)) | |
319 | - | |
320 | - courseOverGround.clear() | |
321 | - courseOverGround.addAll(populateCourseOverGround(vessel)) | |
322 | - | |
323 | - heading.clear() | |
324 | - heading.addAll(populateHeading(vessel)) | |
325 | - | |
326 | - vesselName.clear() | |
327 | - vesselName.addAll(populateVesselName(vessel)) | |
328 | - | |
329 | - imo.clear() | |
330 | - imo.addAll(populateIMO(vessel)) | |
331 | - | |
332 | - callSign.clear() | |
333 | - callSign.addAll(populateCallSign(vessel)) | |
334 | - | |
335 | - vesselType.clear() | |
336 | - vesselType.addAll(populateVesselType(vessel)) | |
337 | - | |
338 | - status.clear() | |
339 | - status.addAll(populateStatus(vessel)) | |
340 | - | |
341 | - length.clear() | |
342 | - length.addAll(populateLength(vessel)) | |
343 | - | |
344 | - width.clear() | |
345 | - width.addAll(populateWidth(vessel)) | |
346 | - | |
347 | - draft.clear() | |
348 | - draft.addAll(populateDraft(vessel)) | |
349 | - | |
350 | - cargo.clear() | |
351 | - cargo.addAll(populateCargo(vessel)) | |
352 | - | |
314 | + when (dataListView.selectionModel.selectedItem.first) { | |
315 | + "Latitude" -> { | |
316 | + latitude.clear() | |
317 | + latitude.addAll(populateLatitude(vessel)) | |
318 | + } | |
319 | + "Longitude" -> { | |
320 | + longitude.clear() | |
321 | + longitude.addAll(populateLongitude(vessel)) | |
322 | + } | |
323 | + "Speed Over Ground" -> { | |
324 | + speedOverGround.clear() | |
325 | + speedOverGround.addAll(populateSpeedOverGround(vessel)) | |
326 | + } | |
327 | + "Course Over Ground" -> { | |
328 | + courseOverGround.clear() | |
329 | + courseOverGround.addAll(populateCourseOverGround(vessel)) | |
330 | + } | |
331 | + "Heading" -> { | |
332 | + heading.clear() | |
333 | + heading.addAll(populateHeading(vessel)) | |
334 | + } | |
335 | + "Vessel Name" -> { | |
336 | + vesselName.clear() | |
337 | + vesselName.addAll(populateVesselName(vessel)) | |
338 | + } | |
339 | + "IMO" -> { | |
340 | + imo.clear() | |
341 | + imo.addAll(populateIMO(vessel)) | |
342 | + } | |
343 | + "Call Sign" -> { | |
344 | + callSign.clear() | |
345 | + callSign.addAll(populateCallSign(vessel)) | |
346 | + } | |
347 | + "Vessel Type" -> { | |
348 | + vesselType.clear() | |
349 | + vesselType.addAll(populateVesselType(vessel)) | |
350 | + } | |
351 | + "Status" -> { | |
352 | + status.clear() | |
353 | + status.addAll(populateStatus(vessel)) | |
354 | + } | |
355 | + "Length" -> { | |
356 | + length.clear() | |
357 | + length.addAll(populateLength(vessel)) | |
358 | + } | |
359 | + "Width" -> { | |
360 | + width.clear() | |
361 | + width.addAll(populateWidth(vessel)) | |
362 | + } | |
363 | + "Draft" -> { | |
364 | + draft.clear() | |
365 | + draft.addAll(populateDraft(vessel)) | |
366 | + } | |
367 | + "Cargo" -> { | |
368 | + cargo.clear() | |
369 | + cargo.addAll(populateCargo(vessel)) | |
370 | + } | |
371 | + } | |
353 | 372 | } |
354 | 373 | |
355 | 374 | private fun setObservableCurrentTimeListener() { |