Commit ee5450fe authored by Claes Sjofors's avatar Claes Sjofors

Preparation for multiple curves with different time scale in curve window

parent a0710922
...@@ -241,21 +241,26 @@ void GeCurveGtk::axis_set_width( int width) ...@@ -241,21 +241,26 @@ void GeCurveGtk::axis_set_width( int width)
void GeCurveGtk::open_minmax( int idx) void GeCurveGtk::open_minmax( int idx)
{ {
char value_str[80]; char min_value_str[80];
char max_value_str[80];
gint pos = 0; gint pos = 0;
create_minmax_dialog(); create_minmax_dialog();
sprintf( value_str, "%f", cd->min_value_axis[idx]); if ( idx < cd->cols) {
sprintf( min_value_str, "%f", cd->y_min_value_axis[idx]);
sprintf( max_value_str, "%f", cd->y_max_value_axis[idx]);
}
else {
sprintf( min_value_str, "%f", cd->x_min_value_axis[idx - cd->cols]);
sprintf( max_value_str, "%f", cd->x_max_value_axis[idx - cd->cols]);
}
gtk_editable_delete_text( GTK_EDITABLE(minmax_textmin_widget), 0, -1); gtk_editable_delete_text( GTK_EDITABLE(minmax_textmin_widget), 0, -1);
gtk_editable_insert_text( GTK_EDITABLE(minmax_textmin_widget), gtk_editable_insert_text( GTK_EDITABLE(minmax_textmin_widget),
value_str, strlen(value_str), &pos); min_value_str, strlen(min_value_str), &pos);
sprintf( value_str, "%f", cd->max_value_axis[idx]);
gtk_editable_delete_text( GTK_EDITABLE(minmax_textmax_widget), 0, -1); gtk_editable_delete_text( GTK_EDITABLE(minmax_textmax_widget), 0, -1);
gtk_editable_insert_text( GTK_EDITABLE(minmax_textmax_widget), gtk_editable_insert_text( GTK_EDITABLE(minmax_textmax_widget),
value_str, strlen(value_str), &pos); max_value_str, strlen(max_value_str), &pos);
minmax_idx = idx; minmax_idx = idx;
} }
......
This diff is collapsed.
...@@ -58,24 +58,38 @@ class GeCurveData { ...@@ -58,24 +58,38 @@ class GeCurveData {
curve_eDataType type; curve_eDataType type;
int rows; int rows;
int cols; int cols;
pwr_tAName name[CURVE_MAX_COLS]; pwr_tAName y_name[CURVE_MAX_COLS];
char unit[CURVE_MAX_COLS][16]; pwr_tAName x_name;
double *data[CURVE_MAX_COLS]; char y_unit[CURVE_MAX_COLS][16];
double max_value[CURVE_MAX_COLS]; char x_unit[CURVE_MAX_COLS][16];
double min_value[CURVE_MAX_COLS]; double *y_data[CURVE_MAX_COLS];
double max_value_axis[CURVE_MAX_COLS]; double *x_data[CURVE_MAX_COLS];
double min_value_axis[CURVE_MAX_COLS]; double y_max_value[CURVE_MAX_COLS];
int trend_lines[CURVE_MAX_COLS]; double y_min_value[CURVE_MAX_COLS];
int axis_lines[CURVE_MAX_COLS]; double x_max_value[CURVE_MAX_COLS];
int axis_linelongq[CURVE_MAX_COLS]; double x_min_value[CURVE_MAX_COLS];
int axis_valueq[CURVE_MAX_COLS]; double y_max_value_axis[CURVE_MAX_COLS];
double y_min_value_axis[CURVE_MAX_COLS];
int y_trend_lines[CURVE_MAX_COLS];
int y_axis_lines[CURVE_MAX_COLS];
int y_axis_linelongq[CURVE_MAX_COLS];
int y_axis_valueq[CURVE_MAX_COLS];
double x_max_value_axis[CURVE_MAX_COLS];
double x_min_value_axis[CURVE_MAX_COLS];
int x_trend_lines[CURVE_MAX_COLS];
int x_axis_lines[CURVE_MAX_COLS];
int x_axis_linelongq[CURVE_MAX_COLS];
int x_axis_valueq[CURVE_MAX_COLS];
glow_eDrawType color[CURVE_MAX_COLS]; glow_eDrawType color[CURVE_MAX_COLS];
glow_eDrawType fillcolor[CURVE_MAX_COLS]; glow_eDrawType fillcolor[CURVE_MAX_COLS];
glow_eDrawType axiscolor[CURVE_MAX_COLS]; glow_eDrawType axiscolor[CURVE_MAX_COLS];
pwr_eType value_type[CURVE_MAX_COLS]; pwr_eType y_value_type[CURVE_MAX_COLS];
curve_eAxis axis_type[CURVE_MAX_COLS]; pwr_eType x_value_type[CURVE_MAX_COLS];
double axis_width[CURVE_MAX_COLS]; curve_eAxis y_axis_type[CURVE_MAX_COLS];
char format[CURVE_MAX_COLS][20]; curve_eAxis x_axis_type[CURVE_MAX_COLS];
double y_axis_width[CURVE_MAX_COLS];
char y_format[CURVE_MAX_COLS][20];
char x_format[CURVE_MAX_COLS][20];
int x_reverse; int x_reverse;
curve_eTimeFormat time_format; curve_eTimeFormat time_format;
...@@ -113,15 +127,15 @@ class GeCurve { ...@@ -113,15 +127,15 @@ class GeCurve {
GeCurveData *cd; GeCurveData *cd;
double axis_window_width; double axis_window_width;
int hide[CURVE_MAX_COLS]; int hide[CURVE_MAX_COLS];
grow_tObject name_rect[CURVE_MAX_COLS]; grow_tObject name_rect[CURVE_MAX_COLS+1];
grow_tObject hide_rect[CURVE_MAX_COLS]; grow_tObject hide_rect[CURVE_MAX_COLS+1];
grow_tObject hide_l1[CURVE_MAX_COLS]; grow_tObject hide_l1[CURVE_MAX_COLS+1];
grow_tObject hide_l2[CURVE_MAX_COLS]; grow_tObject hide_l2[CURVE_MAX_COLS+1];
grow_tObject scale_rect[CURVE_MAX_COLS]; grow_tObject scale_rect[CURVE_MAX_COLS+1];
grow_tObject mark_annot[CURVE_MAX_COLS]; grow_tObject mark_annot[CURVE_MAX_COLS+1];
grow_tObject cursor_annot[CURVE_MAX_COLS]; grow_tObject cursor_annot[CURVE_MAX_COLS+1];
grow_tObject axis_rect[CURVE_MAX_COLS]; grow_tObject axis_rect[CURVE_MAX_COLS+1];
grow_tObject axis_object[CURVE_MAX_COLS]; grow_tObject axis_object[CURVE_MAX_COLS+1];
grow_tObject axis_lineobject; grow_tObject axis_lineobject;
int auto_refresh; int auto_refresh;
int axis_displayed; int axis_displayed;
......
...@@ -1967,16 +1967,28 @@ typedef struct { ...@@ -1967,16 +1967,28 @@ typedef struct {
short y; //!< y coordinate short y; //!< y coordinate
} glow_sPointX; } glow_sPointX;
//! Curve data type
typedef enum {
glow_eCurveDataType_CommonX,
glow_eCurveDataType_SeparateX
} glow_eCurveDataType;
//! Configuration of curves //! Configuration of curves
typedef struct { typedef struct {
glow_eCurveDataType type;
int curves; //!< Number of curves int curves; //!< Number of curves
int rows; //!< Number of points int rows; //!< Number of points
int x_reverse; //!< Reverse the curves when drawing them int x_reverse; //!< Reverse the curves when drawing them
double max_value[TREND_MAX_CURVES + 1]; //!< Max value for every curve double y_max_value[TREND_MAX_CURVES]; //!< Max value for every curve
double min_value[TREND_MAX_CURVES + 1]; //!< Min value for every curve double x_max_value[TREND_MAX_CURVES]; //!< Max value for every curve
double *data[TREND_MAX_CURVES + 1]; //!< Data for every curve double y_min_value[TREND_MAX_CURVES]; //!< Min value for every curve
glow_eDrawType color[TREND_MAX_CURVES + 1]; //!< Color of every curve double x_min_value[TREND_MAX_CURVES]; //!< Min value for every curve
glow_eDrawType fillcolor[TREND_MAX_CURVES + 1]; //!< Fill color for every curve double *y_data[TREND_MAX_CURVES]; //!< y data for every curve
double *x_data[TREND_MAX_CURVES]; //!< x data for every curve
glow_eDrawType color[TREND_MAX_CURVES]; //!< Color of every curve
glow_eDrawType fillcolor[TREND_MAX_CURVES]; //!< Fill color for every curve
} glow_sCurveData; } glow_sCurveData;
//! Data for a GrowTrend object //! Data for a GrowTrend object
......
...@@ -62,138 +62,139 @@ void GrowCurve::configure_curves( glow_sCurveData *data) ...@@ -62,138 +62,139 @@ void GrowCurve::configure_curves( glow_sCurveData *data)
} }
ctx->nodraw--; ctx->nodraw--;
if ( data->type == glow_eCurveDataType_CommonX) {
curve_cnt = data->curves;
no_of_points = data->rows;
curve_cnt = data->curves - 1; for ( i = 0; i < curve_cnt; i++) {
no_of_points = data->rows; y_max_value[i] = data->y_max_value[i];
y_min_value[i] = data->y_min_value[i];
for ( i = 0; i < curve_cnt; i++) { curve_drawtype[i] = data->color[i];
y_max_value[i] = data->max_value[i+1]; curve_fill_drawtype[i] = data->fillcolor[i];
y_min_value[i] = data->min_value[i+1]; }
curve_drawtype[i] = data->color[i+1];
curve_fill_drawtype[i] = data->fillcolor[i+1];
}
points = no_of_points; points = no_of_points;
if ( fill_curve) if ( fill_curve)
points += 2; points += 2;
curve_width = min( DRAW_TYPE_SIZE, max( 1, curve_width)); curve_width = min( DRAW_TYPE_SIZE, max( 1, curve_width));
pointarray = (glow_sPoint *) calloc( points, sizeof(glow_sPoint)); pointarray = (glow_sPoint *) calloc( points, sizeof(glow_sPoint));
for ( idx = 0; idx < curve_cnt; idx++) { for ( idx = 0; idx < curve_cnt; idx++) {
point_p = pointarray; point_p = pointarray;
for ( i = 0; i < points; i++) for ( i = 0; i < points; i++) {
{ if ( !fill_curve) {
if ( !fill_curve) { if ( data->x_reverse)
if ( data->x_reverse) x_value = ur.x - (data->x_data[0][i] - data->x_min_value[0]) /
x_value = ur.x - (data->data[0][i] - data->min_value[0]) / (data->x_max_value[0] - data->x_min_value[0]) * (ur.x - ll.x);
(data->max_value[0] - data->min_value[0]) * (ur.x - ll.x); else
else x_value = ll.x + (data->x_data[0][i] - data->x_min_value[0]) /
x_value = ll.x + (data->data[0][i] - data->min_value[0]) / (data->x_max_value[0] - data->x_min_value[0]) * (ur.x - ll.x);
(data->max_value[0] - data->min_value[0]) * (ur.x - ll.x);
x_value = max( ll.x, min( x_value, ur.x));
x_value = max( ll.x, min( x_value, ur.x));
y_value = ur.y - (data->y_data[idx][i] - y_min_value[idx]) /
y_value = ur.y - (data->data[idx+1][i] - y_min_value[idx]) / (y_max_value[idx] - y_min_value[idx]) * (ur.y - ll.y);
(y_max_value[idx] - y_min_value[idx]) * (ur.y - ll.y);
y_value = max( ll.y, min( y_value, ur.y));
y_value = max( ll.y, min( y_value, ur.y));
point_p->y = y_value;
point_p->y = y_value; point_p->x = x_value;
point_p->x = x_value; }
} else {
else if ( i == 0) {
{ point_p->y = ur.y;
if ( i == 0) { // point_p->x = ur.x;
point_p->y = ur.y; if ( data->x_reverse)
// point_p->x = ur.x; point_p->x = ur.x - (data->x_data[0][i] - data->x_min_value[0]) /
if ( data->x_reverse) (data->x_max_value[0] - data->x_min_value[0]) * (ur.x - ll.x);
point_p->x = ur.x - (data->data[0][i] - data->min_value[0]) / else
(data->max_value[0] - data->min_value[0]) * (ur.x - ll.x); point_p->x = ll.x + (data->x_data[0][i] - data->x_min_value[0]) /
else (data->x_max_value[0] - data->x_min_value[0]) * (ur.x - ll.x);
point_p->x = ll.x + (data->data[0][i] - data->min_value[0]) / }
(data->max_value[0] - data->min_value[0]) * (ur.x - ll.x); else if ( i == points - 1) {
} point_p->y = ur.y;
else if ( i == points - 1) { if ( data->x_reverse)
point_p->y = ur.y; point_p->x = ur.x - (data->x_data[0][i-2] - data->x_min_value[0]) /
if ( data->x_reverse) (data->x_max_value[0] - data->x_min_value[0]) * (ur.x - ll.x);
point_p->x = ur.x - (data->data[0][i-2] - data->min_value[0]) / else
(data->max_value[0] - data->min_value[0]) * (ur.x - ll.x); point_p->x = ll.x + (data->x_data[0][i-2] - data->x_min_value[0]) /
else (data->x_max_value[0] - data->x_min_value[0]) * (ur.x - ll.x);
point_p->x = ll.x + (data->data[0][i-2] - data->min_value[0]) / // point_p->x = ll.x;
(data->max_value[0] - data->min_value[0]) * (ur.x - ll.x); }
// point_p->x = ll.x; else {
} if ( data->x_reverse)
else { x_value = ur.x - (data->x_data[0][i-1] - data->x_min_value[0]) /
if ( data->x_reverse) (data->x_max_value[0] - data->x_min_value[0]) * (ur.x - ll.x);
x_value = ur.x - (data->data[0][i-1] - data->min_value[0]) / else
(data->max_value[0] - data->min_value[0]) * (ur.x - ll.x); x_value = ll.x + (data->x_data[0][i-1] - data->x_min_value[0]) /
else (data->x_max_value[0] - data->x_min_value[0]) * (ur.x - ll.x);
x_value = ll.x + (data->data[0][i-1] - data->min_value[0]) /
(data->max_value[0] - data->min_value[0]) * (ur.x - ll.x); x_value = max( ll.x, min( x_value, ur.x));
x_value = max( ll.x, min( x_value, ur.x)); y_value = ur.y - (data->y_data[idx][i-1] - y_min_value[idx]) /
(y_max_value[idx] - y_min_value[idx]) * (ur.y - ll.y);
y_value = ur.y - (data->data[idx+1][i-1] - y_min_value[idx]) /
(y_max_value[idx] - y_min_value[idx]) * (ur.y - ll.y); y_value = max( ll.y, min( y_value, ur.y));
y_value = max( ll.y, min( y_value, ur.y)); point_p->y = y_value;
point_p->x = x_value;
point_p->y = y_value; }
point_p->x = x_value; }
} point_p++;
} }
point_p++;
}
if ( curve_drawtype[idx] != glow_eDrawType_Inherit) if ( curve_drawtype[idx] != glow_eDrawType_Inherit)
dt = curve_drawtype[idx]; dt = curve_drawtype[idx];
else else
dt = draw_type; dt = draw_type;
if ( curve_fill_drawtype[idx] != glow_eDrawType_Inherit)
dt_fill = curve_fill_drawtype[idx];
else
dt_fill = draw_type;
if ( curve_fill_drawtype[idx] != glow_eDrawType_Inherit) ctx->nodraw++;
dt_fill = curve_fill_drawtype[idx]; curve[idx] = new GrowPolyLine( ctx, "", pointarray, points, dt,
else curve_width,
dt_fill = draw_type; 0, fill_curve, 1, 0, dt_fill);
ctx->nodraw--;
}
free( (char *) pointarray);
ctx->nodraw++; draw();
curve[idx] = new GrowPolyLine( ctx, "", pointarray, points, dt,
curve_width,
0, fill_curve, 1, 0, dt_fill);
ctx->nodraw--;
} }
free( (char *) pointarray);
draw();
} }
void GrowCurve::add_points( glow_sCurveData *data) void GrowCurve::add_points( glow_sCurveData *data)
{ {
int idx; if ( data->type == glow_eCurveDataType_CommonX) {
double y_value; int idx;
double y_value;
// Remove old curves // Remove old curves
ctx->nodraw++; ctx->nodraw++;
for ( idx = 0; idx < curve_cnt; idx++) { for ( idx = 0; idx < curve_cnt; idx++) {
y_value = ur.y - (data->data[idx+1][0] - y_min_value[idx]) / y_value = ur.y - (data->y_data[idx][0] - y_min_value[idx]) /
(y_max_value[idx] - y_min_value[idx]) * (ur.y - ll.y); (y_max_value[idx] - y_min_value[idx]) * (ur.y - ll.y);
y_value = max( ll.y, min( y_value, ur.y));
if ( !fill)
erase( &ctx->mw);
if ( !fill_curve)
curve[idx]->add_and_shift_y_value( y_value);
else
curve[idx]->add_and_shift_y_value_filled( y_value);
}
ctx->nodraw--;
draw(); y_value = max( ll.y, min( y_value, ur.y));
// draw( (GlowTransform *)NULL, highlight, hot, NULL, NULL);
ctx->nav_draw( &ctx->navw, 0, 0, ctx->navw.window_width, ctx->navw.window_height); if ( !fill)
// nav_draw( (GlowTransform *) NULL, highlight, NULL, NULL); erase( &ctx->mw);
if ( !fill_curve)
curve[idx]->add_and_shift_y_value( y_value);
else
curve[idx]->add_and_shift_y_value_filled( y_value);
}
ctx->nodraw--;
draw();
// draw( (GlowTransform *)NULL, highlight, hot, NULL, NULL);
ctx->nav_draw( &ctx->navw, 0, 0, ctx->navw.window_width, ctx->navw.window_height);
// nav_draw( (GlowTransform *) NULL, highlight, NULL, NULL);
}
} }
......
...@@ -99,25 +99,25 @@ XttFast::XttFast( void *parent_ctx, ...@@ -99,25 +99,25 @@ XttFast::XttFast( void *parent_ctx,
// Create data for time axis // Create data for time axis
gcd = new GeCurveData( curve_eDataType_DsTrend); gcd = new GeCurveData( curve_eDataType_DsTrend);
gcd->data[0] = (double *) malloc( 8 * max_points); gcd->x_data[0] = (double *) malloc( 8 * max_points);
strcpy( gcd->name[0], "Time"); strcpy( gcd->x_name, "Time");
gcd->axis_type[0] = curve_eAxis_x; gcd->x_axis_type[0] = curve_eAxis_x;
memcpy( &time_buff, &fp.TimeBuffer, sizeof(time_buff)); memcpy( &time_buff, &fp.TimeBuffer, sizeof(time_buff));
fast_cnt = 0; fast_cnt = 0;
for ( i = 0; i < FAST_CURVES; i++) { for ( i = 0; i < FAST_CURVES; i++) {
if ( fp.CurveValid[i]) { if ( fp.CurveValid[i]) {
gcd->data[fast_cnt + 1] = (double *) calloc( 1, 8 * max_points); gcd->y_data[fast_cnt] = (double *) calloc( 1, 8 * max_points);
gcd->axis_type[fast_cnt + 1] = curve_eAxis_y; gcd->y_axis_type[fast_cnt] = curve_eAxis_y;
memcpy( &buff[fast_cnt], &fp.Buffers[i], sizeof(buff[0])); memcpy( &buff[fast_cnt], &fp.Buffers[i], sizeof(buff[0]));
type[fast_cnt] = (pwr_eType) fp.AttributeType[i]; type[fast_cnt] = (pwr_eType) fp.AttributeType[i];
fast_idx[i] = fast_cnt + 1; fast_idx[i] = fast_cnt;
curve_idx[fast_cnt + 1] = i; curve_idx[fast_cnt] = i;
*sts = gdh_AttrrefToName( &fp.Attribute[i], attr_name, *sts = gdh_AttrrefToName( &fp.Attribute[i], attr_name,
sizeof(attr_name), cdh_mNName); sizeof(attr_name), cdh_mNName);
if (EVEN(*sts)) continue; if (EVEN(*sts)) continue;
strcpy( gcd->name[fast_cnt + 1], attr_name); strcpy( gcd->y_name[fast_cnt], attr_name);
fast_cnt++; fast_cnt++;
} }
} }
...@@ -153,7 +153,7 @@ XttFast::XttFast( void *parent_ctx, ...@@ -153,7 +153,7 @@ XttFast::XttFast( void *parent_ctx,
element_size[i] = 4; element_size[i] = 4;
} }
} }
gcd->cols = fast_cnt + 1; gcd->cols = fast_cnt;
gcd->rows = max_points; gcd->rows = max_points;
axis_configured = true; axis_configured = true;
...@@ -161,11 +161,11 @@ XttFast::XttFast( void *parent_ctx, ...@@ -161,11 +161,11 @@ XttFast::XttFast( void *parent_ctx,
if ( fp.CurveValid[i]) { if ( fp.CurveValid[i]) {
j = fast_idx[i]; j = fast_idx[i];
if ( fp.YMinValue[i] != fp.YMaxValue[i]) if ( fp.YMinValue[i] != fp.YMaxValue[i])
gcd->scale( gcd->axis_type[j], gcd->value_type[j], gcd->scale( gcd->y_axis_type[j], gcd->y_value_type[j],
fp.YMinValue[i], fp.YMaxValue[i], fp.YMinValue[i], fp.YMaxValue[i],
&gcd->min_value_axis[j], &gcd->max_value_axis[j], &gcd->y_min_value_axis[j], &gcd->y_max_value_axis[j],
&gcd->trend_lines[j], &gcd->axis_lines[j], &gcd->axis_linelongq[j], &gcd->y_trend_lines[j], &gcd->y_axis_lines[j], &gcd->y_axis_linelongq[j],
&gcd->axis_valueq[j], gcd->format[j], &gcd->axis_width[j], 1, 1); &gcd->y_axis_valueq[j], gcd->y_format[j], &gcd->y_axis_width[j], 1, 1);
else else
axis_configured = false; axis_configured = false;
} }
...@@ -248,14 +248,14 @@ void XttFast::fast_scan( void *data) ...@@ -248,14 +248,14 @@ void XttFast::fast_scan( void *data)
for ( j = 0; j < fast->max_points; j++) { for ( j = 0; j < fast->max_points; j++) {
if ( k >= fast->max_points) if ( k >= fast->max_points)
k = 0; k = 0;
fast->gcd->data[0][j] = tmp[k] - tmp[trigg_index]; fast->gcd->x_data[0][j] = tmp[k] - tmp[trigg_index];
if ( k == last_index) if ( k == last_index)
break; break;
k++; k++;
} }
// If to few points, fill with dummy data // If to few points, fill with dummy data
for ( ; j < fast->max_points; j++) { for ( ; j < fast->max_points; j++) {
fast->gcd->data[0][j] = tmp[k] - tmp[trigg_index]; fast->gcd->x_data[0][j] = tmp[k] - tmp[trigg_index];
} }
free( tmp); free( tmp);
} }
...@@ -266,7 +266,7 @@ void XttFast::fast_scan( void *data) ...@@ -266,7 +266,7 @@ void XttFast::fast_scan( void *data)
if ( EVEN(sts)) return; if ( EVEN(sts)) return;
for ( j = 0; j < fast->max_points; j++) for ( j = 0; j < fast->max_points; j++)
fast->gcd->data[0][j] = tmp[j]; fast->gcd->x_data[0][j] = tmp[j];
free( tmp); free( tmp);
} }
for ( i = 0; i < fast->fast_cnt; i++) { for ( i = 0; i < fast->fast_cnt; i++) {
...@@ -283,34 +283,34 @@ void XttFast::fast_scan( void *data) ...@@ -283,34 +283,34 @@ void XttFast::fast_scan( void *data)
k = 0; k = 0;
switch( fast->type[i]) { switch( fast->type[i]) {
case pwr_eType_Float32: case pwr_eType_Float32:
fast->gcd->data[i + 1][j] = ((pwr_tFloat32 *)tmp)[k]; fast->gcd->y_data[i][j] = ((pwr_tFloat32 *)tmp)[k];
break; break;
case pwr_eType_Float64: case pwr_eType_Float64:
fast->gcd->data[i + 1][j] = ((pwr_tFloat64 *)tmp)[k]; fast->gcd->y_data[i][j] = ((pwr_tFloat64 *)tmp)[k];
break; break;
case pwr_eType_Int64: case pwr_eType_Int64:
fast->gcd->data[i + 1][j] = ((pwr_tInt64 *)tmp)[k]; fast->gcd->y_data[i][j] = ((pwr_tInt64 *)tmp)[k];
break; break;
case pwr_eType_UInt64: case pwr_eType_UInt64:
fast->gcd->data[i + 1][j] = ((pwr_tUInt64 *)tmp)[k]; fast->gcd->y_data[i][j] = ((pwr_tUInt64 *)tmp)[k];
break; break;
case pwr_eType_Int32: case pwr_eType_Int32:
fast->gcd->data[i + 1][j] = ((pwr_tInt32 *)tmp)[k]; fast->gcd->y_data[i][j] = ((pwr_tInt32 *)tmp)[k];
break; break;
case pwr_eType_UInt32: case pwr_eType_UInt32:
fast->gcd->data[i + 1][j] = ((pwr_tUInt32 *)tmp)[k]; fast->gcd->y_data[i][j] = ((pwr_tUInt32 *)tmp)[k];
break; break;
case pwr_eType_Int16: case pwr_eType_Int16:
fast->gcd->data[i + 1][j] = ((pwr_tUInt16 *)tmp)[k]; fast->gcd->y_data[i][j] = ((pwr_tUInt16 *)tmp)[k];
break; break;
case pwr_eType_UInt16: case pwr_eType_UInt16:
fast->gcd->data[i + 1][j] = ((pwr_tUInt16 *)tmp)[k]; fast->gcd->y_data[i][j] = ((pwr_tUInt16 *)tmp)[k];
break; break;
case pwr_eType_Int8: case pwr_eType_Int8:
fast->gcd->data[i + 1][j] = ((pwr_tInt8 *)tmp)[k]; fast->gcd->y_data[i][j] = ((pwr_tInt8 *)tmp)[k];
break; break;
case pwr_eType_UInt8: case pwr_eType_UInt8:
fast->gcd->data[i + 1][j] = ((pwr_tUInt8 *)tmp)[k]; fast->gcd->y_data[i][j] = ((pwr_tUInt8 *)tmp)[k];
break; break;
default: default:
; ;
...@@ -323,34 +323,34 @@ void XttFast::fast_scan( void *data) ...@@ -323,34 +323,34 @@ void XttFast::fast_scan( void *data)
for ( ; j < fast->max_points; j++) { for ( ; j < fast->max_points; j++) {
switch( fast->type[i]) { switch( fast->type[i]) {
case pwr_eType_Float32: case pwr_eType_Float32:
fast->gcd->data[i + 1][j] = ((pwr_tFloat32 *)tmp)[k]; fast->gcd->y_data[i][j] = ((pwr_tFloat32 *)tmp)[k];
break; break;
case pwr_eType_Float64: case pwr_eType_Float64:
fast->gcd->data[i + 1][j] = ((pwr_tFloat64 *)tmp)[k]; fast->gcd->y_data[i][j] = ((pwr_tFloat64 *)tmp)[k];
break; break;
case pwr_eType_Int64: case pwr_eType_Int64:
fast->gcd->data[i + 1][j] = ((pwr_tInt64 *)tmp)[k]; fast->gcd->y_data[i][j] = ((pwr_tInt64 *)tmp)[k];
break; break;
case pwr_eType_UInt64: case pwr_eType_UInt64:
fast->gcd->data[i + 1][j] = ((pwr_tUInt64 *)tmp)[k]; fast->gcd->y_data[i][j] = ((pwr_tUInt64 *)tmp)[k];
break; break;
case pwr_eType_Int32: case pwr_eType_Int32:
fast->gcd->data[i + 1][j] = ((pwr_tInt32 *)tmp)[k]; fast->gcd->y_data[i][j] = ((pwr_tInt32 *)tmp)[k];
break; break;
case pwr_eType_UInt32: case pwr_eType_UInt32:
fast->gcd->data[i + 1][j] = ((pwr_tUInt32 *)tmp)[k]; fast->gcd->y_data[i][j] = ((pwr_tUInt32 *)tmp)[k];
break; break;
case pwr_eType_Int16: case pwr_eType_Int16:
fast->gcd->data[i + 1][j] = ((pwr_tInt16 *)tmp)[k]; fast->gcd->y_data[i][j] = ((pwr_tInt16 *)tmp)[k];
break; break;
case pwr_eType_UInt16: case pwr_eType_UInt16:
fast->gcd->data[i + 1][j] = ((pwr_tInt16 *)tmp)[k]; fast->gcd->y_data[i][j] = ((pwr_tInt16 *)tmp)[k];
break; break;
case pwr_eType_Int8: case pwr_eType_Int8:
fast->gcd->data[i + 1][j] = ((pwr_tInt8 *)tmp)[k]; fast->gcd->y_data[i][j] = ((pwr_tInt8 *)tmp)[k];
break; break;
case pwr_eType_UInt8: case pwr_eType_UInt8:
fast->gcd->data[i + 1][j] = ((pwr_tUInt8 *)tmp)[k]; fast->gcd->y_data[i][j] = ((pwr_tUInt8 *)tmp)[k];
break; break;
default: ; default: ;
} }
...@@ -366,34 +366,34 @@ void XttFast::fast_scan( void *data) ...@@ -366,34 +366,34 @@ void XttFast::fast_scan( void *data)
for ( j = 0; j < fast->max_points; j++) { for ( j = 0; j < fast->max_points; j++) {
switch( fast->type[i]) { switch( fast->type[i]) {
case pwr_eType_Float32: case pwr_eType_Float32:
fast->gcd->data[i + 1][j] = ((pwr_tFloat32 *)tmp)[j]; fast->gcd->y_data[i][j] = ((pwr_tFloat32 *)tmp)[j];
break; break;
case pwr_eType_Float64: case pwr_eType_Float64:
fast->gcd->data[i + 1][j] = ((pwr_tFloat64 *)tmp)[j]; fast->gcd->y_data[i][j] = ((pwr_tFloat64 *)tmp)[j];
break; break;
case pwr_eType_Int64: case pwr_eType_Int64:
fast->gcd->data[i + 1][j] = ((pwr_tInt64 *)tmp)[j]; fast->gcd->y_data[i][j] = ((pwr_tInt64 *)tmp)[j];
break; break;
case pwr_eType_UInt64: case pwr_eType_UInt64:
fast->gcd->data[i + 1][j] = ((pwr_tUInt64 *)tmp)[j]; fast->gcd->y_data[i][j] = ((pwr_tUInt64 *)tmp)[j];
break; break;
case pwr_eType_Int32: case pwr_eType_Int32:
fast->gcd->data[i + 1][j] = ((pwr_tInt32 *)tmp)[j]; fast->gcd->y_data[i][j] = ((pwr_tInt32 *)tmp)[j];
break; break;
case pwr_eType_UInt32: case pwr_eType_UInt32:
fast->gcd->data[i + 1][j] = ((pwr_tUInt32 *)tmp)[j]; fast->gcd->y_data[i][j] = ((pwr_tUInt32 *)tmp)[j];
break; break;
case pwr_eType_Int16: case pwr_eType_Int16:
fast->gcd->data[i + 1][j] = ((pwr_tInt16 *)tmp)[j]; fast->gcd->y_data[i][j] = ((pwr_tInt16 *)tmp)[j];
break; break;
case pwr_eType_UInt16: case pwr_eType_UInt16:
fast->gcd->data[i + 1][j] = ((pwr_tInt16 *)tmp)[j]; fast->gcd->y_data[i][j] = ((pwr_tInt16 *)tmp)[j];
break; break;
case pwr_eType_Int8: case pwr_eType_Int8:
fast->gcd->data[i + 1][j] = ((pwr_tInt8 *)tmp)[j]; fast->gcd->y_data[i][j] = ((pwr_tInt8 *)tmp)[j];
break; break;
case pwr_eType_UInt8: case pwr_eType_UInt8:
fast->gcd->data[i + 1][j] = ((pwr_tUInt8 *)tmp)[j]; fast->gcd->y_data[i][j] = ((pwr_tUInt8 *)tmp)[j];
break; break;
default: ; default: ;
} }
...@@ -418,15 +418,17 @@ void XttFast::fast_scan( void *data) ...@@ -418,15 +418,17 @@ void XttFast::fast_scan( void *data)
} }
} }
else { else {
double axis_width;
fast->gcd->get_borders(); fast->gcd->get_borders();
// fast->gcd->get_default_axis(); // fast->gcd->get_default_axis();
fast->gcd->scale( fast->gcd->axis_type[0], fast->gcd->value_type[0], fast->gcd->scale( fast->gcd->x_axis_type[0], fast->gcd->x_value_type[0],
fast->gcd->min_value[0], fast->gcd->max_value[0], fast->gcd->x_min_value[0], fast->gcd->x_max_value[0],
&fast->gcd->min_value_axis[0], &fast->gcd->max_value_axis[0], &fast->gcd->x_min_value_axis[0], &fast->gcd->x_max_value_axis[0],
&fast->gcd->trend_lines[0], &fast->gcd->axis_lines[0], &fast->gcd->x_trend_lines[0], &fast->gcd->x_axis_lines[0],
&fast->gcd->axis_linelongq[0], &fast->gcd->x_axis_linelongq[0],
&fast->gcd->axis_valueq[0], fast->gcd->format[0], &fast->gcd->x_axis_valueq[0], fast->gcd->x_format[0],
&fast->gcd->axis_width[0], 1, 1); &axis_width, 1, 1);
if ( !fast->first_scan) { if ( !fast->first_scan) {
fast->curve->configure_curves(); fast->curve->configure_curves();
// fast->curve->configure_axes(); // fast->curve->configure_axes();
......
...@@ -90,51 +90,51 @@ int XttSevHist::get_data( pwr_tStatus *sts, pwr_tTime from, pwr_tTime to) ...@@ -90,51 +90,51 @@ int XttSevHist::get_data( pwr_tStatus *sts, pwr_tTime from, pwr_tTime to)
// Create data for time axis // Create data for time axis
gcd = new GeCurveData( curve_eDataType_DsTrend); gcd = new GeCurveData( curve_eDataType_DsTrend);
gcd->data[0] = (double *) calloc( 1, 8 * rows); gcd->x_data[0] = (double *) calloc( 1, 8 * rows);
for ( int i = 0; i < rows; i++) for ( int i = 0; i < rows; i++)
gcd->data[0][i] = (double)tbuf[i].tv_sec + (double)1e-9 * tbuf[i].tv_nsec; gcd->x_data[0][i] = (double)tbuf[i].tv_sec + (double)1e-9 * tbuf[i].tv_nsec;
strcpy( gcd->name[0], "Time"); strcpy( gcd->x_name, "Time");
gcd->axis_type[0] = curve_eAxis_x; gcd->x_axis_type[0] = curve_eAxis_x;
strcpy( gcd->format[0], "%10t"); strcpy( gcd->x_format[0], "%10t");
strcpy( gcd->name[1], aname); strcpy( gcd->y_name[0], aname);
gcd->data[1] = (double *) calloc( 1, 8 * rows); gcd->y_data[0] = (double *) calloc( 1, 8 * rows);
for ( int i = 0; i < rows; i++) { for ( int i = 0; i < rows; i++) {
switch ( vtype) { switch ( vtype) {
case pwr_eType_Int64: case pwr_eType_Int64:
gcd->data[1][i] = ((pwr_tInt32 *)vbuf)[i]; gcd->y_data[0][i] = ((pwr_tInt32 *)vbuf)[i];
break; break;
case pwr_eType_Int32: case pwr_eType_Int32:
gcd->data[1][i] = ((pwr_tInt32 *)vbuf)[i]; gcd->y_data[0][i] = ((pwr_tInt32 *)vbuf)[i];
break; break;
case pwr_eType_Int16: case pwr_eType_Int16:
gcd->data[1][i] = ((pwr_tInt32 *)vbuf)[i]; gcd->y_data[0][i] = ((pwr_tInt32 *)vbuf)[i];
break; break;
case pwr_eType_Int8: case pwr_eType_Int8:
gcd->data[1][i] = ((pwr_tInt32 *)vbuf)[i]; gcd->y_data[0][i] = ((pwr_tInt32 *)vbuf)[i];
break; break;
case pwr_eType_UInt64: case pwr_eType_UInt64:
gcd->data[1][i] = ((pwr_tUInt32 *)vbuf)[i]; gcd->y_data[0][i] = ((pwr_tUInt32 *)vbuf)[i];
break; break;
case pwr_eType_UInt32: case pwr_eType_UInt32:
gcd->data[1][i] = ((pwr_tUInt32 *)vbuf)[i]; gcd->y_data[0][i] = ((pwr_tUInt32 *)vbuf)[i];
break; break;
case pwr_eType_UInt16: case pwr_eType_UInt16:
gcd->data[1][i] = ((pwr_tUInt32 *)vbuf)[i]; gcd->y_data[0][i] = ((pwr_tUInt32 *)vbuf)[i];
break; break;
case pwr_eType_UInt8: case pwr_eType_UInt8:
gcd->data[1][i] = ((pwr_tUInt32 *)vbuf)[i]; gcd->y_data[0][i] = ((pwr_tUInt32 *)vbuf)[i];
break; break;
case pwr_eType_Float32: case pwr_eType_Float32:
gcd->data[1][i] = ((pwr_tFloat32 *)vbuf)[i]; gcd->y_data[0][i] = ((pwr_tFloat32 *)vbuf)[i];
break; break;
case pwr_eType_Float64: case pwr_eType_Float64:
gcd->data[1][i] = ((pwr_tFloat64 *)vbuf)[i]; gcd->y_data[0][i] = ((pwr_tFloat64 *)vbuf)[i];
break; break;
case pwr_eType_Boolean: case pwr_eType_Boolean:
gcd->data[1][i] = ((pwr_tBoolean *)vbuf)[i]; gcd->y_data[0][i] = ((pwr_tBoolean *)vbuf)[i];
break; break;
default: default:
*sts = SEV__CURVETYPE; *sts = SEV__CURVETYPE;
...@@ -144,9 +144,9 @@ int XttSevHist::get_data( pwr_tStatus *sts, pwr_tTime from, pwr_tTime to) ...@@ -144,9 +144,9 @@ int XttSevHist::get_data( pwr_tStatus *sts, pwr_tTime from, pwr_tTime to)
free( tbuf); free( tbuf);
free( vbuf); free( vbuf);
gcd->axis_type[1] = curve_eAxis_y; gcd->y_axis_type[0] = curve_eAxis_y;
gcd->cols = 1 + 1; gcd->cols = 1;
gcd->rows = rows; gcd->rows = rows;
gcd->get_borders(); gcd->get_borders();
...@@ -155,12 +155,12 @@ int XttSevHist::get_data( pwr_tStatus *sts, pwr_tTime from, pwr_tTime to) ...@@ -155,12 +155,12 @@ int XttSevHist::get_data( pwr_tStatus *sts, pwr_tTime from, pwr_tTime to)
if ( to.tv_sec != 0 && from.tv_sec != 0) { if ( to.tv_sec != 0 && from.tv_sec != 0) {
time_Adiff( &trange, &to, &from); time_Adiff( &trange, &to, &from);
if ( time_DToFloat( 0, &trange) < 600) if ( time_DToFloat( 0, &trange) < 600)
strcpy( gcd->format[0], "%10t"); strcpy( gcd->x_format[0], "%10t");
else else
strcpy( gcd->format[0], "%11t"); strcpy( gcd->x_format[0], "%11t");
} }
else else
strcpy( gcd->format[0], "%11t"); strcpy( gcd->x_format[0], "%11t");
gcd->select_color( 0); gcd->select_color( 0);
...@@ -196,13 +196,13 @@ int XttSevHist::get_objectdata( pwr_tStatus *sts, pwr_tTime from, pwr_tTime to) ...@@ -196,13 +196,13 @@ int XttSevHist::get_objectdata( pwr_tStatus *sts, pwr_tTime from, pwr_tTime to)
// Create data for time axis // Create data for time axis
gcd = new GeCurveData( curve_eDataType_DsTrend); gcd = new GeCurveData( curve_eDataType_DsTrend);
gcd->data[0] = (double *) calloc( 1, 8 * rows); gcd->x_data[0] = (double *) calloc( 1, 8 * rows);
for ( int i = 0; i < rows; i++) for ( int i = 0; i < rows; i++)
gcd->data[0][i] = (double)tbuf[i].tv_sec + (double)1e-9 * tbuf[i].tv_nsec; gcd->x_data[0][i] = (double)tbuf[i].tv_sec + (double)1e-9 * tbuf[i].tv_nsec;
strcpy( gcd->name[0], "Time"); strcpy( gcd->x_name, "Time");
gcd->axis_type[0] = curve_eAxis_x; gcd->x_axis_type[0] = curve_eAxis_x;
strcpy( gcd->format[0], "%10t"); strcpy( gcd->x_format[0], "%10t");
//todo linesize br vi kunna f frn sevcli_get_objectitemdata //todo linesize br vi kunna f frn sevcli_get_objectitemdata
int linesize = 0; int linesize = 0;
...@@ -211,7 +211,7 @@ int XttSevHist::get_objectdata( pwr_tStatus *sts, pwr_tTime from, pwr_tTime to) ...@@ -211,7 +211,7 @@ int XttSevHist::get_objectdata( pwr_tStatus *sts, pwr_tTime from, pwr_tTime to)
} }
void *dataptr = vbuf; void *dataptr = vbuf;
int tmp = 0; int tmp = 0;
gcd->cols = 1; gcd->cols = 0;
for( int i = 0; i < numAttributes; i++) { for( int i = 0; i < numAttributes; i++) {
switch ( histattrbuf[i].type ) { switch ( histattrbuf[i].type ) {
...@@ -232,16 +232,16 @@ int XttSevHist::get_objectdata( pwr_tStatus *sts, pwr_tTime from, pwr_tTime to) ...@@ -232,16 +232,16 @@ int XttSevHist::get_objectdata( pwr_tStatus *sts, pwr_tTime from, pwr_tTime to)
continue; continue;
} }
if( gcd->cols >= CURVE_MAX_COLS ) { if( gcd->cols >= CURVE_MAX_COLS) {
printf("To many columns for curve class max:%d\n", CURVE_MAX_COLS); printf("To many columns for curve class max:%d\n", CURVE_MAX_COLS);
break; break;
} }
gcd->cols++; gcd->cols++;
strcpy( gcd->name[gcd->cols-1], histattrbuf[i].aname); strcpy( gcd->y_name[gcd->cols-1], histattrbuf[i].aname);
gcd->data[gcd->cols-1] = (double *) calloc( 1, 8 * rows); gcd->y_data[gcd->cols-1] = (double *) calloc( 1, 8 * rows);
gcd->axis_type[gcd->cols-1] = curve_eAxis_y; gcd->y_axis_type[gcd->cols-1] = curve_eAxis_y;
dataptr = (char *)vbuf + tmp; dataptr = (char *)vbuf + tmp;
//tmp += histattrbuf[i].size; //tmp += histattrbuf[i].size;
...@@ -250,37 +250,37 @@ int XttSevHist::get_objectdata( pwr_tStatus *sts, pwr_tTime from, pwr_tTime to) ...@@ -250,37 +250,37 @@ int XttSevHist::get_objectdata( pwr_tStatus *sts, pwr_tTime from, pwr_tTime to)
dataptr = ((char *)vbuf)+ j * linesize + tmp; dataptr = ((char *)vbuf)+ j * linesize + tmp;
switch ( histattrbuf[i].type ) { switch ( histattrbuf[i].type ) {
case pwr_eType_Int64: case pwr_eType_Int64:
gcd->data[gcd->cols-1][j] = *(pwr_tInt64 *)dataptr; gcd->y_data[gcd->cols-1][j] = *(pwr_tInt64 *)dataptr;
break; break;
case pwr_eType_Int32: case pwr_eType_Int32:
gcd->data[gcd->cols-1][j] = *(pwr_tInt32 *)dataptr; gcd->y_data[gcd->cols-1][j] = *(pwr_tInt32 *)dataptr;
break; break;
case pwr_eType_Int16: case pwr_eType_Int16:
gcd->data[gcd->cols-1][j] = *(pwr_tInt16 *)dataptr; gcd->y_data[gcd->cols-1][j] = *(pwr_tInt16 *)dataptr;
break; break;
case pwr_eType_Int8: case pwr_eType_Int8:
gcd->data[gcd->cols-1][j] = *(pwr_tInt8 *)dataptr; gcd->y_data[gcd->cols-1][j] = *(pwr_tInt8 *)dataptr;
break; break;
case pwr_eType_UInt64: case pwr_eType_UInt64:
gcd->data[gcd->cols-1][j] = *(pwr_tUInt64 *)dataptr; gcd->y_data[gcd->cols-1][j] = *(pwr_tUInt64 *)dataptr;
break; break;
case pwr_eType_UInt32: case pwr_eType_UInt32:
gcd->data[gcd->cols-1][j] = *(pwr_tUInt32 *)dataptr; gcd->y_data[gcd->cols-1][j] = *(pwr_tUInt32 *)dataptr;
break; break;
case pwr_eType_UInt16: case pwr_eType_UInt16:
gcd->data[gcd->cols-1][j] = *(pwr_tUInt16 *)dataptr; gcd->y_data[gcd->cols-1][j] = *(pwr_tUInt16 *)dataptr;
break; break;
case pwr_eType_UInt8: case pwr_eType_UInt8:
gcd->data[gcd->cols-1][j] = *(pwr_tUInt8 *)dataptr; gcd->y_data[gcd->cols-1][j] = *(pwr_tUInt8 *)dataptr;
break; break;
case pwr_eType_Float32: case pwr_eType_Float32:
gcd->data[gcd->cols-1][j] = *(pwr_tFloat32 *)dataptr; gcd->y_data[gcd->cols-1][j] = *(pwr_tFloat32 *)dataptr;
break; break;
case pwr_eType_Float64: case pwr_eType_Float64:
gcd->data[gcd->cols-1][j] = *(pwr_tFloat64 *)dataptr; gcd->y_data[gcd->cols-1][j] = *(pwr_tFloat64 *)dataptr;
break; break;
case pwr_eType_Boolean: case pwr_eType_Boolean:
gcd->data[gcd->cols-1][j] = *(pwr_tBoolean *)dataptr; gcd->y_data[gcd->cols-1][j] = *(pwr_tBoolean *)dataptr;
break; break;
default: default:
*sts = SEV__CURVETYPE; *sts = SEV__CURVETYPE;
...@@ -303,12 +303,12 @@ int XttSevHist::get_objectdata( pwr_tStatus *sts, pwr_tTime from, pwr_tTime to) ...@@ -303,12 +303,12 @@ int XttSevHist::get_objectdata( pwr_tStatus *sts, pwr_tTime from, pwr_tTime to)
if ( to.tv_sec != 0 && from.tv_sec != 0) { if ( to.tv_sec != 0 && from.tv_sec != 0) {
time_Adiff( &trange, &to, &from); time_Adiff( &trange, &to, &from);
if ( time_DToFloat( 0, &trange) < 600) if ( time_DToFloat( 0, &trange) < 600)
strcpy( gcd->format[0], "%10t"); strcpy( gcd->x_format[0], "%10t");
else else
strcpy( gcd->format[0], "%11t"); strcpy( gcd->x_format[0], "%11t");
} }
else else
strcpy( gcd->format[0], "%11t"); strcpy( gcd->x_format[0], "%11t");
gcd->select_color( 0); gcd->select_color( 0);
...@@ -348,11 +348,11 @@ void XttSevHist::sevhist_higher_res_cb( void *ctx) ...@@ -348,11 +348,11 @@ void XttSevHist::sevhist_higher_res_cb( void *ctx)
sevhist->curve->measure_window( &ll_x, &ll_y, &ur_x, &ur_y); sevhist->curve->measure_window( &ll_x, &ll_y, &ur_x, &ur_y);
t_low.tv_sec = int( sevhist->gcd->min_value_axis[0] + t_low.tv_sec = int( sevhist->gcd->x_min_value_axis[0] +
ll_x / 200 * (sevhist->gcd->max_value_axis[0] - sevhist->gcd->min_value_axis[0])); ll_x / 200 * (sevhist->gcd->x_max_value_axis[0] - sevhist->gcd->x_min_value_axis[0]));
t_low.tv_nsec = 0; t_low.tv_nsec = 0;
t_high.tv_sec = int( sevhist->gcd->min_value_axis[0] + t_high.tv_sec = int( sevhist->gcd->x_min_value_axis[0] +
ur_x / 200 * (sevhist->gcd->max_value_axis[0] - sevhist->gcd->min_value_axis[0])); ur_x / 200 * (sevhist->gcd->x_max_value_axis[0] - sevhist->gcd->x_min_value_axis[0]));
t_high.tv_nsec = 0; t_high.tv_nsec = 0;
{ {
...@@ -378,18 +378,18 @@ void XttSevHist::sevhist_lower_res_cb( void *ctx) ...@@ -378,18 +378,18 @@ void XttSevHist::sevhist_lower_res_cb( void *ctx)
sevhist->curve->measure_window( &ll_x, &ll_y, &ur_x, &ur_y); sevhist->curve->measure_window( &ll_x, &ll_y, &ur_x, &ur_y);
t_low.tv_sec = int( sevhist->gcd->min_value_axis[0] - t_low.tv_sec = int( sevhist->gcd->x_min_value_axis[0] -
5 * (sevhist->gcd->max_value_axis[0] - sevhist->gcd->min_value_axis[0])); 5 * (sevhist->gcd->x_max_value_axis[0] - sevhist->gcd->x_min_value_axis[0]));
t_low.tv_nsec = 0; t_low.tv_nsec = 0;
t_high.tv_sec = int( sevhist->gcd->max_value_axis[0] + t_high.tv_sec = int( sevhist->gcd->x_max_value_axis[0] +
5 * (sevhist->gcd->max_value_axis[0] - sevhist->gcd->min_value_axis[0])); 5 * (sevhist->gcd->x_max_value_axis[0] - sevhist->gcd->x_min_value_axis[0]));
t_high.tv_nsec = 0; t_high.tv_nsec = 0;
if ( t_low.tv_sec == sevhist->time_low_old && t_high.tv_sec == sevhist->time_high_old) { if ( t_low.tv_sec == sevhist->time_low_old && t_high.tv_sec == sevhist->time_high_old) {
t_low.tv_sec = int( sevhist->gcd->min_value_axis[0] - t_low.tv_sec = int( sevhist->gcd->x_min_value_axis[0] -
25 * (sevhist->gcd->max_value_axis[0] - sevhist->gcd->min_value_axis[0])); 25 * (sevhist->gcd->x_max_value_axis[0] - sevhist->gcd->x_min_value_axis[0]));
t_high.tv_sec = int( sevhist->gcd->max_value_axis[0] + t_high.tv_sec = int( sevhist->gcd->x_max_value_axis[0] +
25 * (sevhist->gcd->max_value_axis[0] - sevhist->gcd->min_value_axis[0])); 25 * (sevhist->gcd->x_max_value_axis[0] - sevhist->gcd->x_min_value_axis[0]));
} }
{ {
......
...@@ -143,15 +143,15 @@ XttTrend::XttTrend( void *parent_ctx, ...@@ -143,15 +143,15 @@ XttTrend::XttTrend( void *parent_ctx,
// Create data for time axis // Create data for time axis
gcd = new GeCurveData( curve_eDataType_DsTrend); gcd = new GeCurveData( curve_eDataType_DsTrend);
gcd->data[0] = (double *) malloc( 8 * max_points); gcd->x_data[0] = (double *) malloc( 8 * max_points);
strcpy( gcd->name[0], "Time"); strcpy( gcd->x_name, "Time");
for ( j = 0; j < max_points; j++) { for ( j = 0; j < max_points; j++) {
gcd->data[0][j] = double( j * min_interval); gcd->x_data[0][j] = double( j * min_interval);
} }
gcd->axis_type[0] = curve_eAxis_x; gcd->x_axis_type[0] = curve_eAxis_x;
for ( i = 0; i < trend_cnt; i++) { for ( i = 0; i < trend_cnt; i++) {
gcd->data[i+1] = (double *) calloc( 1, 8 * max_points); gcd->y_data[i] = (double *) calloc( 1, 8 * max_points);
int write_buffer = (int) tp[i].WriteBuffer; int write_buffer = (int) tp[i].WriteBuffer;
start_idx = write_buffer * trend_buff_size / 2 start_idx = write_buffer * trend_buff_size / 2
...@@ -170,14 +170,14 @@ XttTrend::XttTrend( void *parent_ctx, ...@@ -170,14 +170,14 @@ XttTrend::XttTrend( void *parent_ctx,
int idx = 0; int idx = 0;
for ( j = start_idx; j >= write_buffer * trend_buff_size/2; j--) { for ( j = start_idx; j >= write_buffer * trend_buff_size/2; j--) {
for ( k = 0; k < interval[i]; k++) { for ( k = 0; k < interval[i]; k++) {
gcd->data[i+1][idx] = tp[i].DataBuffer[j]; gcd->y_data[i][idx] = tp[i].DataBuffer[j];
idx++; idx++;
} }
} }
for ( j = tp[i].NoOfSample - 1 + (!write_buffer) * trend_buff_size/2; for ( j = tp[i].NoOfSample - 1 + (!write_buffer) * trend_buff_size/2;
j >= (!write_buffer) * trend_buff_size/2; j--) { j >= (!write_buffer) * trend_buff_size/2; j--) {
for ( k = 0; k < interval[i]; k++) { for ( k = 0; k < interval[i]; k++) {
gcd->data[i+1][idx] = tp[i].DataBuffer[j]; gcd->y_data[i][idx] = tp[i].DataBuffer[j];
idx++; idx++;
} }
} }
...@@ -186,14 +186,14 @@ XttTrend::XttTrend( void *parent_ctx, ...@@ -186,14 +186,14 @@ XttTrend::XttTrend( void *parent_ctx,
for ( j = tp[i].NoOfSample - 1 + write_buffer * trend_buff_size/2; for ( j = tp[i].NoOfSample - 1 + write_buffer * trend_buff_size/2;
j > start_idx; j--) { j > start_idx; j--) {
for ( k = 0; k < interval[i]; k++) { for ( k = 0; k < interval[i]; k++) {
gcd->data[i+1][idx] = tp[i].DataBuffer[j]; gcd->y_data[i][idx] = tp[i].DataBuffer[j];
idx++; idx++;
} }
} }
} }
last_buffer[i] = tp[i].WriteBuffer; last_buffer[i] = tp[i].WriteBuffer;
last_next_index[i] = tp[i].NextWriteIndex[last_buffer[i]]; last_next_index[i] = tp[i].NextWriteIndex[last_buffer[i]];
gcd->axis_type[i+1] = curve_eAxis_y; gcd->y_axis_type[i] = curve_eAxis_y;
} }
// Subscribe to object // Subscribe to object
...@@ -203,7 +203,7 @@ XttTrend::XttTrend( void *parent_ctx, ...@@ -203,7 +203,7 @@ XttTrend::XttTrend( void *parent_ctx,
&subid[i], sizeof(pwr_sClass_DsTrend)); &subid[i], sizeof(pwr_sClass_DsTrend));
if ( EVEN(*sts)) return; if ( EVEN(*sts)) return;
strcpy( gcd->name[i+1], object_name[i]); strcpy( gcd->y_name[i], object_name[i]);
switch( trend_p[i]->DataType) { switch( trend_p[i]->DataType) {
case pwr_eType_Float32: case pwr_eType_Float32:
...@@ -228,7 +228,7 @@ XttTrend::XttTrend( void *parent_ctx, ...@@ -228,7 +228,7 @@ XttTrend::XttTrend( void *parent_ctx,
element_size[i] = 4; element_size[i] = 4;
} }
} }
gcd->cols = trend_cnt + 1; gcd->cols = trend_cnt;
gcd->rows = max_points; gcd->rows = max_points;
gcd->x_reverse = 1; gcd->x_reverse = 1;
gcd->get_borders(); gcd->get_borders();
...@@ -239,12 +239,12 @@ XttTrend::XttTrend( void *parent_ctx, ...@@ -239,12 +239,12 @@ XttTrend::XttTrend( void *parent_ctx,
// Use axis values from plotgroup object // Use axis values from plotgroup object
for ( i = 0; i < trend_cnt; i++) { for ( i = 0; i < trend_cnt; i++) {
if ( plot.YMinValue[i] != plot.YMaxValue[i]) if ( plot.YMinValue[i] != plot.YMaxValue[i])
gcd->scale( gcd->axis_type[i+1], gcd->value_type[i+1], gcd->scale( gcd->y_axis_type[i], gcd->y_value_type[i],
plot.YMinValue[i], plot.YMaxValue[i], plot.YMinValue[i], plot.YMaxValue[i],
&gcd->min_value_axis[i+1], &gcd->max_value_axis[i+1], &gcd->y_min_value_axis[i], &gcd->y_max_value_axis[i],
&gcd->trend_lines[i+1], &gcd->axis_lines[i+1], &gcd->axis_linelongq[i+1], &gcd->y_trend_lines[i], &gcd->y_axis_lines[i], &gcd->y_axis_linelongq[i],
&gcd->axis_valueq[i+1], gcd->format[i+1], &gcd->y_axis_valueq[i], gcd->y_format[i],
&gcd->axis_width[i+1], 1, 1); &gcd->y_axis_width[i], 1, 1);
} }
} }
} }
...@@ -303,7 +303,7 @@ void XttTrend::trend_scan( void *data) ...@@ -303,7 +303,7 @@ void XttTrend::trend_scan( void *data)
for ( i = 0; i < trend->trend_cnt; i++) { for ( i = 0; i < trend->trend_cnt; i++) {
// Shift data // Shift data
for ( j = trend->max_points - 1; j > 0; j--) for ( j = trend->max_points - 1; j > 0; j--)
trend->gcd->data[i+1][j] = trend->gcd->data[i+1][j-1]; trend->gcd->y_data[i][j] = trend->gcd->y_data[i][j-1];
// Insert new value // Insert new value
write_buffer = trend->trend_p[i]->WriteBuffer; write_buffer = trend->trend_p[i]->WriteBuffer;
idx = write_buffer * trend_buff_size / 2 idx = write_buffer * trend_buff_size / 2
...@@ -314,7 +314,7 @@ void XttTrend::trend_scan( void *data) ...@@ -314,7 +314,7 @@ void XttTrend::trend_scan( void *data)
else else
idx--; idx--;
trend->gcd->data[i+1][0] = trend->trend_p[i]->DataBuffer[idx]; trend->gcd->y_data[i][0] = trend->trend_p[i]->DataBuffer[idx];
} }
trend->curve->points_added(); trend->curve->points_added();
} }
......
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