def draw_sections(self, width, height, scale): t0, t1 = self.g_pool.timestamps[0], self.g_pool.timestamps[-1] pixel_to_time_fac = height / (t1 - t0) with gl_utils.Coord_System(t0, t1, height, 0): gl.glTranslatef(0, 0.001 + scale * self.timeline_line_height / 2, 0) for s in self.sections: cal_slc = slice(*s['calibration_range']) map_slc = slice(*s['mapping_range']) cal_ts = self.g_pool.timestamps[cal_slc] map_ts = self.g_pool.timestamps[map_slc] color = cygl_utils.RGBA(*s['color'][:3], 1.) if len(cal_ts): cygl_utils.draw_rounded_rect((cal_ts[0], -4 * scale), (cal_ts[-1] - cal_ts[0], 8 * scale), corner_radius=0, color=color, sharpness=1.) if len(map_ts): cygl_utils.draw_rounded_rect((map_ts[0], -scale), (map_ts[-1] - map_ts[0], 2 * scale), corner_radius=0, color=color, sharpness=1.) color = cygl_utils.RGBA(1., 1., 1., .5) if s['calibration_method'] == "natural_features": cygl_utils.draw_x([(m['timestamp'], 0) for m in self.manual_ref_positions], height=12 * scale, width=3 * pixel_to_time_fac / scale, thickness=scale, color=color) else: cygl_utils.draw_bars([(m['timestamp'], 0) for m in self.circle_marker_positions], height=12 * scale, thickness=scale, color=color) gl.glTranslatef(0, scale * self.timeline_line_height, 0)
def _draw_bars_element_ts(self, element, scale, height): color = cygl_utils.RGBA(*element.color_rgba) cygl_utils.draw_bars( [(ts, 0) for ts in element.bar_positions_ts], height=element.height * scale, thickness=element.width * scale, color=color, )