Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions console_backend/src/observation_tab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ use crate::utils::serialize_capnproto_builder;

#[derive(Clone, Debug)]
pub struct ObservationTableRow {
pub prn: String,
pub sat: i16,
pub code: String,
pub pseudo_range: f64, // (m)
pub carrier_phase: f64, // (cycles)
pub cn0: f64, // (dB-Hz)
Expand All @@ -24,7 +25,8 @@ pub struct ObservationTableRow {
impl ObservationTableRow {
pub fn new() -> ObservationTableRow {
ObservationTableRow {
prn: "".to_string(),
sat: 0,
code: "".to_string(),
pseudo_range: 0.0,
carrier_phase: 0.0,
cn0: 0.0,
Expand Down Expand Up @@ -94,6 +96,7 @@ impl ObservationTable {
self.old_carrier_phase = self.new_carrier_phase.clone();
self.incoming_obs.clear();
self.new_carrier_phase.clear();
self.rows.clear();
}

pub fn obs_check(&mut self, tow: f64, wn: u16, obs_total: u8, obs_count: u8) -> bool {
Expand Down Expand Up @@ -222,7 +225,8 @@ impl<S: CapnProtoSender> ObservationTab<S> {
};

let mut row = ObservationTableRow::new();
row.prn = format!("{} ({})", obs_fields.sat, obs_fields.code).to_string();
row.code = format!("{}", obs_fields.code);
row.sat = obs_fields.sat;
row.pseudo_range = obs_fields.pseudo_range;
row.carrier_phase = obs_fields.carrier_phase;
row.cn0 = obs_fields.cn0 / 4.0;
Expand Down Expand Up @@ -282,7 +286,8 @@ impl<S: CapnProtoSender> ObservationTab<S> {
for (idx, (_key, row)) in table.rows.iter().enumerate() {
let mut list_item = rows.reborrow().get(idx as u32);

list_item.set_prn(&row.prn);
list_item.set_sat(row.sat);
list_item.set_code(&row.code);
list_item.set_pseudo_range(row.pseudo_range);
list_item.set_carrier_phase(row.carrier_phase);
list_item.set_cn0(row.cn0);
Expand Down
2 changes: 1 addition & 1 deletion resources/ObservationTab.qml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Item {
orientation: Qt.Vertical
width: parent.width
height: parent.height
visible: localTable.populated || remoteTable.populated
visible: true

Item {
SplitView.minimumHeight: Constants.observationTab.titleAreaHight
Expand Down
37 changes: 37 additions & 0 deletions resources/ObservationTabComponents/ObservationFilterColumn.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import "../Constants"
import "../TableComponents"
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import SwiftConsole 1.0

ColumnLayout {
id: obsFilterColumn

property variant codes: []

visible: codes.length > 0
Layout.alignment: Qt.AlignTop

Repeater {
model: codes

CheckBox {
indicator.width: 15
indicator.height: 15
spacing: 2
padding: 2
verticalPadding: 0.2
checked: true
onCheckedChanged: {
observationTableModel.filter_prn(modelData, !checked);
observationTableModel.update();
}
text: modelData + ": " + observationTableModel.codes.filter((x) => {
return x === modelData;
}).length
}

}

}
135 changes: 91 additions & 44 deletions resources/ObservationTabComponents/ObservationTable.qml
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,25 @@ ColumnLayout {
"family": Constants.genericTable.fontFamily,
"pointSize": Constants.largePointSize
})
property variant avgWidth: parent.width / 8
property variant columnWidths: [parent.width / 8, parent.width / 8, parent.width / 8, parent.width / 8, parent.width / 8, parent.width / 8, parent.width / 16, 3 * parent.width / 16]
property variant columnNames: ["PRN", "Pseudorange (m)", "Carrier Phase (cycles)", "C/N0 (dB-Hz)", "Meas. Doppler (Hz)", "Comp. Doppler (Hz)", "Lock", "Flags"]
property real mouse_x: 0

function update() {
observationTableModel.update();
}

spacing: 0
onWidthChanged: {
innerTable.forceLayout();
}
onHeightChanged: {
innerTable.forceLayout();
}

ObservationTableModel {
id: observationTableModel

onDataPopulated: {
var widthLeft = observationTable.width;
var idealColumnWidths = [];
for (var col = 0; col < headerRepeater.count; col++) {
var idealColumnWidth = Math.min(500, observationTableModel.columnWidth(col, tableFont, headerRepeater.itemAt(col).font));
idealColumnWidths.push(idealColumnWidth);
widthLeft -= idealColumnWidths[col];
}
var extraWidth = widthLeft / headerRepeater.count;
for (var col = 0; col < headerRepeater.count; col++) {
headerRepeater.itemAt(col).initialWidth = idealColumnWidths[col] + extraWidth;
}
innerTable.forceLayout();
}
}

RowLayout {
Expand Down Expand Up @@ -94,28 +89,90 @@ ColumnLayout {

}

Item {
Layout.fillWidth: true
implicitHeight: header.implicitHeight
clip: true
RowLayout {
spacing: 3

ObservationFilterColumn {
codes: observationTableModel ? observationTableModel.gps_codes : 0
}

ObservationFilterColumn {
codes: observationTableModel ? observationTableModel.glo_codes : 0
}

ObservationFilterColumn {
codes: observationTableModel ? observationTableModel.bds_codes : 0
}

ObservationFilterColumn {
codes: observationTableModel ? observationTableModel.gal_codes : 0
}

Row {
id: header
ObservationFilterColumn {
codes: observationTableModel ? observationTableModel.qzs_codes : 0
}

width: innerTable.contentWidth
x: -innerTable.contentX
z: 1
spacing: innerTable.columnSpacing
ObservationFilterColumn {
codes: observationTableModel ? observationTableModel.sbas_codes : 0
}

}

Repeater {
id: headerRepeater
HorizontalHeaderView {
id: horizontalHeader

model: observationTableModel ? observationTableModel.columnCount() : 0
interactive: false
syncView: innerTable
z: Constants.genericTable.headerZOffset

SortableColumnHeading {
initialWidth: Math.min(500, observationTableModel.columnWidth(index, tableFont, font))
height: Constants.genericTable.cellHeight
table: innerTable
delegate: Rectangle {
implicitWidth: columnWidths[index]
implicitHeight: Constants.genericTable.cellHeight
border.color: Constants.genericTable.borderColor

Label {
width: parent.width
anchors.centerIn: parent
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: columnNames[index]
elide: Text.ElideRight
clip: true
font.family: Constants.genericTable.fontFamily
font.pointSize: Constants.largePointSize
}

MouseArea {
width: Constants.genericTable.mouseAreaResizeWidth
height: parent.height
anchors.right: parent.right
cursorShape: Qt.SizeHorCursor
onPressed: {
mouse_x = mouseX;
}
onPositionChanged: {
if (pressed) {
var delta_x = (mouseX - mouse_x);
var next_idx = (index + 1) % 8;
var min_width = observationTable.width / 12;
if (columnWidths[index] + delta_x > min_width && columnWidths[next_idx] - delta_x > min_width) {
columnWidths[index] += delta_x;
columnWidths[next_idx] -= delta_x;
}
innerTable.forceLayout();
}
}
}

gradient: Gradient {
GradientStop {
position: 0
color: Constants.genericTable.cellColor
}

GradientStop {
position: 1
color: Constants.genericTable.gradientColor
}

}
Expand All @@ -127,24 +184,14 @@ ColumnLayout {
TableView {
id: innerTable

width: Math.min(header.width + 1, parent.width)
Layout.fillHeight: true
Layout.fillWidth: true
columnSpacing: -1
rowSpacing: -1
clip: true
onWidthChanged: {
// Don't ask why this is needed. It's a hack.
// If you want to find out, just comment out this code.
if (width === 0) {
width = Qt.binding(function() {
return Math.min(header.width + 1, observationTable.width);
});
forceLayout();
}
}
boundsBehavior: Flickable.StopAtBounds
columnWidthProvider: function(column) {
return headerRepeater.itemAt(column).width;
return columnWidths[column];
}
model: observationTableModel

Expand Down
1 change: 1 addition & 0 deletions resources/console_resources.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
<file>TrackingTabComponents/TrackingSkyPlotTab.qml</file>
<file>ObservationTab.qml</file>
<file>ObservationTabComponents/ObservationTable.qml</file>
<file>ObservationTabComponents/ObservationFilterColumn.qml</file>
<file>MainDrawerComponents/LicensesPopup.qml</file>
<file>UpdateTab.qml</file>
<file>UpdateTabComponents/FirmwareVersionAndDownloadLabels.qml</file>
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/base/console_backend.capnp
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,15 @@ struct BaselineTableStatus {
}

struct ObservationTableRow {
prn @0 :Text;
code @0 :Text;
pseudoRange @1 :Float64;
carrierPhase @2 :Float64;
cn0 @3 :Float64;
measuredDoppler @4 :Float64;
computedDoppler @5 :Float64;
lock @6 :UInt16;
flags @7 :UInt8;
sat @8: Int16;
}

struct ObservationStatus {
Expand Down
Loading