From e1ed2c6d78bb616e24166c13126adba1b95ea4ea Mon Sep 17 00:00:00 2001 From: lecoanet Date: Mon, 24 Jan 2005 15:46:32 +0000 Subject: Added a -historywidth attribute to control de width of the past positions. It used to be derived from the track symbol size preventing the use of very big icons. --- generic/Track.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'generic') diff --git a/generic/Track.c b/generic/Track.c index 47b80a0..b079f63 100644 --- a/generic/Track.c +++ b/generic/Track.c @@ -132,6 +132,7 @@ typedef struct _TrackItemStruct { ZnPoint speed_vector; /* s. v. slope in world coord */ ZnDim speed_vector_width; ZnGradient *history_color; + ZnDim history_width; /* Private data */ ZnFieldSetStruct field_set; @@ -175,6 +176,8 @@ static ZnAttrConfig track_attrs[] = { Tk_Offset(TrackItemStruct, flags), FROZEN_LABEL_BIT, ZN_COORDS_FLAG, False }, { ZN_CONFIG_GRADIENT, "-historycolor", NULL, Tk_Offset(TrackItemStruct, history_color), 0, ZN_DRAW_FLAG, False }, + { ZN_CONFIG_DIM, "-historywidth", NULL, + Tk_Offset(TrackItemStruct, history_width), 0, ZN_COORDS_FLAG, False }, { ZN_CONFIG_ANCHOR, "-labelanchor", NULL, Tk_Offset(TrackItemStruct, label_anchor), 0, ZN_COORDS_FLAG, False }, { ZN_CONFIG_ANGLE, "-labelangle", NULL, @@ -410,6 +413,7 @@ Init(ZnItem item, track->marker_fill_pattern = ZnUnspecifiedImage; track->speed_vector_color = ZnGetGradientByValue(wi->fore_color); track->history_color = ZnGetGradientByValue(wi->fore_color); + track->history_width = 8; CLEAR(track->flags, MARKER_FILLED_BIT); SET(track->flags, FILLED_HISTORY_BIT); CLEAR(track->flags, DOT_MIXED_HISTORY_BIT); @@ -752,15 +756,17 @@ ComputeCoordinates(ZnItem item, wi->track_visible_history_size : 0); ZnResetBBox(&bbox); + w = track->history_width; + w2 = (w+1)/2; num_acc_pos = ZnListSize(track->history); hist = ZnListArray(track->history); for (i = 0; i < num_acc_pos; i++) { ZnTransformPoint(wi->current_transfo, &hist[i].world, &hist[i].dev); if ((i < visible_history_size) && (hist[i].visible)) { bbox.orig.x = hist[i].dev.x - w2; - bbox.orig.y = hist[i].dev.y - h2; + bbox.orig.y = hist[i].dev.y - w2; bbox.corner.x = bbox.orig.x + w; - bbox.corner.y = bbox.orig.y + h; + bbox.corner.y = bbox.orig.y + w; ZnAddBBoxToBBox(&item->item_bounding_box, &bbox); } } @@ -871,7 +877,7 @@ ComputeCoordinates(ZnItem item, field_set->label_pos.y = ZnNearestInt(field_set->label_pos.y); /* - * Need to compensate for GL thicke lines + * Need to compensate for GL thick lines */ #ifdef GL #define CORR 1 @@ -1227,7 +1233,7 @@ Draw(ZnItem item) } num_acc_pos = MIN(visible_history_size, ZnListSize(track->history)); hist = ZnListArray(track->history); - side_size = MAX(width, height); + side_size = track->history_width; for (i = 0, nb_hist = 0; i < num_acc_pos; i++) { if (ISSET(track->flags, LAST_AS_FIRST_BIT) && @@ -1498,7 +1504,7 @@ Render(ZnItem item) glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); num_acc_pos = MIN(visible_history_size, ZnListSize(track->history)); hist = ZnListArray(track->history); - side_size = MAX(width, height); + side_size = track->history_width; /* * Turning off line and point smoothing * to enhance ;-) history drawing. -- cgit v1.1