Commit 33f599a6 authored by Claes Sjofors's avatar Claes Sjofors

Ge trend curve position fix and fastcurve ghost drawing fix

parent 8069fd28
...@@ -7830,6 +7830,7 @@ int GeTrend::connect( grow_tObject object, glow_sTraceData *trace_data) ...@@ -7830,6 +7830,7 @@ int GeTrend::connect( grow_tObject object, glow_sTraceData *trace_data)
pwr_tAName parsed_name; pwr_tAName parsed_name;
int sts; int sts;
int inverted; int inverted;
int attr_cnt = 0;
size1 = 4; size1 = 4;
p1 = 0; p1 = 0;
...@@ -7851,8 +7852,9 @@ int GeTrend::connect( grow_tObject object, glow_sTraceData *trace_data) ...@@ -7851,8 +7852,9 @@ int GeTrend::connect( grow_tObject object, glow_sTraceData *trace_data)
trend_typeid1 = attr_type; trend_typeid1 = attr_type;
break; break;
default: default:
; ;
} }
attr_cnt++;
} }
size2 = 4; size2 = 4;
p2 = 0; p2 = 0;
...@@ -7875,6 +7877,7 @@ int GeTrend::connect( grow_tObject object, glow_sTraceData *trace_data) ...@@ -7875,6 +7877,7 @@ int GeTrend::connect( grow_tObject object, glow_sTraceData *trace_data)
default: default:
; ;
} }
attr_cnt++;
} }
grow_GetTrendScanTime( object, &scan_time); grow_GetTrendScanTime( object, &scan_time);
acc_time = scan_time; acc_time = scan_time;
...@@ -7931,6 +7934,7 @@ int GeTrend::connect( grow_tObject object, glow_sTraceData *trace_data) ...@@ -7931,6 +7934,7 @@ int GeTrend::connect( grow_tObject object, glow_sTraceData *trace_data)
} }
} }
grow_SetTrendNoOfCurves( object, attr_cnt);
trace_data->p = &pdummy; trace_data->p = &pdummy;
first_scan = true; first_scan = true;
return 1; return 1;
......
...@@ -1155,7 +1155,8 @@ void GlowArray::open( GrowCtx *ctx, ifstream& fp) ...@@ -1155,7 +1155,8 @@ void GlowArray::open( GrowCtx *ctx, ifstream& fp)
} }
case glow_eSave_GrowTrend: case glow_eSave_GrowTrend:
{ {
GrowTrend *n = new GrowTrend( ctx, ""); GrowTrend *n = new GrowTrend( ctx, "", 0, 0, 0, 0, glow_eDrawType_Line, 1, glow_mDisplayLevel_1,
0, 1, glow_eDrawType_Line, 1);
n->open( fp); n->open( fp);
insert( n); insert( n);
break; break;
......
...@@ -4620,6 +4620,11 @@ void grow_SetTrendScanTime( grow_tObject object, double time) ...@@ -4620,6 +4620,11 @@ void grow_SetTrendScanTime( grow_tObject object, double time)
((GrowTrend *)object)->set_scan_time( time); ((GrowTrend *)object)->set_scan_time( time);
} }
void grow_SetTrendNoOfCurves( grow_tObject object, int no_of_curves)
{
((GrowTrend *)object)->set_no_of_curves( no_of_curves);
}
void grow_SetSliderRange( grow_tObject object, double min, double max) void grow_SetSliderRange( grow_tObject object, double min, double max)
{ {
((GrowSlider *)object)->set_range( min, max); ((GrowSlider *)object)->set_range( min, max);
......
...@@ -2330,6 +2330,13 @@ extern "C" { ...@@ -2330,6 +2330,13 @@ extern "C" {
*/ */
void grow_SetTrendScanTime( grow_tObject object, double time); void grow_SetTrendScanTime( grow_tObject object, double time);
//! Set number of curves for of a trend object.
/*!
\param object Trend object.
\param no_of_curves Number of curves.
*/
void grow_SetTrendNoOfCurves( grow_tObject object, int no_of_curves);
//! Set number of vertical and horizontal lines in a trend object. //! Set number of vertical and horizontal lines in a trend object.
/*! /*!
\param object Trend object. \param object Trend object.
......
...@@ -52,7 +52,7 @@ GrowPolyLine::GrowPolyLine( GrowCtx *glow_ctx, const char *name, ...@@ -52,7 +52,7 @@ GrowPolyLine::GrowPolyLine( GrowCtx *glow_ctx, const char *name,
glow_sPoint *pointarray, int point_cnt, glow_sPoint *pointarray, int point_cnt,
glow_eDrawType border_d_type, int line_w, glow_eDrawType border_d_type, int line_w,
int fix_line_w, int fill, int display_border, int display_shadow, int fix_line_w, int fill, int display_border, int display_shadow,
glow_eDrawType fill_d_type, int closed, int nodraw) : glow_eDrawType fill_d_type, int closed, int nodraw, int noround) :
GlowPolyLine(glow_ctx,pointarray,point_cnt,border_d_type,line_w, GlowPolyLine(glow_ctx,pointarray,point_cnt,border_d_type,line_w,
fix_line_w,fill,closed), x_right(0), x_left(0), y_high(0), y_low(0), fix_line_w,fill,closed), x_right(0), x_left(0), y_high(0), y_low(0),
hot(0), pzero(ctx), highlight(0), inverse(0), user_data(NULL), hot(0), pzero(ctx), highlight(0), inverse(0), user_data(NULL),
...@@ -65,11 +65,14 @@ GrowPolyLine::GrowPolyLine( GrowCtx *glow_ctx, const char *name, ...@@ -65,11 +65,14 @@ GrowPolyLine::GrowPolyLine( GrowCtx *glow_ctx, const char *name,
shadow_contrast(2), disable_shadow(0), fill_eq_light(0), shadow_contrast(2), disable_shadow(0), fill_eq_light(0),
fill_eq_shadow(0), fill_eq_bglight(0), fill_eq_bgshadow(0), fill_eq_background(0), fill_eq_shadow(0), fill_eq_bglight(0), fill_eq_bgshadow(0), fill_eq_background(0),
fixcolor(0), fixposition(0), fixcolor(0), fixposition(0),
gradient(glow_eGradient_No), gradient_contrast(4), disable_gradient(0) gradient(glow_eGradient_No), gradient_contrast(4), disable_gradient(0),
round(0.5)
{ {
strcpy( n_name, name); strcpy( n_name, name);
pzero.nav_zoom(); pzero.nav_zoom();
strcpy( last_group, ""); strcpy( last_group, "");
if ( noround)
round = 0;
if ( ctx->grid_on && point_cnt > 0) { if ( ctx->grid_on && point_cnt > 0) {
double x_grid, y_grid, x, y; double x_grid, y_grid, x, y;
...@@ -397,8 +400,8 @@ void GrowPolyLine::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, ...@@ -397,8 +400,8 @@ void GrowPolyLine::draw( GlowWind *w, GlowTransform *t, int highlight, int hot,
else if (x1 * w->zoom_factor_x - w->offset_x < SHRT_MIN) else if (x1 * w->zoom_factor_x - w->offset_x < SHRT_MIN)
point_p->x = SHRT_MIN; point_p->x = SHRT_MIN;
else else
point_p->x = int( x1 * w->zoom_factor_x + 0.5) - w->offset_x; point_p->x = int( x1 * w->zoom_factor_x + round) - w->offset_x;
point_p->y = int( y1 * w->zoom_factor_y + 0.5) - w->offset_y; point_p->y = int( y1 * w->zoom_factor_y + round) - w->offset_y;
point_p++; point_p++;
} }
if ( fill) if ( fill)
...@@ -536,8 +539,8 @@ void GrowPolyLine::erase( GlowWind *w, GlowTransform *t, int hot, void *node) ...@@ -536,8 +539,8 @@ void GrowPolyLine::erase( GlowWind *w, GlowTransform *t, int hot, void *node)
y1 = trf.y( t, ((GlowPoint *)a_points[i])->x, ((GlowPoint *)a_points[i])->y); y1 = trf.y( t, ((GlowPoint *)a_points[i])->x, ((GlowPoint *)a_points[i])->y);
} }
point_p->x = int( x1 * w->zoom_factor_x + 0.5) - w->offset_x; point_p->x = int( x1 * w->zoom_factor_x + round) - w->offset_x;
point_p->y = int( y1 * w->zoom_factor_y + 0.5) - w->offset_y; point_p->y = int( y1 * w->zoom_factor_y + round) - w->offset_y;
point_p++; point_p++;
} }
int display_shadow = ((node && ((GrowNode *)node)->shadow) || shadow) && !disable_shadow && int display_shadow = ((node && ((GrowNode *)node)->shadow) || shadow) && !disable_shadow &&
...@@ -1566,8 +1569,8 @@ void GrowPolyLine::export_javabean( GlowTransform *t, void *node, ...@@ -1566,8 +1569,8 @@ void GrowPolyLine::export_javabean( GlowTransform *t, void *node,
p[i].x = x1 * ctx->mw.zoom_factor_x - ctx->mw.offset_x; p[i].x = x1 * ctx->mw.zoom_factor_x - ctx->mw.offset_x;
p[i].y = y1 * ctx->mw.zoom_factor_y - ctx->mw.offset_y; p[i].y = y1 * ctx->mw.zoom_factor_y - ctx->mw.offset_y;
if ( jshadow) { if ( jshadow) {
points[i].x = int( p[i].x + 0.5); points[i].x = int( p[i].x + round);
points[i].y = int( p[i].y + 0.5); points[i].y = int( p[i].y + round);
} }
} }
...@@ -1576,7 +1579,7 @@ void GrowPolyLine::export_javabean( GlowTransform *t, void *node, ...@@ -1576,7 +1579,7 @@ void GrowPolyLine::export_javabean( GlowTransform *t, void *node,
if ( jshadow) { if ( jshadow) {
double trf_scale = trf.vertical_scale( t); double trf_scale = trf.vertical_scale( t);
int ish = int( shadow_width / 100 * trf_scale * int ish = int( shadow_width / 100 * trf_scale *
min((x_right - x_left)*ctx->mw.zoom_factor_x, (y_high - y_low)*ctx->mw.zoom_factor_y) + 0.5); min((x_right - x_left)*ctx->mw.zoom_factor_x, (y_high - y_low)*ctx->mw.zoom_factor_y) + round);
if ( ish) if ( ish)
calculate_shadow( &sp, &p_num, ish, 0, 0, 1, 0); calculate_shadow( &sp, &p_num, ish, 0, 0, 1, 0);
......
...@@ -69,12 +69,12 @@ class GrowPolyLine : public GlowPolyLine { ...@@ -69,12 +69,12 @@ class GrowPolyLine : public GlowPolyLine {
\param nodraw Don't draw the object now. \param nodraw Don't draw the object now.
*/ */
GrowPolyLine( GrowCtx *glow_ctx, const char *name, GrowPolyLine( GrowCtx *glow_ctx, const char *name,
glow_sPoint *pointarray, int point_cnt, glow_sPoint *pointarray, int point_cnt,
glow_eDrawType border_d_type = glow_eDrawType_Line, glow_eDrawType border_d_type = glow_eDrawType_Line,
int line_w = 1, int fix_line_w = 0, int line_w = 1, int fix_line_w = 0,
int fill = 0, int display_border = 1, int display_shadow = 0, int fill = 0, int display_border = 1, int display_shadow = 0,
glow_eDrawType fill_d_type = glow_eDrawType_Line, glow_eDrawType fill_d_type = glow_eDrawType_Line,
int closed = 0, int nodraw = 0); int closed = 0, int nodraw = 0, int noround = 0);
//! Destructor //! Destructor
~GrowPolyLine(); ~GrowPolyLine();
...@@ -388,6 +388,7 @@ class GrowPolyLine : public GlowPolyLine { ...@@ -388,6 +388,7 @@ class GrowPolyLine : public GlowPolyLine {
glow_eGradient gradient; //!< Type of gradient. glow_eGradient gradient; //!< Type of gradient.
int gradient_contrast; //!< Gradient contrast. int gradient_contrast; //!< Gradient contrast.
int disable_gradient; //!< Disable gradient, even if parent node has gradient. int disable_gradient; //!< Disable gradient, even if parent node has gradient.
float round; //!< Value to round or floor points.
//! Set user data. //! Set user data.
/*! /*!
......
...@@ -114,11 +114,10 @@ void GrowTrend::configure_curves() ...@@ -114,11 +114,10 @@ void GrowTrend::configure_curves()
glow_sPoint *point_p; glow_sPoint *point_p;
int i; int i;
#if 0
if ( 0 /* strcmp( trace.data[1], "") == 0 */ ) if ( !curve_cnt)
curve_cnt = 1;
else
curve_cnt = 2; curve_cnt = 2;
#endif
no_of_points = max( 2, no_of_points); no_of_points = max( 2, no_of_points);
points = no_of_points; points = no_of_points;
...@@ -163,8 +162,7 @@ void GrowTrend::configure_curves() ...@@ -163,8 +162,7 @@ void GrowTrend::configure_curves()
ctx->nodraw++; ctx->nodraw++;
curve[i] = new GrowPolyLine( ctx, "", pointarray, points, dt, curve[i] = new GrowPolyLine( ctx, "", pointarray, points, dt,
curve_width, curve_width, 0, fill_curve, 1, 0, dt_fill, 0, 1, 1);
0, fill_curve, 1, 0, dt_fill);
ctx->nodraw--; ctx->nodraw--;
} }
free( (char *) pointarray); free( (char *) pointarray);
...@@ -577,11 +575,15 @@ void GrowTrend::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, voi ...@@ -577,11 +575,15 @@ void GrowTrend::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, voi
ctx->gdraw->line( w, x, y, x + width, y, drawtype, 0, 0); ctx->gdraw->line( w, x, y, x + width, y, drawtype, 0, 0);
} }
if ( fill_curve) if ( border)
ctx->gdraw->rect( w, ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, drawtype, idx, 0);
if ( fill_curve) {
for ( i = 0; i < curve_cnt; i++) { for ( i = 0; i < curve_cnt; i++) {
if ( curve[i]) if ( curve[i])
curve[i]->fill = 0; curve[i]->fill = 0;
} }
}
if ( t) { if ( t) {
GlowTransform tmp = *t * trf; GlowTransform tmp = *t * trf;
for ( i = 0; i < curve_cnt; i++) { for ( i = 0; i < curve_cnt; i++) {
...@@ -596,15 +598,15 @@ void GrowTrend::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, voi ...@@ -596,15 +598,15 @@ void GrowTrend::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, voi
} }
} }
if ( fill_curve) if ( fill_curve) {
ctx->gdraw->line( w, ll_x, ll_y, ll_x, ur_y, drawtype, idx, 0);
ctx->gdraw->line( w, ur_x, ll_y, ur_x, ur_y, drawtype, idx, 0);
for ( i = 0; i < curve_cnt; i++) { for ( i = 0; i < curve_cnt; i++) {
if ( curve[i]) if ( curve[i])
curve[i]->fill = 1; curve[i]->fill = 1;
} }
if ( border) {
ctx->gdraw->rect( w, ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, drawtype, idx, 0);
} }
} }
//! Erase the object. //! Erase the object.
...@@ -805,6 +807,15 @@ void GrowTrend::get_trace_attr( GlowTraceData **attr) ...@@ -805,6 +807,15 @@ void GrowTrend::get_trace_attr( GlowTraceData **attr)
*attr = &trace; *attr = &trace;
} }
//! Set no of curves
/*!
\param no_of_curves Number of curves.
*/
void GrowTrend::set_no_of_curves( int no_of_curves)
{
curve_cnt = no_of_curves;
configure_curves();
}
//! Set scantime //! Set scantime
/*! /*!
\param time Scantime in seconds. \param time Scantime in seconds.
...@@ -1003,7 +1014,7 @@ void GrowTrend::set_data( double *data[3], int data_curves, int data_points) ...@@ -1003,7 +1014,7 @@ void GrowTrend::set_data( double *data[3], int data_curves, int data_points)
ctx->nodraw++; ctx->nodraw++;
curve[j] = new GrowPolyLine( ctx, "", pointarray, cpoints, dt, curve[j] = new GrowPolyLine( ctx, "", pointarray, cpoints, dt,
curve_width, curve_width,
0, fill_curve, 1, 0, dt_fill); 0, fill_curve, 1, 0, dt_fill, 0, 1, 1);
ctx->nodraw--; ctx->nodraw--;
} }
free( (char *) pointarray); free( (char *) pointarray);
......
...@@ -134,6 +134,7 @@ class GrowTrend : public GrowRect { ...@@ -134,6 +134,7 @@ class GrowTrend : public GrowRect {
void align( double x, double y, glow_eAlignDirection direction); void align( double x, double y, glow_eAlignDirection direction);
void set_no_of_curves( int no_of_curves);
void set_scan_time( double time); void set_scan_time( double time);
//! Get scantime //! Get scantime
......
Markdown is supported
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