From 01bb3d88534da76e9fa224e77fc85a774c728cc6 Mon Sep 17 00:00:00 2001 From: Our Air Quality Date: Mon, 12 Aug 2024 18:32:03 +1000 Subject: [PATCH] rtkplot: count all observation frequencies and for rtkplot_qt correct the legend color. --- app/qtapp/rtkplot_qt/plotcmn.cpp | 10 ++++++++-- app/winapp/rtkplot/plotcmn.cpp | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/qtapp/rtkplot_qt/plotcmn.cpp b/app/qtapp/rtkplot_qt/plotcmn.cpp index f62a46658..393592641 100644 --- a/app/qtapp/rtkplot_qt/plotcmn.cpp +++ b/app/qtapp/rtkplot_qt/plotcmn.cpp @@ -78,7 +78,13 @@ void Plot::showLegend(const QStringList &msgs) for (int i = 0; (i < 7) & (i < msgs.count()); i++) { lblQL[i]->setText(msgs[i]); - setWidgetTextColor(lblQL[i], plotOptDialog->getMarkerColor(sel, i + 1)); + int col = i + 1; // Default coloring follows the marker color index + if (msgs[0] == " #OBS = 5 ") { + // Match the legend color to the observation color, see observationColor() + int n = i < 5 ? 5 - i : 0; + col = 3 - n + (n > 2 ? 5 : 0); + } + setWidgetTextColor(lblQL[i], plotOptDialog->getMarkerColor(sel, col)); lblQL[i]->adjustSize(); lblQL[i]->updateGeometry(); } @@ -316,7 +322,7 @@ QColor Plot::observationColor(const obsd_t *obs, double az, double el, QVariant if (simulatedObservation) { color = sysColor(obs->sat); } else if (obstype.isNull()) { // "ALL" selected - for (i = n = 0; i < NFREQ && n < 5; i++) { + for (i = n = 0; i < NFREQ + NEXOBS && n < 5; i++) { if (obs->L[i] != 0.0 || obs->P[i] != 0.0) n++; } if (n == 0) { diff --git a/app/winapp/rtkplot/plotcmn.cpp b/app/winapp/rtkplot/plotcmn.cpp index b1d47e768..58274092f 100644 --- a/app/winapp/rtkplot/plotcmn.cpp +++ b/app/winapp/rtkplot/plotcmn.cpp @@ -329,7 +329,7 @@ TColor __fastcall TPlot::ObsColor(const obsd_t *obs, double az, double el) color=SysColor(obs->sat); } else if (!strcmp(obstype,"ALL")) { - for (i=n=0;iL[i]!=0.0||obs->P[i]!=0.0) n++; } if (n==0) {