aboutsummaryrefslogtreecommitdiff
path: root/generic
diff options
context:
space:
mode:
authorlecoanet2005-01-24 15:46:32 +0000
committerlecoanet2005-01-24 15:46:32 +0000
commite1ed2c6d78bb616e24166c13126adba1b95ea4ea (patch)
tree705057e0eaf430d759ebee0bf29d400e52b1bbdf /generic
parent00b0b5a898d9a705092704cb234ca5a5cdd6570b (diff)
downloadtkzinc-e1ed2c6d78bb616e24166c13126adba1b95ea4ea.zip
tkzinc-e1ed2c6d78bb616e24166c13126adba1b95ea4ea.tar.gz
tkzinc-e1ed2c6d78bb616e24166c13126adba1b95ea4ea.tar.bz2
tkzinc-e1ed2c6d78bb616e24166c13126adba1b95ea4ea.tar.xz
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.
Diffstat (limited to 'generic')
-rw-r--r--generic/Track.c16
1 files changed, 11 insertions, 5 deletions
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.