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;
} }
......
...@@ -115,13 +115,23 @@ void GeCurve::activate_minmax_ok( double min_value, double max_value) ...@@ -115,13 +115,23 @@ void GeCurve::activate_minmax_ok( double min_value, double max_value)
{ {
int i = minmax_idx; int i = minmax_idx;
cd->scale( cd->axis_type[i], cd->value_type[i], if ( minmax_idx < cd->cols)
min_value, max_value, cd->scale( cd->y_axis_type[i], cd->y_value_type[i],
&cd->min_value_axis[i], &cd->max_value_axis[i], min_value, max_value,
&cd->trend_lines[i], &cd->axis_lines[i], &cd->axis_linelongq[i], &cd->y_min_value_axis[i], &cd->y_max_value_axis[i],
&cd->axis_valueq[i], cd->format[i], &cd->y_trend_lines[i], &cd->y_axis_lines[i], &cd->y_axis_linelongq[i],
&cd->axis_width[i], 1, 1); &cd->y_axis_valueq[i], cd->y_format[i],
&cd->y_axis_width[i], 1, 1);
else {
double axis_width;
i = 0;
cd->scale( cd->x_axis_type[i], cd->x_value_type[i],
min_value, max_value,
&cd->x_min_value_axis[i], &cd->x_max_value_axis[i],
&cd->x_trend_lines[i], &cd->x_axis_lines[i], &cd->x_axis_linelongq[i],
&cd->x_axis_valueq[i], cd->x_format[i],
&axis_width, 1, 1);
}
// cd->min_value_axis[minmax_idx] = min_value; // cd->min_value_axis[minmax_idx] = min_value;
// cd->max_value_axis[minmax_idx] = max_value; // cd->max_value_axis[minmax_idx] = max_value;
...@@ -165,15 +175,15 @@ int GeCurve::growcurve_cb( GlowCtx *ctx, glow_tEvent event) ...@@ -165,15 +175,15 @@ int GeCurve::growcurve_cb( GlowCtx *ctx, glow_tEvent event)
curve->x_to_points( event->any.x, &time, values); curve->x_to_points( event->any.x, &time, values);
for ( int i = 1; i < curve->cd->cols; i++) { for ( int i = 0; i < curve->cd->cols; i++) {
sprintf( str, "%7.2f", values[i]); sprintf( str, "%7.2f", values[i]);
grow_SetAnnotation( curve->mark_annot[i], 0, str, strlen(str)); grow_SetAnnotation( curve->mark_annot[i], 0, str, strlen(str));
} }
if ( !(strcmp( curve->cd->format[0], "%10t") == 0 || if ( !(strcmp( curve->cd->x_format[0], "%10t") == 0 ||
strcmp( curve->cd->format[0], "%11t") == 0)) { strcmp( curve->cd->x_format[0], "%11t") == 0)) {
sprintf( str, "%7.2f", time); sprintf( str, "%7.2f", time);
grow_SetAnnotation( curve->mark_annot[0], 0, str, strlen(str)); grow_SetAnnotation( curve->mark_annot[curve->cd->cols], 0, str, strlen(str));
} }
else { else {
// Time is a date // Time is a date
...@@ -234,13 +244,13 @@ int GeCurve::growcurve_cb( GlowCtx *ctx, glow_tEvent event) ...@@ -234,13 +244,13 @@ int GeCurve::growcurve_cb( GlowCtx *ctx, glow_tEvent event)
row = r; row = r;
} }
for ( int i = 1; i < curve->cd->cols; i++) { for ( int i = 0; i < curve->cd->cols; i++) {
sprintf( str, "%7.2f", curve->cd->data[i][row]); sprintf( str, "%7.2f", curve->cd->y_data[i][row]);
grow_SetAnnotation( curve->mark_annot[i], 0, str, strlen(str)); grow_SetAnnotation( curve->mark_annot[i], 0, str, strlen(str));
} }
sprintf( str, "%7.2f", curve->cd->data[0][row]); sprintf( str, "%7.2f", curve->cd->x_data[0][row]);
grow_SetAnnotation( curve->mark_annot[0], 0, str, strlen(str)); grow_SetAnnotation( curve->mark_annot[curve->cd->cols], 0, str, strlen(str));
#endif #endif
break; break;
} }
...@@ -252,22 +262,22 @@ int GeCurve::growcurve_cb( GlowCtx *ctx, glow_tEvent event) ...@@ -252,22 +262,22 @@ int GeCurve::growcurve_cb( GlowCtx *ctx, glow_tEvent event)
curve->last_cursor_x = event->any.x; curve->last_cursor_x = event->any.x;
curve->x_to_points( event->any.x, &time, values); curve->x_to_points( event->any.x, &time, values);
for ( int i = 1; i < curve->cd->cols; i++) { for ( int i = 0; i < curve->cd->cols; i++) {
sprintf( str, "%7.2f", values[i]); sprintf( str, "%7.2f", values[i]);
grow_SetAnnotation( curve->cursor_annot[i], 0, str, strlen(str)); grow_SetAnnotation( curve->cursor_annot[i], 0, str, strlen(str));
} }
if ( !(strcmp( curve->cd->format[0], "%10t") == 0 || if ( !(strcmp( curve->cd->x_format[0], "%10t") == 0 ||
strcmp( curve->cd->format[0], "%11t") == 0)) { strcmp( curve->cd->x_format[0], "%11t") == 0)) {
sprintf( str, "%7.2f", time); sprintf( str, "%7.2f", time);
grow_SetAnnotation( curve->cursor_annot[0], 0, str, strlen(str)); grow_SetAnnotation( curve->cursor_annot[curve->cd->cols], 0, str, strlen(str));
} }
else { else {
// Time is a date // Time is a date
pwr_tTime t; pwr_tTime t;
time_Float64ToD( (pwr_tDeltaTime *) &t, time); time_Float64ToD( (pwr_tDeltaTime *) &t, time);
time_AtoAscii( &t, time_eFormat_DateAndTime, str, sizeof(str)); time_AtoAscii( &t, time_eFormat_DateAndTime, str, sizeof(str));
grow_SetAnnotation( curve->cursor_annot[0], 0, str, strlen(str)); grow_SetAnnotation( curve->cursor_annot[curve->cd->cols], 0, str, strlen(str));
} }
break; break;
} }
...@@ -387,16 +397,15 @@ int GeCurve::growaxis_cb( GlowCtx *ctx, glow_tEvent event) ...@@ -387,16 +397,15 @@ int GeCurve::growaxis_cb( GlowCtx *ctx, glow_tEvent event)
{ {
case glow_eEvent_MB1Click: case glow_eEvent_MB1Click:
{ {
if ( event->object.object_type != glow_eObjectType_NoObject) { if ( event->object.object_type != glow_eObjectType_NoObject) {
for ( int i = 0; i < curve->cd->cols; i++) { for ( int i = 0; i < curve->cd->cols; i++) {
if ( event->object.object == curve->axis_object[i]) { if ( event->object.object == curve->axis_object[i]) {
grow_SetTrendLines( curve->curve_object, grow_SetTrendLines( curve->curve_object,
curve->cd->trend_lines[0] - 2, curve->cd->x_trend_lines[0] - 2,
2 * curve->cd->trend_lines[i] - 3); 2 * curve->cd->y_trend_lines[i] - 3);
grow_Redraw( curve->growcurve_ctx); grow_Redraw( curve->growcurve_ctx);
grow_SetAxisConf( curve->axis_lineobject, 0, 10, grow_SetAxisConf( curve->axis_lineobject, 0, 10,
2 * curve->cd->trend_lines[i] - 1, 1, 10, 0, "%2.0f"); 2 * curve->cd->y_trend_lines[i] - 1, 1, 10, 0, "%2.0f");
grow_Redraw( curve->growaxis_ctx); grow_Redraw( curve->growaxis_ctx);
break; break;
} }
...@@ -451,13 +460,13 @@ int GeCurve::grownames_cb( GlowCtx *ctx, glow_tEvent event) ...@@ -451,13 +460,13 @@ int GeCurve::grownames_cb( GlowCtx *ctx, glow_tEvent event)
if ( curve->hide[i]) { if ( curve->hide[i]) {
// Check max number of curves // Check max number of curves
int num = 0; int num = 0;
for ( int i = 1; i < curve->cd->cols; i++) { for ( int j = 0; j < curve->cd->cols; j++) {
if ( !curve->hide[i]) if ( !curve->hide[j])
num++; num++;
} }
if ( num >= TREND_MAX_CURVES - 1) { if ( num >= TREND_MAX_CURVES - 1) {
curve->wow->DisplayError( "Error", curve->wow->DisplayError( "Error",
" Max number of curves exceeded "); " Max number of curves exceeded ");
break; break;
} }
} }
...@@ -475,6 +484,8 @@ int GeCurve::grownames_cb( GlowCtx *ctx, glow_tEvent event) ...@@ -475,6 +484,8 @@ int GeCurve::grownames_cb( GlowCtx *ctx, glow_tEvent event)
} }
break; break;
} }
}
for ( int i = 0; i < curve->cd->cols + 1; i++) {
if ( event->object.object == curve->scale_rect[i] ) { if ( event->object.object == curve->scale_rect[i] ) {
curve->open_minmax( i); curve->open_minmax( i);
break; break;
...@@ -546,8 +557,8 @@ int GeCurve::init_grownames_cb( GlowCtx *fctx, void *client_data) ...@@ -546,8 +557,8 @@ int GeCurve::init_grownames_cb( GlowCtx *fctx, void *client_data)
unsigned long mask; unsigned long mask;
glow_eDrawType color; glow_eDrawType color;
double x; double x;
int date = (strcmp( curve->cd->format[0], "%10t") == 0 || int date = (strcmp( curve->cd->x_format[0], "%10t") == 0 ||
strcmp( curve->cd->format[0], "%11t") == 0) ? 1 : 0; strcmp( curve->cd->x_format[0], "%11t") == 0) ? 1 : 0;
int time_size; int time_size;
if ( date) if ( date)
time_size = 8; time_size = 8;
...@@ -622,13 +633,13 @@ int GeCurve::init_grownames_cb( GlowCtx *fctx, void *client_data) ...@@ -622,13 +633,13 @@ int GeCurve::init_grownames_cb( GlowCtx *fctx, void *client_data)
glow_eDrawType_Line, 2, glow_eFont_Helvetica, glow_eDrawType_Line, 2, glow_eFont_Helvetica,
glow_mDisplayLevel_1, NULL, &o1); glow_mDisplayLevel_1, NULL, &o1);
for ( int i = 1; i < curve->cd->cols; i++) { for ( int i = 0; i < curve->cd->cols; i++) {
// Draw shadowed frame // Draw shadowed frame
grow_CreateGrowRect( curve->grownames_ctx, "", 0, (i-0.2), 60, 1, grow_CreateGrowRect( curve->grownames_ctx, "", 0, (i+0.8), 60, 1,
glow_eDrawType_Line, 1, 0, glow_mDisplayLevel_1, 0, 0, 1, glow_eDrawType_Line, 1, 0, glow_mDisplayLevel_1, 0, 0, 1,
glow_eDrawType_Color32, NULL, &o1); glow_eDrawType_Color32, NULL, &o1);
// Draw color rectangle // Draw color rectangle
grow_CreateGrowRect( curve->grownames_ctx, "", 0.25, (i-0.2)+0.3, 0.75, 0.5, grow_CreateGrowRect( curve->grownames_ctx, "", 0.25, (i+0.8)+0.3, 0.75, 0.5,
glow_eDrawType_Line, 1, 0, glow_mDisplayLevel_1, 1, 1, 1, glow_eDrawType_Line, 1, 0, glow_mDisplayLevel_1, 1, 1, 1,
curve->cd->color[i], NULL, &curve->name_rect[i]); curve->cd->color[i], NULL, &curve->name_rect[i]);
...@@ -638,37 +649,37 @@ int GeCurve::init_grownames_cb( GlowCtx *fctx, void *client_data) ...@@ -638,37 +649,37 @@ int GeCurve::init_grownames_cb( GlowCtx *fctx, void *client_data)
color = glow_eDrawType_Line; color = glow_eDrawType_Line;
// Draw checkbox for hide // Draw checkbox for hide
grow_CreateGrowLine( curve->grownames_ctx, "", 1.4, (i-0.2)+0.45, 1.52, (i-0.2)+0.75, grow_CreateGrowLine( curve->grownames_ctx, "", 1.4, (i+0.8)+0.45, 1.52, (i+0.8)+0.75,
color, 2, 0, NULL, &curve->hide_l1[i]); color, 2, 0, NULL, &curve->hide_l1[i]);
grow_CreateGrowLine( curve->grownames_ctx, "", 1.50, (i-0.2)+0.75, 1.77, (i-0.2)+0.35, grow_CreateGrowLine( curve->grownames_ctx, "", 1.50, (i+0.8)+0.75, 1.77, (i+0.8)+0.35,
color, 2, 0, NULL, &curve->hide_l2[i]); color, 2, 0, NULL, &curve->hide_l2[i]);
grow_CreateGrowRect( curve->grownames_ctx, "", 1.3, (i-0.2)+0.3, 0.5, 0.5, grow_CreateGrowRect( curve->grownames_ctx, "", 1.3, (i+0.8)+0.3, 0.5, 0.5,
glow_eDrawType_Line, 1, 0, glow_mDisplayLevel_1, 0, 1, 1, glow_eDrawType_Line, 1, 0, glow_mDisplayLevel_1, 0, 1, 1,
glow_eDrawType_Color32, NULL, &curve->hide_rect[i]); glow_eDrawType_Color32, NULL, &curve->hide_rect[i]);
// Draw nodes for mark and cursor values // Draw nodes for mark and cursor values
x = 2.2; x = 2.2;
grow_CreateGrowNode( curve->grownames_ctx, "", nc, x, (i-0.2)+0.05, NULL, grow_CreateGrowNode( curve->grownames_ctx, "", nc, x, (i+0.8)+0.05, NULL,
&curve->cursor_annot[i]); &curve->cursor_annot[i]);
x += time_size + 0.2; x += time_size + 0.2;
grow_CreateGrowNode( curve->grownames_ctx, "", nc, x, (i-0.2)+0.05, NULL, grow_CreateGrowNode( curve->grownames_ctx, "", nc, x, (i+0.8)+0.05, NULL,
&curve->mark_annot[i]); &curve->mark_annot[i]);
// Draw unit // Draw unit
x += time_size + 0.6; x += time_size + 0.6;
grow_CreateGrowText( curve->grownames_ctx, "", curve->cd->unit[i], grow_CreateGrowText( curve->grownames_ctx, "", curve->cd->y_unit[i],
x, (i-0.2) + 0.75, glow_eDrawType_TextHelvetica, x, (i+0.8) + 0.75, glow_eDrawType_TextHelvetica,
glow_eDrawType_Line, 2, glow_eFont_Helvetica, glow_eDrawType_Line, 2, glow_eFont_Helvetica,
glow_mDisplayLevel_1, NULL, &t1); glow_mDisplayLevel_1, NULL, &t1);
// Draw button for scale // Draw button for scale
x += 2; x += 2;
grow_CreateGrowRect( curve->grownames_ctx, "", x, (i-0.2)+0.1, 1.2, 0.7, grow_CreateGrowRect( curve->grownames_ctx, "", x, (i+0.8)+0.1, 1.2, 0.7,
glow_eDrawType_Line, 1, 0, glow_mDisplayLevel_1, 1, 1, 1, glow_eDrawType_Line, 1, 0, glow_mDisplayLevel_1, 1, 1, 1,
glow_eDrawType_Color33, NULL, &curve->scale_rect[i]); glow_eDrawType_Color33, NULL, &curve->scale_rect[i]);
grow_SetObjectShadowWidth( curve->scale_rect[i], 20); grow_SetObjectShadowWidth( curve->scale_rect[i], 20);
// Draw attribute name // Draw attribute name
x += 3; x += 3;
grow_CreateGrowText( curve->grownames_ctx, "", curve->cd->name[i], grow_CreateGrowText( curve->grownames_ctx, "", curve->cd->y_name[i],
x, (i-0.2) + 0.75, glow_eDrawType_TextHelveticaBold, x, (i+0.8) + 0.75, glow_eDrawType_TextHelveticaBold,
glow_eDrawType_Line, 2, glow_eFont_Helvetica, glow_eDrawType_Line, 2, glow_eFont_Helvetica,
glow_mDisplayLevel_1, NULL, &t1); glow_mDisplayLevel_1, NULL, &t1);
grow_SetAnnotation( curve->cursor_annot[i], 0, "0", 1); grow_SetAnnotation( curve->cursor_annot[i], 0, "0", 1);
...@@ -676,35 +687,35 @@ int GeCurve::init_grownames_cb( GlowCtx *fctx, void *client_data) ...@@ -676,35 +687,35 @@ int GeCurve::init_grownames_cb( GlowCtx *fctx, void *client_data)
} }
// Draw nodes for time values // Draw nodes for time values
// Draw shadowed frame // Draw shadowed frame
grow_CreateGrowRect( curve->grownames_ctx, "", 0, (curve->cd->cols-0.2), 60, 1, grow_CreateGrowRect( curve->grownames_ctx, "", 0, (curve->cd->cols+0.8), 60, 1,
glow_eDrawType_Line, 1, 0, glow_mDisplayLevel_1, 0, 0, 1, glow_eDrawType_Line, 1, 0, glow_mDisplayLevel_1, 0, 0, 1,
glow_eDrawType_Color32, NULL, &o1); glow_eDrawType_Color32, NULL, &o1);
x = 2.2; x = 2.2;
grow_CreateGrowNode( curve->grownames_ctx, "", nc, x, (curve->cd->cols-0.2)+0.05, NULL, grow_CreateGrowNode( curve->grownames_ctx, "", nc, x, (curve->cd->cols+0.8)+0.05, NULL,
&curve->cursor_annot[0]); &curve->cursor_annot[curve->cd->cols]);
x += time_size + 0.2; x += time_size + 0.2;
grow_CreateGrowNode( curve->grownames_ctx, "", nc, x, (curve->cd->cols-0.2)+0.05, NULL, grow_CreateGrowNode( curve->grownames_ctx, "", nc, x, (curve->cd->cols+0.8)+0.05, NULL,
&curve->mark_annot[0]); &curve->mark_annot[curve->cd->cols]);
// Draw unit // Draw unit
x += time_size + 0.6; x += time_size + 0.6;
grow_CreateGrowText( curve->grownames_ctx, "", "s", grow_CreateGrowText( curve->grownames_ctx, "", "s",
x, (curve->cd->cols-0.2) + 0.75, glow_eDrawType_TextHelvetica, x, (curve->cd->cols+0.8) + 0.75, glow_eDrawType_TextHelvetica,
glow_eDrawType_Line, 2, glow_eFont_Helvetica, glow_eDrawType_Line, 2, glow_eFont_Helvetica,
glow_mDisplayLevel_1, NULL, &t1); glow_mDisplayLevel_1, NULL, &t1);
// Draw button for scale // Draw button for scale
x += 2; x += 2;
grow_CreateGrowRect( curve->grownames_ctx, "", x, (curve->cd->cols-0.2)+0.1, 1.2, 0.7, grow_CreateGrowRect( curve->grownames_ctx, "", x, (curve->cd->cols+0.8)+0.1, 1.2, 0.7,
glow_eDrawType_Line, 1, 0, glow_mDisplayLevel_1, 1, 1, 1, glow_eDrawType_Line, 1, 0, glow_mDisplayLevel_1, 1, 1, 1,
glow_eDrawType_Color33, NULL, &curve->scale_rect[0]); glow_eDrawType_Color33, NULL, &curve->scale_rect[curve->cd->cols]);
grow_SetObjectShadowWidth( curve->scale_rect[0], 20); grow_SetObjectShadowWidth( curve->scale_rect[curve->cd->cols], 20);
// Draw attribute name // Draw attribute name
x += 3; x += 3;
grow_CreateGrowText( curve->grownames_ctx, "", Lng::translate("Time axis"), grow_CreateGrowText( curve->grownames_ctx, "", Lng::translate("Time axis"),
x, (curve->cd->cols-0.2) + 0.75, glow_eDrawType_TextHelveticaBold, x, (curve->cd->cols+0.8) + 0.75, glow_eDrawType_TextHelveticaBold,
glow_eDrawType_Line, 2, glow_eFont_Helvetica, glow_eDrawType_Line, 2, glow_eFont_Helvetica,
glow_mDisplayLevel_1, NULL, &t1); glow_mDisplayLevel_1, NULL, &t1);
grow_SetAnnotation( curve->cursor_annot[0], 0, "0", 1); grow_SetAnnotation( curve->cursor_annot[curve->cd->cols], 0, "0", 1);
grow_SetAnnotation( curve->mark_annot[0], 0, "0", 1); grow_SetAnnotation( curve->mark_annot[curve->cd->cols], 0, "0", 1);
return 1; return 1;
} }
...@@ -753,23 +764,23 @@ int GeCurve::configure_axes() ...@@ -753,23 +764,23 @@ int GeCurve::configure_axes()
grow_New( growaxis_ctx); grow_New( growaxis_ctx);
memset( axis_object, 0, sizeof( axis_object)); memset( axis_object, 0, sizeof( axis_object));
for ( i = 1; i < cd->cols; i++) { for ( i = 0; i < cd->cols; i++) {
if ( cd->value_type[i] != pwr_eType_Boolean && if ( cd->y_value_type[i] != pwr_eType_Boolean &&
!hide[i]) { !hide[i]) {
grow_CreateGrowRect( growaxis_ctx, "", x, 0, grow_CreateGrowRect( growaxis_ctx, "", x, 0,
cd->axis_width[i], 30, cd->y_axis_width[i], 30,
glow_eDrawType_Line, 1, 0, glow_mDisplayLevel_1, 1, 0, 0, glow_eDrawType_Line, 1, 0, glow_mDisplayLevel_1, 1, 0, 0,
cd->axiscolor[i], NULL, cd->axiscolor[i], NULL,
&axis_rect[i]); &axis_rect[i]);
x += cd->axis_width[i]; x += cd->y_axis_width[i];
} }
} }
// Draw horizontal lines with same interval as the trend object // Draw horizontal lines with same interval as the trend object
// Get number of horizontal lines from first not hidden float // Get number of horizontal lines from first not hidden float
idx = 1; idx = 0;
for ( i = 1; i < cd->cols; i++) { for ( i = 0; i < cd->cols; i++) {
if ( cd->value_type[i] != pwr_eType_Boolean && !hide[i]) { if ( cd->y_value_type[i] != pwr_eType_Boolean && !hide[i]) {
idx = i; idx = i;
break; break;
} }
...@@ -780,22 +791,22 @@ int GeCurve::configure_axes() ...@@ -780,22 +791,22 @@ int GeCurve::configure_axes()
glow_eDrawType_TextHelvetica, NULL, glow_eDrawType_TextHelvetica, NULL,
&axis_lineobject); &axis_lineobject);
grow_SetAxisConf( axis_lineobject, 0, 10, grow_SetAxisConf( axis_lineobject, 0, 10,
2 * cd->trend_lines[idx] - 1, 1, 10, 0, "%1.0f"); 2 * cd->y_trend_lines[idx] - 1, 1, 10, 0, "%1.0f");
x = 0; x = 0;
for ( i = 1; i < cd->cols; i++) { for ( i = 0; i < cd->cols; i++) {
if ( cd->value_type[i] != pwr_eType_Boolean && if ( cd->y_value_type[i] != pwr_eType_Boolean &&
!hide[i]) { !hide[i]) {
grow_CreateGrowAxis( growaxis_ctx, "", grow_CreateGrowAxis( growaxis_ctx, "",
x, 0, x + cd->axis_width[i], 30, x, 0, x + cd->y_axis_width[i], 30,
glow_eDrawType_Line, 1, 6, glow_eDrawType_Line, 1, 6,
glow_eDrawType_TextHelvetica, NULL, glow_eDrawType_TextHelvetica, NULL,
&axis_object[i]); &axis_object[i]);
grow_SetAxisConf( axis_object[i], cd->max_value_axis[i], grow_SetAxisConf( axis_object[i], cd->y_max_value_axis[i],
cd->min_value_axis[i], cd->y_min_value_axis[i],
2 * cd->trend_lines[i] - 1, 2, 2, 0, cd->format[i]); 2 * cd->y_trend_lines[i] - 1, 2, 2, 0, cd->y_format[i]);
x += cd->axis_width[i]; x += cd->y_axis_width[i];
} }
} }
axis_window_width = max( x, 1); axis_window_width = max( x, 1);
...@@ -821,15 +832,17 @@ int GeCurve::configure_curves() ...@@ -821,15 +832,17 @@ int GeCurve::configure_curves()
int max_index, min_index; int max_index, min_index;
double minval, maxval; double minval, maxval;
// Get max and min index in x */ gcd.type = glow_eCurveDataType_CommonX;
// Get max and min index in x
max_index = -1; max_index = -1;
min_index = -1; min_index = -1;
if ( cd->min_value_axis[0] > cd->min_value[0] || if ( cd->x_min_value_axis[0] > cd->x_min_value[0] ||
cd->max_value_axis[0] < cd->max_value[0]) { cd->x_max_value_axis[0] < cd->x_max_value[0]) {
for ( i = 0; i < cd->rows; i++) { for ( i = 0; i < cd->rows; i++) {
if ( min_index == -1 && cd->data[0][i] >= cd->min_value_axis[0] ) if ( min_index == -1 && cd->x_data[0][i] >= cd->x_min_value_axis[0] )
min_index = i; min_index = i;
if ( max_index == -1 && cd->data[0][i] >= cd->max_value_axis[0] ) if ( max_index == -1 && cd->x_data[0][i] >= cd->x_max_value_axis[0] )
max_index = i - 1; max_index = i - 1;
} }
if ( min_index == -1) if ( min_index == -1)
...@@ -845,22 +858,28 @@ int GeCurve::configure_curves() ...@@ -845,22 +858,28 @@ int GeCurve::configure_curves()
idx = 0; idx = 0;
for ( i = 0; i < cd->cols; i++) { for ( i = 0; i < cd->cols; i++) {
if ( !hide[i]) { if ( !hide[i]) {
gcd.max_value[idx] = cd->max_value_axis[i]; gcd.y_max_value[idx] = cd->y_max_value_axis[i];
gcd.min_value[idx] = cd->min_value_axis[i]; gcd.y_min_value[idx] = cd->y_min_value_axis[i];
gcd.data[idx] = &cd->data[i][min_index]; gcd.y_data[idx] = &cd->y_data[i][min_index];
gcd.color[idx] = cd->color[i]; gcd.color[idx] = cd->color[i];
gcd.fillcolor[idx] = cd->fillcolor[i]; gcd.fillcolor[idx] = cd->fillcolor[i];
idx++; idx++;
if ( idx == TREND_MAX_CURVES - 1)
break;
} }
} }
gcd.x_data[0] = &cd->x_data[0][min_index];
gcd.x_max_value[0] = cd->x_max_value_axis[0];
gcd.x_min_value[0] = cd->x_min_value_axis[0];
gcd.curves = idx; gcd.curves = idx;
gcd.rows = max_index - min_index + 1; gcd.rows = max_index - min_index + 1;
gcd.x_reverse = cd->x_reverse; gcd.x_reverse = cd->x_reverse;
// Get number of horizontal lines from first not hidden float // Get number of horizontal lines from first not hidden float
idx = 1; idx = 1;
for ( i = 1; i < cd->cols; i++) { for ( i = 0; i < cd->cols; i++) {
if ( cd->value_type[i] != pwr_eType_Boolean && !hide[i]) { if ( cd->y_value_type[i] != pwr_eType_Boolean && !hide[i]) {
idx = i; idx = i;
break; break;
} }
...@@ -868,22 +887,22 @@ int GeCurve::configure_curves() ...@@ -868,22 +887,22 @@ int GeCurve::configure_curves()
grow_SetTrendLines( curve_object, grow_SetTrendLines( curve_object,
// int(cd->max_value_axis[0] - cd->min_value_axis[0] - 1), // int(cd->max_value_axis[0] - cd->min_value_axis[0] - 1),
cd->trend_lines[0] - 2, cd->x_trend_lines[0] - 2,
2 * cd->trend_lines[idx] - 3); 2 * cd->y_trend_lines[idx] - 3);
if ( cd->x_reverse) { if ( cd->x_reverse) {
minval = cd->max_value_axis[0]; minval = cd->x_max_value_axis[0];
maxval = cd->min_value_axis[0]; maxval = cd->x_min_value_axis[0];
} }
else { else {
minval = cd->min_value_axis[0]; minval = cd->x_min_value_axis[0];
maxval = cd->max_value_axis[0]; maxval = cd->x_max_value_axis[0];
} }
grow_SetAxisConf( curve_axisobject, minval, maxval, grow_SetAxisConf( curve_axisobject, minval, maxval,
// 10 * int( cd->max_value_axis[0] - cd->min_value_axis[0]) + 1, // 10 * int( cd->max_value_axis[0] - cd->min_value_axis[0]) + 1,
cd->axis_lines[0], cd->x_axis_lines[0],
cd->axis_linelongq[0], cd->axis_valueq[0], 270, cd->format[0]); cd->x_axis_linelongq[0], cd->x_axis_valueq[0], 270, cd->x_format[0]);
grow_CurveConfigure( curve_object, &gcd); grow_CurveConfigure( curve_object, &gcd);
...@@ -901,15 +920,17 @@ void GeCurve::points_added() ...@@ -901,15 +920,17 @@ void GeCurve::points_added()
glow_sCurveData gcd; glow_sCurveData gcd;
int max_index, min_index; int max_index, min_index;
gcd.type = glow_eCurveDataType_CommonX;
// Get max and min index in x */ // Get max and min index in x */
max_index = -1; max_index = -1;
min_index = -1; min_index = -1;
if ( cd->min_value_axis[0] > cd->min_value[0] || if ( cd->x_min_value_axis[0] > cd->x_min_value[0] ||
cd->max_value_axis[0] < cd->max_value[0]) { cd->x_max_value_axis[0] < cd->x_max_value[0]) {
for ( i = 0; i < cd->rows; i++) { for ( i = 0; i < cd->rows; i++) {
if ( min_index == -1 && cd->data[0][i] >= cd->min_value_axis[0] ) if ( min_index == -1 && cd->x_data[0][i] >= cd->x_min_value_axis[0] )
min_index = i; min_index = i;
if ( max_index == -1 && cd->data[0][i] >= cd->max_value_axis[0] ) if ( max_index == -1 && cd->x_data[0][i] >= cd->x_max_value_axis[0] )
max_index = i - 1; max_index = i - 1;
} }
if ( min_index == -1) if ( min_index == -1)
...@@ -925,14 +946,19 @@ void GeCurve::points_added() ...@@ -925,14 +946,19 @@ void GeCurve::points_added()
idx = 0; idx = 0;
for ( i = 0; i < cd->cols; i++) { for ( i = 0; i < cd->cols; i++) {
if ( !hide[i]) { if ( !hide[i]) {
gcd.max_value[idx] = cd->max_value_axis[i]; gcd.y_max_value[idx] = cd->y_max_value_axis[i];
gcd.min_value[idx] = cd->min_value_axis[i]; gcd.y_min_value[idx] = cd->y_min_value_axis[i];
gcd.data[idx] = &cd->data[i][min_index]; gcd.y_data[idx] = &cd->y_data[i][min_index];
gcd.color[idx] = cd->color[i]; gcd.color[idx] = cd->color[i];
gcd.fillcolor[idx] = cd->fillcolor[i]; gcd.fillcolor[idx] = cd->fillcolor[i];
idx++; idx++;
if ( idx == TREND_MAX_CURVES - 1)
break;
} }
} }
gcd.x_max_value[0] = cd->x_max_value_axis[0];
gcd.x_min_value[0] = cd->x_min_value_axis[0];
gcd.x_data[0] = &cd->x_data[0][min_index];
gcd.curves = idx; gcd.curves = idx;
gcd.rows = max_index - min_index + 1; gcd.rows = max_index - min_index + 1;
gcd.x_reverse = cd->x_reverse; gcd.x_reverse = cd->x_reverse;
...@@ -994,15 +1020,19 @@ int GeCurve::read_file( char *filename) ...@@ -994,15 +1020,19 @@ int GeCurve::read_file( char *filename)
cd = new GeCurveData( curve_eDataType_LogFile); cd = new GeCurveData( curve_eDataType_LogFile);
cd->x_reverse = 0; cd->x_reverse = 0;
cd->cols = nr; cd->cols = nr - 1;
cd->rows = rows; cd->rows = rows;
for ( i = 0; i < nr; i++) { for ( i = 0; i < nr; i++) {
strcpy( cd->name[i], item_str[i]); if ( i == 0) {
cd->data[i] = (double *) malloc( rows * sizeof( double)); strcpy( cd->x_name, item_str[i]);
if ( i == 0) cd->x_data[i] = (double *) malloc( rows * sizeof( double));
cd->axis_type[i] = curve_eAxis_x; cd->x_axis_type[i] = curve_eAxis_x;
else }
cd->axis_type[i] = curve_eAxis_y; else {
strcpy( cd->y_name[i-1], item_str[i]);
cd->y_data[i-1] = (double *) malloc( rows * sizeof( double));
cd->y_axis_type[i-1] = curve_eAxis_y;
}
} }
fp = fopen( fname, "r"); fp = fopen( fname, "r");
...@@ -1014,8 +1044,11 @@ int GeCurve::read_file( char *filename) ...@@ -1014,8 +1044,11 @@ int GeCurve::read_file( char *filename)
sizeof( item_str) / sizeof( item_str[0]), sizeof( item_str) / sizeof( item_str[0]),
sizeof( item_str[0]), 0); sizeof( item_str[0]), 0);
skip_line = 0; skip_line = 0;
for ( i = 0; i < cd->cols; i++) { for ( i = 0; i < cd->cols + 1; i++) {
nr = sscanf( item_str[i], "%lf", &cd->data[i][j]); if ( i == 0)
nr = sscanf( item_str[i], "%lf", &cd->x_data[i][j]);
else
nr = sscanf( item_str[i], "%lf", &cd->y_data[i-1][j]);
if ( nr != 1) { if ( nr != 1) {
if ( i == 0) { if ( i == 0) {
printf( "Unreadble line %d\n", j); printf( "Unreadble line %d\n", j);
...@@ -1024,7 +1057,7 @@ int GeCurve::read_file( char *filename) ...@@ -1024,7 +1057,7 @@ int GeCurve::read_file( char *filename)
break; break;
} }
else else
cd->data[i][j] = 0; cd->y_data[i][j] = 0;
} }
} }
if ( skip_line) if ( skip_line)
...@@ -1090,7 +1123,7 @@ GeCurve::GeCurve( void *gc_parent_ctx, ...@@ -1090,7 +1123,7 @@ GeCurve::GeCurve( void *gc_parent_ctx,
memset( scale_rect, 0, sizeof(scale_rect)); memset( scale_rect, 0, sizeof(scale_rect));
memset( hide_l1, 0, sizeof(hide_l1)); memset( hide_l1, 0, sizeof(hide_l1));
memset( hide_l2, 0, sizeof(hide_l2)); memset( hide_l2, 0, sizeof(hide_l2));
memset( mark_annot, 0, sizeof(cursor_annot)); memset( cursor_annot, 0, sizeof(cursor_annot));
memset( mark_annot, 0, sizeof(mark_annot)); memset( mark_annot, 0, sizeof(mark_annot));
curve_color = background_dark; curve_color = background_dark;
curve_border = border_dark; curve_border = border_dark;
...@@ -1114,50 +1147,79 @@ GeCurve::GeCurve( void *gc_parent_ctx, ...@@ -1114,50 +1147,79 @@ GeCurve::GeCurve( void *gc_parent_ctx,
GeCurveData::GeCurveData( curve_eDataType datatype) : GeCurveData::GeCurveData( curve_eDataType datatype) :
type(datatype), rows(0), cols(0), x_reverse(0), time_format(curve_eTimeFormat_Float) type(datatype), rows(0), cols(0), x_reverse(0), time_format(curve_eTimeFormat_Float)
{ {
memset( data, 0, sizeof(data)); memset( x_data, 0, sizeof(x_data));
memset( y_data, 0, sizeof(y_data));
for ( int i = 0; i < CURVE_MAX_COLS; i++) { for ( int i = 0; i < CURVE_MAX_COLS; i++) {
strcpy( unit[i], ""); strcpy( y_unit[i], "");
strcpy( format[i], ""); strcpy( y_format[i], "");
strcpy( name[i], ""); strcpy( y_name[i], "");
max_value[i] = 0; y_max_value[i] = 0;
min_value[i] = 0; y_min_value[i] = 0;
min_value_axis[i] = 0; y_min_value_axis[i] = 0;
max_value_axis[i] = 0; y_max_value_axis[i] = 0;
trend_lines[i] = 0; y_trend_lines[i] = 0;
axis_lines[i] = 0; y_axis_lines[i] = 0;
axis_linelongq[i] = 0; y_axis_linelongq[i] = 0;
axis_valueq[i] = 0; y_axis_valueq[i] = 0;
axis_width[i] = 0; y_axis_width[i] = 0;
strcpy( x_unit[i], "");
strcpy( x_format[i], "");
x_max_value[i] = 0;
x_min_value[i] = 0;
x_min_value_axis[i] = 0;
x_max_value_axis[i] = 0;
x_trend_lines[i] = 0;
x_axis_lines[i] = 0;
x_axis_linelongq[i] = 0;
x_axis_valueq[i] = 0;
} }
strcpy( x_name, "");
} }
GeCurveData::~GeCurveData() GeCurveData::~GeCurveData()
{ {
for ( int i = 0; i < cols; i++) for ( int i = 0; i < cols; i++) {
free( (char *) data[i]); free( (char *) y_data[i]);
if ( x_data[i])
free( (char *) x_data[i]);
}
} }
void GeCurveData::get_borders() void GeCurveData::get_borders()
{ {
for ( int i = 0; i < cols; i++) { for ( int i = 0; i < cols; i++) {
max_value[i] = 1e-37; y_max_value[i] = 1e-37;
min_value[i] = 1e37; y_min_value[i] = 1e37;
value_type[i] = pwr_eType_Boolean; y_value_type[i] = pwr_eType_Boolean;
for ( int j = 0; j < rows; j++) { for ( int j = 0; j < rows; j++) {
if ( data[i][j] < min_value[i]) if ( y_data[i][j] < y_min_value[i])
min_value[i] = data[i][j]; y_min_value[i] = y_data[i][j];
if ( data[i][j] > max_value[i]) if ( y_data[i][j] > y_max_value[i])
max_value[i] = data[i][j]; y_max_value[i] = y_data[i][j];
if ( value_type[i] == pwr_eType_Boolean && if ( y_value_type[i] == pwr_eType_Boolean &&
!( data[i][j] == 1 || data[i][j] == 0)) { !( y_data[i][j] == 1 || y_data[i][j] == 0)) {
value_type[i] = pwr_eType_Float64; y_value_type[i] = pwr_eType_Float64;
// printf( "Not Boolean %s: %f\n", name[i], data[i][j]); // printf( "Not Boolean %s: %f\n", name[i], data[i][j]);
} }
} }
} }
for ( int i = 0; i < 1; i++) {
x_max_value[i] = 1e-37;
x_min_value[i] = 1e37;
x_value_type[i] = pwr_eType_Float64;
for ( int j = 0; j < rows; j++) {
if ( x_data[i][j] < x_min_value[i])
x_min_value[i] = x_data[i][j];
if ( x_data[i][j] > x_max_value[i])
x_max_value[i] = x_data[i][j];
}
}
} }
void GeCurveData::get_default_axis() void GeCurveData::get_default_axis()
...@@ -1165,11 +1227,17 @@ void GeCurveData::get_default_axis() ...@@ -1165,11 +1227,17 @@ void GeCurveData::get_default_axis()
for ( int i = 0; i < cols; i++) { for ( int i = 0; i < cols; i++) {
scale( axis_type[i], value_type[i], min_value[i], max_value[i], scale( y_axis_type[i], y_value_type[i], y_min_value[i], y_max_value[i],
&min_value_axis[i], &max_value_axis[i], &trend_lines[i], &axis_lines[i], &y_min_value_axis[i], &y_max_value_axis[i], &y_trend_lines[i], &y_axis_lines[i],
&axis_linelongq[i], &axis_valueq[i], format[i], &y_axis_linelongq[i], &y_axis_valueq[i], y_format[i],
&axis_width[i], 0, 0); &y_axis_width[i], 0, 0);
} }
int i = 0;
double axis_width;
scale( x_axis_type[i], x_value_type[i], x_min_value[i], x_max_value[i],
&x_min_value_axis[i], &x_max_value_axis[i], &x_trend_lines[i], &x_axis_lines[i],
&x_axis_linelongq[i], &x_axis_valueq[i], x_format[i],
&axis_width, 0, 0);
} }
void GeCurveData::select_color( bool dark_bg) void GeCurveData::select_color( bool dark_bg)
...@@ -1180,15 +1248,6 @@ void GeCurveData::select_color( bool dark_bg) ...@@ -1180,15 +1248,6 @@ void GeCurveData::select_color( bool dark_bg)
j = i % 9; j = i % 9;
switch( j) { switch( j) {
case 0: case 0:
// Seablue
color[i] = glow_eDrawType_Color265;
axiscolor[i] = glow_eDrawType_Color255;
if ( dark_bg)
fillcolor[i] = glow_eDrawType_Color257;
else
fillcolor[i] = glow_eDrawType_Color254;
break;
case 1:
// Orange // Orange
if ( dark_bg) if ( dark_bg)
color[i] = glow_eDrawType_Color144; color[i] = glow_eDrawType_Color144;
...@@ -1200,7 +1259,7 @@ void GeCurveData::select_color( bool dark_bg) ...@@ -1200,7 +1259,7 @@ void GeCurveData::select_color( bool dark_bg)
else else
fillcolor[i] = glow_eDrawType_Color133; fillcolor[i] = glow_eDrawType_Color133;
break; break;
case 2: case 1:
// YellowGreen // YellowGreen
if ( dark_bg) if ( dark_bg)
color[i] = glow_eDrawType_Color85; color[i] = glow_eDrawType_Color85;
...@@ -1212,7 +1271,7 @@ void GeCurveData::select_color( bool dark_bg) ...@@ -1212,7 +1271,7 @@ void GeCurveData::select_color( bool dark_bg)
else else
fillcolor[i] = glow_eDrawType_Color64; fillcolor[i] = glow_eDrawType_Color64;
break; break;
case 3: case 2:
// Yellow // Yellow
if ( dark_bg) if ( dark_bg)
color[i] = glow_eDrawType_Color115; color[i] = glow_eDrawType_Color115;
...@@ -1224,7 +1283,7 @@ void GeCurveData::select_color( bool dark_bg) ...@@ -1224,7 +1283,7 @@ void GeCurveData::select_color( bool dark_bg)
else else
fillcolor[i] = glow_eDrawType_Color104; fillcolor[i] = glow_eDrawType_Color104;
break; break;
case 4: case 3:
// Blue // Blue
color[i] = glow_eDrawType_Color235; color[i] = glow_eDrawType_Color235;
axiscolor[i] = glow_eDrawType_Color225; axiscolor[i] = glow_eDrawType_Color225;
...@@ -1233,7 +1292,7 @@ void GeCurveData::select_color( bool dark_bg) ...@@ -1233,7 +1292,7 @@ void GeCurveData::select_color( bool dark_bg)
else else
fillcolor[i] = glow_eDrawType_Color214; fillcolor[i] = glow_eDrawType_Color214;
break; break;
case 5: case 4:
// Violet // Violet
color[i] = glow_eDrawType_Color205; color[i] = glow_eDrawType_Color205;
axiscolor[i] = glow_eDrawType_Color195; axiscolor[i] = glow_eDrawType_Color195;
...@@ -1242,7 +1301,7 @@ void GeCurveData::select_color( bool dark_bg) ...@@ -1242,7 +1301,7 @@ void GeCurveData::select_color( bool dark_bg)
else else
fillcolor[i] = glow_eDrawType_Color184; fillcolor[i] = glow_eDrawType_Color184;
break; break;
case 6: case 5:
// Red // Red
color[i] = glow_eDrawType_Color175; color[i] = glow_eDrawType_Color175;
axiscolor[i] = glow_eDrawType_Color165; axiscolor[i] = glow_eDrawType_Color165;
...@@ -1251,7 +1310,7 @@ void GeCurveData::select_color( bool dark_bg) ...@@ -1251,7 +1310,7 @@ void GeCurveData::select_color( bool dark_bg)
else else
fillcolor[i] = glow_eDrawType_Color154; fillcolor[i] = glow_eDrawType_Color154;
break; break;
case 7: case 6:
// Green // Green
color[i] = glow_eDrawType_Color295; color[i] = glow_eDrawType_Color295;
axiscolor[i] = glow_eDrawType_Color285; axiscolor[i] = glow_eDrawType_Color285;
...@@ -1260,7 +1319,7 @@ void GeCurveData::select_color( bool dark_bg) ...@@ -1260,7 +1319,7 @@ void GeCurveData::select_color( bool dark_bg)
else else
fillcolor[i] = glow_eDrawType_Color274; fillcolor[i] = glow_eDrawType_Color274;
break; break;
case 8: case 7:
// Gray // Gray
color[i] = glow_eDrawType_Color35; color[i] = glow_eDrawType_Color35;
axiscolor[i] = glow_eDrawType_Color35; axiscolor[i] = glow_eDrawType_Color35;
...@@ -1269,7 +1328,15 @@ void GeCurveData::select_color( bool dark_bg) ...@@ -1269,7 +1328,15 @@ void GeCurveData::select_color( bool dark_bg)
else else
fillcolor[i] = glow_eDrawType_Color34; fillcolor[i] = glow_eDrawType_Color34;
break; break;
case 8:
// Seablue
color[i] = glow_eDrawType_Color265;
axiscolor[i] = glow_eDrawType_Color255;
if ( dark_bg)
fillcolor[i] = glow_eDrawType_Color257;
else
fillcolor[i] = glow_eDrawType_Color254;
break;
} }
#if 0 #if 0
if ( j < 4) if ( j < 4)
...@@ -1593,15 +1660,15 @@ void GeCurve::x_to_points( double x, double *t, double *values) ...@@ -1593,15 +1660,15 @@ void GeCurve::x_to_points( double x, double *t, double *values)
// Time is a date // Time is a date
if ( !cd->x_reverse) if ( !cd->x_reverse)
time = cd->min_value_axis[0] + x * time = cd->x_min_value_axis[0] + x *
(cd->max_value_axis[0] - cd->min_value_axis[0]) / 200; (cd->x_max_value_axis[0] - cd->x_min_value_axis[0]) / 200;
else else
time = cd->min_value_axis[0] + (200.0 - x) * time = cd->x_min_value_axis[0] + (200.0 - x) *
(cd->max_value_axis[0] - cd->min_value_axis[0]) / 200; (cd->x_max_value_axis[0] - cd->x_min_value_axis[0]) / 200;
// Approximate row // Approximate row
row = int ((time - cd->min_value[0]) / row = int ((time - cd->x_min_value[0]) /
(cd->max_value[0] - cd->min_value[0]) * (cd->x_max_value[0] - cd->x_min_value[0]) *
(cd->rows - 1) + 0.5); (cd->rows - 1) + 0.5);
if ( row > cd->rows - 1) if ( row > cd->rows - 1)
row = cd->rows - 1; row = cd->rows - 1;
...@@ -1613,20 +1680,20 @@ void GeCurve::x_to_points( double x, double *t, double *values) ...@@ -1613,20 +1680,20 @@ void GeCurve::x_to_points( double x, double *t, double *values)
int r = row; int r = row;
for (int i = 0;; i++) { for (int i = 0;; i++) {
if ( r == 0) { if ( r == 0) {
b2 = (cd->data[0][row] + cd->data[0][r+1]) / 2; b2 = (cd->x_data[0][row] + cd->x_data[0][r+1]) / 2;
if ( time < b2) if ( time < b2)
break; break;
r++; r++;
} }
else if ( r == cd->rows - 1) { else if ( r == cd->rows - 1) {
b1 = (cd->data[0][r] + cd->data[0][r-1]) / 2; b1 = (cd->x_data[0][r] + cd->x_data[0][r-1]) / 2;
if ( time >= b1) if ( time >= b1)
break; break;
r--; r--;
} }
else { else {
b1 = (cd->data[0][r] + cd->data[0][r-1]) / 2; b1 = (cd->x_data[0][r] + cd->x_data[0][r-1]) / 2;
b2 = (cd->data[0][r] + cd->data[0][r+1]) / 2; b2 = (cd->x_data[0][r] + cd->x_data[0][r+1]) / 2;
if ( b1 <= time && time < b2) if ( b1 <= time && time < b2)
break; break;
if ( b1 <= time) if ( b1 <= time)
...@@ -1642,8 +1709,8 @@ void GeCurve::x_to_points( double x, double *t, double *values) ...@@ -1642,8 +1709,8 @@ void GeCurve::x_to_points( double x, double *t, double *values)
} }
row = r; row = r;
} }
for ( int i = 1; i < cd->cols; i++) for ( int i = 0; i < cd->cols; i++)
values[i] = cd->data[i][row]; values[i] = cd->y_data[i][row];
*t = cd->data[0][row]; *t = cd->x_data[0][row];
} }
...@@ -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