version 1.1, 2000/01/09 17:00:51 |
version 1.1.1.3, 2003/09/15 07:09:25 |
Line 95 static void check_corner_height __PROTO((struct coordi |
|
Line 95 static void check_corner_height __PROTO((struct coordi |
|
double height[2][2], double depth[2][2])); |
double height[2][2], double depth[2][2])); |
static void draw_bottom_grid __PROTO((struct surface_points * plot, |
static void draw_bottom_grid __PROTO((struct surface_points * plot, |
int plot_count)); |
int plot_count)); |
static void xtick_callback __PROTO((int axis, double place, char *text, |
/* HBB 20010118: these should be static, but can't --- HP-UX assembler bug */ |
struct lp_style_type grid)); |
void xtick_callback __PROTO((int axis, double place, char *text, |
static void ytick_callback __PROTO((int axis, double place, char *text, |
struct lp_style_type grid)); |
struct lp_style_type grid)); |
void ytick_callback __PROTO((int axis, double place, char *text, |
static void ztick_callback __PROTO((int axis, double place, char *text, |
struct lp_style_type grid)); |
struct lp_style_type grid)); |
void ztick_callback __PROTO((int axis, double place, char *text, |
|
struct lp_style_type grid)); |
static void setlinestyle __PROTO((struct lp_style_type style)); |
static void setlinestyle __PROTO((struct lp_style_type style)); |
|
|
static void boundary3d __PROTO((int scaling, struct surface_points * plots, |
static void boundary3d __PROTO((int scaling, struct surface_points * plots, |
Line 231 static double back_x, back_y; |
|
Line 232 static double back_x, back_y; |
|
static double tic_unitx, tic_unity; |
static double tic_unitx, tic_unity; |
|
|
/* (DFK) Watch for cancellation error near zero on axes labels */ |
/* (DFK) Watch for cancellation error near zero on axes labels */ |
#define SIGNIF (0.01) /* less than one hundredth of a tic mark */ |
|
#define CheckZero(x,tic) (fabs(x) < ((tic) * SIGNIF) ? 0.0 : (x)) |
#define CheckZero(x,tic) (fabs(x) < ((tic) * SIGNIF) ? 0.0 : (x)) |
#define NearlyEqual(x,y,tic) (fabs((x)-(y)) < ((tic) * SIGNIF)) |
#define NearlyEqual(x,y,tic) (fabs((x)-(y)) < ((tic) * SIGNIF)) |
|
|
|
|
key_rows = ptitl_cnt; |
key_rows = ptitl_cnt; |
key_cols = 1; |
key_cols = 1; |
if (key == -1 && key_vpos == TUNDER) { |
if (key == -1 && key_vpos == TUNDER) { |
|
if (ptitl_cnt > 0) { |
/* calculate max no cols, limited by label-length */ |
/* calculate max no cols, limited by label-length */ |
key_cols = (int) (xright - xleft) / ((max_ptitl_len + 4) * (t->h_char) + key_sample_width); |
key_cols = (int) (xright - xleft) / ((max_ptitl_len + 4) * (t->h_char) + key_sample_width); |
|
/* HBB 991019: fix division by zero problem */ |
|
if (key_cols == 0) |
|
key_cols = 1; |
key_rows = (int) (ptitl_cnt / key_cols) + ((ptitl_cnt % key_cols) > 0); |
key_rows = (int) (ptitl_cnt / key_cols) + ((ptitl_cnt % key_cols) > 0); |
/* now calculate actual no cols depending on no rows */ |
/* now calculate actual no cols depending on no rows */ |
key_cols = (int) (ptitl_cnt / key_rows) + ((ptitl_cnt % key_rows) > 0); |
key_cols = (int) (ptitl_cnt / key_rows) + ((ptitl_cnt % key_rows) > 0); |
key_col_wth = (int) (xright - xleft) / key_cols; |
key_col_wth = (int) (xright - xleft) / key_cols; |
/* key_rows += ktitle_lines; - messes up key - div */ |
/* key_rows += ktitle_lines; - messes up key - div */ |
|
} else { |
|
key_rows = key_cols = key_col_wth = 0; |
|
} |
} |
} |
/* this should also consider the view and number of lines in |
/* this should also consider the view and number of lines in |
* xformat || yformat || xlabel || ylabel */ |
* xformat || yformat || xlabel || ylabel */ |
|
|
/* an absolute 1, with no terminal-dependent scaling ? */ |
/* an absolute 1, with no terminal-dependent scaling ? */ |
ybot = (t->v_char) * 2.5 + 1; |
ybot = (t->v_char) * 2.5 + 1; |
if (key_rows && key_vpos == TUNDER) |
if (key_rows && key == -1 && key_vpos == TUNDER) /* HBB 20000328 */ |
ybot += key_rows * key_entry_height + ktitle_lines * t->v_char; |
ybot += key_rows * key_entry_height + ktitle_lines * t->v_char; |
|
|
if (strlen(title.text)) { |
if (strlen(title.text)) { |
|
|
/* HBB 980308: sigh... another 16bit glitch: on term's with more than |
/* HBB 980308: sigh... another 16bit glitch: on term's with more than |
* 8000 pixels in either direction, these calculations produce garbage |
* 8000 pixels in either direction, these calculations produce garbage |
* results if done in (16bit) ints */ |
* results if done in (16bit) ints */ |
xscaler = (xright - xleft) * 4 / 7; /* HBB: Magic number alert! */ |
xscaler = ((xright - xleft) * 4L) / 7L; /* HBB: Magic number alert! */ |
yscaler = ((ytop - ybot) * 4L) / 7L; |
yscaler = ((ytop - ybot) * 4L) / 7L; |
|
|
} |
} |
Line 487 int pcount; /* count of plots in linked list */ |
|
Line 494 int pcount; /* count of plots in linked list */ |
|
struct surface_points *this_plot = NULL; |
struct surface_points *this_plot = NULL; |
unsigned int xl, yl; |
unsigned int xl, yl; |
int linetypeOffset = 0; |
int linetypeOffset = 0; |
double ztemp, temp; |
/* double ztemp, temp; unused */ |
struct text_label *this_label; |
struct text_label *this_label; |
struct arrow_def *this_arrow; |
struct arrow_def *this_arrow; |
TBOOLEAN scaling; |
TBOOLEAN scaling; |
transform_matrix mat; |
transform_matrix mat; |
int key_count; |
int key_count; |
char ss[MAX_LINE_LEN+1], *s, *e; |
char *s, *e; |
|
|
/* Initiate transformation matrix using the global view variables. */ |
/* Initiate transformation matrix using the global view variables. */ |
mat_rot_z(surface_rot_z, trans_mat); |
mat_rot_z(surface_rot_z, trans_mat); |
Line 502 int pcount; /* count of plots in linked list */ |
|
Line 509 int pcount; /* count of plots in linked list */ |
|
mat_scale(surface_scale / 2.0, surface_scale / 2.0, surface_scale / 2.0, mat); |
mat_scale(surface_scale / 2.0, surface_scale / 2.0, surface_scale / 2.0, mat); |
mat_mult(trans_mat, trans_mat, mat); |
mat_mult(trans_mat, trans_mat, mat); |
|
|
/* modify min_z/max_z so it will zscale properly. */ |
|
ztemp = (z_max3d - z_min3d) / (2.0 * surface_zscale); |
|
temp = (z_max3d + z_min3d) / 2.0; |
|
z_min3d = temp - ztemp; |
|
z_max3d = temp + ztemp; |
|
|
|
|
|
/* The extrema need to be set even when a surface is not being |
/* The extrema need to be set even when a surface is not being |
* drawn. Without this, gnuplot used to assume that the X and |
* drawn. Without this, gnuplot used to assume that the X and |
* Y axis started at zero. -RKC |
* Y axis started at zero. -RKC |
Line 573 int pcount; /* count of plots in linked list */ |
|
Line 573 int pcount; /* count of plots in linked list */ |
|
boundary3d(scaling, plots, pcount); |
boundary3d(scaling, plots, pcount); |
|
|
/* SCALE FACTORS */ |
/* SCALE FACTORS */ |
zscale3d = 2.0 / (ceiling_z - floor_z); |
zscale3d = 2.0 / (ceiling_z - floor_z) * surface_zscale; |
yscale3d = 2.0 / (y_max3d - y_min3d); |
yscale3d = 2.0 / (y_max3d - y_min3d); |
xscale3d = 2.0 / (x_max3d - x_min3d); |
xscale3d = 2.0 / (x_max3d - x_min3d); |
|
|
Line 581 int pcount; /* count of plots in linked list */ |
|
Line 581 int pcount; /* count of plots in linked list */ |
|
|
|
/* PLACE TITLE */ |
/* PLACE TITLE */ |
if (*title.text != 0) { |
if (*title.text != 0) { |
safe_strncpy(ss, title.text, sizeof(ss)); |
|
write_multiline((unsigned int) ((xleft + xright) / 2 + title.xoffset * t->h_char), |
write_multiline((unsigned int) ((xleft + xright) / 2 + title.xoffset * t->h_char), |
(unsigned int) (ytop + (titlelin + title.yoffset) * (t->h_char)), |
(unsigned int) (ytop + (titlelin + title.yoffset) * (t->h_char)), |
ss, CENTRE, JUST_TOP, 0, title.font); |
title.text, CENTRE, JUST_TOP, 0, title.font); |
} |
} |
/* PLACE TIMEDATE */ |
/* PLACE TIMEDATE */ |
if (*timelabel.text) { |
if (*timelabel.text) { |
Line 619 int pcount; /* count of plots in linked list */ |
|
Line 618 int pcount; /* count of plots in linked list */ |
|
|
|
|
|
map_position(&this_label->place, &x, &y, "label"); |
map_position(&this_label->place, &x, &y, "label"); |
safe_strncpy(ss, this_label->text, sizeof(ss)); |
|
if (this_label->rotate && (*t->text_angle) (1)) { |
if (this_label->rotate && (*t->text_angle) (1)) { |
write_multiline(x, y, this_label->text, this_label->pos, CENTRE, 1, this_label->font); |
write_multiline(x, y, this_label->text, this_label->pos, CENTRE, 1, this_label->font); |
(*t->text_angle) (0); |
(*t->text_angle) (0); |
Line 675 int pcount; /* count of plots in linked list */ |
|
Line 673 int pcount; /* count of plots in linked list */ |
|
xl /= 1000; |
xl /= 1000; |
xl += xleft; |
xl += xleft; |
#else |
#else |
|
/* HBB 19990608: why calculate these again? boundary3d has already |
|
* done it... */ |
|
if (ptitl_cnt > 0) { |
/* maximise no cols, limited by label-length */ |
/* maximise no cols, limited by label-length */ |
key_cols = (int) (xright - xleft) / key_col_wth; |
key_cols = (int) (xright - xleft) / key_col_wth; |
key_rows = (int) (ptitl_cnt + key_cols - 1) / key_cols; |
key_rows = (int) (ptitl_cnt + key_cols - 1) / key_cols; |
Line 689 int pcount; /* count of plots in linked list */ |
|
Line 690 int pcount; /* count of plots in linked list */ |
|
*/ |
*/ |
xl = xleft + ((xright - xleft) * key_size_left) / (key_cols * (key_size_left + key_size_right)); |
xl = xleft + ((xright - xleft) * key_size_left) / (key_cols * (key_size_left + key_size_right)); |
yl = yoffset * t->ymax + (key_rows) * key_entry_height + (ktitle_lines + 2) * t->v_char; |
yl = yoffset * t->ymax + (key_rows) * key_entry_height + (ktitle_lines + 2) * t->v_char; |
|
} |
#endif |
#endif |
} else { |
} else { |
if (key_vpos == TTOP) { |
if (key_vpos == TTOP) { |
Line 735 int pcount; /* count of plots in linked list */ |
|
Line 737 int pcount; /* count of plots in linked list */ |
|
|
|
/* KEY TITLE */ |
/* KEY TITLE */ |
if (key != 0 && strlen(key_title)) { |
if (key != 0 && strlen(key_title)) { |
sprintf(ss, "%s\n", key_title); |
char *ss = gp_alloc(strlen(key_title) + 2, "tmp string ss"); |
|
strcpy(ss, key_title); |
|
strcat(ss, "\n"); |
s = ss; |
s = ss; |
yl -= t->v_char / 2; |
yl -= t->v_char / 2; |
while ((e = (char *) strchr(s, '\n')) != NULL) { |
while ((e = (char *) strchr(s, '\n')) != NULL) { |
Line 757 int pcount; /* count of plots in linked list */ |
|
Line 761 int pcount; /* count of plots in linked list */ |
|
yl -= t->v_char; |
yl -= t->v_char; |
} |
} |
yl += t->v_char / 2; |
yl += t->v_char / 2; |
|
free(ss); |
} |
} |
key_count = 0; |
key_count = 0; |
yl_ref = yl -= key_entry_height / 2; /* centralise the keys */ |
yl_ref = yl -= key_entry_height / 2; /* centralise the keys */ |
Line 821 int pcount; /* count of plots in linked list */ |
|
Line 826 int pcount; /* count of plots in linked list */ |
|
case FINANCEBARS: |
case FINANCEBARS: |
case VECTOR: |
case VECTOR: |
case POINTSTYLE: |
case POINTSTYLE: |
if (lkey && !clip_point(xl + key_point_offset, yl)) { |
if (lkey) { |
key_sample_point(xl, yl, this_plot->lp_properties.p_type); |
key_sample_point(xl, yl, this_plot->lp_properties.p_type); |
} |
} |
if (!(hidden3d && draw_surface)) |
if (!(hidden3d && draw_surface)) |
Line 837 int pcount; /* count of plots in linked list */ |
|
Line 842 int pcount; /* count of plots in linked list */ |
|
plot3d_lines(this_plot); |
plot3d_lines(this_plot); |
|
|
/* put points */ |
/* put points */ |
if (lkey && !clip_point(xl + key_point_offset, yl)) |
if (lkey) |
key_sample_point(xl, yl, this_plot->lp_properties.p_type); |
key_sample_point(xl, yl, this_plot->lp_properties.p_type); |
|
|
if (!(hidden3d && draw_surface)) |
if (!(hidden3d && draw_surface)) |
Line 1618 else if (height[i][j] != depth[i][j]) \ |
|
Line 1623 else if (height[i][j] != depth[i][j]) \ |
|
y1 -= tic_unity * ticscale * (t->v_tic); |
y1 -= tic_unity * ticscale * (t->v_tic); |
} |
} |
/* write_multiline mods it */ |
/* write_multiline mods it */ |
safe_strncpy(ss, xlabel.text, sizeof(ss)); |
write_multiline(x1, y1, xlabel.text, CENTRE, JUST_TOP, 0, xlabel.font); |
write_multiline(x1, y1, ss, CENTRE, JUST_TOP, 0, xlabel.font); |
|
} |
} |
} |
} |
if (ytics || *ylabel.text) { |
if (ytics || *ylabel.text) { |
Line 1665 else if (height[i][j] != depth[i][j]) \ |
|
Line 1669 else if (height[i][j] != depth[i][j]) \ |
|
gen_tics(FIRST_Z_AXIS, &zticdef, work_grid.l_type & (GRID_Z | GRID_MZ), |
gen_tics(FIRST_Z_AXIS, &zticdef, work_grid.l_type & (GRID_Z | GRID_MZ), |
mztics, mztfreq, ztick_callback); |
mztics, mztfreq, ztick_callback); |
} |
} |
if ((xzeroaxis.l_type >= -2) && !is_log_y && inrange(0, y_min3d, y_max3d)) { |
if ((yzeroaxis.l_type >= -2) && !is_log_x && inrange(0, x_min3d, x_max3d)) { |
unsigned int x, y, x1, y1; |
unsigned int x, y, x1, y1; |
term_apply_lp_properties(&xzeroaxis); |
term_apply_lp_properties(&yzeroaxis); |
map3d_xy(0.0, y_min3d, base_z, &x, &y); /* line through x=0 */ |
map3d_xy(0.0, y_min3d, base_z, &x, &y); /* line through x=0 */ |
map3d_xy(0.0, y_max3d, base_z, &x1, &y1); |
map3d_xy(0.0, y_max3d, base_z, &x1, &y1); |
draw_clip_line(x, y, x1, y1); |
draw_clip_line(x, y, x1, y1); |
} |
} |
if ((yzeroaxis.l_type >= -2) && !is_log_x && inrange(0, x_min3d, x_max3d)) { |
if ((xzeroaxis.l_type >= -2) && !is_log_y && inrange(0, y_min3d, y_max3d)) { |
unsigned int x, y, x1, y1; |
unsigned int x, y, x1, y1; |
term_apply_lp_properties(&yzeroaxis); |
term_apply_lp_properties(&xzeroaxis); |
map3d_xy(x_min3d, 0.0, base_z, &x, &y); /* line through y=0 */ |
map3d_xy(x_min3d, 0.0, base_z, &x, &y); /* line through y=0 */ |
map3d_xy(x_max3d, 0.0, base_z, &x1, &y1); |
map3d_xy(x_max3d, 0.0, base_z, &x1, &y1); |
draw_clip_line(x, y, x1, y1); |
draw_clip_line(x, y, x1, y1); |
Line 1686 else if (height[i][j] != depth[i][j]) \ |
|
Line 1690 else if (height[i][j] != depth[i][j]) \ |
|
x += zlabel.xoffset * t->h_char; |
x += zlabel.xoffset * t->h_char; |
y += zlabel.yoffset * t->v_char; |
y += zlabel.yoffset * t->v_char; |
|
|
safe_strncpy(ss, zlabel.text, sizeof(ss)); |
write_multiline(x, y, zlabel.text, CENTRE, CENTRE, 0, zlabel.font); |
write_multiline(x, y, ss, CENTRE, CENTRE, 0, zlabel.font); |
|
|
|
} |
} |
} |
} |
|
|
|
|
static void xtick_callback(axis, place, text, grid) |
/* HBB 20010118: all the *_callback() functions made non-static. This |
|
* is necessary to work around a bug in HP's assembler shipped with |
|
* HP-UX 10 and higher, if GCC tries to use it */ |
|
void xtick_callback(axis, place, text, grid) |
int axis; |
int axis; |
double place; |
double place; |
char *text; |
char *text; |
Line 1749 struct lp_style_type grid; /* linetype or -2 for none |
|
Line 1755 struct lp_style_type grid; /* linetype or -2 for none |
|
} |
} |
} |
} |
|
|
static void ytick_callback(axis, place, text, grid) |
void ytick_callback(axis, place, text, grid) |
int axis; |
int axis; |
double place; |
double place; |
char *text; |
char *text; |
Line 1803 struct lp_style_type grid; |
|
Line 1809 struct lp_style_type grid; |
|
} |
} |
} |
} |
|
|
static void ztick_callback(axis, place, text, grid) |
void ztick_callback(axis, place, text, grid) |
int axis; |
int axis; |
double place; |
double place; |
char *text; |
char *text; |
|
|
graph_error("Cannot mix screen co-ordinates with other types"); |
graph_error("Cannot mix screen co-ordinates with other types"); |
} { |
} { |
register struct termentry *t = term; |
register struct termentry *t = term; |
*x = pos->x * (t->xmax) + 0.5; |
/* HBB 20000914: off-by-one bug. Maximum allowed output is |
*y = pos->y * (t->ymax) + 0.5; |
* t->?max - 1, not t->?max itself! */ |
|
*x = pos->x * (t->xmax -1) + 0.5; |
|
*y = pos->y * (t->ymax -1) + 0.5; |
} |
} |
|
|
return; |
return; |
Line 1958 static void key_sample_point(xl, yl, pointtype) |
|
Line 1966 static void key_sample_point(xl, yl, pointtype) |
|
int xl, yl; |
int xl, yl; |
int pointtype; |
int pointtype; |
{ |
{ |
if (!clip_point(xl + key_point_offset, yl)) { |
/* HBB 20000412: fixed incorrect clipping: the point sample was |
(*term->point) (xl + key_point_offset, yl, pointtype); |
* clipped against the graph box, even if in 'below' or 'outside' |
} else { |
* position. But the result of that clipping was utterly ignored, |
|
* because the 'else' part did exactly the same thing as the |
|
* 'then' one. Some callers of this routine thus did their own |
|
* clipping, which I removed, along with this change. |
|
* |
|
* Now, all 'automatically' placed cases will never be clipped, |
|
* only user-specified ones. */ |
|
if ((key == -1) /* ==-1 means auto-placed key */ |
|
|| !clip_point(xl + key_point_offset, yl)) { |
(*term->point) (xl + key_point_offset, yl, pointtype); |
(*term->point) (xl + key_point_offset, yl, pointtype); |
} |
} |
} |
} |