def get_color(key): code, sat = key # reuse palatte for glo signals if code_is_glo(code): sat += GLO_FCN_OFFSET elif code_is_sbas(code): sat -= 120 elif code_is_qzss(code): sat -= 193 if sat > 37: sat = sat % 37 key = str((0, sat)) color = color_dict.get(key, 0xff0000) return color
def get_label(key, extra): code, sat, ch = key lbl = 'Ch {ch:02d}: {code} '.format(ch=ch, code=code_to_str(code)) if code_is_glo(code): lbl += 'F{sat:0=+3d}'.format(sat=sat) if ch in extra: lbl += ' R{slot:02d}'.format(slot=extra[ch]) elif code_is_sbas(code): lbl += 'S{sat:3d}'.format(sat=sat) elif code_is_bds2(code): lbl += 'C{sat:02d}'.format(sat=sat) elif code_is_qzss(code): lbl += 'J{sat:3d}'.format(sat=sat) else: lbl += 'G{sat:02d}'.format(sat=sat) return lbl
def get_label(key, extra): code, sat = key lbl = '{code} '.format(code=code_to_str(code)) if code_is_glo(code): lbl += 'F{sat:0=+3d}'.format(sat=sat) if sat in extra: lbl += ' R{slot:02d}'.format(slot=extra[sat]) elif code_is_sbas(code): lbl += 'S{sat:3d}'.format(sat=sat) elif code_is_bds(code): lbl += 'C{sat:02d}'.format(sat=sat) elif code_is_qzss(code): lbl += 'J{sat:3d}'.format(sat=sat) elif code_is_galileo(code): lbl += 'E{sat:02d}'.format(sat=sat) else: lbl += 'G{sat:02d}'.format(sat=sat) return lbl
def azel_callback(self, sbp_msg, **metadata): svazelmsg = MsgSvAzEl(sbp_msg) tracked = self._trk_view.get_tracked_sv_labels() pending_update = { 'x_gps': [], 'x_glo': [], 'x_gal': [], 'x_bds': [], 'x_qzss': [], 'x_sbas': [], 'y_gps': [], 'y_glo': [], 'y_gal': [], 'y_bds': [], 'y_qzss': [], 'y_sbas': [] } # store new label updates, and display at once overlay_update = [] for azel in svazelmsg.azel: sid = azel.sid az = azel.az * 2 el = azel.el x, y = self.azel_to_xy(az, el) sat_string = "" if code_is_gps(sid.code) and self.gps_visible: pending_update['x_gps'].append(x) pending_update['y_gps'].append(y) elif code_is_glo(sid.code) and self.glo_visible: pending_update['x_glo'].append(x) pending_update['y_glo'].append(y) elif code_is_galileo(sid.code) and self.gal_visible: pending_update['x_gal'].append(x) pending_update['y_gal'].append(y) elif code_is_bds(sid.code) and self.bds_visible: pending_update['x_bds'].append(x) pending_update['y_bds'].append(y) elif code_is_qzss(sid.code) and self.qzss_visible: pending_update['x_qzss'].append(x) pending_update['y_qzss'].append(y) elif code_is_sbas(sid.code) and self.sbas_visible: pending_update['x_sbas'].append(x) pending_update['y_sbas'].append(y) sat_string = get_label((sid.code, sid.sat))[2] if sat_string in tracked: sat_string += TRK_SIGN label = DataLabel(component=self.plot, data_point=(x, y), label_text=sat_string, label_position="bottom right", border_visible=False, bgcolor="transparent", marker_visible=False, font='modern 14', arrow_visible=False, show_label_coords=False) overlay_update.append(label) # display label updates self.plot.overlays = (self.axis_overlays + overlay_update + self.default_overlays) self.plot_data.update(pending_update)