Commit 252cca2f authored by Richard A. Kirian's avatar Richard A. Kirian Committed by Thomas White
Browse files

hdfsee: added an option to overlay rings with user-defined radii

parent 9fa6b17a
......@@ -240,16 +240,24 @@ static int draw_stuff(cairo_surface_t *surf, DisplayWindow *dw)
//show_simple_ring(cr, dw, 380.0, &basic_m);
/* Draw resolution circles */
show_ring(cr, dw, 10.0e-10, "10A", &basic_m, 1.0, 0.0, 0.0);
show_ring(cr, dw, 9.0e-10, "9A", &basic_m, 1.0, 0.0, 0.0);
show_ring(cr, dw, 8.0e-10, "8A", &basic_m, 1.0, 0.0, 0.0);
show_ring(cr, dw, 7.0e-10, "7A", &basic_m, 1.0, 0.5, 0.0);
show_ring(cr, dw, 6.0e-10, "6A", &basic_m, 1.0, 1.0, 0.0);
show_ring(cr, dw, 5.0e-10, "5A", &basic_m, 0.0, 1.0, 0.0);
show_ring(cr, dw, 4.0e-10, "4A", &basic_m, 0.0, 1.0, 0.0);
// show_ring(cr, dw, 3.0e-10, "3A", &basic_m);
// show_ring(cr, dw, 2.0e-10, "2A", &basic_m);
// show_ring(cr, dw, 1.0e-10, "1A", &basic_m);
if ( dw->n_rings == -1 ) {
/* n_rings == -1 means default behavior */
show_ring(cr, dw, 10.0e-10, "10A", &basic_m, 1.0, 0.0, 0.0);
show_ring(cr, dw, 9.0e-10, "9A", &basic_m, 1.0, 0.0, 0.0);
show_ring(cr, dw, 8.0e-10, "8A", &basic_m, 1.0, 0.0, 0.0);
show_ring(cr, dw, 7.0e-10, "7A", &basic_m, 1.0, 0.5, 0.0);
show_ring(cr, dw, 6.0e-10, "6A", &basic_m, 1.0, 1.0, 0.0);
show_ring(cr, dw, 5.0e-10, "5A", &basic_m, 0.0, 1.0, 0.0);
show_ring(cr, dw, 4.0e-10, "4A", &basic_m, 0.0, 1.0, 0.0);
//show_ring(cr, dw, 3.0e-10, "3A", &basic_m);
//show_ring(cr, dw, 2.0e-10, "2A", &basic_m);
//show_ring(cr, dw, 1.0e-10, "1A", &basic_m);
} else {
int i;
for ( i=0; i<dw->n_rings; i++ ) {
show_simple_ring(cr, dw, dw->ring_radii[i], &basic_m);
}
}
}
......@@ -1720,7 +1728,8 @@ DisplayWindow *displaywindow_open(const char *filename, const char *peaks,
int boost, int binning, int cmfilter,
int noisefilter, int colscale,
const char *element, const char *geometry,
int show_rings, double ring_size)
int show_rings, double *ring_radii, int n_rings,
double ring_size)
{
DisplayWindow *dw;
char *title;
......@@ -1749,6 +1758,8 @@ DisplayWindow *displaywindow_open(const char *filename, const char *peaks,
dw->not_ready_yet = 1;
dw->surf = NULL;
dw->ring_radius = ring_size;
dw->ring_radii = ring_radii;
dw->n_rings = n_rings;
/* Open the file, if any */
if ( filename != NULL ) {
......
......@@ -87,6 +87,8 @@ typedef struct {
int show_rings;
int show_peaks;
double ring_radius;
double *ring_radii;
int n_rings;
int show_col_scale;
int scale;
......@@ -101,7 +103,7 @@ extern DisplayWindow *displaywindow_open(const char *filename,
int noisefilter, int colscale,
const char *element,
const char *geometry, int show_rings,
double ring_size);
double *ring_radii, int n_rings, double ring_size);
#endif /* DISPLAYWINDOW_H */
......@@ -99,7 +99,10 @@ int main(int argc, char *argv[])
char *element = NULL;
char *geometry = NULL;
double ring_size = 5.0;
char *reslist = NULL;
double ring_radii[128];
int n_rings = -1;
/* Long options */
const struct option longopts[] = {
{"help", 0, NULL, 'h'},
......@@ -113,6 +116,7 @@ int main(int argc, char *argv[])
{"geometry", 1, NULL, 'g'},
{"show-rings", 0, &config_showrings, 1},
{"ring-size", 1, NULL, 2},
{"simple-rings", 1, NULL, 'r'},
{0, 0, NULL, 0}
};
......@@ -168,7 +172,26 @@ int main(int argc, char *argv[])
ERROR("Ring size must be numerical.\n");
return 1;
}
case 'r' :
config_showrings = 1;
reslist = strdup(optarg);
int nchar = strlen(reslist);
char thisvalue[128];
int i;
int j=0;
n_rings = 0;
for ( i=0; i<=nchar; i++ ) {
if ( ( reslist[i] != ',' ) && ( reslist[i] != '\0' ) ) {
thisvalue[j] = reslist[i];
j++;
} else {
j=0;
thisvalue[i] = '\0';
ring_radii[n_rings] = atof(thisvalue);
n_rings++;
}
}
break;
case 0 :
break;
......@@ -208,6 +231,8 @@ int main(int argc, char *argv[])
colscale, element,
geometry,
config_showrings,
ring_radii,
n_rings,
ring_size);
if ( main_window_list[i] == NULL ) {
ERROR("Couldn't open display window\n");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment