diff options
Diffstat (limited to 'generic')
-rw-r--r-- | generic/Track.c | 64 |
1 files changed, 47 insertions, 17 deletions
diff --git a/generic/Track.c b/generic/Track.c index 5e7b425..6b29b82 100644 --- a/generic/Track.c +++ b/generic/Track.c @@ -50,9 +50,11 @@ static const char compile_id[]="$Compile: " __FILE__ " " __DATE__ " " __TIME__ " #define FILLED_HISTORY_BIT 1 << 1 #define DOT_MIXED_HISTORY_BIT 1 << 2 #define CIRCLE_HISTORY_BIT 1 << 3 -#define POLAR_BIT 1 << 5 -#define FROZEN_LABEL_BIT 1 << 6 -#define LAST_AS_FIRST_BIT 1 << 7 +#define SV_MARK_BIT 1 << 4 +#define SV_TICKS_BIT 1 << 5 +#define POLAR_BIT 1 << 6 +#define FROZEN_LABEL_BIT 1 << 7 +#define LAST_AS_FIRST_BIT 1 << 8 #define CURRENT_POSITION -2 #define LEADER -3 @@ -101,6 +103,7 @@ typedef struct _TrackItemStruct { LineStyle connection_style; int connection_width; ZnColor speed_vector_color; /* s. v. color */ + int speed_vector_alpha; int visible_history_size; /* Number of visible positions */ ZnPoint pos; /* item world coordinates */ ZnPoint speed_vector; /* s. v. slope in world coord */ @@ -203,11 +206,17 @@ static ZnAttrConfig track_attrs[] = { Tk_Offset(TrackItemStruct, header.flags), SENSITIVE_BIT, ZN_REPICK_FLAG, False }, { ZN_CONFIG_POINT, "-speedvector", NULL, Tk_Offset(TrackItemStruct, speed_vector), 0, ZN_COORDS_FLAG, False }, + { ZN_CONFIG_COLOR, "-speedvectoralpha", NULL, + Tk_Offset(TrackItemStruct, speed_vector_alpha), 0, ZN_DRAW_FLAG, False }, { ZN_CONFIG_COLOR, "-speedvectorcolor", NULL, Tk_Offset(TrackItemStruct, speed_vector_color), 0, ZN_DRAW_FLAG, False }, + { ZN_CONFIG_BOOL, "-speedvectormark", NULL, + Tk_Offset(TrackItemStruct, flags), SV_MARK_BIT, ZN_COORDS_FLAG, False }, { ZN_CONFIG_BOOL, "-speedvectorsensitive", NULL, Tk_Offset(TrackItemStruct, header.part_sensitive), PART_NUMBER_TO_BIT(SPEED_VECTOR), ZN_REPICK_FLAG, False }, + { ZN_CONFIG_BOOL, "-speedvectorticks", NULL, + Tk_Offset(TrackItemStruct, flags), SV_TICKS_BIT, ZN_DRAW_FLAG, False }, { ZN_CONFIG_DIM, "-speedvectorwidth", NULL, Tk_Offset(TrackItemStruct, speed_vector_width), 0, ZN_COORDS_FLAG, False }, { ZN_CONFIG_PATTERN, "-symbol", NULL, @@ -363,8 +372,10 @@ Init(Item item, track->marker_style = LINE_SIMPLE; track->marker_fill_pattern = ZnUnspecifiedPattern; track->speed_vector_color = ZnGetColorByValue(wi->win, wi->fore_color); + track->speed_vector_alpha = 100; track->history_color = ZnGetColorByValue(wi->win, wi->fore_color); CLEAR(track->flags, MARKER_FILLED_BIT); + CLEAR(track->flags, SV_MARK_BIT); SET(track->flags, FILLED_HISTORY_BIT); CLEAR(track->flags, DOT_MIXED_HISTORY_BIT); CLEAR(track->flags, CIRCLE_HISTORY_BIT); @@ -1304,13 +1315,38 @@ Render(Item item) * Draw the speed vector. */ if ((item->class == ZnTrack) && (track->speed_vector_width > 0)) { + ZnPoint mark[2]; + color = track->speed_vector_color; - glColor4us(color->red, color->green, color->blue, 65535); + glColor4us(color->red, color->green, color->blue, + track->speed_vector_alpha*wi->alpha/100*65535/100); glLineWidth(track->speed_vector_width); + /*a faire avec des lignes perp dans le stencil */ + if (ISSET(track->flags, SV_TICKS_BIT)) { + } + else { + } glBegin(GL_LINES); - glVertex2f(track->dev.x, track->dev.y); - glVertex2f(track->speed_vector_dev.x, track->speed_vector_dev.y); + glVertex2f(track->dev.x, track->dev.y); + glVertex2f(track->speed_vector_dev.x, track->speed_vector_dev.y); glEnd(); + /* afaire avec un point non anti aliasé */ + if (ISSET(track->flags, SV_MARK_BIT)) { + glBegin(GL_QUADS); + GetButtPoints(&track->dev, &track->speed_vector_dev, track->speed_vector_width + 3, + True, &mark[0], &mark[1]); + glVertex2f(mark[0].x, mark[0].y); + glVertex2f(mark[1].x, mark[1].y); + GetButtPoints(&track->dev, &track->speed_vector_dev, - (track->speed_vector_width + 3), + True, &mark[0], &mark[1]); + glVertex2f(mark[0].x, mark[0].y); + glVertex2f(mark[1].x, mark[1].y); + glEnd(); + /* glPointSize(track->speed_vector_width + 2); + glBegin(GL_POINTS); + glVertex2f(track->speed_vector_dev.x, track->speed_vector_dev.y); + glEnd();*/ + } } /* @@ -1320,17 +1356,11 @@ Render(Item item) points = ZnListArray(track->leader_points); num_points = ZnListSize(track->leader_points); color = track->leader_color; - glColor4us(color->red, color->green, color->blue, 65535); - glLineWidth(track->leader_width); - glBegin(GL_LINE_STRIP); - for (i = 0; i < num_points; i++, points++) { - glVertex2f(points->x, points->y); - } - glEnd(); - if (track->leader_first_end != NULL) { - } - if (track->leader_last_end != NULL) { - } + RenderPolyline(wi, + points, num_points, track->leader_width, False, + track->leader_style, CapRound, JoinRound, + track->leader_first_end, track->leader_last_end, + track->leader_color, 65535); } tmp_str[0] = track->symbol; |