Non uniform Sampling Panel - CONNJUR/CONNJUR_widgets GitHub Wiki
The Non-uniform Sampling Panel is a GTK/cairo widget for displaying a scrollable list of the sampling schedule along with a graphical display of the sampling coverage. The panel displays a scrollable view of the actual schedule in the bottom portion. The top portion shows a graphical representation of the schedule. This uses a drawing area and the cairo API. A white canvas is drawn and speckled with dots for each point in the sample schedule. In the case of a 1D schedule, the points are drawn as rectangular bars on a narrow stripe. For 2D schedules, each point is drawn as a small square on a canvas of dimensions determined from the schedule values.Example code is shown below:
if (y_max == 0) dot_height=20; // Rectangle for 1D schedule
gtk_widget_set_size_request (widget, (x_max+1)*(dot_width), (y_max+1)*(dot_height));
cairo_set_source_rgb(cr, 1,1,1); // white canvas
cairo_paint(cr);
cairo_set_source_rgb(cr, 0.5,0,0.5); //purple dots
for (i=0; i<num_lines; i++) cairo_rectangle(cr, dot_width*sched[i].x, dot_height*sched[i].y, dot_width-1, dot_height-1);
cairo_fill (cr);
Code for this widget is found at: https://github.com/gryk/CONNJUR_spike/tree/master/cjrShowVarian